@equinor/mad-dfw 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8503815: Adjusted props related to data display and buttons in the `WorkOrderCell` component.
8
+ Removed the `Id` part from the data props. Removed/adjusted the props: `showActions`,
9
+ `onStartButtonPress`, `onReadyForOperationPress` and `onTecoButtonPress`. New props for this:
10
+ `startJobButton`, `readyForOperationButton` and `tecoButton`. These props have three options
11
+ `visible`, `disabled` and `onpress`. Removed validations for when the buttons are displayed.
12
+
3
13
  ## 0.2.0
4
14
 
5
15
  ### Minor Changes
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MCPLMBQO.js";
4
4
  import {
5
5
  PropertyList
6
- } from "./chunk-TQDX6N52.js";
6
+ } from "./chunk-JRXLEWCW.js";
7
7
  import {
8
8
  StatusIcon
9
9
  } from "./chunk-VDHOYF7Z.js";
@@ -46,14 +46,14 @@ var WorkOrderCellNavigation = (_a) => {
46
46
  () => {
47
47
  var _a2;
48
48
  return getStatusIconsAndLabels(
49
- rest.activeStatusIds,
49
+ rest.activeStatus,
50
50
  (_a2 = rest.requiredEnd) != null ? _a2 : null,
51
51
  currentDate,
52
52
  isHseCritical,
53
53
  isProductionCritical
54
54
  );
55
55
  },
56
- [rest.activeStatusIds, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
56
+ [rest.activeStatus, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
57
57
  );
58
58
  return /* @__PURE__ */ React.createElement(Cell, { onPress, style }, /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(View, { style: styles.contentContainer }, /* @__PURE__ */ React.createElement(Typography, { numberOfLines: 1, variant: "h5", bold: true, style: styles.title }, title), maintenanceType && /* @__PURE__ */ React.createElement(Label, { label: maintenanceType, style: styles.label }), /* @__PURE__ */ React.createElement(
59
59
  PropertyList,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MCPLMBQO.js";
4
4
  import {
5
5
  PropertyList
6
- } from "./chunk-TQDX6N52.js";
6
+ } from "./chunk-JRXLEWCW.js";
7
7
  import {
8
8
  StatusIcon
9
9
  } from "./chunk-VDHOYF7Z.js";
@@ -13,7 +13,15 @@ import {
13
13
  } from "./chunk-G2ADBYYC.js";
14
14
 
15
15
  // src/dfwcomponents/WorkOrderCell/WorkOrderCell.tsx
16
- import { Button, Cell, EDSStyleSheet, Label, Typography, useStyles } from "@equinor/mad-components";
16
+ import {
17
+ Button,
18
+ Cell,
19
+ EDSStyleSheet,
20
+ Label,
21
+ Typography,
22
+ useBreakpoint,
23
+ useStyles
24
+ } from "@equinor/mad-components";
17
25
  import moment from "moment";
18
26
  import React, { useMemo } from "react";
19
27
  import { View } from "react-native";
@@ -26,12 +34,11 @@ var WorkOrderCell = (_a) => {
26
34
  valueColor = "textTertiary",
27
35
  isHseCritical,
28
36
  isProductionCritical,
29
- showActions,
30
37
  overwriteLabel,
31
38
  style,
32
- onStartButtonPress,
33
- onCompleteButtonPress,
34
- onTecoButtonPress
39
+ startJobButton,
40
+ readyForOperationButton,
41
+ tecoButton
35
42
  } = _b, rest = __objRest(_b, [
36
43
  "title",
37
44
  "maintenanceType",
@@ -40,31 +47,29 @@ var WorkOrderCell = (_a) => {
40
47
  "valueColor",
41
48
  "isHseCritical",
42
49
  "isProductionCritical",
43
- "showActions",
44
50
  "overwriteLabel",
45
51
  "style",
46
- "onStartButtonPress",
47
- "onCompleteButtonPress",
48
- "onTecoButtonPress"
52
+ "startJobButton",
53
+ "readyForOperationButton",
54
+ "tecoButton"
49
55
  ]);
50
56
  var _a2, _b2;
57
+ const breakpoint = useBreakpoint();
51
58
  const styles = useStyles(themeStyles, { symbolDirection });
59
+ const anyButtonVisible = (_b2 = (_a2 = startJobButton == null ? void 0 : startJobButton.visible) != null ? _a2 : readyForOperationButton == null ? void 0 : readyForOperationButton.visible) != null ? _b2 : tecoButton == null ? void 0 : tecoButton.visible;
52
60
  const currentDate = moment();
53
- const activeStatuses = (_a2 = rest.activeStatusIds) == null ? void 0 : _a2.split(" ");
54
- const isStartDisabled = (_b2 = activeStatuses == null ? void 0 : activeStatuses.includes("STRT")) != null ? _b2 : activeStatuses == null ? void 0 : activeStatuses.includes("RDOP");
55
- const isCompleteDisabled = !(activeStatuses == null ? void 0 : activeStatuses.includes("STRT"));
56
61
  const iconsAndLabels = useMemo(
57
62
  () => {
58
63
  var _a3;
59
64
  return getStatusIconsAndLabels(
60
- rest.activeStatusIds,
65
+ rest.activeStatus,
61
66
  (_a3 = rest.requiredEnd) != null ? _a3 : null,
62
67
  currentDate,
63
68
  isHseCritical,
64
69
  isProductionCritical
65
70
  );
66
71
  },
67
- [rest.activeStatusIds, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
72
+ [rest.activeStatus, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
68
73
  );
69
74
  return /* @__PURE__ */ React.createElement(Cell, { style }, /* @__PURE__ */ React.createElement(Typography, { numberOfLines: 1, variant: "h5", bold: true, style: styles.title }, title), showSymbols && /* @__PURE__ */ React.createElement(View, { style: [styles.iconListContainer, { flexDirection: symbolDirection }] }, iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(StatusIcon, __spreadValues({ key: index }, item)))), maintenanceType && /* @__PURE__ */ React.createElement(Label, { label: maintenanceType, style: styles.label }), /* @__PURE__ */ React.createElement(
70
75
  PropertyList,
@@ -74,30 +79,42 @@ var WorkOrderCell = (_a) => {
74
79
  valueColor,
75
80
  currentDate: currentDate.toDate()
76
81
  }
77
- ), showActions && /* @__PURE__ */ React.createElement(View, { style: styles.actionContainer }, showActions.startButton && /* @__PURE__ */ React.createElement(
78
- Button,
79
- {
80
- title: "Start job",
81
- variant: "outlined",
82
- disabled: isStartDisabled,
83
- onPress: onStartButtonPress
84
- }
85
- ), showActions.completeButton && /* @__PURE__ */ React.createElement(
86
- Button,
82
+ ), anyButtonVisible && /* @__PURE__ */ React.createElement(
83
+ View,
87
84
  {
88
- title: "Ready for operation",
89
- variant: "outlined",
90
- disabled: isCompleteDisabled,
91
- onPress: onCompleteButtonPress
92
- }
93
- ), showActions.tecoButton && /* @__PURE__ */ React.createElement(
94
- Button,
95
- {
96
- title: "Technical complete",
97
- variant: "outlined",
98
- onPress: onTecoButtonPress
99
- }
100
- )));
85
+ style: [
86
+ styles.actionContainer,
87
+ breakpoint === "xs" && { flexDirection: "column" }
88
+ ]
89
+ },
90
+ (startJobButton == null ? void 0 : startJobButton.visible) && /* @__PURE__ */ React.createElement(
91
+ Button,
92
+ {
93
+ title: "Start job",
94
+ variant: "outlined",
95
+ disabled: startJobButton.disabled,
96
+ onPress: startJobButton.onPress
97
+ }
98
+ ),
99
+ (readyForOperationButton == null ? void 0 : readyForOperationButton.visible) && /* @__PURE__ */ React.createElement(
100
+ Button,
101
+ {
102
+ title: "Ready for operation",
103
+ variant: "outlined",
104
+ disabled: readyForOperationButton.disabled,
105
+ onPress: readyForOperationButton == null ? void 0 : readyForOperationButton.onPress
106
+ }
107
+ ),
108
+ (tecoButton == null ? void 0 : tecoButton.visible) && /* @__PURE__ */ React.createElement(
109
+ Button,
110
+ {
111
+ title: "Technical complete",
112
+ variant: "outlined",
113
+ disabled: tecoButton.disabled,
114
+ onPress: tecoButton.onPress
115
+ }
116
+ )
117
+ ));
101
118
  };
102
119
  var themeStyles = EDSStyleSheet.create(
103
120
  (theme, { symbolDirection }) => ({
@@ -108,8 +125,8 @@ var themeStyles = EDSStyleSheet.create(
108
125
  marginBottom: theme.spacing.cell.group.titleBottomPadding
109
126
  },
110
127
  actionContainer: {
111
- gap: theme.spacing.container.paddingVertical,
112
- marginTop: theme.spacing.spacer.medium,
128
+ gap: theme.spacing.spacer.small,
129
+ marginTop: theme.spacing.container.paddingVertical,
113
130
  flexDirection: "row",
114
131
  justifyContent: "center"
115
132
  },
@@ -123,7 +140,7 @@ var themeStyles = EDSStyleSheet.create(
123
140
  flexWrap: "wrap",
124
141
  flexDirection: symbolDirection,
125
142
  paddingBottom: theme.spacing.cell.group.titleBottomPadding,
126
- gap: symbolDirection === "row" ? theme.spacing.spacer.medium : theme.spacing.cell.content.titleDescriptionGap
143
+ gap: symbolDirection === "row" ? theme.spacing.spacer.small : theme.spacing.cell.content.titleDescriptionGap
127
144
  }
128
145
  })
129
146
  );
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-EOMGHONK.js";
3
+ } from "./chunk-GZZZUFR3.js";
4
4
  import {
5
5
  WorkOrderCellNavigation
6
- } from "./chunk-EYU4DV4X.js";
6
+ } from "./chunk-6X2PRIG5.js";
7
7
 
8
8
  // src/dfwcomponents/WorkOrderCell/index.ts
9
9
  var WorkOrderCell2 = WorkOrderCell;
@@ -8,15 +8,15 @@ import moment from "moment";
8
8
  import { useToken } from "@equinor/mad-components";
9
9
  var defaultWorkOrderLabelMap = {
10
10
  title: "Title",
11
- workOrderId: "Work order ID",
11
+ workOrder: "Work order",
12
12
  maintenanceType: "Maintenance type",
13
13
  functionalLocation: "Functional Location",
14
- equipmentId: "Equipment",
15
- activeStatusIds: "Active status",
14
+ equipment: "Equipment",
15
+ activeStatus: "Active status",
16
16
  basicStartDate: "Basic start",
17
17
  basicFinishDate: "Basic finish",
18
18
  requiredEnd: "Required end",
19
- workCenterId: "Work center"
19
+ workCenter: "Work center"
20
20
  };
21
21
  var PropertyList = ({
22
22
  workOrder,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PropertyList
3
- } from "../../chunk-TQDX6N52.js";
3
+ } from "../../chunk-JRXLEWCW.js";
4
4
  import "../../chunk-2JQRYR7Z.js";
5
5
  import "../../chunk-DQQOZB3E.js";
6
6
  import "../../chunk-G2ADBYYC.js";
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { WorkOrderCellProps } from "./types";
3
- export declare const WorkOrderCell: ({ title, maintenanceType, showSymbols, symbolDirection, valueColor, isHseCritical, isProductionCritical, showActions, overwriteLabel, style, onStartButtonPress, onCompleteButtonPress, onTecoButtonPress, ...rest }: WorkOrderCellProps) => React.JSX.Element;
3
+ export declare const WorkOrderCell: ({ title, maintenanceType, showSymbols, symbolDirection, valueColor, isHseCritical, isProductionCritical, overwriteLabel, style, startJobButton, readyForOperationButton, tecoButton, ...rest }: WorkOrderCellProps) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-EOMGHONK.js";
3
+ } from "../../chunk-GZZZUFR3.js";
4
4
  import "../../chunk-MCPLMBQO.js";
5
- import "../../chunk-TQDX6N52.js";
5
+ import "../../chunk-JRXLEWCW.js";
6
6
  import "../../chunk-2JQRYR7Z.js";
7
7
  import "../../chunk-DQQOZB3E.js";
8
8
  import "../../chunk-VDHOYF7Z.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkOrderCellNavigation
3
- } from "../../chunk-EYU4DV4X.js";
3
+ } from "../../chunk-6X2PRIG5.js";
4
4
  import "../../chunk-MCPLMBQO.js";
5
- import "../../chunk-TQDX6N52.js";
5
+ import "../../chunk-JRXLEWCW.js";
6
6
  import "../../chunk-2JQRYR7Z.js";
7
7
  import "../../chunk-DQQOZB3E.js";
8
8
  import "../../chunk-VDHOYF7Z.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-6POU5MQB.js";
4
- import "../../chunk-EOMGHONK.js";
5
- import "../../chunk-EYU4DV4X.js";
3
+ } from "../../chunk-H7FKL5KN.js";
4
+ import "../../chunk-GZZZUFR3.js";
5
+ import "../../chunk-6X2PRIG5.js";
6
6
  import "../../chunk-MCPLMBQO.js";
7
- import "../../chunk-TQDX6N52.js";
7
+ import "../../chunk-JRXLEWCW.js";
8
8
  import "../../chunk-2JQRYR7Z.js";
9
9
  import "../../chunk-DQQOZB3E.js";
10
10
  import "../../chunk-VDHOYF7Z.js";
@@ -2,20 +2,20 @@ import { Color, IconName } from "@equinor/mad-components";
2
2
  import { ViewProps } from "react-native";
3
3
  export type WorkOrder = {
4
4
  title: string;
5
- workOrderId: string;
5
+ workOrder: string;
6
6
  maintenanceType?: string;
7
- equipmentId?: string;
8
- activeStatusIds?: string;
7
+ equipment?: string;
8
+ activeStatus?: string;
9
9
  basicStartDate?: string;
10
10
  basicFinishDate?: string;
11
11
  requiredEnd?: string;
12
- workCenterId?: string;
12
+ workCenter?: string;
13
13
  functionalLocation?: string;
14
14
  };
15
- export type WorkOrderCellActions = {
16
- startButton?: boolean;
17
- completeButton?: boolean;
18
- tecoButton?: boolean;
15
+ type ButtonOptions = {
16
+ disabled?: boolean;
17
+ visible: boolean;
18
+ onPress: () => void;
19
19
  };
20
20
  export type WorkOrderCellProps = {
21
21
  showSymbols?: boolean;
@@ -25,10 +25,9 @@ export type WorkOrderCellProps = {
25
25
  isProductionCritical?: boolean;
26
26
  style?: ViewProps["style"];
27
27
  overwriteLabel?: Partial<Record<keyof WorkOrder, string>>;
28
- showActions?: WorkOrderCellActions;
29
- onStartButtonPress?: () => void;
30
- onCompleteButtonPress?: () => void;
31
- onTecoButtonPress?: () => void;
28
+ startJobButton?: ButtonOptions;
29
+ readyForOperationButton?: ButtonOptions;
30
+ tecoButton?: ButtonOptions;
32
31
  } & WorkOrder;
33
32
  export type StatusConfig = {
34
33
  icon: IconName;
@@ -36,3 +35,4 @@ export type StatusConfig = {
36
35
  textColor: Color;
37
36
  iconColor: Color;
38
37
  };
38
+ export {};
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-6POU5MQB.js";
4
- import "./chunk-EOMGHONK.js";
5
- import "./chunk-EYU4DV4X.js";
3
+ } from "./chunk-H7FKL5KN.js";
4
+ import "./chunk-GZZZUFR3.js";
5
+ import "./chunk-6X2PRIG5.js";
6
6
  import "./chunk-MCPLMBQO.js";
7
- import "./chunk-TQDX6N52.js";
7
+ import "./chunk-JRXLEWCW.js";
8
8
  import "./chunk-2JQRYR7Z.js";
9
9
  import {
10
10
  PropertyRow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-dfw",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A React Native component library for the Digital Field Worker applications.",
5
5
  "type": "module",
6
6
  "scripts": {