datastake-daf 0.6.755 → 0.6.757

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 (49) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/components/index.js +666 -626
  7. package/dist/constants/index.js +26 -0
  8. package/dist/hooks/index.js +11 -8
  9. package/dist/layouts/index.js +470 -448
  10. package/dist/pages/index.js +621 -551
  11. package/dist/utils/index.js +816 -448
  12. package/package.json +1 -1
  13. package/rollup.config.js +20 -0
  14. package/src/@daf/core/components/EditForm/form.jsx +1 -1
  15. package/src/@daf/core/components/EditForm/storyConfig2.js +866 -25029
  16. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +4 -2
  17. package/src/@daf/core/components/Icon/configs/ClockPlus.js +14 -0
  18. package/src/@daf/core/components/Icon/configs/WaziDarkIcon.js +15 -0
  19. package/src/@daf/core/components/Icon/configs/index.js +4 -0
  20. package/src/@daf/core/components/Screens/BaseScreen/index.jsx +3 -3
  21. package/src/@daf/hooks/useFilters.js +10 -8
  22. package/src/@daf/hooks/useWidgetFetch.js +3 -3
  23. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  24. package/src/@daf/pages/Dashboards/helper.js +3 -3
  25. package/src/@daf/pages/Documents/columns.js +2 -4
  26. package/src/@daf/pages/Documents/index.jsx +2 -3
  27. package/src/@daf/pages/Events/Activities/index.jsx +3 -4
  28. package/src/@daf/pages/Events/Incidents/index.jsx +2 -3
  29. package/src/@daf/pages/Events/columns.js +12 -14
  30. package/src/@daf/pages/Events/index.jsx +2 -3
  31. package/src/@daf/pages/Locations/MineSite/columns.js +23 -24
  32. package/src/@daf/pages/Locations/MineSite/index.jsx +5 -4
  33. package/src/@daf/pages/Locations/columns.js +2 -2
  34. package/src/@daf/pages/Locations/index.jsx +2 -3
  35. package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -2
  36. package/src/@daf/pages/Stakeholders/Workers/columns.js +14 -4
  37. package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -3
  38. package/src/@daf/pages/Stakeholders/index.jsx +2 -3
  39. package/src/@daf/pages/Summary/Minesite/components/MineDetailsSection/index.js +1 -1
  40. package/src/@daf/pages/Summary/Minesite/index.jsx +3 -0
  41. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +7 -1
  42. package/src/@daf/pages/Summary/Operator/index.jsx +4 -1
  43. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +1 -1
  44. package/src/@daf/pages/Summary/hook.js +5 -2
  45. package/src/constants/breadCrumbs.js +20 -0
  46. package/src/constants.js +1 -0
  47. package/src/helpers/breadCrumbs.js +347 -0
  48. package/src/styles/components/_dataLink.scss +1 -0
  49. package/src/utils.js +3 -1
@@ -35,6 +35,7 @@ const WorkersTable = ({
35
35
  extendingFilters = {},
36
36
  createDefaultValues = {},
37
37
  applications = [],
38
+ breadcrumbs = [],
38
39
  }) => {
39
40
  const [selectOptions, setSelectOptions] = useState();
40
41
  const [activeTab, setActiveTab] = useState('own');
@@ -52,8 +53,6 @@ const WorkersTable = ({
52
53
  applications,
53
54
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
54
55
 
55
- const breadCrumbs = [];
56
-
57
56
  const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
58
57
 
59
58
  const filters = useMemo(() => {
@@ -95,7 +94,7 @@ const WorkersTable = ({
95
94
  <TablePageWithTabs
96
95
  t={t}
97
96
  title={t("Workers")}
98
- breadCrumbs={breadCrumbs}
97
+ breadCrumbs={breadcrumbs}
99
98
  location={location}
100
99
  loading={loading}
101
100
  goTo={goTo}
@@ -35,6 +35,7 @@ const StakeholdersTable = ({
35
35
  form = {},
36
36
  applications = [],
37
37
  subjectClear = () => {},
38
+ breadcrumbs = [],
38
39
  }) => {
39
40
  const [selectOptions, setSelectOptions] = useState();
40
41
  const [activeTab, setActiveTab] = useState("own");
@@ -50,8 +51,6 @@ const StakeholdersTable = ({
50
51
  applications,
51
52
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
52
53
 
53
- const breadCrumbs = [];
54
-
55
54
  const { paginationQuery, searchParams, otherParams } = useGetQueryParams({location});
56
55
 
57
56
  useEffect(() => {
@@ -89,7 +88,7 @@ const StakeholdersTable = ({
89
88
  <TablePageWithTabs
90
89
  t={t}
91
90
  title={t("Stakeholders")}
92
- breadCrumbs={breadCrumbs}
91
+ breadCrumbs={breadcrumbs}
93
92
  location={location}
94
93
  loading={loading}
95
94
  goTo={goTo}
@@ -16,7 +16,7 @@ const MineDetailsSection = ({
16
16
  basepath: "analytics",
17
17
  url: '/widgets/mine-site-details',
18
18
  defaultData: [],
19
- stop: selectedPartners?.loading,
19
+ stop: !locationData?.datastakeId || selectedPartners?.loading,
20
20
  filters: {
21
21
  datastakeId: locationData?.datastakeId,
22
22
  sources: selectedPartners?.partners || [],
@@ -29,6 +29,7 @@ const MineSummary = ({
29
29
  getRedirectLink = () => {},
30
30
  goBack = () => {},
31
31
  onIdChange = () => {},
32
+ breadcrumbs = [],
32
33
  }) => {
33
34
  const {
34
35
  selectedItem,
@@ -59,6 +60,7 @@ const MineSummary = ({
59
60
  theme,
60
61
  service,
61
62
  onIdChange,
63
+ type: "mine",
62
64
  });
63
65
 
64
66
  return (
@@ -69,6 +71,7 @@ const MineSummary = ({
69
71
  className="with-border-header h-w-btn-header no-px-body"
70
72
  goBackTo={!hasSelect && goBack}
71
73
  loading={loading}
74
+ breadcrumbs={breadcrumbs}
72
75
  addedHeaderFirst
73
76
  actionButtons={[
74
77
  {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Tag, Tooltip } from "antd";
3
3
  import CountryFlag from "../../../../../core/components/UI/CountryFlag/index.jsx";
4
- import {findOptions } from "../../../../../../helpers/StringHelper.js";
4
+ import {findOptions, truncateString } from "../../../../../../helpers/StringHelper.js";
5
5
 
6
6
  export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
7
7
  {
@@ -36,6 +36,12 @@ export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
36
36
  label: t("Legal Form"),
37
37
  render: () => {
38
38
  const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions);
39
+ if(subCategory?.length > 22) {
40
+ const _subCategory = truncateString(subCategory, 22);
41
+ return <Tooltip title={subCategory}>
42
+ <span style={{fontWeight: "normal", fontSize: 14}}>{_subCategory || "-"}</span>
43
+ </Tooltip>;
44
+ }
39
45
  return <div>{subCategory || "-"}</div>;
40
46
  },
41
47
  },
@@ -29,7 +29,8 @@ const OperatorSummary = ({
29
29
  goTo = () => {},
30
30
  getRedirectLink = () => {},
31
31
  goBack = () => {},
32
- onIdChange = () => {}
32
+ onIdChange = () => {},
33
+ breadcrumbs = [],
33
34
  }) => {
34
35
  const {
35
36
  selectedItem,
@@ -60,6 +61,7 @@ const OperatorSummary = ({
60
61
  theme,
61
62
  service,
62
63
  onIdChange,
64
+ type: "operator",
63
65
  });
64
66
 
65
67
  return (
@@ -69,6 +71,7 @@ const OperatorSummary = ({
69
71
  title={hasSelect ? t("Operator Review") : (singleItemData?.name || "") + " " + t("Summary")}
70
72
  className="with-border-header h-w-btn-header no-px-body"
71
73
  goBackTo={!hasSelect && goBack}
74
+ breadcrumbs={breadcrumbs}
72
75
  addedHeaderFirst
73
76
  actionButtons={[
74
77
  {
@@ -16,7 +16,7 @@ const InformationAvailability = ({
16
16
  basepath: subject === "stakeholder" ? "stakeholder" : "location",
17
17
  url: `/completion/${id}`,
18
18
  defaultData: [],
19
- stop: selectedPartners?.loading,
19
+ stop: !id || selectedPartners?.loading,
20
20
  filters: {
21
21
  // datastakeId: id,
22
22
  scope: subject === "stakeholder" ? "operatorInfo" : "locationInfo",
@@ -17,7 +17,8 @@ export const useSummary = ({
17
17
  t,
18
18
  theme = {},
19
19
  service,
20
- onIdChange = () => {}
20
+ onIdChange = () => {},
21
+ type
21
22
  }) => {
22
23
  const [search, setSearch] = useState("");
23
24
  const [debouncedSearch, setDebouncedSearch] = useState("");
@@ -110,10 +111,12 @@ export const useSummary = ({
110
111
 
111
112
  const filters = useMemo(() => {
112
113
  return {
113
- pagination: { size: 20, page: 1 },
114
+ pagination: { take: 20, skip: 1 },
114
115
  ...(debouncedSearch
115
116
  ? { search: { qs: debouncedSearch, fields: ["name","datastakeId","orgShortName"] } }
116
117
  : {}),
118
+ ...(type === 'operator' && { stakeholderType: 'operator'}),
119
+ ...(type === 'mine' && { category: 'mineSite'}),
117
120
  };
118
121
  }, [debouncedSearch]);
119
122
 
@@ -0,0 +1,20 @@
1
+ export const defaultBreadCrumbsLabels = {
2
+ events: "Events",
3
+ accounts: "Accounts",
4
+ modules: "Modules",
5
+ settings: "Settings",
6
+ user: "Users",
7
+ analysis: "Analysis",
8
+ 'data-store': "Data Store",
9
+ data: "Data",
10
+ partners: "Partners",
11
+ locations: "Locations",
12
+ 'information-channels': 'Channels',
13
+ 'find-information': 'Query',
14
+ stakeholders: "Stakeholders",
15
+ documents: "Documents",
16
+ mines: "Mines",
17
+ summary: "Summary",
18
+ edit: "Edit",
19
+ details: "Details",
20
+ }
@@ -0,0 +1 @@
1
+ export { defaultBreadCrumbsLabels } from './constants/breadCrumbs.js';
@@ -0,0 +1,347 @@
1
+
2
+ export const buildBreadCrumbs = ({
3
+ config,
4
+ items,
5
+ t,
6
+ breadCrumbsLabels,
7
+ id,
8
+ getRedirectLink,
9
+ createOnClick,
10
+ goTo,
11
+ view,
12
+ skipInteractions = false,
13
+ }) => {
14
+ const pathConfig = config.path || [];
15
+
16
+ pathConfig.forEach((pathItem) => {
17
+ if (typeof pathItem === 'string') {
18
+ items.push({
19
+ label: t(breadCrumbsLabels[pathItem]),
20
+ onClick: () => {},
21
+ });
22
+ } else if (typeof pathItem === 'object') {
23
+ const { key, link, useRedirect } = pathItem;
24
+
25
+ if (key === 'id' && id) {
26
+ const resolvedLink = typeof link === 'function' ? link(id) : link;
27
+ const finalLink = useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
28
+
29
+ items.push({
30
+ label: id,
31
+ onClick: skipInteractions ? () => {} : (finalLink ? createOnClick(() => goTo(finalLink)) : () => {}),
32
+ });
33
+ } else {
34
+ const resolvedLink = typeof link === 'function' ? link(view, id) : link;
35
+ const finalLink = resolvedLink && useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
36
+
37
+ items.push({
38
+ label: t(breadCrumbsLabels[key]),
39
+ onClick: skipInteractions ? () => {} : (finalLink ? createOnClick(() => goTo(finalLink)) : () => {}),
40
+ });
41
+ }
42
+ }
43
+ });
44
+
45
+ if (config.includeId && id && id !== 'user') {
46
+ items.push({ label: id, onClick: () => {} });
47
+ }
48
+
49
+ if (config.suffix) {
50
+ config.suffix.forEach((suffixItem) => {
51
+ items.push({
52
+ label: t(breadCrumbsLabels[suffixItem]),
53
+ onClick: () => {},
54
+ });
55
+ });
56
+ }
57
+ }
58
+
59
+ export const renderBreadCrumbs = ({
60
+ t = () => {},
61
+ goTo = () => {},
62
+ view,
63
+ isAnalysis = false,
64
+ isEdit = false,
65
+ isView = false,
66
+ isDataStore = false,
67
+ id,
68
+ addedItems = [],
69
+ changeNotificationState,
70
+ breadCrumbConfig = {},
71
+ breadCrumbsLabels = {},
72
+ getRedirectLink = () => {},
73
+ condition,
74
+ conditionFallback = 'show-non-interactive', // 'show-non-interactive' | 'hide' | 'show-simplified'
75
+ }) => {
76
+ const items = [];
77
+
78
+ const createOnClick = (callback) => {
79
+ if (!callback) return () => {};
80
+
81
+ return () => {
82
+ if (changeNotificationState) {
83
+ changeNotificationState({ onYes: callback });
84
+ } else {
85
+ callback();
86
+ }
87
+ };
88
+ };
89
+
90
+ const evaluateCondition = (cond, context) => {
91
+ if (cond === undefined) return true; // No condition = always pass
92
+ if (typeof cond === 'function') return cond(context); // Function condition
93
+ return Boolean(cond); // Boolean condition
94
+ };
95
+
96
+ const config = breadCrumbConfig[view];
97
+
98
+ console.log({config, breadCrumbConfig, breadCrumbsLabels, condition})
99
+
100
+ if (config) {
101
+ const conditionContext = {
102
+ isDataStore,
103
+ isAnalysis,
104
+ isEdit,
105
+ isView,
106
+ id,
107
+ view,
108
+ t,
109
+ goTo,
110
+ getRedirectLink,
111
+ changeNotificationState,
112
+ addedItems,
113
+ };
114
+
115
+ const externalConditionPassed = evaluateCondition(condition, conditionContext);
116
+ const configConditionPassed = evaluateCondition(config.condition, conditionContext);
117
+
118
+ const shouldShowBreadcrumbs = externalConditionPassed && configConditionPassed;
119
+
120
+ if (!configConditionPassed) {
121
+ if (config.fallback) {
122
+ buildBreadCrumbs({
123
+ config: config.fallback,
124
+ items,
125
+ t,
126
+ breadCrumbsLabels,
127
+ id,
128
+ getRedirectLink,
129
+ createOnClick,
130
+ goTo,
131
+ view,
132
+ });
133
+ }
134
+ } else if (!externalConditionPassed) {
135
+ if (config.fallback) {
136
+ // Use config fallback when prop condition fails
137
+ buildBreadCrumbs({
138
+ config: config.fallback,
139
+ items,
140
+ t,
141
+ breadCrumbsLabels,
142
+ id,
143
+ getRedirectLink,
144
+ createOnClick,
145
+ goTo,
146
+ view,
147
+ });
148
+ }
149
+ else {
150
+ switch (conditionFallback) {
151
+ case 'hide':
152
+ break;
153
+ case 'show-simplified':{
154
+ const simplifiedConfig = {
155
+ ...config,
156
+ path: config.path.slice(0, 2),
157
+ includeId: false,
158
+ suffix: undefined,
159
+ };
160
+
161
+ buildBreadCrumbs({
162
+ config: simplifiedConfig,
163
+ items,
164
+ t,
165
+ breadCrumbsLabels,
166
+ id,
167
+ getRedirectLink,
168
+ createOnClick,
169
+ goTo,
170
+ view,
171
+ });
172
+ break;
173
+ }
174
+ case 'show-non-interactive':
175
+ default:
176
+ buildBreadCrumbs({
177
+ config,
178
+ items,
179
+ t,
180
+ breadCrumbsLabels,
181
+ id,
182
+ getRedirectLink,
183
+ createOnClick,
184
+ goTo,
185
+ view,
186
+ skipInteractions: true,
187
+ });
188
+ break;
189
+ }
190
+ }
191
+ } else {
192
+ buildBreadCrumbs({
193
+ config,
194
+ items,
195
+ t,
196
+ breadCrumbsLabels,
197
+ id,
198
+ getRedirectLink,
199
+ createOnClick,
200
+ goTo,
201
+ view,
202
+ });
203
+ }
204
+ }
205
+
206
+
207
+ if (isView) {
208
+ items.push({ label: t(breadCrumbsLabels.details) });
209
+ } else if (isEdit) {
210
+ items.push({ label: t(breadCrumbsLabels.edit) });
211
+ } else if (isAnalysis) {
212
+ items.push({ label: t(breadCrumbsLabels.summary) });
213
+ }
214
+
215
+ items.push(...addedItems);
216
+
217
+ return items.filter((v) => !!v.label);
218
+
219
+ }
220
+
221
+ // Breadcrumbs Config Helper
222
+
223
+ // 1.Simple static path
224
+ // 'country-overview': {
225
+ // path: ['analysis', 'country-overview'],
226
+ // }
227
+ // Result: Analysis > Country Overview
228
+ // Neither is clickable
229
+
230
+ // 2.Clickable Parents with Links
231
+ // 'mines': {
232
+ // path: [
233
+ // 'modules', // Not clickable
234
+ // { key: 'mines', link: '/app/mines' } // Clickable, navigates to /app/mines
235
+ // ],
236
+ // }
237
+ // Result: Modules > Mines (clickable)
238
+
239
+ // 3.Include ID at the end
240
+ // 'partners': {
241
+ // path: ['modules', { key: 'partners', link: '/app/partners', useRedirect: true }],
242
+ // includeId: true, // ← ID will be added at the end
243
+ // }
244
+ // With id='ABC123':
245
+ // Result: Modules > Partners (clickable) > ABC123 (not clickable)
246
+
247
+ // 4.Dynamic Id in the middle
248
+ // 'mine-evaluation': {
249
+ // path: [
250
+ // 'modules',
251
+ // { key: 'mines', link: '/app/mines' },
252
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // ← ID here
253
+ // 'evaluation',
254
+ // ],
255
+ // }
256
+ // With id='MINE-456':
257
+ // Result: Modules > Mines > MINE-456 (clickable to /app/mines/MINE-456) > Evaluation
258
+
259
+ // 5. Dynamic Links using functions
260
+ // 'producers': {
261
+ // path: [
262
+ // 'modules',
263
+ // {
264
+ // key: 'producers',
265
+ // link: (view) => `/app/${view}`, // ← Uses 'view' parameter
266
+ // useRedirect: true
267
+ // }
268
+ // ],
269
+ // includeId: true,
270
+ // }
271
+ // With view='producers':
272
+ // Result: Modules > Producers (navigates to /app/producers)
273
+
274
+ // 6.use Redirect link
275
+ // 'settings': {
276
+ // path: [
277
+ // {
278
+ // key: 'settings',
279
+ // link: '/app/view/settings',
280
+ // useRedirect: true // ← Wraps with getRedirectLink()
281
+ // }
282
+ // ],
283
+ // }
284
+ // Navigation will use getRedirectLink('/app/view/settings')
285
+
286
+ // 7.Conditional Rendering
287
+ // 'entities': {
288
+ // condition: (opts) => opts.isDataStore, // ← Only shows if isDataStore=true
289
+ // path: [
290
+ // 'data',
291
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
292
+ // { key: 'entities', link: '/app/data-store/entities', useRedirect: true },
293
+ // ],
294
+ // }
295
+ // With isDataStore=false: No breadcrumbs shown
296
+ // With isDataStore=true: Data > Store > Entities
297
+
298
+ // 8.Conditional Fallback
299
+ // 'locations': {
300
+ // condition: (opts) => opts.isDataStore,
301
+ // path: [
302
+ // 'data',
303
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
304
+ // { key: 'locations', link: '/app/data-store/locations', useRedirect: true },
305
+ // ],
306
+ // fallback: { // ← Alternative when condition is false
307
+ // path: [
308
+ // 'modules',
309
+ // 'linkedSubjects',
310
+ // { key: 'locations', link: '/app/locations', useRedirect: true },
311
+ // ],
312
+ // includeId: true,
313
+ // },
314
+ // }
315
+ // isDataStore=true: Data > Store > Locations
316
+ // isDataStore=false: Modules > Associated Information > Locations > {id}
317
+
318
+ // 9. Suffix items
319
+ // 'mine-monitoring': {
320
+ // path: [
321
+ // 'modules',
322
+ // { key: 'mines', link: '/app/mines' }
323
+ // ],
324
+ // includeId: true,
325
+ // suffix: ['visits'], // ← Added at the end
326
+ // }
327
+ // With id='MINE-789':
328
+ // Result: Modules > Mines > MINE-789 > Visits
329
+
330
+ // 10. Complex multi level path
331
+ // 'monitoringReport': {
332
+ // path: [
333
+ // 'modules', // Static label
334
+ // { key: 'mines', link: '/app/mines' }, // Clickable parent
335
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // Dynamic ID with link
336
+ // 'monitoringReport', // Static label at end
337
+ // ],
338
+ // }
339
+ // With id='MINE-999':
340
+ // Result: Modules > Mines (→/app/mines) > MINE-999 (→/app/mines/MINE-999) > Executive Monitoring Report
341
+
342
+ // 11. Access multiple options in condition
343
+ // 'custom-view': {
344
+ // condition: (opts) => opts.isDataStore && opts.isEdit && opts.id,
345
+ // path: ['data', 'custom'],
346
+ // }
347
+ // Available in opts: { isDataStore, isAnalysis, isEdit, isView, id, view }
@@ -1,4 +1,5 @@
1
1
  .data-link-cont {
2
+ max-width: 614px; //DATA LINK STRETCH
2
3
  .add-btn {
3
4
  min-width: 32px;
4
5
  width: 32px;
package/src/utils.js CHANGED
@@ -58,4 +58,6 @@ export {
58
58
  buildActionWidgetsConfig,
59
59
  buildKeyIndicatorsConfig,
60
60
  buildBreadcrumbs
61
- } from './@daf/utils/adminConfigBuilders.js'
61
+ } from './@daf/utils/adminConfigBuilders.js'
62
+
63
+ export { renderBreadCrumbs, buildBreadCrumbs as buildBreadCrumbsHelper } from './helpers/breadCrumbs.js'