@dexteel/mesf-core 4.21.0 → 4.22.1

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
- ".": "4.21.0"
2
+ ".": "4.22.1"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [4.22.1](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.22.0...@dexteel/mesf-core-v4.22.1) (2025-01-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ShiftNavigatorV2:** fix date picker ([03caca9](https://github.com/dexteel/mesf-core-frontend/commit/03caca9657ab6e7a0d63c98f93e8f6a49c547e9d))
9
+ * **ShiftNavigatorV2:** minor style change in period selector ([ff847a1](https://github.com/dexteel/mesf-core-frontend/commit/ff847a138d35e03ece52fe018fb49887432b80d1))
10
+
11
+ ## [4.22.0] - 2024-12-30
12
+
13
+
14
+
15
+ # Changelog
16
+
17
+ ## [4.22.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.21.0...@dexteel/mesf-core-v4.22.0) (2024-12-30)
18
+
19
+
20
+ ### Features
21
+
22
+ * **ShiftNavigatorV2:** Add configurable properties to enhance component flexibility ([e1d7f45](https://github.com/dexteel/mesf-core-frontend/commit/e1d7f45442aab9c3b9c8ef94fa2ad806eaaef40c))
23
+
24
+ ## [4.21.0] - 2024-12-19
25
+
26
+
27
+
1
28
  # Changelog
2
29
 
3
30
  ## [4.21.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.20.6...@dexteel/mesf-core-v4.21.0) (2024-12-19)
@@ -1,3 +1,2 @@
1
- import axios from "axios";
2
1
  export declare function renewToken(): Promise<any[]>;
3
- export declare const axiosInstance: axios.AxiosInstance;
2
+ export declare const axiosInstance: import("axios").AxiosInstance;
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
2
  import { SearchShiftsParameters } from "../models/SearchShiftsParameters";
3
+ interface PeriodOption {
4
+ value: string;
5
+ label: string;
6
+ }
3
7
  type Props = {
4
8
  value: SearchShiftsParameters | null;
5
9
  onChange: (value: any) => void;
10
+ showShiftAndCrews?: boolean;
11
+ dateFormat?: string;
12
+ periodOptions?: PeriodOption[];
6
13
  };
7
- export declare const ShiftPeriodNavigatorControl: ({ value, onChange }: Props) => React.JSX.Element;
14
+ export declare const ShiftPeriodNavigatorControl: ({ value, onChange, showShiftAndCrews, dateFormat, periodOptions, }: Props) => React.JSX.Element;
8
15
  export {};
package/dist/index.esm.js CHANGED
@@ -54,7 +54,7 @@ import AccountTreeIcon from '@material-ui/icons/AccountTree';
54
54
  import Code from '@material-ui/icons/Code';
55
55
  import TreeItem from '@material-ui/lab/TreeItem';
56
56
  import TreeView from '@material-ui/lab/TreeView';
57
- import { useSpring, animated } from 'react-spring';
57
+ import { useSpring, animated } from '@react-spring/web';
58
58
  import { DataGrid, GridOverlay } from '@material-ui/data-grid';
59
59
  import { format, fromZonedTime, formatInTimeZone } from 'date-fns-tz';
60
60
  import { findIana } from 'windows-iana';
@@ -8238,15 +8238,23 @@ var useStyles$5 = makeStyles(function (theme) {
8238
8238
  _c)
8239
8239
  });
8240
8240
  });
8241
+ var DEFAULT_PERIOD_OPTIONS = [
8242
+ { value: "Shift", label: "Shift" },
8243
+ { value: "Day", label: "Day" },
8244
+ { value: "4Days", label: "4 Days" },
8245
+ { value: "Week", label: "Week" },
8246
+ { value: "Month", label: "Month" },
8247
+ ];
8241
8248
  var moment = getMomentTz();
8242
8249
  var ShiftPeriodNavigatorControl = function (_a) {
8243
- var value = _a.value, onChange = _a.onChange;
8250
+ var _b;
8251
+ var value = _a.value, onChange = _a.onChange, _c = _a.showShiftAndCrews, showShiftAndCrews = _c === void 0 ? true : _c, _d = _a.dateFormat, dateFormat = _d === void 0 ? "MM/DD/YYYY HH:mm a" : _d, _e = _a.periodOptions, periodOptions = _e === void 0 ? DEFAULT_PERIOD_OPTIONS : _e;
8244
8252
  var classes = useStyles$5();
8245
- var _b = useState("Shift"), period = _b[0], setPeriod = _b[1];
8246
- var _c = useState(false), loadingShiftPeriodList = _c[0], setLoadingShiftPeriodList = _c[1];
8247
- var _d = useState(""); _d[0]; var setError = _d[1];
8248
- var _e = useState([]), shiftPeriodList = _e[0], setShiftPeriodList = _e[1];
8249
- var _f = useState(false), isActionInProgress = _f[0], setIsActionInProgress = _f[1];
8253
+ var _f = useState(((_b = periodOptions[0]) === null || _b === void 0 ? void 0 : _b.value) || "Day"), period = _f[0], setPeriod = _f[1];
8254
+ var _g = useState(false), loadingShiftPeriodList = _g[0], setLoadingShiftPeriodList = _g[1];
8255
+ var _h = useState(""); _h[0]; var setError = _h[1];
8256
+ var _j = useState([]), shiftPeriodList = _j[0], setShiftPeriodList = _j[1];
8257
+ var _k = useState(false), isActionInProgress = _k[0], setIsActionInProgress = _k[1];
8250
8258
  var handleArrowNavigation = function (direction) { return __awaiter(void 0, void 0, void 0, function () {
8251
8259
  var error_1;
8252
8260
  return __generator(this, function (_a) {
@@ -8377,7 +8385,7 @@ var ShiftPeriodNavigatorControl = function (_a) {
8377
8385
  case 0:
8378
8386
  newPeriod = e.target.value;
8379
8387
  setPeriod(newPeriod);
8380
- return [4 /*yield*/, searchShiftsRangeByParameters(newPeriod, null, (endShift === null || endShift === void 0 ? void 0 : endShift.End) ? moment(endShift.End).toDate() : null, false)];
8388
+ return [4 /*yield*/, searchShiftsRangeByParameters(newPeriod, null, (endShift === null || endShift === void 0 ? void 0 : endShift.Start) ? moment(endShift.Start).toDate() : null, false)];
8381
8389
  case 1:
8382
8390
  _a.sent();
8383
8391
  return [2 /*return*/];
@@ -8394,36 +8402,36 @@ var ShiftPeriodNavigatorControl = function (_a) {
8394
8402
  }, []);
8395
8403
  var startShift = shiftPeriodList[0];
8396
8404
  var endShift = shiftPeriodList[1];
8405
+ var renderShiftCrewInfo = function (shift) {
8406
+ if (!showShiftAndCrews || !shift)
8407
+ return null;
8408
+ return (React__default.createElement("span", { style: {
8409
+ paddingRight: 5,
8410
+ whiteSpace: "nowrap",
8411
+ overflow: "hidden",
8412
+ textOverflow: "ellipsis",
8413
+ fontSize: 15,
8414
+ fontWeight: "bold"
8415
+ } },
8416
+ shift.Shift,
8417
+ " - ",
8418
+ shift.Crew));
8419
+ };
8397
8420
  return (React__default.createElement("div", { className: classes.container },
8398
8421
  React__default.createElement("div", { className: classes.gridItem },
8399
8422
  React__default.createElement(IconButton$1, { size: "small", color: "primary", disabled: loadingShiftPeriodList, onClick: function () { return handleArrowNavigation("prev"); } },
8400
8423
  React__default.createElement(ChevronLeft, null))),
8401
8424
  React__default.createElement("div", { className: "".concat(classes.gridItem, " ").concat(classes.datePickerWrapper) },
8402
- React__default.createElement(DatePicker$1, { label: "Start", format: "MM/DD/YYYY HH:mm a", value: moment((startShift === null || startShift === void 0 ? void 0 : startShift.Start) || moment().subtract(1, "day")), onChange: function (value) {
8425
+ React__default.createElement(DatePicker$1, { label: "Start", format: dateFormat, value: moment((startShift === null || startShift === void 0 ? void 0 : startShift.Start) || moment().subtract(1, "day")), onChange: function (value) {
8403
8426
  return handleDateChange(value ? moment(value) : null, "start");
8404
8427
  }, disabled: loadingShiftPeriodList, slots: {
8405
- textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: {
8406
- width: "100%"
8407
- }, InputProps: __assign(__assign({}, props.InputProps), { style: {
8408
- height: "50px",
8409
- paddingTop: "2px"
8410
- } }) }))); },
8428
+ 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: { height: "50px", paddingTop: "2px" } }) }))); },
8411
8429
  openPickerIcon: function () { return (React__default.createElement("div", { style: {
8412
8430
  display: "flex",
8413
8431
  alignItems: "center",
8414
8432
  width: "100%"
8415
8433
  } },
8416
- React__default.createElement("span", { style: {
8417
- paddingRight: 5,
8418
- whiteSpace: "nowrap",
8419
- overflow: "hidden",
8420
- textOverflow: "ellipsis",
8421
- fontSize: 15,
8422
- fontWeight: "bold"
8423
- } }, startShift === null || startShift === void 0 ? void 0 :
8424
- startShift.Shift,
8425
- " - ", startShift === null || startShift === void 0 ? void 0 :
8426
- startShift.Crew),
8434
+ renderShiftCrewInfo(startShift),
8427
8435
  React__default.createElement(IconButton$1, { style: { padding: "0px", flexShrink: 0 } },
8428
8436
  React__default.createElement(CalendarIcon, null)))); }
8429
8437
  } })),
@@ -8432,39 +8440,19 @@ var ShiftPeriodNavigatorControl = function (_a) {
8432
8440
  React__default.createElement(Select, { value: period, onChange: handleChangeScope, disabled: loadingShiftPeriodList, style: {
8433
8441
  height: "50px",
8434
8442
  width: "100%",
8435
- paddingTop: 10
8436
- } },
8437
- React__default.createElement(MenuItem, { value: "Shift" }, "Shift"),
8438
- React__default.createElement(MenuItem, { value: "Day" }, "Day"),
8439
- React__default.createElement(MenuItem, { value: "4Days" }, "4 Days"),
8440
- React__default.createElement(MenuItem, { value: "Week" }, "Week"),
8441
- React__default.createElement(MenuItem, { value: "Month" }, "Month")))),
8443
+ paddingBottom: 0
8444
+ } }, periodOptions.map(function (option) { return (React__default.createElement(MenuItem, { key: option.value, value: option.value }, option.label)); })))),
8442
8445
  React__default.createElement("div", { className: "".concat(classes.gridItem, " ").concat(classes.datePickerWrapper) },
8443
- React__default.createElement(DatePicker$1, { label: "End", format: "MM/DD/YYYY HH:mm a", value: moment((endShift === null || endShift === void 0 ? void 0 : endShift.Start) || moment().subtract(1, "day")), onChange: function (value) {
8446
+ React__default.createElement(DatePicker$1, { label: "End", format: dateFormat, value: moment((endShift === null || endShift === void 0 ? void 0 : endShift.Start) || moment().subtract(1, "day")), onChange: function (value) {
8444
8447
  return handleDateChange(value ? moment(value) : null, "end");
8445
8448
  }, disabled: loadingShiftPeriodList, slots: {
8446
- textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: {
8447
- width: "100%"
8448
- }, InputProps: __assign(__assign({}, props.InputProps), { style: {
8449
- height: "50px",
8450
- paddingTop: "2px"
8451
- } }) }))); },
8449
+ 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: { height: "50px", paddingTop: "2px" } }) }))); },
8452
8450
  openPickerIcon: function () { return (React__default.createElement("div", { style: {
8453
8451
  display: "flex",
8454
8452
  alignItems: "center",
8455
8453
  width: "100%"
8456
8454
  } },
8457
- React__default.createElement("span", { style: {
8458
- paddingRight: 5,
8459
- whiteSpace: "nowrap",
8460
- overflow: "hidden",
8461
- textOverflow: "ellipsis",
8462
- fontSize: 15,
8463
- fontWeight: "bold"
8464
- } }, endShift === null || endShift === void 0 ? void 0 :
8465
- endShift.Shift,
8466
- " - ", endShift === null || endShift === void 0 ? void 0 :
8467
- endShift.Crew),
8455
+ renderShiftCrewInfo(endShift),
8468
8456
  React__default.createElement(IconButton$1, { style: { padding: "4px", flexShrink: 0 } },
8469
8457
  React__default.createElement(CalendarIcon, null)))); }
8470
8458
  } })),