@equinor/mad-dfw 0.5.2 → 0.5.3

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,13 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f73c165: Make the text values in the `WorkOrderCell` component selectable
8
+ - f73c165: Fixed validation for when the `not started` icon should be visible in the
9
+ `WorkOrderCell` component
10
+
3
11
  ## 0.5.2
4
12
 
5
13
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatDate
3
- } from "./chunk-GNURJIGB.js";
3
+ } from "./chunk-SJFZ7LJV.js";
4
4
  import {
5
5
  PropertyRow
6
6
  } from "./chunk-DQQOZB3E.js";
@@ -79,10 +79,19 @@ var WorkOrderPropertyList = ({
79
79
  key: `${label}-${value}`,
80
80
  label,
81
81
  value,
82
- textColor
82
+ textColor,
83
+ selectable: true
83
84
  }
84
85
  );
85
- }), additionalPropertyRows.map((item, index) => /* @__PURE__ */ React.createElement(PropertyRow, { key: `additional-${index}`, label: item.label, value: item.value })));
86
+ }), additionalPropertyRows.map((item, index) => /* @__PURE__ */ React.createElement(
87
+ PropertyRow,
88
+ {
89
+ key: `additional-${index}`,
90
+ label: item.label,
91
+ value: item.value,
92
+ selectable: true
93
+ }
94
+ )));
86
95
  };
87
96
 
88
97
  export {
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-VDHOYF7Z.js";
4
4
  import {
5
5
  WorkOrderPropertyList
6
- } from "./chunk-4G4367DY.js";
6
+ } from "./chunk-36WMXUZG.js";
7
7
  import {
8
8
  getStatusIconsAndLabels
9
- } from "./chunk-GNURJIGB.js";
9
+ } from "./chunk-SJFZ7LJV.js";
10
10
  import {
11
11
  __objRest,
12
12
  __spreadValues
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-VDHOYF7Z.js";
4
4
  import {
5
5
  WorkOrderPropertyList
6
- } from "./chunk-4G4367DY.js";
6
+ } from "./chunk-36WMXUZG.js";
7
7
  import {
8
8
  getStatusIconsAndLabels
9
- } from "./chunk-GNURJIGB.js";
9
+ } from "./chunk-SJFZ7LJV.js";
10
10
  import {
11
11
  __objRest,
12
12
  __spreadProps,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-EVCZ3YPL.js";
3
+ } from "./chunk-5EFVKCUB.js";
4
4
  import {
5
5
  WorkOrderCellNavigation
6
- } from "./chunk-6P3AA5FM.js";
6
+ } from "./chunk-KBFX3MNW.js";
7
7
 
8
8
  // src/dfwcomponents/WorkOrderCell/index.ts
9
9
  var WorkOrderCell2 = WorkOrderCell;
@@ -0,0 +1,74 @@
1
+ // src/dfwcomponents/WorkOrderCell/utils.ts
2
+ var getStatusIconConfig = (status) => {
3
+ const statusMap = {
4
+ notStarted: {
5
+ icon: "circle-outline",
6
+ label: "Not started",
7
+ textColor: "textTertiary",
8
+ iconColor: "textPrimary"
9
+ },
10
+ started: {
11
+ icon: "circle-half-full",
12
+ label: "Started",
13
+ textColor: "textTertiary",
14
+ iconColor: "textPrimary"
15
+ },
16
+ finished: {
17
+ icon: "circle",
18
+ label: "Finished",
19
+ textColor: "textTertiary",
20
+ iconColor: "textPrimary"
21
+ },
22
+ requiredEndOverdue: {
23
+ icon: "alarm",
24
+ label: "Required end overdue",
25
+ textColor: "textTertiary",
26
+ iconColor: "danger"
27
+ },
28
+ hseCritical: {
29
+ icon: "alert-outline",
30
+ label: "HSE critical",
31
+ textColor: "textTertiary",
32
+ iconColor: "danger"
33
+ },
34
+ productionCritical: {
35
+ icon: "water-outline",
36
+ label: "Production critical",
37
+ textColor: "textTertiary",
38
+ iconColor: "danger"
39
+ }
40
+ };
41
+ return statusMap[status];
42
+ };
43
+ var getStatusIconsAndLabels = (activeStatusIds, requiredEndDate, hseCritical, productionCritical) => {
44
+ var _a;
45
+ const today = /* @__PURE__ */ new Date();
46
+ const iconsAndLabels = [];
47
+ const activeStatuses = (_a = activeStatusIds == null ? void 0 : activeStatusIds.split(" ")) != null ? _a : [];
48
+ if (requiredEndDate && today > new Date(requiredEndDate)) {
49
+ iconsAndLabels.push(getStatusIconConfig("requiredEndOverdue"));
50
+ }
51
+ if (hseCritical) {
52
+ iconsAndLabels.push(getStatusIconConfig("hseCritical"));
53
+ }
54
+ if (productionCritical) {
55
+ iconsAndLabels.push(getStatusIconConfig("productionCritical"));
56
+ }
57
+ if (activeStatuses.includes("RDOP") || activeStatuses.includes("TECO")) {
58
+ iconsAndLabels.push(getStatusIconConfig("finished"));
59
+ } else if (activeStatuses.includes("STRT")) {
60
+ iconsAndLabels.push(getStatusIconConfig("started"));
61
+ } else {
62
+ iconsAndLabels.push(getStatusIconConfig("notStarted"));
63
+ }
64
+ return iconsAndLabels;
65
+ };
66
+ var formatDate = (dateString) => {
67
+ const date = new Date(dateString);
68
+ return date.toLocaleDateString("en-GB").replace(/\//g, ".");
69
+ };
70
+
71
+ export {
72
+ getStatusIconsAndLabels,
73
+ formatDate
74
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-EVCZ3YPL.js";
3
+ } from "../../chunk-5EFVKCUB.js";
4
4
  import "../../chunk-VDHOYF7Z.js";
5
- import "../../chunk-4G4367DY.js";
6
- import "../../chunk-GNURJIGB.js";
5
+ import "../../chunk-36WMXUZG.js";
6
+ import "../../chunk-SJFZ7LJV.js";
7
7
  import "../../chunk-2JQRYR7Z.js";
8
8
  import "../../chunk-DQQOZB3E.js";
9
9
  import "../../chunk-G2ADBYYC.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WorkOrderCellNavigation
3
- } from "../../chunk-6P3AA5FM.js";
3
+ } from "../../chunk-KBFX3MNW.js";
4
4
  import "../../chunk-VDHOYF7Z.js";
5
- import "../../chunk-4G4367DY.js";
6
- import "../../chunk-GNURJIGB.js";
5
+ import "../../chunk-36WMXUZG.js";
6
+ import "../../chunk-SJFZ7LJV.js";
7
7
  import "../../chunk-2JQRYR7Z.js";
8
8
  import "../../chunk-DQQOZB3E.js";
9
9
  import "../../chunk-G2ADBYYC.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WorkOrderPropertyList
3
- } from "../../chunk-4G4367DY.js";
4
- import "../../chunk-GNURJIGB.js";
3
+ } from "../../chunk-36WMXUZG.js";
4
+ import "../../chunk-SJFZ7LJV.js";
5
5
  import "../../chunk-2JQRYR7Z.js";
6
6
  import "../../chunk-DQQOZB3E.js";
7
7
  import "../../chunk-G2ADBYYC.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-EGOXZ76E.js";
4
- import "../../chunk-EVCZ3YPL.js";
5
- import "../../chunk-6P3AA5FM.js";
3
+ } from "../../chunk-KJHXRF5U.js";
4
+ import "../../chunk-5EFVKCUB.js";
5
+ import "../../chunk-KBFX3MNW.js";
6
6
  import "../../chunk-VDHOYF7Z.js";
7
- import "../../chunk-4G4367DY.js";
8
- import "../../chunk-GNURJIGB.js";
7
+ import "../../chunk-36WMXUZG.js";
8
+ import "../../chunk-SJFZ7LJV.js";
9
9
  import "../../chunk-2JQRYR7Z.js";
10
10
  import "../../chunk-DQQOZB3E.js";
11
11
  import "../../chunk-G2ADBYYC.js";
@@ -1,4 +1,3 @@
1
1
  import { StatusConfig } from "./types";
2
- export declare const getStatusIconConfig: (status: string) => StatusConfig | undefined;
3
2
  export declare const getStatusIconsAndLabels: (activeStatusIds?: string, requiredEndDate?: string, hseCritical?: boolean, productionCritical?: boolean) => StatusConfig[];
4
3
  export declare const formatDate: (dateString: string) => string;
@@ -1,11 +1,9 @@
1
1
  import {
2
2
  formatDate,
3
- getStatusIconConfig,
4
3
  getStatusIconsAndLabels
5
- } from "../../chunk-GNURJIGB.js";
4
+ } from "../../chunk-SJFZ7LJV.js";
6
5
  import "../../chunk-G2ADBYYC.js";
7
6
  export {
8
7
  formatDate,
9
- getStatusIconConfig,
10
8
  getStatusIconsAndLabels
11
9
  };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "./chunk-EGOXZ76E.js";
4
- import "./chunk-EVCZ3YPL.js";
5
- import "./chunk-6P3AA5FM.js";
3
+ } from "./chunk-KJHXRF5U.js";
4
+ import "./chunk-5EFVKCUB.js";
5
+ import "./chunk-KBFX3MNW.js";
6
6
  import "./chunk-VDHOYF7Z.js";
7
- import "./chunk-4G4367DY.js";
8
- import "./chunk-GNURJIGB.js";
7
+ import "./chunk-36WMXUZG.js";
8
+ import "./chunk-SJFZ7LJV.js";
9
9
  import "./chunk-2JQRYR7Z.js";
10
10
  import {
11
11
  PropertyRow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-dfw",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "A React Native component library for the Digital Field Worker applications.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,75 +0,0 @@
1
- // src/dfwcomponents/WorkOrderCell/utils.ts
2
- var getStatusIconConfig = (status) => {
3
- switch (status) {
4
- case "STRT":
5
- return {
6
- icon: "circle-half-full",
7
- label: "Started",
8
- textColor: "textTertiary",
9
- iconColor: "textPrimary"
10
- };
11
- case "RDOP":
12
- return {
13
- icon: "circle",
14
- label: "Ready for operation",
15
- textColor: "textTertiary",
16
- iconColor: "textPrimary"
17
- };
18
- }
19
- return void 0;
20
- };
21
- var getStatusIconsAndLabels = (activeStatusIds, requiredEndDate, hseCritical, productionCritical) => {
22
- const requiredEnd = requiredEndDate ? new Date(requiredEndDate) : null;
23
- const activeStatuses = activeStatusIds == null ? void 0 : activeStatusIds.split(" ");
24
- const today = /* @__PURE__ */ new Date();
25
- const iconsAndLabels = [];
26
- if (requiredEnd && today > requiredEnd) {
27
- iconsAndLabels.push({
28
- icon: "alarm",
29
- label: "Required end overdue",
30
- textColor: "textTertiary",
31
- iconColor: "danger"
32
- });
33
- }
34
- if (hseCritical) {
35
- iconsAndLabels.push({
36
- icon: "alert-outline",
37
- label: "HSE critical",
38
- textColor: "textTertiary",
39
- iconColor: "danger"
40
- });
41
- }
42
- if (productionCritical) {
43
- iconsAndLabels.push({
44
- icon: "water-outline",
45
- label: "Production critical",
46
- textColor: "textTertiary",
47
- iconColor: "danger"
48
- });
49
- }
50
- if (!(activeStatuses == null ? void 0 : activeStatuses.includes("STRT"))) {
51
- iconsAndLabels.push({
52
- icon: "circle-outline",
53
- label: "Not started",
54
- textColor: "textTertiary",
55
- iconColor: "textPrimary"
56
- });
57
- }
58
- activeStatuses == null ? void 0 : activeStatuses.forEach((status) => {
59
- const statusConfig = getStatusIconConfig(status);
60
- if (statusConfig) {
61
- iconsAndLabels.push(statusConfig);
62
- }
63
- });
64
- return iconsAndLabels;
65
- };
66
- var formatDate = (dateString) => {
67
- const date = new Date(dateString);
68
- return date.toLocaleDateString("en-GB").replace(/\//g, ".");
69
- };
70
-
71
- export {
72
- getStatusIconConfig,
73
- getStatusIconsAndLabels,
74
- formatDate
75
- };