@equinor/mad-dfw 0.4.1 → 0.5.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,33 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0bab79b: The `WorkOrderCell.Navigation` component is now swipeable.
8
+ - 0bab79b: New prop for `WorkOrderCell` components ,`additionalPropertyRows`: Adds custom rows to
9
+ standard details.
10
+
11
+ ## 0.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - c3cd036: - Introduced `tagPlantId` field on `WorkOrder` type.
16
+
17
+ - Expanded the allowed props on the `WorkOrderCell` to accept all non-child view props in
18
+ addition to its fundamental props.
19
+
20
+ **Breaking changes:**
21
+
22
+ - Moved all work order related data into the `workOrder` prop of the cell
23
+ - Renamed `requiredEnd` to `requiredEndDate`
24
+ - Renamed `workCenter` to `workCenterId`
25
+ - Renamed `functionalLocation` to `tagId`
26
+ - Renamed `basicFinishDate` to `basicEndDate`
27
+ - Renamed `equipment` to `equipmentId`
28
+ - Renamed `activeStatus` to `activeStatusIds`
29
+ - Removed the `overwriteLabel` prop on `WorkOrderCellProps`
30
+
3
31
  ## 0.4.1
4
32
 
5
33
  ### Patch Changes
@@ -0,0 +1,90 @@
1
+ import {
2
+ formatDate
3
+ } from "./chunk-GNURJIGB.js";
4
+ import {
5
+ PropertyRow
6
+ } from "./chunk-DQQOZB3E.js";
7
+
8
+ // src/dfwcomponents/WorkOrderCell/WorkOrderPropertyList.tsx
9
+ import React from "react";
10
+ var propertyRowConfig = [
11
+ {
12
+ label: (wo) => wo.workOrderType,
13
+ value: (wo) => wo.workOrderId,
14
+ condition: () => true
15
+ },
16
+ {
17
+ label: "Tag",
18
+ value: (wo) => wo.tagId,
19
+ condition: (wo) => !!wo.tagId && !wo.tagPlantId
20
+ },
21
+ {
22
+ label: "Equipment",
23
+ value: (wo) => wo.equipmentId,
24
+ condition: (wo) => !!wo.equipmentId
25
+ },
26
+ {
27
+ label: "Active statuses",
28
+ value: (wo) => wo.activeStatusIds,
29
+ condition: (wo) => !!wo.activeStatusIds
30
+ },
31
+ {
32
+ label: "Basic start / finish",
33
+ value: (wo) => `${formatDate(wo.basicStartDate)} - ${formatDate(wo.basicEndDate)}`,
34
+ condition: (wo) => !!wo.basicStartDate && !!wo.basicEndDate
35
+ },
36
+ {
37
+ label: "Basic start",
38
+ value: (wo) => formatDate(wo.basicStartDate),
39
+ condition: (wo) => !!wo.basicStartDate && !wo.basicEndDate
40
+ },
41
+ {
42
+ label: "Basic finish",
43
+ value: (wo) => formatDate(wo.basicEndDate),
44
+ condition: (wo) => !!wo.basicEndDate && !wo.basicStartDate
45
+ },
46
+ {
47
+ label: "Required end",
48
+ value: (wo) => formatDate(wo.requiredEndDate),
49
+ color: (wo) => /* @__PURE__ */ new Date() > new Date(wo.requiredEndDate) ? "danger" : "textTertiary",
50
+ condition: (wo) => !!wo.requiredEndDate
51
+ },
52
+ {
53
+ label: "Work center",
54
+ value: (wo) => {
55
+ var _a;
56
+ return (_a = wo.workCenterId) != null ? _a : "";
57
+ },
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
+ }
65
+ ];
66
+ var WorkOrderPropertyList = ({
67
+ workOrder,
68
+ additionalPropertyRows = []
69
+ }) => {
70
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, propertyRowConfig.map((item) => {
71
+ const label = typeof item.label === "function" ? item.label(workOrder) : item.label;
72
+ const value = typeof item.value === "function" ? item.value(workOrder) : item.value;
73
+ const textColor = typeof item.color === "function" ? item.color(workOrder) : item.color;
74
+ if (!item.condition(workOrder))
75
+ return null;
76
+ return /* @__PURE__ */ React.createElement(
77
+ PropertyRow,
78
+ {
79
+ key: `${label}-${value}`,
80
+ label,
81
+ value,
82
+ textColor
83
+ }
84
+ );
85
+ }), additionalPropertyRows.map((item, index) => /* @__PURE__ */ React.createElement(PropertyRow, { key: `additional-${index}`, label: item.label, value: item.value })));
86
+ };
87
+
88
+ export {
89
+ WorkOrderPropertyList
90
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-BHBXYUCP.js";
3
+ } from "./chunk-FTG43LBL.js";
4
4
  import {
5
5
  WorkOrderCellNavigation
6
- } from "./chunk-MGKGHFEF.js";
6
+ } from "./chunk-6P3AA5FM.js";
7
7
 
8
8
  // src/dfwcomponents/WorkOrderCell/index.ts
9
9
  var WorkOrderCell2 = WorkOrderCell;
@@ -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,15 +1,12 @@
1
- import {
2
- PropertyList
3
- } from "./chunk-AIIMQRJ6.js";
4
- import {
5
- getStatusIconsAndLabels
6
- } from "./chunk-JFOLVFFO.js";
7
- import {
8
- PropertyRow
9
- } from "./chunk-DQQOZB3E.js";
10
1
  import {
11
2
  StatusIcon
12
3
  } from "./chunk-VDHOYF7Z.js";
4
+ import {
5
+ WorkOrderPropertyList
6
+ } from "./chunk-4G4367DY.js";
7
+ import {
8
+ getStatusIconsAndLabels
9
+ } from "./chunk-GNURJIGB.js";
13
10
  import {
14
11
  __objRest,
15
12
  __spreadValues
@@ -29,52 +26,35 @@ import React, { useMemo } from "react";
29
26
  import { View } from "react-native";
30
27
  var WorkOrderCell = (_a) => {
31
28
  var _b = _a, {
32
- title,
33
- workOrderId,
34
- workOrderType,
35
- maintenanceType,
36
29
  showSymbols = true,
37
- valueColor = "textTertiary",
38
- isHseCritical,
39
- isProductionCritical,
40
- style,
41
30
  startJobButton,
42
31
  readyForOperationButton,
43
- tecoButton
32
+ tecoButton,
33
+ workOrder,
34
+ additionalPropertyRows = []
44
35
  } = _b, rest = __objRest(_b, [
45
- "title",
46
- "workOrderId",
47
- "workOrderType",
48
- "maintenanceType",
49
36
  "showSymbols",
50
- "valueColor",
51
- "isHseCritical",
52
- "isProductionCritical",
53
- "style",
54
37
  "startJobButton",
55
38
  "readyForOperationButton",
56
- "tecoButton"
39
+ "tecoButton",
40
+ "workOrder",
41
+ "additionalPropertyRows"
57
42
  ]);
58
43
  var _a2, _b2;
59
44
  const breakpoint = useBreakpoint();
60
45
  const token = useToken();
61
46
  const styles = useStyles(themeStyles);
62
47
  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;
63
- const currentDate = useMemo(() => /* @__PURE__ */ new Date(), []);
64
48
  const iconsAndLabels = useMemo(
65
- () => {
66
- var _a3;
67
- return getStatusIconsAndLabels(
68
- rest.activeStatus,
69
- (_a3 = rest.requiredEnd) != null ? _a3 : null,
70
- currentDate,
71
- isHseCritical,
72
- isProductionCritical
73
- );
74
- },
75
- [rest.activeStatus, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
49
+ () => getStatusIconsAndLabels(
50
+ workOrder.activeStatusIds,
51
+ workOrder.requiredEndDate,
52
+ workOrder.isHseCritical,
53
+ workOrder.isProductionCritical
54
+ ),
55
+ [workOrder]
76
56
  );
77
- return /* @__PURE__ */ React.createElement(Cell, { style }, /* @__PURE__ */ React.createElement(
57
+ return /* @__PURE__ */ React.createElement(Cell, __spreadValues({}, rest), /* @__PURE__ */ React.createElement(
78
58
  Typography,
79
59
  {
80
60
  numberOfLines: 1,
@@ -82,8 +62,14 @@ var WorkOrderCell = (_a) => {
82
62
  bold: true,
83
63
  style: !showSymbols && { paddingBottom: token.spacing.container.paddingVertical }
84
64
  },
85
- title
86
- ), 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 }, maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, maintenanceType), /* @__PURE__ */ React.createElement(PropertyRow, { label: workOrderType, value: workOrderId }), /* @__PURE__ */ React.createElement(PropertyList, { data: rest, valueColor })), anyButtonVisible && /* @__PURE__ */ React.createElement(
65
+ workOrder.title
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
+ )), anyButtonVisible && /* @__PURE__ */ React.createElement(
87
73
  View,
88
74
  {
89
75
  style: [
@@ -18,11 +18,12 @@ var getStatusIconConfig = (status) => {
18
18
  }
19
19
  return void 0;
20
20
  };
21
- var getStatusIconsAndLabels = (activeStatusIds, requiredEndDate, currentDate, hseCritical, productionCritical) => {
21
+ var getStatusIconsAndLabels = (activeStatusIds, requiredEndDate, hseCritical, productionCritical) => {
22
22
  const requiredEnd = requiredEndDate ? new Date(requiredEndDate) : null;
23
23
  const activeStatuses = activeStatusIds == null ? void 0 : activeStatusIds.split(" ");
24
+ const today = /* @__PURE__ */ new Date();
24
25
  const iconsAndLabels = [];
25
- if (requiredEnd && currentDate > requiredEnd) {
26
+ if (requiredEnd && today > requiredEnd) {
26
27
  iconsAndLabels.push({
27
28
  icon: "alarm",
28
29
  label: "Required end overdue",
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { WorkOrderCellProps } from "./types";
3
- export declare const WorkOrderCell: ({ title, workOrderId, workOrderType, maintenanceType, showSymbols, valueColor, isHseCritical, isProductionCritical, style, startJobButton, readyForOperationButton, tecoButton, ...rest }: WorkOrderCellProps) => React.JSX.Element;
3
+ export declare const WorkOrderCell: ({ showSymbols, startJobButton, readyForOperationButton, tecoButton, workOrder, additionalPropertyRows, ...rest }: WorkOrderCellProps) => React.JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-BHBXYUCP.js";
4
- import "../../chunk-AIIMQRJ6.js";
5
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-FTG43LBL.js";
4
+ import "../../chunk-VDHOYF7Z.js";
5
+ import "../../chunk-4G4367DY.js";
6
+ import "../../chunk-GNURJIGB.js";
6
7
  import "../../chunk-2JQRYR7Z.js";
7
8
  import "../../chunk-DQQOZB3E.js";
8
- import "../../chunk-VDHOYF7Z.js";
9
9
  import "../../chunk-G2ADBYYC.js";
10
10
  export {
11
11
  WorkOrderCell
@@ -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: ({ title, workOrderId, workOrderType, maintenanceType, valueColor, isHseCritical, isProductionCritical, showSymbols, onPress, style, ...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,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCellNavigation
3
- } from "../../chunk-MGKGHFEF.js";
4
- import "../../chunk-AIIMQRJ6.js";
5
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-6P3AA5FM.js";
4
+ import "../../chunk-VDHOYF7Z.js";
5
+ import "../../chunk-4G4367DY.js";
6
+ import "../../chunk-GNURJIGB.js";
6
7
  import "../../chunk-2JQRYR7Z.js";
7
8
  import "../../chunk-DQQOZB3E.js";
8
- import "../../chunk-VDHOYF7Z.js";
9
9
  import "../../chunk-G2ADBYYC.js";
10
10
  export {
11
11
  WorkOrderCellNavigation
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { AdditionalPropertyRow, WorkOrder } from "./types";
3
+ type WorkOrderPropertyListProps = {
4
+ workOrder: WorkOrder;
5
+ additionalPropertyRows?: AdditionalPropertyRow[];
6
+ };
7
+ export declare const WorkOrderPropertyList: ({ workOrder, additionalPropertyRows, }: WorkOrderPropertyListProps) => React.JSX.Element;
8
+ export {};
@@ -1,10 +1,10 @@
1
1
  import {
2
- PropertyList
3
- } from "../../chunk-AIIMQRJ6.js";
4
- import "../../chunk-JFOLVFFO.js";
2
+ WorkOrderPropertyList
3
+ } from "../../chunk-4G4367DY.js";
4
+ import "../../chunk-GNURJIGB.js";
5
5
  import "../../chunk-2JQRYR7Z.js";
6
6
  import "../../chunk-DQQOZB3E.js";
7
7
  import "../../chunk-G2ADBYYC.js";
8
8
  export {
9
- PropertyList
9
+ WorkOrderPropertyList
10
10
  };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-QQL5ES55.js";
4
- import "../../chunk-BHBXYUCP.js";
5
- import "../../chunk-MGKGHFEF.js";
6
- import "../../chunk-AIIMQRJ6.js";
7
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-4IALCT65.js";
4
+ import "../../chunk-FTG43LBL.js";
5
+ import "../../chunk-6P3AA5FM.js";
6
+ import "../../chunk-VDHOYF7Z.js";
7
+ import "../../chunk-4G4367DY.js";
8
+ import "../../chunk-GNURJIGB.js";
8
9
  import "../../chunk-2JQRYR7Z.js";
9
10
  import "../../chunk-DQQOZB3E.js";
10
- import "../../chunk-VDHOYF7Z.js";
11
11
  import "../../chunk-G2ADBYYC.js";
12
12
  export {
13
13
  WorkOrderCell
@@ -1,18 +1,25 @@
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;
6
10
  workOrderType: WorkOrderType;
7
11
  title: string;
8
12
  maintenanceType?: string;
9
- equipment?: string;
10
- activeStatus?: string;
13
+ tagId?: string;
14
+ tagPlantId?: string;
15
+ equipmentId?: string;
16
+ activeStatusIds?: string;
11
17
  basicStartDate?: string;
12
- basicFinishDate?: string;
13
- requiredEnd?: string;
14
- workCenter?: string;
15
- functionalLocation?: string;
18
+ basicEndDate?: string;
19
+ requiredEndDate?: string;
20
+ workCenterId?: string;
21
+ isHseCritical?: boolean;
22
+ isProductionCritical?: boolean;
16
23
  };
17
24
  type ButtonOptions = {
18
25
  disabled?: boolean;
@@ -21,18 +28,28 @@ type ButtonOptions = {
21
28
  onPress: () => void;
22
29
  };
23
30
  export type WorkOrderCellProps = {
24
- workOrderId: string;
25
- workOrderType: WorkOrderType;
31
+ /**
32
+ * Boolean value indicating whether or not the work order cell should display statuses as icons.
33
+ */
26
34
  showSymbols?: boolean;
27
- valueColor?: Color;
28
- isHseCritical?: boolean;
29
- isProductionCritical?: boolean;
30
- style?: ViewProps["style"];
31
- overwriteLabel?: Partial<Record<keyof WorkOrder, string>>;
35
+ /**
36
+ * Button configuration for the start job button.
37
+ */
32
38
  startJobButton?: ButtonOptions;
39
+ /**
40
+ * Button configuration for the ready for operation button.
41
+ */
33
42
  readyForOperationButton?: ButtonOptions;
43
+ /**
44
+ * Button configuration for the complete button.
45
+ */
34
46
  tecoButton?: ButtonOptions;
35
- } & WorkOrder;
47
+ /**
48
+ * Work order data to display in the cell.
49
+ */
50
+ workOrder: WorkOrder;
51
+ additionalPropertyRows?: AdditionalPropertyRow[];
52
+ } & Omit<ViewProps, "children">;
36
53
  export type StatusConfig = {
37
54
  icon: IconName;
38
55
  label?: string;
@@ -1,4 +1,4 @@
1
1
  import { StatusConfig } from "./types";
2
2
  export declare const getStatusIconConfig: (status: string) => StatusConfig | undefined;
3
- export declare const getStatusIconsAndLabels: (activeStatusIds: string | undefined, requiredEndDate: string | null, currentDate: Date, hseCritical?: boolean, productionCritical?: boolean) => StatusConfig[];
3
+ export declare const getStatusIconsAndLabels: (activeStatusIds?: string, requiredEndDate?: string, hseCritical?: boolean, productionCritical?: boolean) => StatusConfig[];
4
4
  export declare const formatDate: (dateString: string) => string;
@@ -2,7 +2,7 @@ import {
2
2
  formatDate,
3
3
  getStatusIconConfig,
4
4
  getStatusIconsAndLabels
5
- } from "../../chunk-JFOLVFFO.js";
5
+ } from "../../chunk-GNURJIGB.js";
6
6
  import "../../chunk-G2ADBYYC.js";
7
7
  export {
8
8
  formatDate,
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-QQL5ES55.js";
4
- import "./chunk-BHBXYUCP.js";
5
- import "./chunk-MGKGHFEF.js";
6
- import "./chunk-AIIMQRJ6.js";
7
- import "./chunk-JFOLVFFO.js";
3
+ } from "./chunk-4IALCT65.js";
4
+ import "./chunk-FTG43LBL.js";
5
+ import "./chunk-6P3AA5FM.js";
6
+ import "./chunk-VDHOYF7Z.js";
7
+ import "./chunk-4G4367DY.js";
8
+ import "./chunk-GNURJIGB.js";
8
9
  import "./chunk-2JQRYR7Z.js";
9
10
  import {
10
11
  PropertyRow
11
12
  } from "./chunk-DQQOZB3E.js";
12
- import "./chunk-VDHOYF7Z.js";
13
13
  import "./chunk-G2ADBYYC.js";
14
14
  export {
15
15
  PropertyRow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-dfw",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "A React Native component library for the Digital Field Worker applications.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,64 +0,0 @@
1
- import {
2
- formatDate
3
- } from "./chunk-JFOLVFFO.js";
4
- import {
5
- PropertyRow
6
- } from "./chunk-DQQOZB3E.js";
7
-
8
- // src/dfwcomponents/WorkOrderCell/PropertyList.tsx
9
- import React from "react";
10
- var workOrderLabelMap = {
11
- title: "Title",
12
- maintenanceType: "Maintenance type",
13
- functionalLocation: "Functional Location",
14
- equipment: "Equipment",
15
- activeStatus: "Active status",
16
- basicStartDate: "Basic start",
17
- basicFinishDate: "Basic finish",
18
- requiredEnd: "Required end",
19
- workCenter: "Work center"
20
- };
21
- var PropertyList = ({ data, valueColor }) => {
22
- const currentDate = /* @__PURE__ */ new Date();
23
- const requiredEnd = data.requiredEnd ? new Date(data.requiredEnd) : null;
24
- const combinedDates = data.basicStartDate && data.basicFinishDate ? `${formatDate(data.basicStartDate)} - ${formatDate(data.basicFinishDate)}` : null;
25
- const getLabel = (key) => {
26
- if (key === "basicStartDate" && combinedDates) {
27
- return "Basic start / finish";
28
- }
29
- return workOrderLabelMap[key];
30
- };
31
- const getDisplayValue = (key, value) => {
32
- if (key === "basicStartDate" && combinedDates) {
33
- return combinedDates;
34
- }
35
- if (["basicStartDate", "basicFinishDate", "requiredEnd"].includes(key)) {
36
- return value ? formatDate(value) : "";
37
- }
38
- return value;
39
- };
40
- return /* @__PURE__ */ React.createElement(React.Fragment, null, Object.entries(data).map(([key, value], index) => {
41
- const typedKey = key;
42
- if (combinedDates && typedKey === "basicFinishDate")
43
- return null;
44
- if (value || typedKey === "basicStartDate" && combinedDates) {
45
- const label = getLabel(typedKey);
46
- const displayValue = getDisplayValue(typedKey, value);
47
- const textColor = typedKey === "requiredEnd" && requiredEnd && currentDate > requiredEnd ? "danger" : valueColor;
48
- return label && /* @__PURE__ */ React.createElement(
49
- PropertyRow,
50
- {
51
- key: index,
52
- label,
53
- value: displayValue != null ? displayValue : "",
54
- textColor
55
- }
56
- );
57
- }
58
- return null;
59
- }));
60
- };
61
-
62
- export {
63
- PropertyList
64
- };
@@ -1,92 +0,0 @@
1
- import {
2
- PropertyList
3
- } from "./chunk-AIIMQRJ6.js";
4
- import {
5
- getStatusIconsAndLabels
6
- } from "./chunk-JFOLVFFO.js";
7
- import {
8
- PropertyRow
9
- } from "./chunk-DQQOZB3E.js";
10
- import {
11
- StatusIcon
12
- } from "./chunk-VDHOYF7Z.js";
13
- import {
14
- __objRest,
15
- __spreadProps,
16
- __spreadValues
17
- } from "./chunk-G2ADBYYC.js";
18
-
19
- // src/dfwcomponents/WorkOrderCell/WorkOrderCellNavigation.tsx
20
- import { Cell, EDSStyleSheet, Icon, Typography, useStyles } from "@equinor/mad-components";
21
- import React, { useMemo } from "react";
22
- import { View } from "react-native";
23
- var WorkOrderCellNavigation = (_a) => {
24
- var _b = _a, {
25
- title,
26
- workOrderId,
27
- workOrderType,
28
- maintenanceType,
29
- valueColor = "textTertiary",
30
- isHseCritical,
31
- isProductionCritical,
32
- showSymbols = true,
33
- onPress,
34
- style
35
- } = _b, rest = __objRest(_b, [
36
- "title",
37
- "workOrderId",
38
- "workOrderType",
39
- "maintenanceType",
40
- "valueColor",
41
- "isHseCritical",
42
- "isProductionCritical",
43
- "showSymbols",
44
- "onPress",
45
- "style"
46
- ]);
47
- const styles = useStyles(themeStyles);
48
- const currentDate = useMemo(() => /* @__PURE__ */ new Date(), []);
49
- const iconsAndLabels = useMemo(
50
- () => {
51
- var _a2;
52
- return getStatusIconsAndLabels(
53
- rest.activeStatus,
54
- (_a2 = rest.requiredEnd) != null ? _a2 : null,
55
- currentDate,
56
- isHseCritical,
57
- isProductionCritical
58
- );
59
- },
60
- [rest.activeStatus, rest.requiredEnd, currentDate, isHseCritical, isProductionCritical]
61
- );
62
- 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), /* @__PURE__ */ React.createElement(View, { style: styles.dataContainer }, maintenanceType && /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short", color: "textTertiary" }, maintenanceType), /* @__PURE__ */ React.createElement(PropertyRow, { label: workOrderType, value: workOrderId }), /* @__PURE__ */ React.createElement(PropertyList, { data: rest, valueColor }))), 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" })));
63
- };
64
- var themeStyles = EDSStyleSheet.create((theme) => ({
65
- container: {
66
- flexDirection: "row",
67
- justifyContent: "space-between",
68
- alignItems: "center"
69
- },
70
- contentContainer: {
71
- flex: 1,
72
- flexDirection: "column"
73
- },
74
- title: {
75
- marginBottom: theme.spacing.container.paddingVertical
76
- },
77
- dataContainer: {
78
- gap: theme.spacing.cell.group.titleBottomPadding
79
- },
80
- iconListContainer: {
81
- position: "absolute",
82
- top: 0,
83
- right: 0,
84
- flexDirection: "row",
85
- alignItems: "center",
86
- gap: theme.spacing.spacer.small
87
- }
88
- }));
89
-
90
- export {
91
- WorkOrderCellNavigation
92
- };
@@ -1,9 +0,0 @@
1
- import { Color } from "@equinor/mad-components";
2
- import React from "react";
3
- import { WorkOrder } from "./types";
4
- type PropertyListProps = {
5
- data: Partial<WorkOrder>;
6
- valueColor: Color;
7
- };
8
- export declare const PropertyList: ({ data, valueColor }: PropertyListProps) => React.JSX.Element;
9
- export {};