@equinor/mad-dfw 0.5.0 → 0.5.2

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,20 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3388a03: Updated button validation to fix visibility issues on buttons in the `WorkOrderCell`
8
+ component
9
+
10
+ ## 0.5.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 0bab79b: The `WorkOrderCell.Navigation` component is now swipeable.
15
+ - 0bab79b: New prop for `WorkOrderCell` components ,`additionalPropertyRows`: Adds custom rows to
16
+ standard details.
17
+
3
18
  ## 0.5.0
4
19
 
5
20
  ### Minor Changes
@@ -13,11 +13,6 @@ var propertyRowConfig = [
13
13
  value: (wo) => wo.workOrderId,
14
14
  condition: () => true
15
15
  },
16
- {
17
- label: "Functional Location",
18
- value: (wo) => `${wo.tagPlantId}-${wo.tagId}`,
19
- condition: (wo) => !!wo.tagId && !!wo.tagPlantId
20
- },
21
16
  {
22
17
  label: "Tag",
23
18
  value: (wo) => wo.tagId,
@@ -61,9 +56,17 @@ var propertyRowConfig = [
61
56
  return (_a = wo.workCenterId) != null ? _a : "";
62
57
  },
63
58
  condition: (wo) => !!wo.workCenterId
59
+ },
60
+ {
61
+ label: "Functional location",
62
+ value: (wo) => `${wo.tagPlantId}-${wo.tagId}`,
63
+ condition: (wo) => !!wo.tagId && !!wo.tagPlantId
64
64
  }
65
65
  ];
66
- var WorkOrderPropertyList = ({ workOrder }) => {
66
+ var WorkOrderPropertyList = ({
67
+ workOrder,
68
+ additionalPropertyRows = []
69
+ }) => {
67
70
  return /* @__PURE__ */ React.createElement(React.Fragment, null, propertyRowConfig.map((item) => {
68
71
  const label = typeof item.label === "function" ? item.label(workOrder) : item.label;
69
72
  const value = typeof item.value === "function" ? item.value(workOrder) : item.value;
@@ -79,7 +82,7 @@ var WorkOrderPropertyList = ({ workOrder }) => {
79
82
  textColor
80
83
  }
81
84
  );
82
- }));
85
+ }), additionalPropertyRows.map((item, index) => /* @__PURE__ */ React.createElement(PropertyRow, { key: `additional-${index}`, label: item.label, value: item.value })));
83
86
  };
84
87
 
85
88
  export {
@@ -0,0 +1,96 @@
1
+ import {
2
+ StatusIcon
3
+ } from "./chunk-VDHOYF7Z.js";
4
+ import {
5
+ WorkOrderPropertyList
6
+ } from "./chunk-4G4367DY.js";
7
+ import {
8
+ getStatusIconsAndLabels
9
+ } from "./chunk-GNURJIGB.js";
10
+ import {
11
+ __objRest,
12
+ __spreadProps,
13
+ __spreadValues
14
+ } from "./chunk-G2ADBYYC.js";
15
+
16
+ // src/dfwcomponents/WorkOrderCell/WorkOrderCellNavigation.tsx
17
+ import {
18
+ Cell,
19
+ EDSStyleSheet,
20
+ Icon,
21
+ Typography,
22
+ useStyles
23
+ } from "@equinor/mad-components";
24
+ import React, { useMemo } from "react";
25
+ import { View } from "react-native";
26
+ var WorkOrderCellNavigation = (_a) => {
27
+ var _b = _a, {
28
+ showSymbols = true,
29
+ workOrder,
30
+ leftSwipeGroup,
31
+ rightSwipeGroup,
32
+ additionalPropertyRows = [],
33
+ onPress
34
+ } = _b, rest = __objRest(_b, [
35
+ "showSymbols",
36
+ "workOrder",
37
+ "leftSwipeGroup",
38
+ "rightSwipeGroup",
39
+ "additionalPropertyRows",
40
+ "onPress"
41
+ ]);
42
+ const styles = useStyles(themeStyles);
43
+ const iconsAndLabels = useMemo(
44
+ () => getStatusIconsAndLabels(
45
+ workOrder.activeStatusIds,
46
+ workOrder.requiredEndDate,
47
+ workOrder.isHseCritical,
48
+ workOrder.isProductionCritical
49
+ ),
50
+ [workOrder]
51
+ );
52
+ return /* @__PURE__ */ React.createElement(
53
+ Cell,
54
+ __spreadProps(__spreadValues({}, rest), {
55
+ onPress,
56
+ leftSwipeGroup,
57
+ rightSwipeGroup
58
+ }),
59
+ /* @__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 }, workOrder.title), /* @__PURE__ */ React.createElement(View, { style: styles.dataContainer }, workOrder.maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, workOrder.maintenanceType), /* @__PURE__ */ React.createElement(
60
+ WorkOrderPropertyList,
61
+ {
62
+ workOrder,
63
+ additionalPropertyRows
64
+ }
65
+ ), " ")), showSymbols && /* @__PURE__ */ React.createElement(View, { style: styles.iconListContainer }, iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(StatusIcon, __spreadProps(__spreadValues({ key: index }, item), { label: void 0 })))), /* @__PURE__ */ React.createElement(Icon, { name: "chevron-right" }))
66
+ );
67
+ };
68
+ var themeStyles = EDSStyleSheet.create((theme) => ({
69
+ container: {
70
+ flexDirection: "row",
71
+ justifyContent: "space-between",
72
+ alignItems: "center"
73
+ },
74
+ contentContainer: {
75
+ flex: 1,
76
+ flexDirection: "column"
77
+ },
78
+ title: {
79
+ marginBottom: theme.spacing.container.paddingVertical
80
+ },
81
+ dataContainer: {
82
+ gap: theme.spacing.cell.group.titleBottomPadding
83
+ },
84
+ iconListContainer: {
85
+ position: "absolute",
86
+ top: 0,
87
+ right: 0,
88
+ flexDirection: "row",
89
+ alignItems: "center",
90
+ gap: theme.spacing.spacer.small
91
+ }
92
+ }));
93
+
94
+ export {
95
+ WorkOrderCellNavigation
96
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-75HKHWRT.js";
3
+ } from "./chunk-EVCZ3YPL.js";
4
4
  import {
5
5
  WorkOrderCellNavigation
6
- } from "./chunk-VHEWDAGI.js";
6
+ } from "./chunk-6P3AA5FM.js";
7
7
 
8
8
  // src/dfwcomponents/WorkOrderCell/index.ts
9
9
  var WorkOrderCell2 = WorkOrderCell;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-VDHOYF7Z.js";
4
4
  import {
5
5
  WorkOrderPropertyList
6
- } from "./chunk-FKFMMXFT.js";
6
+ } from "./chunk-4G4367DY.js";
7
7
  import {
8
8
  getStatusIconsAndLabels
9
9
  } from "./chunk-GNURJIGB.js";
@@ -30,19 +30,21 @@ var WorkOrderCell = (_a) => {
30
30
  startJobButton,
31
31
  readyForOperationButton,
32
32
  tecoButton,
33
- workOrder
33
+ workOrder,
34
+ additionalPropertyRows = []
34
35
  } = _b, rest = __objRest(_b, [
35
36
  "showSymbols",
36
37
  "startJobButton",
37
38
  "readyForOperationButton",
38
39
  "tecoButton",
39
- "workOrder"
40
+ "workOrder",
41
+ "additionalPropertyRows"
40
42
  ]);
41
- var _a2, _b2;
43
+ var _a2, _b2, _c;
42
44
  const breakpoint = useBreakpoint();
43
45
  const token = useToken();
44
46
  const styles = useStyles(themeStyles);
45
- 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;
47
+ const shouldShowActions = ((_a2 = startJobButton == null ? void 0 : startJobButton.visible) != null ? _a2 : false) || ((_b2 = readyForOperationButton == null ? void 0 : readyForOperationButton.visible) != null ? _b2 : false) || ((_c = tecoButton == null ? void 0 : tecoButton.visible) != null ? _c : false);
46
48
  const iconsAndLabels = useMemo(
47
49
  () => getStatusIconsAndLabels(
48
50
  workOrder.activeStatusIds,
@@ -61,7 +63,13 @@ var WorkOrderCell = (_a) => {
61
63
  style: !showSymbols && { paddingBottom: token.spacing.container.paddingVertical }
62
64
  },
63
65
  workOrder.title
64
- ), showSymbols && iconsAndLabels.length > 0 && /* @__PURE__ */ React.createElement(View, { style: styles.iconListContainer }, iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(StatusIcon, __spreadValues({ key: index }, item)))), /* @__PURE__ */ React.createElement(View, { style: styles.dataContainer }, workOrder.maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, workOrder.maintenanceType), /* @__PURE__ */ React.createElement(WorkOrderPropertyList, { workOrder })), anyButtonVisible && /* @__PURE__ */ React.createElement(
66
+ ), showSymbols && iconsAndLabels.length > 0 && /* @__PURE__ */ React.createElement(View, { style: styles.iconListContainer }, iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(StatusIcon, __spreadValues({ key: index }, item)))), /* @__PURE__ */ React.createElement(View, { style: styles.dataContainer }, workOrder.maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, workOrder.maintenanceType), /* @__PURE__ */ React.createElement(
67
+ WorkOrderPropertyList,
68
+ {
69
+ workOrder,
70
+ additionalPropertyRows
71
+ }
72
+ )), shouldShowActions && /* @__PURE__ */ React.createElement(
65
73
  View,
66
74
  {
67
75
  style: [
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { WorkOrderCellProps } from "./types";
3
- export declare const WorkOrderCell: ({ showSymbols, startJobButton, readyForOperationButton, tecoButton, workOrder, ...rest }: WorkOrderCellProps) => React.JSX.Element;
3
+ export declare const WorkOrderCell: ({ showSymbols, startJobButton, readyForOperationButton, tecoButton, workOrder, additionalPropertyRows, ...rest }: WorkOrderCellProps) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-75HKHWRT.js";
3
+ } from "../../chunk-EVCZ3YPL.js";
4
4
  import "../../chunk-VDHOYF7Z.js";
5
- import "../../chunk-FKFMMXFT.js";
5
+ import "../../chunk-4G4367DY.js";
6
6
  import "../../chunk-GNURJIGB.js";
7
7
  import "../../chunk-2JQRYR7Z.js";
8
8
  import "../../chunk-DQQOZB3E.js";
@@ -1,7 +1,11 @@
1
+ import { CellSwipeItemProps } from "@equinor/mad-components";
1
2
  import React from "react";
2
3
  import { WorkOrderCellProps } from "./types";
4
+ type SwipeGroup = CellSwipeItemProps[];
3
5
  type WorkOrderCellNavigationProps = WorkOrderCellProps & {
4
6
  onPress: () => void;
7
+ leftSwipeGroup?: SwipeGroup;
8
+ rightSwipeGroup?: SwipeGroup;
5
9
  };
6
- export declare const WorkOrderCellNavigation: ({ showSymbols, onPress, workOrder, ...rest }: WorkOrderCellNavigationProps) => React.JSX.Element;
10
+ export declare const WorkOrderCellNavigation: ({ showSymbols, workOrder, leftSwipeGroup, rightSwipeGroup, additionalPropertyRows, onPress, ...rest }: WorkOrderCellNavigationProps) => React.JSX.Element;
7
11
  export {};
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkOrderCellNavigation
3
- } from "../../chunk-VHEWDAGI.js";
3
+ } from "../../chunk-6P3AA5FM.js";
4
4
  import "../../chunk-VDHOYF7Z.js";
5
- import "../../chunk-FKFMMXFT.js";
5
+ import "../../chunk-4G4367DY.js";
6
6
  import "../../chunk-GNURJIGB.js";
7
7
  import "../../chunk-2JQRYR7Z.js";
8
8
  import "../../chunk-DQQOZB3E.js";
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- import { WorkOrder } from "./types";
2
+ import { AdditionalPropertyRow, WorkOrder } from "./types";
3
3
  type WorkOrderPropertyListProps = {
4
4
  workOrder: WorkOrder;
5
+ additionalPropertyRows?: AdditionalPropertyRow[];
5
6
  };
6
- export declare const WorkOrderPropertyList: ({ workOrder }: WorkOrderPropertyListProps) => React.JSX.Element;
7
+ export declare const WorkOrderPropertyList: ({ workOrder, additionalPropertyRows, }: WorkOrderPropertyListProps) => React.JSX.Element;
7
8
  export {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkOrderPropertyList
3
- } from "../../chunk-FKFMMXFT.js";
3
+ } from "../../chunk-4G4367DY.js";
4
4
  import "../../chunk-GNURJIGB.js";
5
5
  import "../../chunk-2JQRYR7Z.js";
6
6
  import "../../chunk-DQQOZB3E.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-VULSI4WO.js";
4
- import "../../chunk-75HKHWRT.js";
5
- import "../../chunk-VHEWDAGI.js";
3
+ } from "../../chunk-EGOXZ76E.js";
4
+ import "../../chunk-EVCZ3YPL.js";
5
+ import "../../chunk-6P3AA5FM.js";
6
6
  import "../../chunk-VDHOYF7Z.js";
7
- import "../../chunk-FKFMMXFT.js";
7
+ import "../../chunk-4G4367DY.js";
8
8
  import "../../chunk-GNURJIGB.js";
9
9
  import "../../chunk-2JQRYR7Z.js";
10
10
  import "../../chunk-DQQOZB3E.js";
@@ -1,5 +1,9 @@
1
1
  import { Color, IconName } from "@equinor/mad-components";
2
2
  import { ViewProps } from "react-native";
3
+ export type AdditionalPropertyRow = {
4
+ label: string;
5
+ value: string;
6
+ };
3
7
  export type WorkOrderType = "PM01" | "PM02" | "PM03" | "PM04" | "PM05" | "PM06" | "PM10" | "PM15" | "PM20" | "unknown";
4
8
  export type WorkOrder = {
5
9
  workOrderId: string;
@@ -44,6 +48,7 @@ export type WorkOrderCellProps = {
44
48
  * Work order data to display in the cell.
45
49
  */
46
50
  workOrder: WorkOrder;
51
+ additionalPropertyRows?: AdditionalPropertyRow[];
47
52
  } & Omit<ViewProps, "children">;
48
53
  export type StatusConfig = {
49
54
  icon: IconName;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-VULSI4WO.js";
4
- import "./chunk-75HKHWRT.js";
5
- import "./chunk-VHEWDAGI.js";
3
+ } from "./chunk-EGOXZ76E.js";
4
+ import "./chunk-EVCZ3YPL.js";
5
+ import "./chunk-6P3AA5FM.js";
6
6
  import "./chunk-VDHOYF7Z.js";
7
- import "./chunk-FKFMMXFT.js";
7
+ import "./chunk-4G4367DY.js";
8
8
  import "./chunk-GNURJIGB.js";
9
9
  import "./chunk-2JQRYR7Z.js";
10
10
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-dfw",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "A React Native component library for the Digital Field Worker applications.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,70 +0,0 @@
1
- import {
2
- StatusIcon
3
- } from "./chunk-VDHOYF7Z.js";
4
- import {
5
- WorkOrderPropertyList
6
- } from "./chunk-FKFMMXFT.js";
7
- import {
8
- getStatusIconsAndLabels
9
- } from "./chunk-GNURJIGB.js";
10
- import {
11
- __objRest,
12
- __spreadProps,
13
- __spreadValues
14
- } from "./chunk-G2ADBYYC.js";
15
-
16
- // src/dfwcomponents/WorkOrderCell/WorkOrderCellNavigation.tsx
17
- import { Cell, EDSStyleSheet, Icon, Typography, useStyles } from "@equinor/mad-components";
18
- import React, { useMemo } from "react";
19
- import { View } from "react-native";
20
- var WorkOrderCellNavigation = (_a) => {
21
- var _b = _a, {
22
- showSymbols = true,
23
- onPress,
24
- workOrder
25
- } = _b, rest = __objRest(_b, [
26
- "showSymbols",
27
- "onPress",
28
- "workOrder"
29
- ]);
30
- const styles = useStyles(themeStyles);
31
- const iconsAndLabels = useMemo(
32
- () => getStatusIconsAndLabels(
33
- workOrder.activeStatusIds,
34
- workOrder.requiredEndDate,
35
- workOrder.isHseCritical,
36
- workOrder.isProductionCritical
37
- ),
38
- [workOrder]
39
- );
40
- return /* @__PURE__ */ React.createElement(Cell, __spreadProps(__spreadValues({}, rest), { onPress }), /* @__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 }, workOrder.title), /* @__PURE__ */ React.createElement(View, { style: styles.dataContainer }, workOrder.maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, workOrder.maintenanceType), /* @__PURE__ */ React.createElement(WorkOrderPropertyList, { workOrder }))), showSymbols && /* @__PURE__ */ React.createElement(View, { style: styles.iconListContainer }, iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(StatusIcon, __spreadProps(__spreadValues({ key: index }, item), { label: void 0 })))), /* @__PURE__ */ React.createElement(Icon, { name: "chevron-right" })));
41
- };
42
- var themeStyles = EDSStyleSheet.create((theme) => ({
43
- container: {
44
- flexDirection: "row",
45
- justifyContent: "space-between",
46
- alignItems: "center"
47
- },
48
- contentContainer: {
49
- flex: 1,
50
- flexDirection: "column"
51
- },
52
- title: {
53
- marginBottom: theme.spacing.container.paddingVertical
54
- },
55
- dataContainer: {
56
- gap: theme.spacing.cell.group.titleBottomPadding
57
- },
58
- iconListContainer: {
59
- position: "absolute",
60
- top: 0,
61
- right: 0,
62
- flexDirection: "row",
63
- alignItems: "center",
64
- gap: theme.spacing.spacer.small
65
- }
66
- }));
67
-
68
- export {
69
- WorkOrderCellNavigation
70
- };