@equinor/mad-dfw 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ae0f906: Added loading prop to the buttons in the `WorkOrderCell` component
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 8503815: Adjusted props related to data display and buttons in the `WorkOrderCell` component.
14
+ Removed the `Id` part from the data props. Removed/adjusted the props: `showActions`,
15
+ `onStartButtonPress`, `onReadyForOperationPress` and `onTecoButtonPress`. New props for this:
16
+ `startJobButton`, `readyForOperationButton` and `tecoButton`. These props have three options
17
+ `visible`, `disabled` and `onpress`. Removed validations for when the buttons are displayed.
18
+
3
19
  ## 0.2.0
4
20
 
5
21
  ### 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,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-EOMGHONK.js";
3
+ } from "./chunk-TPYVM6NR.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,
@@ -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,45 @@ 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
+ loading: startJobButton.loading,
97
+ onPress: startJobButton.onPress
98
+ }
99
+ ),
100
+ (readyForOperationButton == null ? void 0 : readyForOperationButton.visible) && /* @__PURE__ */ React.createElement(
101
+ Button,
102
+ {
103
+ title: "Ready for operation",
104
+ variant: "outlined",
105
+ disabled: readyForOperationButton.disabled,
106
+ loading: readyForOperationButton.loading,
107
+ onPress: readyForOperationButton.onPress
108
+ }
109
+ ),
110
+ (tecoButton == null ? void 0 : tecoButton.visible) && /* @__PURE__ */ React.createElement(
111
+ Button,
112
+ {
113
+ title: "Technical complete",
114
+ variant: "outlined",
115
+ disabled: tecoButton.disabled,
116
+ loading: tecoButton.loading,
117
+ onPress: tecoButton.onPress
118
+ }
119
+ )
120
+ ));
101
121
  };
102
122
  var themeStyles = EDSStyleSheet.create(
103
123
  (theme, { symbolDirection }) => ({
@@ -108,8 +128,8 @@ var themeStyles = EDSStyleSheet.create(
108
128
  marginBottom: theme.spacing.cell.group.titleBottomPadding
109
129
  },
110
130
  actionContainer: {
111
- gap: theme.spacing.container.paddingVertical,
112
- marginTop: theme.spacing.spacer.medium,
131
+ gap: theme.spacing.spacer.small,
132
+ marginTop: theme.spacing.container.paddingVertical,
113
133
  flexDirection: "row",
114
134
  justifyContent: "center"
115
135
  },
@@ -123,7 +143,7 @@ var themeStyles = EDSStyleSheet.create(
123
143
  flexWrap: "wrap",
124
144
  flexDirection: symbolDirection,
125
145
  paddingBottom: theme.spacing.cell.group.titleBottomPadding,
126
- gap: symbolDirection === "row" ? theme.spacing.spacer.medium : theme.spacing.cell.content.titleDescriptionGap
146
+ gap: symbolDirection === "row" ? theme.spacing.spacer.small : theme.spacing.cell.content.titleDescriptionGap
127
147
  }
128
148
  })
129
149
  );
@@ -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-TPYVM6NR.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-GZT3W2AO.js";
4
+ import "../../chunk-TPYVM6NR.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,21 @@ 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
+ loading?: boolean;
18
+ visible: boolean;
19
+ onPress: () => void;
19
20
  };
20
21
  export type WorkOrderCellProps = {
21
22
  showSymbols?: boolean;
@@ -25,10 +26,9 @@ export type WorkOrderCellProps = {
25
26
  isProductionCritical?: boolean;
26
27
  style?: ViewProps["style"];
27
28
  overwriteLabel?: Partial<Record<keyof WorkOrder, string>>;
28
- showActions?: WorkOrderCellActions;
29
- onStartButtonPress?: () => void;
30
- onCompleteButtonPress?: () => void;
31
- onTecoButtonPress?: () => void;
29
+ startJobButton?: ButtonOptions;
30
+ readyForOperationButton?: ButtonOptions;
31
+ tecoButton?: ButtonOptions;
32
32
  } & WorkOrder;
33
33
  export type StatusConfig = {
34
34
  icon: IconName;
@@ -36,3 +36,4 @@ export type StatusConfig = {
36
36
  textColor: Color;
37
37
  iconColor: Color;
38
38
  };
39
+ 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-GZT3W2AO.js";
4
+ import "./chunk-TPYVM6NR.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.1",
4
4
  "description": "A React Native component library for the Digital Field Worker applications.",
5
5
  "type": "module",
6
6
  "scripts": {