@dexteel/mesf-core 5.7.0 → 5.8.0

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "5.7.0"
2
+ ".": "5.8.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [5.8.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.7.1...@dexteel/mesf-core-v5.8.0) (2025-08-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Shift navigator control:** Add 'withoutPaper' prop to control the use of Paper in the ShiftDayNavigatorControl component ([#429](https://github.com/dexteel/mesf-core-frontend/issues/429)) ([68c01b0](https://github.com/dexteel/mesf-core-frontend/commit/68c01b0712c3cec65d7673842a67af49735fb483))
9
+
10
+ ## [5.7.1] - 2025-08-25
11
+
12
+
13
+
14
+ # Changelog
15
+
16
+ ## [5.7.1](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.7.0...@dexteel/mesf-core-v5.7.1) (2025-08-25)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **shift-navigator:** fix custom date picker values and add date validation ([2535c74](https://github.com/dexteel/mesf-core-frontend/commit/2535c74d76a3157fa6cfbaf8f8eb9565a1a2923c))
22
+ * **shift-navigator:** fix custom date picker values and add date validation ([7f8f181](https://github.com/dexteel/mesf-core-frontend/commit/7f8f1818bee8b00519123c68e6bfa4bd5aa827ec))
23
+
24
+ ## [5.7.0] - 2025-07-17
25
+
26
+
27
+
1
28
  # Changelog
2
29
 
3
30
  ## [5.7.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.6.3...@dexteel/mesf-core-v5.7.0) (2025-07-17)
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  export type ShiftNavigatorDirection = "Previous" | "Next" | "Last";
3
- export declare const ShiftDayNavigatorControl: (props: {
3
+ export declare const ShiftDayNavigatorControl: ({ useRouter, onShiftChange, preventInit, withPaper, }: {
4
4
  useRouter?: boolean;
5
5
  onShiftChange?: (shiftId: number) => void;
6
6
  preventInit?: boolean;
7
+ withPaper?: boolean;
7
8
  }) => React.JSX.Element;
package/dist/index.esm.js CHANGED
@@ -1394,11 +1394,12 @@ var ShiftNavigatorProvider = function (_a) {
1394
1394
  return (React__default.createElement(ShiftNavigatorContext.Provider, { value: shiftNavigatorManager }, children));
1395
1395
  };
1396
1396
 
1397
- var ShiftDayNavigatorControl = function (props) {
1398
- var _a;
1399
- var _b = useShiftNavigator(), shiftInfo = _b.shiftInfo, initShiftNavigator = _b.initShiftNavigator, moveShift = _b.moveShift, getShiftDataFromAPI = _b.getShiftDataFromAPI;
1400
- var _c = useState(shiftInfo), shiftInfoCopy = _c[0], setShiftInfoCopy = _c[1];
1401
- var _d = useState(""); _d[0]; var setError = _d[1];
1397
+ var ShiftDayNavigatorControl = function (_a) {
1398
+ var _b;
1399
+ var useRouter = _a.useRouter, onShiftChange = _a.onShiftChange, preventInit = _a.preventInit, _c = _a.withPaper, withPaper = _c === void 0 ? true : _c;
1400
+ var _d = useShiftNavigator(), shiftInfo = _d.shiftInfo, initShiftNavigator = _d.initShiftNavigator, moveShift = _d.moveShift, getShiftDataFromAPI = _d.getShiftDataFromAPI;
1401
+ var _e = useState(shiftInfo), shiftInfoCopy = _e[0], setShiftInfoCopy = _e[1];
1402
+ var _f = useState(""); _f[0]; var setError = _f[1];
1402
1403
  var shiftId = useParams().shiftId;
1403
1404
  var firstRender = useRef(true);
1404
1405
  var updateHistory = function (shiftId) {
@@ -1406,8 +1407,8 @@ var ShiftDayNavigatorControl = function (props) {
1406
1407
  window.history.replaceState(null, "", "/".concat(paths[1]) + "/".concat(shiftId));
1407
1408
  };
1408
1409
  if (shiftInfo !== null && shiftInfo.CurrentShiftId) {
1409
- if (props.useRouter) {
1410
- updateHistory((_a = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId) === null || _a === void 0 ? void 0 : _a.toString());
1410
+ if (useRouter) {
1411
+ updateHistory((_b = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId) === null || _b === void 0 ? void 0 : _b.toString());
1411
1412
  }
1412
1413
  }
1413
1414
  useEffect(function () {
@@ -1454,62 +1455,62 @@ var ShiftDayNavigatorControl = function (props) {
1454
1455
  useEffect(function () {
1455
1456
  if (firstRender.current) {
1456
1457
  firstRender.current = false;
1457
- if (props.preventInit) {
1458
+ if (preventInit) {
1458
1459
  return;
1459
1460
  }
1460
- if (props.useRouter && shiftId) {
1461
+ if (useRouter && shiftId) {
1461
1462
  getShiftDataFromAPI(null, Number(shiftId)).then(function () {
1462
- props.onShiftChange && props.onShiftChange(Number(shiftId));
1463
+ onShiftChange && onShiftChange(Number(shiftId));
1463
1464
  });
1464
1465
  }
1465
1466
  else {
1466
1467
  initShiftNavigator().then(function () {
1467
- props.onShiftChange && props.onShiftChange(Number(shiftId));
1468
+ onShiftChange && onShiftChange(Number(shiftId));
1468
1469
  });
1469
1470
  }
1470
1471
  }
1471
1472
  }, []);
1472
- return (React__default.createElement(Paper, null,
1473
- React__default.createElement(Grid, { item: true, container: true, style: { minWidth: "0%", margin: "1rem" }, direction: "row", justifyContent: "flex-start", alignItems: "center", spacing: 1 },
1474
- React__default.createElement(Grid, { item: true },
1475
- React__default.createElement(Tooltip, { title: "Previous Shift" },
1476
- React__default.createElement(IconButton$1, { "aria-label": "Previous Shift", color: "primary", disabled: !(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.PreviousShiftId), onClick: function () {
1477
- moveShift("Previous").then(function () { });
1478
- }, size: "small" },
1479
- React__default.createElement(ArrowBackRounded, null)))),
1480
- React__default.createElement(Grid, { item: true },
1481
- React__default.createElement(DatePicker, { label: "Current Date", timezone: "UTC", format: "MM/DD/YYYY", maxDate: moment$2(), closeOnSelect: true, formatDensity: "dense", value: moment$2(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentProductionDate), onChange: function (date) {
1482
- if (date) {
1483
- getShiftDataFromAPI(date.toDate(), 0).then(function () { });
1484
- }
1485
- }, slots: {
1486
- textField: TextField,
1487
- }, slotProps: {
1488
- textField: {
1489
- variant: "outlined",
1490
- size: "small",
1491
- inputProps: {
1492
- style: {
1493
- textAlign: "center",
1494
- width: "110px",
1495
- },
1473
+ var gridContent = (React__default.createElement(Grid, { item: true, container: true, style: { minWidth: "0%", margin: "1rem" }, direction: "row", justifyContent: "flex-start", alignItems: "center", spacing: 1 },
1474
+ React__default.createElement(Grid, { item: true },
1475
+ React__default.createElement(Tooltip, { title: "Previous Shift" },
1476
+ React__default.createElement(IconButton$1, { "aria-label": "Previous Shift", color: "primary", disabled: !(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.PreviousShiftId), onClick: function () {
1477
+ moveShift("Previous").then(function () { });
1478
+ }, size: "small" },
1479
+ React__default.createElement(ArrowBackRounded, null)))),
1480
+ React__default.createElement(Grid, { item: true },
1481
+ React__default.createElement(DatePicker, { label: "Current Date", timezone: "UTC", format: "MM/DD/YYYY", maxDate: moment$2(), closeOnSelect: true, formatDensity: "dense", value: moment$2(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentProductionDate), onChange: function (date) {
1482
+ if (date) {
1483
+ getShiftDataFromAPI(date.toDate(), 0).then(function () { });
1484
+ }
1485
+ }, slots: {
1486
+ textField: TextField,
1487
+ }, slotProps: {
1488
+ textField: {
1489
+ variant: "outlined",
1490
+ size: "small",
1491
+ inputProps: {
1492
+ style: {
1493
+ textAlign: "center",
1494
+ width: "110px",
1496
1495
  },
1497
1496
  },
1498
- } })),
1499
- React__default.createElement(Grid, { item: true, style: { maxWidth: "100px" } },
1500
- React__default.createElement(TextField, { label: "Shift - Crew", value: "".concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) || "", " - ").concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) || ""), placeholder: "Shift", "aria-readonly": true, variant: "outlined", size: "small" })),
1501
- React__default.createElement(Grid, { item: true },
1502
- React__default.createElement(Tooltip, { title: "Next Shift" },
1503
- React__default.createElement(IconButton$1, { "aria-label": "next", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
1504
- moveShift("Next").then(function () { });
1505
- }, size: "small" },
1506
- React__default.createElement(ArrowForwardRounded, null)))),
1507
- React__default.createElement(Grid, { item: true },
1508
- React__default.createElement(Tooltip, { title: "Last Shift" },
1509
- React__default.createElement(IconButton$1, { "aria-label": "delete", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.LastShiftId) || !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
1510
- moveShift("Last").then(function () { });
1511
- }, size: "small" },
1512
- React__default.createElement(SkipNext, null)))))));
1497
+ },
1498
+ } })),
1499
+ React__default.createElement(Grid, { item: true, style: { maxWidth: "100px" } },
1500
+ React__default.createElement(TextField, { label: "Shift - Crew", value: "".concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) || "", " - ").concat((shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) || ""), placeholder: "Shift", "aria-readonly": true, variant: "outlined", size: "small" })),
1501
+ React__default.createElement(Grid, { item: true },
1502
+ React__default.createElement(Tooltip, { title: "Next Shift" },
1503
+ React__default.createElement(IconButton$1, { "aria-label": "next", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
1504
+ moveShift("Next").then(function () { });
1505
+ }, size: "small" },
1506
+ React__default.createElement(ArrowForwardRounded, null)))),
1507
+ React__default.createElement(Grid, { item: true },
1508
+ React__default.createElement(Tooltip, { title: "Last Shift" },
1509
+ React__default.createElement(IconButton$1, { "aria-label": "delete", color: "primary", disabled: !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.LastShiftId) || !(shiftInfoCopy === null || shiftInfoCopy === void 0 ? void 0 : shiftInfoCopy.NextShiftId), onClick: function () {
1510
+ moveShift("Last").then(function () { });
1511
+ }, size: "small" },
1512
+ React__default.createElement(SkipNext, null))))));
1513
+ return withPaper !== false ? React__default.createElement(Paper, null, gridContent) : gridContent;
1513
1514
  };
1514
1515
 
1515
1516
  var getShiftsRangeByParameters = function (period_1) {
@@ -1857,9 +1858,11 @@ var ShiftPeriodNavigatorControl = function (_a) {
1857
1858
  React__default.createElement(IconButton$1, { size: "small", color: "primary", disabled: loadingShiftPeriodList || isCustomMode, onClick: function () { return handleArrowNavigation("prev"); } },
1858
1859
  React__default.createElement(ChevronLeft, null))),
1859
1860
  React__default.createElement("div", { className: "".concat(classes.gridItem, " ").concat(classes.datePickerWrapper) },
1860
- React__default.createElement(DatePicker$1, { label: "Start", format: dateFormat, value: moment$2((startShift === null || startShift === void 0 ? void 0 : startShift.Start) || moment$2().subtract(1, "day")), onChange: function (value) {
1861
+ React__default.createElement(DatePicker$1, { label: "Start", format: dateFormat, value: isCustomMode
1862
+ ? customStartDate || moment$2().subtract(1, "day")
1863
+ : moment$2((startShift === null || startShift === void 0 ? void 0 : startShift.Start) || moment$2().subtract(1, "day")), onChange: function (value) {
1861
1864
  return handleDateChange(value ? moment$2(value) : null, "start");
1862
- }, disabled: loadingShiftPeriodList, enableAccessibleFieldDOMStructure: false, slots: {
1865
+ }, disabled: loadingShiftPeriodList, maxDate: isCustomMode ? moment$2() : undefined, enableAccessibleFieldDOMStructure: false, slots: {
1863
1866
  textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: { width: "100%" }, InputProps: __assign(__assign({}, props.InputProps), { style: { paddingTop: "2px" } }) }))); },
1864
1867
  openPickerIcon: function () { return (React__default.createElement("div", { style: {
1865
1868
  display: "flex",
@@ -1877,9 +1880,11 @@ var ShiftPeriodNavigatorControl = function (_a) {
1877
1880
  width: "100%",
1878
1881
  } }, periodOptions.map(function (option) { return (React__default.createElement(MenuItem, { key: option.value, value: option.value }, option.label)); })))),
1879
1882
  React__default.createElement("div", { className: "".concat(classes.gridItem, " ").concat(classes.datePickerWrapper) },
1880
- React__default.createElement(DatePicker$1, { label: "End", format: dateFormat, value: moment$2((endShift === null || endShift === void 0 ? void 0 : endShift.Start) || moment$2().subtract(1, "day")), onChange: function (value) {
1883
+ React__default.createElement(DatePicker$1, { label: "End", format: dateFormat, value: isCustomMode
1884
+ ? customEndDate || moment$2()
1885
+ : moment$2((endShift === null || endShift === void 0 ? void 0 : endShift.End) || (endShift === null || endShift === void 0 ? void 0 : endShift.Start) || moment$2()), onChange: function (value) {
1881
1886
  return handleDateChange(value ? moment$2(value) : null, "end");
1882
- }, disabled: loadingShiftPeriodList, enableAccessibleFieldDOMStructure: false, slots: {
1887
+ }, disabled: loadingShiftPeriodList, minDate: isCustomMode && customStartDate ? customStartDate : undefined, maxDate: isCustomMode ? moment$2() : undefined, enableAccessibleFieldDOMStructure: false, slots: {
1883
1888
  textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: { width: "100%" }, InputProps: __assign(__assign({}, props.InputProps), { style: { paddingTop: "2px" } }) }))); },
1884
1889
  openPickerIcon: function () { return (React__default.createElement("div", { style: {
1885
1890
  display: "flex",