@equinor/mad-dfw 0.0.3 → 0.0.5
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 +20 -0
- package/dist/chunk-BJHNY6HU.js +171 -0
- package/dist/{chunk-JLN4BW2C.js → chunk-KROUGXV5.js} +1 -0
- package/dist/chunk-RW7P2LMK.js +0 -0
- package/dist/dfwcomponents/PropertyRow/PropertyRow.js +1 -1
- package/dist/dfwcomponents/PropertyRow/index.js +1 -1
- package/dist/dfwcomponents/WorkOrderCell/WorkOrderCell.d.ts +19 -0
- package/dist/dfwcomponents/WorkOrderCell/WorkOrderCell.js +8 -0
- package/dist/dfwcomponents/WorkOrderCell/index.d.ts +1 -0
- package/dist/dfwcomponents/WorkOrderCell/index.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @equinor/mad-dfw
|
|
2
2
|
|
|
3
|
+
## 0.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 46401e7: Add truhyness check to `PropertyRow` render function to avoid rendering rows with empty
|
|
8
|
+
values.
|
|
9
|
+
- Updated dependencies [e43285f]
|
|
10
|
+
- Updated dependencies [79fb731]
|
|
11
|
+
- Updated dependencies [37025ac]
|
|
12
|
+
- @equinor/mad-components@0.12.0
|
|
13
|
+
|
|
14
|
+
## 0.0.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 15c1410: Added `WorkOrderCell` component.
|
|
19
|
+
- Updated dependencies [8adb0dc]
|
|
20
|
+
- Updated dependencies [496cd9a]
|
|
21
|
+
- @equinor/mad-components@0.11.3
|
|
22
|
+
|
|
3
23
|
## 0.0.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PropertyRow,
|
|
3
|
+
__objRest
|
|
4
|
+
} from "./chunk-KROUGXV5.js";
|
|
5
|
+
|
|
6
|
+
// src/dfwcomponents/WorkOrderCell/WorkOrderCell.tsx
|
|
7
|
+
import React, { useMemo } from "react";
|
|
8
|
+
import { View } from "react-native";
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
Cell,
|
|
12
|
+
Icon,
|
|
13
|
+
Label,
|
|
14
|
+
Typography,
|
|
15
|
+
useStyles,
|
|
16
|
+
EDSStyleSheet
|
|
17
|
+
} from "@equinor/mad-components";
|
|
18
|
+
var WorkOrderLabelMap = {
|
|
19
|
+
title: "Title",
|
|
20
|
+
workOrderId: "Work Order ID",
|
|
21
|
+
maintenanceType: "Maintenance Type",
|
|
22
|
+
tagId: "Tag ID",
|
|
23
|
+
equipmentId: "Equipment ID",
|
|
24
|
+
activeStatusIds: "Active Status IDs",
|
|
25
|
+
basicStartDate: "Basic Start Date",
|
|
26
|
+
basicEndDate: "Basic End Date",
|
|
27
|
+
workCenterId: "Work Center ID"
|
|
28
|
+
};
|
|
29
|
+
var getStatusIconConfig = (status) => {
|
|
30
|
+
switch (status) {
|
|
31
|
+
case "RDEX":
|
|
32
|
+
return {
|
|
33
|
+
icon: "circle-outline",
|
|
34
|
+
label: "Ready for execution",
|
|
35
|
+
textColor: "textTertiary",
|
|
36
|
+
iconColor: "textPrimary"
|
|
37
|
+
};
|
|
38
|
+
case "STRT":
|
|
39
|
+
return {
|
|
40
|
+
icon: "circle-half-full",
|
|
41
|
+
label: "Started",
|
|
42
|
+
textColor: "textTertiary",
|
|
43
|
+
iconColor: "textPrimary"
|
|
44
|
+
};
|
|
45
|
+
case "RDOP":
|
|
46
|
+
return {
|
|
47
|
+
icon: "circle",
|
|
48
|
+
label: "Ready for operation",
|
|
49
|
+
textColor: "textTertiary",
|
|
50
|
+
iconColor: "textPrimary"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return void 0;
|
|
54
|
+
};
|
|
55
|
+
var WorkOrderCell = (_a) => {
|
|
56
|
+
var _b = _a, {
|
|
57
|
+
title,
|
|
58
|
+
maintenanceType,
|
|
59
|
+
onStartButtonPress,
|
|
60
|
+
onCompleteButtonPress,
|
|
61
|
+
onPress,
|
|
62
|
+
showSymbols
|
|
63
|
+
} = _b, rest = __objRest(_b, [
|
|
64
|
+
"title",
|
|
65
|
+
"maintenanceType",
|
|
66
|
+
"onStartButtonPress",
|
|
67
|
+
"onCompleteButtonPress",
|
|
68
|
+
"onPress",
|
|
69
|
+
"showSymbols"
|
|
70
|
+
]);
|
|
71
|
+
var _a2;
|
|
72
|
+
const styles = useStyles(themeStyles);
|
|
73
|
+
const activeStatuses = (_a2 = rest.activeStatusIds) == null ? void 0 : _a2.split(" ");
|
|
74
|
+
const iconsAndLabels = useMemo(() => {
|
|
75
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
76
|
+
const endDate = rest.basicEndDate ? new Date(rest.basicEndDate) : null;
|
|
77
|
+
const result = [];
|
|
78
|
+
if (endDate && currentDate > endDate) {
|
|
79
|
+
result.push({
|
|
80
|
+
icon: "alarm",
|
|
81
|
+
label: "Required end overdue",
|
|
82
|
+
textColor: "textTertiary",
|
|
83
|
+
iconColor: "danger"
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
activeStatuses == null ? void 0 : activeStatuses.forEach((status) => {
|
|
87
|
+
const statusConfig = getStatusIconConfig(status);
|
|
88
|
+
if (statusConfig) {
|
|
89
|
+
result.push(statusConfig);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
}, [activeStatuses, rest.basicEndDate]);
|
|
94
|
+
const isStartDisabled = !!(activeStatuses == null ? void 0 : activeStatuses.includes("STRT")) || !!(activeStatuses == null ? void 0 : activeStatuses.includes("RDOP"));
|
|
95
|
+
const isCompleteDisabled = !(activeStatuses == null ? void 0 : activeStatuses.includes("STRT")) || (activeStatuses == null ? void 0 : activeStatuses.includes("RDOP"));
|
|
96
|
+
return /* @__PURE__ */ React.createElement(
|
|
97
|
+
Cell,
|
|
98
|
+
{
|
|
99
|
+
onPress: onPress ? onPress : void 0,
|
|
100
|
+
rightAdornment: onPress ? /* @__PURE__ */ React.createElement(View, { style: { justifyContent: "center" } }, /* @__PURE__ */ React.createElement(Icon, { name: "chevron-right" })) : null
|
|
101
|
+
},
|
|
102
|
+
/* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }, /* @__PURE__ */ React.createElement(Typography, { numberOfLines: 1, variant: "h5", bold: true, style: { marginBottom: 16 } }, title), showSymbols && (iconsAndLabels == null ? void 0 : iconsAndLabels.map((item, index) => /* @__PURE__ */ React.createElement(View, { key: index, style: styles.iconContainer }, /* @__PURE__ */ React.createElement(Icon, { name: item.icon, size: 24, color: item.iconColor }), /* @__PURE__ */ React.createElement(
|
|
103
|
+
Typography,
|
|
104
|
+
{
|
|
105
|
+
numberOfLines: 1,
|
|
106
|
+
group: "paragraph",
|
|
107
|
+
variant: "caption",
|
|
108
|
+
color: item.textColor
|
|
109
|
+
},
|
|
110
|
+
item.label
|
|
111
|
+
)))), /* @__PURE__ */ React.createElement(Label, { label: maintenanceType, style: { marginBottom: 8 } }), Object.entries(rest).map(([key, value], index) => {
|
|
112
|
+
if (value) {
|
|
113
|
+
const label = WorkOrderLabelMap[key];
|
|
114
|
+
let displayValue = value;
|
|
115
|
+
if (key === "basicStartDate" || key === "basicEndDate") {
|
|
116
|
+
displayValue = value ? new Date(value).toLocaleDateString() : "";
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ React.createElement(
|
|
119
|
+
PropertyRow,
|
|
120
|
+
{
|
|
121
|
+
key: index,
|
|
122
|
+
label,
|
|
123
|
+
value: displayValue,
|
|
124
|
+
style: { marginBottom: 8 }
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}), (!!onStartButtonPress || !!onCompleteButtonPress) && /* @__PURE__ */ React.createElement(
|
|
130
|
+
View,
|
|
131
|
+
{
|
|
132
|
+
style: {
|
|
133
|
+
gap: 16,
|
|
134
|
+
flexDirection: "row",
|
|
135
|
+
justifyContent: "center",
|
|
136
|
+
marginTop: 22
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
onStartButtonPress && /* @__PURE__ */ React.createElement(
|
|
140
|
+
Button,
|
|
141
|
+
{
|
|
142
|
+
title: "Start",
|
|
143
|
+
onPress: onStartButtonPress,
|
|
144
|
+
variant: "outlined",
|
|
145
|
+
disabled: isStartDisabled
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
onCompleteButtonPress && /* @__PURE__ */ React.createElement(
|
|
149
|
+
Button,
|
|
150
|
+
{
|
|
151
|
+
title: "Complete",
|
|
152
|
+
onPress: onCompleteButtonPress,
|
|
153
|
+
variant: "outlined",
|
|
154
|
+
disabled: isCompleteDisabled
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
))
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
var themeStyles = EDSStyleSheet.create(() => ({
|
|
161
|
+
iconContainer: {
|
|
162
|
+
flexDirection: "row",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
gap: 8,
|
|
165
|
+
marginBottom: 8
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
WorkOrderCell
|
|
171
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type WorkOrder = {
|
|
3
|
+
title: string;
|
|
4
|
+
workOrderId: string;
|
|
5
|
+
maintenanceType?: string;
|
|
6
|
+
tagId?: string;
|
|
7
|
+
equipmentId?: string;
|
|
8
|
+
activeStatusIds?: string;
|
|
9
|
+
basicStartDate?: string;
|
|
10
|
+
basicEndDate?: string;
|
|
11
|
+
workCenterId?: string;
|
|
12
|
+
};
|
|
13
|
+
export type WorkOrderCellProps = {
|
|
14
|
+
onStartButtonPress?: () => void;
|
|
15
|
+
onCompleteButtonPress?: () => void;
|
|
16
|
+
onPress?: () => void;
|
|
17
|
+
showSymbols?: boolean;
|
|
18
|
+
} & WorkOrder;
|
|
19
|
+
export declare const WorkOrderCell: ({ title, maintenanceType, onStartButtonPress, onCompleteButtonPress, onPress, showSymbols, ...rest }: WorkOrderCellProps) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WorkOrderCell";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import "./chunk-RW7P2LMK.js";
|
|
2
|
+
import {
|
|
3
|
+
WorkOrderCell
|
|
4
|
+
} from "./chunk-BJHNY6HU.js";
|
|
1
5
|
import "./chunk-2JQRYR7Z.js";
|
|
2
6
|
import {
|
|
3
7
|
PropertyRow
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KROUGXV5.js";
|
|
5
9
|
export {
|
|
6
|
-
PropertyRow
|
|
10
|
+
PropertyRow,
|
|
11
|
+
WorkOrderCell
|
|
7
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/mad-dfw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A React Native component library for the Digital Field Worker applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-native": ">=0.70"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@equinor/mad-components": "0.
|
|
30
|
+
"@equinor/mad-components": "0.12.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@equinor/eslint-config-mad": "0.3.1"
|