datastake-daf 0.6.758 → 0.6.760

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.
Files changed (45) hide show
  1. package/dist/components/index.js +2355 -2056
  2. package/dist/constants/index.js +51 -1
  3. package/dist/layouts/index.js +476 -452
  4. package/dist/pages/index.js +881 -885
  5. package/dist/services/index.js +91 -0
  6. package/dist/utils/index.js +523 -456
  7. package/package.json +1 -1
  8. package/src/@daf/core/components/Dashboard/Map/Map.stories.js +8 -0
  9. package/src/@daf/core/components/Dashboard/Map/helper.js +134 -3
  10. package/src/@daf/core/components/Dashboard/Map/hook.js +4 -0
  11. package/src/@daf/core/components/Dashboard/Map/index.jsx +19 -0
  12. package/src/@daf/core/components/Dashboard/Map/storyConfig.js +2 -1
  13. package/src/@daf/core/components/Dashboard/Map/storyConfig6.js +69 -0
  14. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/config.js +2 -5
  15. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +1 -1
  16. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +1 -1
  17. package/src/@daf/core/components/Icon/configs/SpacingHeight.js +8 -0
  18. package/src/@daf/core/components/Icon/configs/SpacingWidth.js +8 -0
  19. package/src/@daf/core/components/Icon/configs/index.js +5 -1
  20. package/src/@daf/core/components/Screens/FindInformation/index.js +2 -1
  21. package/src/@daf/core/components/Screens/Users/columns.js +0 -6
  22. package/src/@daf/core/components/Table/NavigationAction/index.jsx +24 -0
  23. package/src/@daf/hooks/useMapHelper.js +15 -1
  24. package/src/@daf/pages/Documents/columns.js +5 -22
  25. package/src/@daf/pages/Events/Activities/columns.js +7 -59
  26. package/src/@daf/pages/Events/Incidents/columns.js +7 -61
  27. package/src/@daf/pages/Events/columns.js +6 -47
  28. package/src/@daf/pages/Events/helper.js +14 -0
  29. package/src/@daf/pages/Locations/MineSite/columns.js +1 -8
  30. package/src/@daf/pages/Locations/columns.js +6 -32
  31. package/src/@daf/pages/Partners/index.jsx +11 -0
  32. package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -8
  33. package/src/@daf/pages/Stakeholders/Workers/columns.js +10 -49
  34. package/src/@daf/pages/Stakeholders/columns.js +4 -25
  35. package/src/@daf/pages/Summary/Activities/Restoration/helper.js +133 -79
  36. package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +57 -60
  37. package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +0 -1
  38. package/src/@daf/services/PartnerService.js +76 -0
  39. package/src/@daf/utils/tags.js +26 -0
  40. package/src/@daf/utils/tooltip.js +5 -2
  41. package/src/constants/breadCrumbs.js +2 -0
  42. package/src/constants.js +2 -1
  43. package/src/index.js +1 -1
  44. package/src/services.js +2 -1
  45. package/src/utils.js +3 -1
@@ -1,57 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Tooltip, Tag } from 'antd';
3
- import { findOptions } from '../../../../helpers/StringHelper.js';
3
+ import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
5
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
6
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
- import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
15
-
16
- const getEventCategoryBySubject = (eventCategoryObject, subject) => {
17
- if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
18
- return null;
19
- }
20
-
21
- const subjectSingular = subject.endsWith('ies')
22
- ? subject.slice(0, -3) + 'y'
23
- : subject.endsWith('s')
24
- ? subject.slice(0, -1)
25
- : subject;
26
-
27
- const key = `typeOfEvent is ${subjectSingular}`;
28
- return eventCategoryObject[key] || null;
29
- };
30
-
31
- export const renderStatusTag = ({ value, t = (s) => s }) => {
32
- const width = 87;
33
-
34
- switch (value) {
35
- case "edited":
36
- return (
37
- <Tag color="yellow" style={{ width }} className="text-center">
38
- {t("Edited")}
39
- </Tag>
40
- );
41
- case "submitted":
42
- return (
43
- <Tag color="green" style={{ width }} className="text-center">
44
- {t("Submitted")}
45
- </Tag>
46
- );
47
- default:
48
- return (
49
- <Tag color="blue" style={{ width }} className="text-center">
50
- {t("Private")}
51
- </Tag>
52
- );
53
- }
54
- };
7
+ import { getEventCategoryBySubject } from '../helper.js';
8
+ import { renderStatusTag } from '../../../utils/tags.js';
9
+ import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
55
10
 
56
11
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
57
12
  {
@@ -209,23 +164,14 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
209
164
  return <div className="daf-default-cell" />;
210
165
  }
211
166
  const onClick = () => {
212
- const link = `/app/view/${subject}/${all.datastakeId}`;
167
+ let link = `/app/view/${subject}/${all.datastakeId}`;
213
168
  if (activeTab === "shared") {
214
169
  link += `?sourceId=${all?.authorId?.id}`;
215
170
  }
216
171
  goTo(getRedirectLink(link));
217
172
  };
218
- const moreMenuItems = [
219
- {
220
- label: t("Details"),
221
- value: "details",
222
- onClick: onClick,
223
- },
224
-
225
- ];
226
- return <div >
227
- <MoreMenu items={moreMenuItems} />
228
- </div>;
173
+
174
+ return <NavigationAction onClick={onClick} theme={theme} />;
229
175
  }
230
176
  }
231
177
  ].filter((column) => column.show !== false);
@@ -2,43 +2,11 @@ import React from 'react';
2
2
  import { Tooltip, Tag } from 'antd';
3
3
  import { findOptions } from '../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../helpers/Forms.js';
5
- import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
- // import CustomIcon from '../../core/components/';
7
5
  import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
8
6
  import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
9
7
  import MoreTags from '../../core/components/Table/MoreTags/index.jsx';
10
- import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
11
- const getLinkValue = (value, linkingObject) => {
12
- if (linkingObject && linkingObject?.[value]) {
13
- return linkingObject?.[value]?.name;
14
- }
15
- return null;
16
- }
17
-
18
- export const renderEventStatusTag = ({ value, t = (s) => s }) => {
19
- const width = 87;
20
-
21
- switch (value) {
22
- case "edited":
23
- return (
24
- <Tag color="orange" style={{ width }} className="text-center">
25
- {t("Edited")}
26
- </Tag>
27
- );
28
- case "submitted":
29
- return (
30
- <Tag color="green" style={{ width }} className="text-center">
31
- {t("Submitted")}
32
- </Tag>
33
- );
34
- default:
35
- return (
36
- <Tag color="blue" style={{ width }} className="text-center">
37
- {t("Private")}
38
- </Tag>
39
- );
40
- }
41
- };
8
+ import NavigationAction from '../../core/components/Table/NavigationAction/index.jsx';
9
+ import { renderStatusTag } from '../../utils/tags.js';
42
10
 
43
11
  export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications }) => [
44
12
  {
@@ -200,7 +168,7 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
200
168
  }
201
169
 
202
170
  const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
203
- return renderEventStatusTag({ value: _val, t });
171
+ return renderStatusTag({ value: _val, t });
204
172
  },
205
173
  ellipsis: true,
206
174
  },
@@ -227,23 +195,14 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
227
195
  return <div className="daf-default-cell" />;
228
196
  }
229
197
  const onClick = () => {
230
- const link = `/app/view/${subject}/${all.datastakeId}`;
198
+ let link = `/app/view/${subject}/${all.datastakeId}`;
231
199
  if (activeTab === "shared") {
232
200
  link += `?sourceId=${all?.authorId?.id}`;
233
201
  }
234
202
  goTo(getRedirectLink(link));
235
203
  };
236
- const moreMenuItems = [
237
- {
238
- label: t("Details"),
239
- value: "details",
240
- onClick: onClick,
241
- },
242
-
243
- ];
244
- return <div >
245
- <MoreMenu items={moreMenuItems} />
246
- </div>;
204
+
205
+ return <NavigationAction onClick={onClick} theme={theme} />;
247
206
  }
248
207
  }
249
208
  ].filter((column) => column.show !== false);
@@ -0,0 +1,14 @@
1
+ export const getEventCategoryBySubject = (eventCategoryObject, subject) => {
2
+ if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
3
+ return null;
4
+ }
5
+
6
+ const subjectSingular = subject.endsWith('ies')
7
+ ? subject.slice(0, -3) + 'y'
8
+ : subject.endsWith('s')
9
+ ? subject.slice(0, -1)
10
+ : subject;
11
+
12
+ const key = `typeOfEvent is ${subjectSingular}`;
13
+ return eventCategoryObject[key] || null;
14
+ };
@@ -1,19 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../helpers/StringHelper.js';
3
+ import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
  import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
9
 
10
- const getLinkValue = (value, linkingObject) => {
11
- if(linkingObject && linkingObject?.[value]) {
12
- return linkingObject?.[value]?.name;
13
- }
14
- return null;
15
- }
16
-
17
10
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
18
11
  {
19
12
  dataIndex: 'datastakeId',
@@ -1,17 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../helpers/StringHelper.js';
3
+ import { findOptions, getLinkValue } from '../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../helpers/Forms.js';
5
- import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
5
  import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
7
6
  import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
8
- import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
7
+ import NavigationAction from '../../core/components/Table/NavigationAction/index.jsx';
15
8
 
16
9
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
17
10
  {
@@ -139,35 +132,16 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
139
132
  if (all.empty) {
140
133
  return <div className="daf-default-cell" />;
141
134
  }
135
+
142
136
  const onClick = () => {
143
- const link = `/app/view/${subject}/${all.datastakeId}`;
137
+ let link = `/app/view/${subject}/${all.datastakeId}`;
144
138
  if (activeTab === "shared") {
145
139
  link += `?sourceId=${all?.authorId?.id}`;
146
140
  }
147
141
  goTo(getRedirectLink(link));
148
142
  };
149
- const moreMenuItems = [
150
- {
151
- label: t("Details"),
152
- value: "details",
153
- onClick: onClick,
154
- },
155
- {
156
- label: t("Summary"),
157
- value: "Summary",
158
- onClick: () => {
159
- let link = `/app/summary/${subject}/${all.datastakeId}`
160
- if (activeTab === "shared") {
161
- link += `?sourceId=${all?.authorId?.id}`;
162
- }
163
- goTo(getRedirectLink(link));
164
- },
165
- // disabled: true,
166
- },
167
- ];
168
- return <div >
169
- <MoreMenu items={moreMenuItems} />
170
- </div>;
143
+
144
+ return <NavigationAction onClick={onClick} theme={theme} />;
171
145
  }
172
146
  }
173
147
  ].filter((column) => column.show !== false);
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ const Partners = () => {
4
+ return (
5
+ <div>
6
+ <h1>Partners</h1>
7
+ </div>
8
+ );
9
+ };
10
+
11
+ export default Partners
@@ -1,17 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../helpers/StringHelper.js';
3
+ import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
  import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
15
9
 
16
10
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
17
11
  {
@@ -153,7 +147,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
153
147
  return <div className="daf-default-cell" />;
154
148
  }
155
149
  const onClick = () => {
156
- const link = `/app/view/${subject}/${all.datastakeId}`;
150
+ let link = `/app/view/${subject}/${all.datastakeId}`;
157
151
  if (activeTab === "shared") {
158
152
  link += `?sourceId=${all?.authorId?.id}`;
159
153
  }
@@ -2,41 +2,10 @@ import React from 'react';
2
2
  import { Tooltip, Tag } from 'antd';
3
3
  import { findOptions } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
5
+ import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
-
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
15
-
16
- export const renderStatusTag = ({ value, t = (s) => s }) => {
17
- const width = 87;
18
-
19
- switch (value) {
20
- case "edited":
21
- return (
22
- <Tag color="yellow" style={{ width }} className="text-center">
23
- {t("Edited")}
24
- </Tag>
25
- );
26
- case "submitted":
27
- return (
28
- <Tag color="green" style={{ width }} className="text-center">
29
- {t("Submitted")}
30
- </Tag>
31
- );
32
- default:
33
- return (
34
- <Tag color="blue" style={{ width }} className="text-center">
35
- {t("Private")}
36
- </Tag>
37
- );
38
- }
39
- };
8
+ import { renderStatusTag } from '../../../utils/tags.js';
40
9
 
41
10
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
42
11
  // {
@@ -164,23 +133,15 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
164
133
  return <div className="daf-default-cell" />;
165
134
  }
166
135
 
167
- const link = `/app/view/${subject}/${all.datastakeId}`;
136
+ const onClick = () => {
137
+ let link = `/app/view/${subject}/${all.datastakeId}`;
138
+ if (activeTab === "shared") {
139
+ link += `?sourceId=${all?.authorId?.id}`;
140
+ }
141
+ goTo(getRedirectLink(link));
142
+ };
168
143
 
169
- return <div style={{ display: "flex", justifyContent: "center" }}>
170
- <button
171
- onClick={() => goTo(getRedirectLink(link))}
172
- style={{
173
- cursor: 'pointer',
174
- border: 'none',
175
- background: 'transparent',
176
- padding: 0,
177
- display: 'flex',
178
- alignItems: 'center'
179
- }}
180
- >
181
- <CustomIcon name="Link" size={15} color={theme.baseGray70} />
182
- </button>
183
- </div>;
144
+ return <NavigationAction onClick={onClick} theme={theme} />;
184
145
  }
185
146
  }
186
147
  ].filter((column) => column.show !== false);
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
3
  import { findOptions } from '../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../helpers/Forms.js';
5
- import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
5
  import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
7
6
  import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
8
- import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
7
+ import NavigationAction from '../../core/components/Table/NavigationAction/index.jsx';
8
+
9
9
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications}) => [
10
10
  {
11
11
  dataIndex: 'datastakeId',
@@ -121,34 +121,13 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
121
121
  return <div className="daf-default-cell" />;
122
122
  }
123
123
  const onClick = () => {
124
- const link = `/app/view/${subject}/${all.datastakeId}`;
124
+ let link = `/app/view/${subject}/${all.datastakeId}`;
125
125
  if (activeTab === "shared") {
126
126
  link += `?sourceId=${all?.authorId?.id}`;
127
127
  }
128
128
  goTo(getRedirectLink(link));
129
129
  };
130
- const moreMenuItems = [
131
- {
132
- label: t("Details"),
133
- value: "details",
134
- onClick: onClick,
135
- },
136
- {
137
- label: t("Summary"),
138
- value: "Summary",
139
- onClick: () => {
140
- let link = `/app/summary/${subject}/${all.datastakeId}`
141
- if (activeTab === "shared") {
142
- link += `?sourceId=${all?.authorId?.id}`;
143
- }
144
- goTo(getRedirectLink(link));
145
- },
146
- // disabled: true,
147
- },
148
- ];
149
- return <div >
150
- <MoreMenu items={moreMenuItems} />
151
- </div>;
130
+ return <NavigationAction onClick={onClick} theme={theme} />;
152
131
  }
153
132
  }
154
133
  ].filter((column) => column.show !== false);