@equinor/mad-dfw 0.4.0 → 0.5.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,32 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c3cd036: - Introduced `tagPlantId` field on `WorkOrder` type.
8
+
9
+ - Expanded the allowed props on the `WorkOrderCell` to accept all non-child view props in
10
+ addition to its fundamental props.
11
+
12
+ **Breaking changes:**
13
+
14
+ - Moved all work order related data into the `workOrder` prop of the cell
15
+ - Renamed `requiredEnd` to `requiredEndDate`
16
+ - Renamed `workCenter` to `workCenterId`
17
+ - Renamed `functionalLocation` to `tagId`
18
+ - Renamed `basicFinishDate` to `basicEndDate`
19
+ - Renamed `equipment` to `equipmentId`
20
+ - Renamed `activeStatus` to `activeStatusIds`
21
+ - Removed the `overwriteLabel` prop on `WorkOrderCellProps`
22
+
23
+ ## 0.4.1
24
+
25
+ ### Patch Changes
26
+
27
+ - 93cd63d: Added new value to the `WorkOrderType`. Prevent excess padding when the
28
+ `maintenanceType` is not being used.
29
+
3
30
  ## 0.4.0
4
31
 
5
32
  ### Minor Changes
@@ -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-FKFMMXFT.js";
7
+ import {
8
+ getStatusIconsAndLabels
9
+ } from "./chunk-GNURJIGB.js";
13
10
  import {
14
11
  __objRest,
15
12
  __spreadValues
@@ -29,52 +26,33 @@ 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
44
34
  } = _b, rest = __objRest(_b, [
45
- "title",
46
- "workOrderId",
47
- "workOrderType",
48
- "maintenanceType",
49
35
  "showSymbols",
50
- "valueColor",
51
- "isHseCritical",
52
- "isProductionCritical",
53
- "style",
54
36
  "startJobButton",
55
37
  "readyForOperationButton",
56
- "tecoButton"
38
+ "tecoButton",
39
+ "workOrder"
57
40
  ]);
58
41
  var _a2, _b2;
59
42
  const breakpoint = useBreakpoint();
60
43
  const token = useToken();
61
44
  const styles = useStyles(themeStyles);
62
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;
63
- const currentDate = useMemo(() => /* @__PURE__ */ new Date(), []);
64
46
  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]
47
+ () => getStatusIconsAndLabels(
48
+ workOrder.activeStatusIds,
49
+ workOrder.requiredEndDate,
50
+ workOrder.isHseCritical,
51
+ workOrder.isProductionCritical
52
+ ),
53
+ [workOrder]
76
54
  );
77
- return /* @__PURE__ */ React.createElement(Cell, { style }, /* @__PURE__ */ React.createElement(
55
+ return /* @__PURE__ */ React.createElement(Cell, __spreadValues({}, rest), /* @__PURE__ */ React.createElement(
78
56
  Typography,
79
57
  {
80
58
  numberOfLines: 1,
@@ -82,8 +60,8 @@ var WorkOrderCell = (_a) => {
82
60
  bold: true,
83
61
  style: !showSymbols && { paddingBottom: token.spacing.container.paddingVertical }
84
62
  },
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 }, /* @__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(
63
+ 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(
87
65
  View,
88
66
  {
89
67
  style: [
@@ -0,0 +1,87 @@
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: "Functional Location",
18
+ value: (wo) => `${wo.tagPlantId}-${wo.tagId}`,
19
+ condition: (wo) => !!wo.tagId && !!wo.tagPlantId
20
+ },
21
+ {
22
+ label: "Tag",
23
+ value: (wo) => wo.tagId,
24
+ condition: (wo) => !!wo.tagId && !wo.tagPlantId
25
+ },
26
+ {
27
+ label: "Equipment",
28
+ value: (wo) => wo.equipmentId,
29
+ condition: (wo) => !!wo.equipmentId
30
+ },
31
+ {
32
+ label: "Active statuses",
33
+ value: (wo) => wo.activeStatusIds,
34
+ condition: (wo) => !!wo.activeStatusIds
35
+ },
36
+ {
37
+ label: "Basic start / finish",
38
+ value: (wo) => `${formatDate(wo.basicStartDate)} - ${formatDate(wo.basicEndDate)}`,
39
+ condition: (wo) => !!wo.basicStartDate && !!wo.basicEndDate
40
+ },
41
+ {
42
+ label: "Basic start",
43
+ value: (wo) => formatDate(wo.basicStartDate),
44
+ condition: (wo) => !!wo.basicStartDate && !wo.basicEndDate
45
+ },
46
+ {
47
+ label: "Basic finish",
48
+ value: (wo) => formatDate(wo.basicEndDate),
49
+ condition: (wo) => !!wo.basicEndDate && !wo.basicStartDate
50
+ },
51
+ {
52
+ label: "Required end",
53
+ value: (wo) => formatDate(wo.requiredEndDate),
54
+ color: (wo) => /* @__PURE__ */ new Date() > new Date(wo.requiredEndDate) ? "danger" : "textTertiary",
55
+ condition: (wo) => !!wo.requiredEndDate
56
+ },
57
+ {
58
+ label: "Work center",
59
+ value: (wo) => {
60
+ var _a;
61
+ return (_a = wo.workCenterId) != null ? _a : "";
62
+ },
63
+ condition: (wo) => !!wo.workCenterId
64
+ }
65
+ ];
66
+ var WorkOrderPropertyList = ({ workOrder }) => {
67
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, propertyRowConfig.map((item) => {
68
+ const label = typeof item.label === "function" ? item.label(workOrder) : item.label;
69
+ const value = typeof item.value === "function" ? item.value(workOrder) : item.value;
70
+ const textColor = typeof item.color === "function" ? item.color(workOrder) : item.color;
71
+ if (!item.condition(workOrder))
72
+ return null;
73
+ return /* @__PURE__ */ React.createElement(
74
+ PropertyRow,
75
+ {
76
+ key: `${label}-${value}`,
77
+ label,
78
+ value,
79
+ textColor
80
+ }
81
+ );
82
+ }));
83
+ };
84
+
85
+ export {
86
+ WorkOrderPropertyList
87
+ };
@@ -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",
@@ -0,0 +1,70 @@
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
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-7GAHGZHM.js";
3
+ } from "./chunk-75HKHWRT.js";
4
4
  import {
5
5
  WorkOrderCellNavigation
6
- } from "./chunk-JVF34AIF.js";
6
+ } from "./chunk-VHEWDAGI.js";
7
7
 
8
8
  // src/dfwcomponents/WorkOrderCell/index.ts
9
9
  var WorkOrderCell2 = WorkOrderCell;
@@ -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, ...rest }: WorkOrderCellProps) => React.JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-7GAHGZHM.js";
4
- import "../../chunk-AIIMQRJ6.js";
5
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-75HKHWRT.js";
4
+ import "../../chunk-VDHOYF7Z.js";
5
+ import "../../chunk-FKFMMXFT.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
@@ -3,5 +3,5 @@ import { WorkOrderCellProps } from "./types";
3
3
  type WorkOrderCellNavigationProps = WorkOrderCellProps & {
4
4
  onPress: () => void;
5
5
  };
6
- export declare const WorkOrderCellNavigation: ({ title, workOrderId, workOrderType, maintenanceType, valueColor, isHseCritical, isProductionCritical, showSymbols, onPress, style, ...rest }: WorkOrderCellNavigationProps) => React.JSX.Element;
6
+ export declare const WorkOrderCellNavigation: ({ showSymbols, onPress, workOrder, ...rest }: WorkOrderCellNavigationProps) => React.JSX.Element;
7
7
  export {};
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCellNavigation
3
- } from "../../chunk-JVF34AIF.js";
4
- import "../../chunk-AIIMQRJ6.js";
5
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-VHEWDAGI.js";
4
+ import "../../chunk-VDHOYF7Z.js";
5
+ import "../../chunk-FKFMMXFT.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,7 @@
1
+ import React from "react";
2
+ import { WorkOrder } from "./types";
3
+ type WorkOrderPropertyListProps = {
4
+ workOrder: WorkOrder;
5
+ };
6
+ export declare const WorkOrderPropertyList: ({ workOrder }: WorkOrderPropertyListProps) => React.JSX.Element;
7
+ 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-FKFMMXFT.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-T4WZHG2X.js";
4
- import "../../chunk-7GAHGZHM.js";
5
- import "../../chunk-JVF34AIF.js";
6
- import "../../chunk-AIIMQRJ6.js";
7
- import "../../chunk-JFOLVFFO.js";
3
+ } from "../../chunk-VULSI4WO.js";
4
+ import "../../chunk-75HKHWRT.js";
5
+ import "../../chunk-VHEWDAGI.js";
6
+ import "../../chunk-VDHOYF7Z.js";
7
+ import "../../chunk-FKFMMXFT.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,21 @@
1
1
  import { Color, IconName } from "@equinor/mad-components";
2
2
  import { ViewProps } from "react-native";
3
- export type WorkOrderType = "PM01" | "PM02" | "PM03" | "PM04" | "PM05" | "PM06" | "PM10" | "PM15" | "PM20";
3
+ export type WorkOrderType = "PM01" | "PM02" | "PM03" | "PM04" | "PM05" | "PM06" | "PM10" | "PM15" | "PM20" | "unknown";
4
4
  export type WorkOrder = {
5
5
  workOrderId: string;
6
6
  workOrderType: WorkOrderType;
7
7
  title: string;
8
8
  maintenanceType?: string;
9
- equipment?: string;
10
- activeStatus?: string;
9
+ tagId?: string;
10
+ tagPlantId?: string;
11
+ equipmentId?: string;
12
+ activeStatusIds?: string;
11
13
  basicStartDate?: string;
12
- basicFinishDate?: string;
13
- requiredEnd?: string;
14
- workCenter?: string;
15
- functionalLocation?: string;
14
+ basicEndDate?: string;
15
+ requiredEndDate?: string;
16
+ workCenterId?: string;
17
+ isHseCritical?: boolean;
18
+ isProductionCritical?: boolean;
16
19
  };
17
20
  type ButtonOptions = {
18
21
  disabled?: boolean;
@@ -21,18 +24,27 @@ type ButtonOptions = {
21
24
  onPress: () => void;
22
25
  };
23
26
  export type WorkOrderCellProps = {
24
- workOrderId: string;
25
- workOrderType: WorkOrderType;
27
+ /**
28
+ * Boolean value indicating whether or not the work order cell should display statuses as icons.
29
+ */
26
30
  showSymbols?: boolean;
27
- valueColor?: Color;
28
- isHseCritical?: boolean;
29
- isProductionCritical?: boolean;
30
- style?: ViewProps["style"];
31
- overwriteLabel?: Partial<Record<keyof WorkOrder, string>>;
31
+ /**
32
+ * Button configuration for the start job button.
33
+ */
32
34
  startJobButton?: ButtonOptions;
35
+ /**
36
+ * Button configuration for the ready for operation button.
37
+ */
33
38
  readyForOperationButton?: ButtonOptions;
39
+ /**
40
+ * Button configuration for the complete button.
41
+ */
34
42
  tecoButton?: ButtonOptions;
35
- } & WorkOrder;
43
+ /**
44
+ * Work order data to display in the cell.
45
+ */
46
+ workOrder: WorkOrder;
47
+ } & Omit<ViewProps, "children">;
36
48
  export type StatusConfig = {
37
49
  icon: IconName;
38
50
  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-T4WZHG2X.js";
4
- import "./chunk-7GAHGZHM.js";
5
- import "./chunk-JVF34AIF.js";
6
- import "./chunk-AIIMQRJ6.js";
7
- import "./chunk-JFOLVFFO.js";
3
+ } from "./chunk-VULSI4WO.js";
4
+ import "./chunk-75HKHWRT.js";
5
+ import "./chunk-VHEWDAGI.js";
6
+ import "./chunk-VDHOYF7Z.js";
7
+ import "./chunk-FKFMMXFT.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.0",
3
+ "version": "0.5.0",
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 }, /* @__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 {};