datastake-daf 0.6.756 → 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.
- package/dist/components/index.js +81 -83
- package/dist/constants/index.js +26 -0
- package/dist/pages/index.js +47 -41
- package/dist/utils/index.js +346 -0
- package/package.json +1 -1
- package/rollup.config.js +20 -0
- package/src/@daf/core/components/EditForm/form.jsx +1 -1
- package/src/@daf/core/components/EditForm/storyConfig2.js +866 -25029
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
- package/src/@daf/pages/Documents/index.jsx +2 -3
- package/src/@daf/pages/Events/Activities/index.jsx +2 -3
- package/src/@daf/pages/Events/Incidents/index.jsx +2 -3
- package/src/@daf/pages/Events/index.jsx +2 -3
- package/src/@daf/pages/Locations/MineSite/columns.js +7 -5
- package/src/@daf/pages/Locations/MineSite/index.jsx +5 -4
- package/src/@daf/pages/Locations/index.jsx +2 -3
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -2
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -3
- package/src/@daf/pages/Stakeholders/index.jsx +2 -3
- package/src/@daf/pages/Summary/Minesite/index.jsx +2 -0
- package/src/@daf/pages/Summary/Operator/index.jsx +3 -1
- package/src/constants/breadCrumbs.js +20 -0
- package/src/constants.js +1 -0
- package/src/helpers/breadCrumbs.js +347 -0
- package/src/utils.js +3 -1
package/dist/pages/index.js
CHANGED
|
@@ -12996,7 +12996,7 @@ function SupplyChain({
|
|
|
12996
12996
|
setSelectedPartners,
|
|
12997
12997
|
informationSources,
|
|
12998
12998
|
hardcodedData,
|
|
12999
|
-
|
|
12999
|
+
breadcrumbs = []
|
|
13000
13000
|
}) {
|
|
13001
13001
|
const sourceOptions = React.useMemo(() => {
|
|
13002
13002
|
if (!partners?.length) return [];
|
|
@@ -13039,7 +13039,7 @@ function SupplyChain({
|
|
|
13039
13039
|
defaultSelected: partners?.map(p => p.id) || []
|
|
13040
13040
|
}, partners?.length)
|
|
13041
13041
|
}),
|
|
13042
|
-
breadcrumbs:
|
|
13042
|
+
breadcrumbs: breadcrumbs
|
|
13043
13043
|
}),
|
|
13044
13044
|
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
13045
13045
|
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators$1, {
|
|
@@ -30064,7 +30064,8 @@ const OperatorsTable = ({
|
|
|
30064
30064
|
form = {},
|
|
30065
30065
|
extendingFilters = {},
|
|
30066
30066
|
createDefaultValues = {},
|
|
30067
|
-
applications = []
|
|
30067
|
+
applications = [],
|
|
30068
|
+
breadcrumbs = []
|
|
30068
30069
|
}) => {
|
|
30069
30070
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30070
30071
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
@@ -30080,7 +30081,6 @@ const OperatorsTable = ({
|
|
|
30080
30081
|
data,
|
|
30081
30082
|
applications
|
|
30082
30083
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
30083
|
-
const breadCrumbs = [];
|
|
30084
30084
|
const {
|
|
30085
30085
|
paginationQuery,
|
|
30086
30086
|
searchParams,
|
|
@@ -30127,7 +30127,7 @@ const OperatorsTable = ({
|
|
|
30127
30127
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
30128
30128
|
t: t,
|
|
30129
30129
|
title: t("Operators"),
|
|
30130
|
-
breadCrumbs:
|
|
30130
|
+
breadCrumbs: breadcrumbs,
|
|
30131
30131
|
location: location,
|
|
30132
30132
|
loading: loading,
|
|
30133
30133
|
goTo: goTo,
|
|
@@ -30551,7 +30551,8 @@ const LocationsTable = ({
|
|
|
30551
30551
|
formValue = {},
|
|
30552
30552
|
form = {},
|
|
30553
30553
|
applications = [],
|
|
30554
|
-
subjectClear = () => {}
|
|
30554
|
+
subjectClear = () => {},
|
|
30555
|
+
breadcrumbs = []
|
|
30555
30556
|
}) => {
|
|
30556
30557
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30557
30558
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -30567,7 +30568,6 @@ const LocationsTable = ({
|
|
|
30567
30568
|
data,
|
|
30568
30569
|
applications
|
|
30569
30570
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
30570
|
-
const breadCrumbs = [];
|
|
30571
30571
|
const {
|
|
30572
30572
|
paginationQuery,
|
|
30573
30573
|
searchParams,
|
|
@@ -30610,7 +30610,7 @@ const LocationsTable = ({
|
|
|
30610
30610
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
30611
30611
|
t: t,
|
|
30612
30612
|
title: t("Locations"),
|
|
30613
|
-
breadCrumbs:
|
|
30613
|
+
breadCrumbs: breadcrumbs,
|
|
30614
30614
|
location: location,
|
|
30615
30615
|
loading: loading,
|
|
30616
30616
|
goTo: goTo,
|
|
@@ -31011,7 +31011,8 @@ const StakeholdersTable = ({
|
|
|
31011
31011
|
formValue = {},
|
|
31012
31012
|
form = {},
|
|
31013
31013
|
applications = [],
|
|
31014
|
-
subjectClear = () => {}
|
|
31014
|
+
subjectClear = () => {},
|
|
31015
|
+
breadcrumbs = []
|
|
31015
31016
|
}) => {
|
|
31016
31017
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31017
31018
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -31026,7 +31027,6 @@ const StakeholdersTable = ({
|
|
|
31026
31027
|
subject: 'stakeholders',
|
|
31027
31028
|
applications
|
|
31028
31029
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
|
|
31029
|
-
const breadCrumbs = [];
|
|
31030
31030
|
const {
|
|
31031
31031
|
paginationQuery,
|
|
31032
31032
|
searchParams,
|
|
@@ -31066,7 +31066,7 @@ const StakeholdersTable = ({
|
|
|
31066
31066
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
31067
31067
|
t: t,
|
|
31068
31068
|
title: t("Stakeholders"),
|
|
31069
|
-
breadCrumbs:
|
|
31069
|
+
breadCrumbs: breadcrumbs,
|
|
31070
31070
|
location: location,
|
|
31071
31071
|
loading: loading,
|
|
31072
31072
|
goTo: goTo,
|
|
@@ -31843,7 +31843,8 @@ const EventsTable = ({
|
|
|
31843
31843
|
form = {},
|
|
31844
31844
|
extendingFilters = {},
|
|
31845
31845
|
applications = [],
|
|
31846
|
-
subjectClear = () => {}
|
|
31846
|
+
subjectClear = () => {},
|
|
31847
|
+
breadcrumbs = []
|
|
31847
31848
|
}) => {
|
|
31848
31849
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31849
31850
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -31859,7 +31860,6 @@ const EventsTable = ({
|
|
|
31859
31860
|
data,
|
|
31860
31861
|
applications
|
|
31861
31862
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
31862
|
-
const breadCrumbs = [];
|
|
31863
31863
|
const {
|
|
31864
31864
|
paginationQuery,
|
|
31865
31865
|
searchParams,
|
|
@@ -31910,7 +31910,7 @@ const EventsTable = ({
|
|
|
31910
31910
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
31911
31911
|
t: t,
|
|
31912
31912
|
title: t("events"),
|
|
31913
|
-
breadCrumbs:
|
|
31913
|
+
breadCrumbs: breadcrumbs,
|
|
31914
31914
|
location: location,
|
|
31915
31915
|
loading: loading,
|
|
31916
31916
|
goTo: goTo,
|
|
@@ -32253,7 +32253,8 @@ const DocumentsTable = ({
|
|
|
32253
32253
|
formValue = {},
|
|
32254
32254
|
form = {},
|
|
32255
32255
|
applications = [],
|
|
32256
|
-
subjectClear = () => {}
|
|
32256
|
+
subjectClear = () => {},
|
|
32257
|
+
breadcrumbs = []
|
|
32257
32258
|
}) => {
|
|
32258
32259
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
32259
32260
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -32268,7 +32269,6 @@ const DocumentsTable = ({
|
|
|
32268
32269
|
subject: 'documents',
|
|
32269
32270
|
applications
|
|
32270
32271
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
|
|
32271
|
-
const breadCrumbs = [];
|
|
32272
32272
|
const {
|
|
32273
32273
|
paginationQuery,
|
|
32274
32274
|
searchParams,
|
|
@@ -32313,7 +32313,7 @@ const DocumentsTable = ({
|
|
|
32313
32313
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
32314
32314
|
t: t,
|
|
32315
32315
|
title: t("Documents"),
|
|
32316
|
-
breadCrumbs:
|
|
32316
|
+
breadCrumbs: breadcrumbs,
|
|
32317
32317
|
location: location,
|
|
32318
32318
|
loading: loading,
|
|
32319
32319
|
goTo: goTo,
|
|
@@ -32920,7 +32920,8 @@ const WorkersTable = ({
|
|
|
32920
32920
|
form = {},
|
|
32921
32921
|
extendingFilters = {},
|
|
32922
32922
|
createDefaultValues = {},
|
|
32923
|
-
applications = []
|
|
32923
|
+
applications = [],
|
|
32924
|
+
breadcrumbs = []
|
|
32924
32925
|
}) => {
|
|
32925
32926
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
32926
32927
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
@@ -32936,7 +32937,6 @@ const WorkersTable = ({
|
|
|
32936
32937
|
data,
|
|
32937
32938
|
applications
|
|
32938
32939
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
32939
|
-
const breadCrumbs = [];
|
|
32940
32940
|
const {
|
|
32941
32941
|
paginationQuery,
|
|
32942
32942
|
searchParams,
|
|
@@ -32983,7 +32983,7 @@ const WorkersTable = ({
|
|
|
32983
32983
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
32984
32984
|
t: t,
|
|
32985
32985
|
title: t("Workers"),
|
|
32986
|
-
breadCrumbs:
|
|
32986
|
+
breadCrumbs: breadcrumbs,
|
|
32987
32987
|
location: location,
|
|
32988
32988
|
loading: loading,
|
|
32989
32989
|
goTo: goTo,
|
|
@@ -33655,7 +33655,8 @@ const ActivitiesTable = ({
|
|
|
33655
33655
|
form = {},
|
|
33656
33656
|
extendingFilters = {},
|
|
33657
33657
|
createDefaultValues = {},
|
|
33658
|
-
applications = []
|
|
33658
|
+
applications = [],
|
|
33659
|
+
breadcrumbs = []
|
|
33659
33660
|
}) => {
|
|
33660
33661
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
33661
33662
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -33671,7 +33672,6 @@ const ActivitiesTable = ({
|
|
|
33671
33672
|
data,
|
|
33672
33673
|
applications
|
|
33673
33674
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
33674
|
-
const breadCrumbs = [];
|
|
33675
33675
|
const {
|
|
33676
33676
|
paginationQuery,
|
|
33677
33677
|
searchParams,
|
|
@@ -33718,7 +33718,7 @@ const ActivitiesTable = ({
|
|
|
33718
33718
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
33719
33719
|
t: t,
|
|
33720
33720
|
title: t("Activities"),
|
|
33721
|
-
breadCrumbs:
|
|
33721
|
+
breadCrumbs: breadcrumbs,
|
|
33722
33722
|
location: location,
|
|
33723
33723
|
loading: loading,
|
|
33724
33724
|
goTo: goTo,
|
|
@@ -34381,7 +34381,8 @@ const IncidentsTable = ({
|
|
|
34381
34381
|
form = {},
|
|
34382
34382
|
extendingFilters = {},
|
|
34383
34383
|
createDefaultValues = {},
|
|
34384
|
-
applications = []
|
|
34384
|
+
applications = [],
|
|
34385
|
+
breadcrumbs = []
|
|
34385
34386
|
}) => {
|
|
34386
34387
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
34387
34388
|
const [activeTab, setActiveTab] = React.useState("own");
|
|
@@ -34397,7 +34398,6 @@ const IncidentsTable = ({
|
|
|
34397
34398
|
data,
|
|
34398
34399
|
applications
|
|
34399
34400
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
34400
|
-
const breadCrumbs = [];
|
|
34401
34401
|
const {
|
|
34402
34402
|
paginationQuery,
|
|
34403
34403
|
searchParams,
|
|
@@ -34444,7 +34444,7 @@ const IncidentsTable = ({
|
|
|
34444
34444
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
34445
34445
|
t: t,
|
|
34446
34446
|
title: t("Incidents"),
|
|
34447
|
-
breadCrumbs:
|
|
34447
|
+
breadCrumbs: breadcrumbs,
|
|
34448
34448
|
location: location,
|
|
34449
34449
|
loading: loading,
|
|
34450
34450
|
goTo: goTo,
|
|
@@ -34513,7 +34513,8 @@ const getColumns$1 = ({
|
|
|
34513
34513
|
getRedirectLink,
|
|
34514
34514
|
theme,
|
|
34515
34515
|
subject,
|
|
34516
|
-
data
|
|
34516
|
+
data,
|
|
34517
|
+
applications
|
|
34517
34518
|
}) => [{
|
|
34518
34519
|
dataIndex: 'datastakeId',
|
|
34519
34520
|
title: t('ID'),
|
|
@@ -34651,7 +34652,7 @@ const getColumns$1 = ({
|
|
|
34651
34652
|
}
|
|
34652
34653
|
}, {
|
|
34653
34654
|
title: t("Sources"),
|
|
34654
|
-
dataIndex: '
|
|
34655
|
+
dataIndex: 'sources',
|
|
34655
34656
|
ellipsis: true,
|
|
34656
34657
|
show: activeTab !== "own",
|
|
34657
34658
|
render: (v, all) => {
|
|
@@ -34660,11 +34661,10 @@ const getColumns$1 = ({
|
|
|
34660
34661
|
className: "daf-default-cell"
|
|
34661
34662
|
});
|
|
34662
34663
|
}
|
|
34663
|
-
const
|
|
34664
|
-
return
|
|
34665
|
-
|
|
34666
|
-
|
|
34667
|
-
}) : '-';
|
|
34664
|
+
const sources = sourceAvatarConfig(v, user, applications);
|
|
34665
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
|
|
34666
|
+
items: sources
|
|
34667
|
+
});
|
|
34668
34668
|
}
|
|
34669
34669
|
}, {
|
|
34670
34670
|
id: 'actions',
|
|
@@ -34677,7 +34677,7 @@ const getColumns$1 = ({
|
|
|
34677
34677
|
});
|
|
34678
34678
|
}
|
|
34679
34679
|
const onClick = () => {
|
|
34680
|
-
|
|
34680
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
34681
34681
|
if (activeTab === "shared") {
|
|
34682
34682
|
link += `?sourceId=${all?.authorId?.id}`;
|
|
34683
34683
|
}
|
|
@@ -35047,7 +35047,9 @@ const ProductionSitesTable = ({
|
|
|
35047
35047
|
formValue = {},
|
|
35048
35048
|
form = {},
|
|
35049
35049
|
extendingFilters = {},
|
|
35050
|
-
createDefaultValues = {}
|
|
35050
|
+
createDefaultValues = {},
|
|
35051
|
+
applications = [],
|
|
35052
|
+
breadcrumbs = []
|
|
35051
35053
|
}) => {
|
|
35052
35054
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
35053
35055
|
const [activeTab, setActiveTab] = React.useState('own');
|
|
@@ -35060,9 +35062,9 @@ const ProductionSitesTable = ({
|
|
|
35060
35062
|
getRedirectLink,
|
|
35061
35063
|
theme,
|
|
35062
35064
|
subject: 'production-sites',
|
|
35063
|
-
data
|
|
35064
|
-
|
|
35065
|
-
|
|
35065
|
+
data,
|
|
35066
|
+
applications
|
|
35067
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
35066
35068
|
const {
|
|
35067
35069
|
paginationQuery,
|
|
35068
35070
|
searchParams,
|
|
@@ -35109,7 +35111,7 @@ const ProductionSitesTable = ({
|
|
|
35109
35111
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
35110
35112
|
t: t,
|
|
35111
35113
|
title: t("production-sites"),
|
|
35112
|
-
breadCrumbs:
|
|
35114
|
+
breadCrumbs: breadcrumbs,
|
|
35113
35115
|
location: location,
|
|
35114
35116
|
loading: loading,
|
|
35115
35117
|
goTo: goTo,
|
|
@@ -37625,7 +37627,8 @@ const OperatorSummary = ({
|
|
|
37625
37627
|
goTo = () => {},
|
|
37626
37628
|
getRedirectLink = () => {},
|
|
37627
37629
|
goBack = () => {},
|
|
37628
|
-
onIdChange = () => {}
|
|
37630
|
+
onIdChange = () => {},
|
|
37631
|
+
breadcrumbs = []
|
|
37629
37632
|
}) => {
|
|
37630
37633
|
const {
|
|
37631
37634
|
selectedItem,
|
|
@@ -37663,6 +37666,7 @@ const OperatorSummary = ({
|
|
|
37663
37666
|
title: hasSelect ? t("Operator Review") : (singleItemData?.name || "") + " " + t("Summary"),
|
|
37664
37667
|
className: "with-border-header h-w-btn-header no-px-body",
|
|
37665
37668
|
goBackTo: !hasSelect && goBack,
|
|
37669
|
+
breadcrumbs: breadcrumbs,
|
|
37666
37670
|
addedHeaderFirst: true,
|
|
37667
37671
|
actionButtons: [{
|
|
37668
37672
|
tooltip: t("Details"),
|
|
@@ -42450,7 +42454,8 @@ const MineSummary = ({
|
|
|
42450
42454
|
goTo = () => {},
|
|
42451
42455
|
getRedirectLink = () => {},
|
|
42452
42456
|
goBack = () => {},
|
|
42453
|
-
onIdChange = () => {}
|
|
42457
|
+
onIdChange = () => {},
|
|
42458
|
+
breadcrumbs = []
|
|
42454
42459
|
}) => {
|
|
42455
42460
|
const {
|
|
42456
42461
|
selectedItem,
|
|
@@ -42489,6 +42494,7 @@ const MineSummary = ({
|
|
|
42489
42494
|
className: "with-border-header h-w-btn-header no-px-body",
|
|
42490
42495
|
goBackTo: !hasSelect && goBack,
|
|
42491
42496
|
loading: loading,
|
|
42497
|
+
breadcrumbs: breadcrumbs,
|
|
42492
42498
|
addedHeaderFirst: true,
|
|
42493
42499
|
actionButtons: [{
|
|
42494
42500
|
tooltip: t("Details"),
|
package/dist/utils/index.js
CHANGED
|
@@ -14139,12 +14139,357 @@ function buildBreadcrumbs({
|
|
|
14139
14139
|
}];
|
|
14140
14140
|
}
|
|
14141
14141
|
|
|
14142
|
+
const buildBreadCrumbs = ({
|
|
14143
|
+
config,
|
|
14144
|
+
items,
|
|
14145
|
+
t,
|
|
14146
|
+
breadCrumbsLabels,
|
|
14147
|
+
id,
|
|
14148
|
+
getRedirectLink,
|
|
14149
|
+
createOnClick,
|
|
14150
|
+
goTo,
|
|
14151
|
+
view,
|
|
14152
|
+
skipInteractions = false
|
|
14153
|
+
}) => {
|
|
14154
|
+
const pathConfig = config.path || [];
|
|
14155
|
+
pathConfig.forEach(pathItem => {
|
|
14156
|
+
if (typeof pathItem === 'string') {
|
|
14157
|
+
items.push({
|
|
14158
|
+
label: t(breadCrumbsLabels[pathItem]),
|
|
14159
|
+
onClick: () => {}
|
|
14160
|
+
});
|
|
14161
|
+
} else if (typeof pathItem === 'object') {
|
|
14162
|
+
const {
|
|
14163
|
+
key,
|
|
14164
|
+
link,
|
|
14165
|
+
useRedirect
|
|
14166
|
+
} = pathItem;
|
|
14167
|
+
if (key === 'id' && id) {
|
|
14168
|
+
const resolvedLink = typeof link === 'function' ? link(id) : link;
|
|
14169
|
+
const finalLink = useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
|
|
14170
|
+
items.push({
|
|
14171
|
+
label: id,
|
|
14172
|
+
onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
|
|
14173
|
+
});
|
|
14174
|
+
} else {
|
|
14175
|
+
const resolvedLink = typeof link === 'function' ? link(view, id) : link;
|
|
14176
|
+
const finalLink = resolvedLink && useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
|
|
14177
|
+
items.push({
|
|
14178
|
+
label: t(breadCrumbsLabels[key]),
|
|
14179
|
+
onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
|
|
14180
|
+
});
|
|
14181
|
+
}
|
|
14182
|
+
}
|
|
14183
|
+
});
|
|
14184
|
+
if (config.includeId && id && id !== 'user') {
|
|
14185
|
+
items.push({
|
|
14186
|
+
label: id,
|
|
14187
|
+
onClick: () => {}
|
|
14188
|
+
});
|
|
14189
|
+
}
|
|
14190
|
+
if (config.suffix) {
|
|
14191
|
+
config.suffix.forEach(suffixItem => {
|
|
14192
|
+
items.push({
|
|
14193
|
+
label: t(breadCrumbsLabels[suffixItem]),
|
|
14194
|
+
onClick: () => {}
|
|
14195
|
+
});
|
|
14196
|
+
});
|
|
14197
|
+
}
|
|
14198
|
+
};
|
|
14199
|
+
const renderBreadCrumbs = ({
|
|
14200
|
+
t = () => {},
|
|
14201
|
+
goTo = () => {},
|
|
14202
|
+
view,
|
|
14203
|
+
isAnalysis = false,
|
|
14204
|
+
isEdit = false,
|
|
14205
|
+
isView = false,
|
|
14206
|
+
isDataStore = false,
|
|
14207
|
+
id,
|
|
14208
|
+
addedItems = [],
|
|
14209
|
+
changeNotificationState,
|
|
14210
|
+
breadCrumbConfig = {},
|
|
14211
|
+
breadCrumbsLabels = {},
|
|
14212
|
+
getRedirectLink = () => {},
|
|
14213
|
+
condition,
|
|
14214
|
+
conditionFallback = 'show-non-interactive' // 'show-non-interactive' | 'hide' | 'show-simplified'
|
|
14215
|
+
}) => {
|
|
14216
|
+
const items = [];
|
|
14217
|
+
const createOnClick = callback => {
|
|
14218
|
+
if (!callback) return () => {};
|
|
14219
|
+
return () => {
|
|
14220
|
+
if (changeNotificationState) {
|
|
14221
|
+
changeNotificationState({
|
|
14222
|
+
onYes: callback
|
|
14223
|
+
});
|
|
14224
|
+
} else {
|
|
14225
|
+
callback();
|
|
14226
|
+
}
|
|
14227
|
+
};
|
|
14228
|
+
};
|
|
14229
|
+
const evaluateCondition = (cond, context) => {
|
|
14230
|
+
if (cond === undefined) return true; // No condition = always pass
|
|
14231
|
+
if (typeof cond === 'function') return cond(context); // Function condition
|
|
14232
|
+
return Boolean(cond); // Boolean condition
|
|
14233
|
+
};
|
|
14234
|
+
const config = breadCrumbConfig[view];
|
|
14235
|
+
console.log({
|
|
14236
|
+
config,
|
|
14237
|
+
breadCrumbConfig,
|
|
14238
|
+
breadCrumbsLabels,
|
|
14239
|
+
condition
|
|
14240
|
+
});
|
|
14241
|
+
if (config) {
|
|
14242
|
+
const conditionContext = {
|
|
14243
|
+
isDataStore,
|
|
14244
|
+
isAnalysis,
|
|
14245
|
+
isEdit,
|
|
14246
|
+
isView,
|
|
14247
|
+
id,
|
|
14248
|
+
view,
|
|
14249
|
+
t,
|
|
14250
|
+
goTo,
|
|
14251
|
+
getRedirectLink,
|
|
14252
|
+
changeNotificationState,
|
|
14253
|
+
addedItems
|
|
14254
|
+
};
|
|
14255
|
+
const externalConditionPassed = evaluateCondition(condition, conditionContext);
|
|
14256
|
+
const configConditionPassed = evaluateCondition(config.condition, conditionContext);
|
|
14257
|
+
if (!configConditionPassed) {
|
|
14258
|
+
if (config.fallback) {
|
|
14259
|
+
buildBreadCrumbs({
|
|
14260
|
+
config: config.fallback,
|
|
14261
|
+
items,
|
|
14262
|
+
t,
|
|
14263
|
+
breadCrumbsLabels,
|
|
14264
|
+
id,
|
|
14265
|
+
getRedirectLink,
|
|
14266
|
+
createOnClick,
|
|
14267
|
+
goTo,
|
|
14268
|
+
view
|
|
14269
|
+
});
|
|
14270
|
+
}
|
|
14271
|
+
} else if (!externalConditionPassed) {
|
|
14272
|
+
if (config.fallback) {
|
|
14273
|
+
// Use config fallback when prop condition fails
|
|
14274
|
+
buildBreadCrumbs({
|
|
14275
|
+
config: config.fallback,
|
|
14276
|
+
items,
|
|
14277
|
+
t,
|
|
14278
|
+
breadCrumbsLabels,
|
|
14279
|
+
id,
|
|
14280
|
+
getRedirectLink,
|
|
14281
|
+
createOnClick,
|
|
14282
|
+
goTo,
|
|
14283
|
+
view
|
|
14284
|
+
});
|
|
14285
|
+
} else {
|
|
14286
|
+
switch (conditionFallback) {
|
|
14287
|
+
case 'hide':
|
|
14288
|
+
break;
|
|
14289
|
+
case 'show-simplified':
|
|
14290
|
+
{
|
|
14291
|
+
const simplifiedConfig = {
|
|
14292
|
+
...config,
|
|
14293
|
+
path: config.path.slice(0, 2),
|
|
14294
|
+
includeId: false,
|
|
14295
|
+
suffix: undefined
|
|
14296
|
+
};
|
|
14297
|
+
buildBreadCrumbs({
|
|
14298
|
+
config: simplifiedConfig,
|
|
14299
|
+
items,
|
|
14300
|
+
t,
|
|
14301
|
+
breadCrumbsLabels,
|
|
14302
|
+
id,
|
|
14303
|
+
getRedirectLink,
|
|
14304
|
+
createOnClick,
|
|
14305
|
+
goTo,
|
|
14306
|
+
view
|
|
14307
|
+
});
|
|
14308
|
+
break;
|
|
14309
|
+
}
|
|
14310
|
+
case 'show-non-interactive':
|
|
14311
|
+
default:
|
|
14312
|
+
buildBreadCrumbs({
|
|
14313
|
+
config,
|
|
14314
|
+
items,
|
|
14315
|
+
t,
|
|
14316
|
+
breadCrumbsLabels,
|
|
14317
|
+
id,
|
|
14318
|
+
getRedirectLink,
|
|
14319
|
+
createOnClick,
|
|
14320
|
+
goTo,
|
|
14321
|
+
view,
|
|
14322
|
+
skipInteractions: true
|
|
14323
|
+
});
|
|
14324
|
+
break;
|
|
14325
|
+
}
|
|
14326
|
+
}
|
|
14327
|
+
} else {
|
|
14328
|
+
buildBreadCrumbs({
|
|
14329
|
+
config,
|
|
14330
|
+
items,
|
|
14331
|
+
t,
|
|
14332
|
+
breadCrumbsLabels,
|
|
14333
|
+
id,
|
|
14334
|
+
getRedirectLink,
|
|
14335
|
+
createOnClick,
|
|
14336
|
+
goTo,
|
|
14337
|
+
view
|
|
14338
|
+
});
|
|
14339
|
+
}
|
|
14340
|
+
}
|
|
14341
|
+
if (isView) {
|
|
14342
|
+
items.push({
|
|
14343
|
+
label: t(breadCrumbsLabels.details)
|
|
14344
|
+
});
|
|
14345
|
+
} else if (isEdit) {
|
|
14346
|
+
items.push({
|
|
14347
|
+
label: t(breadCrumbsLabels.edit)
|
|
14348
|
+
});
|
|
14349
|
+
} else if (isAnalysis) {
|
|
14350
|
+
items.push({
|
|
14351
|
+
label: t(breadCrumbsLabels.summary)
|
|
14352
|
+
});
|
|
14353
|
+
}
|
|
14354
|
+
items.push(...addedItems);
|
|
14355
|
+
return items.filter(v => !!v.label);
|
|
14356
|
+
};
|
|
14357
|
+
|
|
14358
|
+
// Breadcrumbs Config Helper
|
|
14359
|
+
|
|
14360
|
+
// 1.Simple static path
|
|
14361
|
+
// 'country-overview': {
|
|
14362
|
+
// path: ['analysis', 'country-overview'],
|
|
14363
|
+
// }
|
|
14364
|
+
// Result: Analysis > Country Overview
|
|
14365
|
+
// Neither is clickable
|
|
14366
|
+
|
|
14367
|
+
// 2.Clickable Parents with Links
|
|
14368
|
+
// 'mines': {
|
|
14369
|
+
// path: [
|
|
14370
|
+
// 'modules', // Not clickable
|
|
14371
|
+
// { key: 'mines', link: '/app/mines' } // Clickable, navigates to /app/mines
|
|
14372
|
+
// ],
|
|
14373
|
+
// }
|
|
14374
|
+
// Result: Modules > Mines (clickable)
|
|
14375
|
+
|
|
14376
|
+
// 3.Include ID at the end
|
|
14377
|
+
// 'partners': {
|
|
14378
|
+
// path: ['modules', { key: 'partners', link: '/app/partners', useRedirect: true }],
|
|
14379
|
+
// includeId: true, // ← ID will be added at the end
|
|
14380
|
+
// }
|
|
14381
|
+
// With id='ABC123':
|
|
14382
|
+
// Result: Modules > Partners (clickable) > ABC123 (not clickable)
|
|
14383
|
+
|
|
14384
|
+
// 4.Dynamic Id in the middle
|
|
14385
|
+
// 'mine-evaluation': {
|
|
14386
|
+
// path: [
|
|
14387
|
+
// 'modules',
|
|
14388
|
+
// { key: 'mines', link: '/app/mines' },
|
|
14389
|
+
// { key: 'id', link: (id) => `/app/mines/${id}` }, // ← ID here
|
|
14390
|
+
// 'evaluation',
|
|
14391
|
+
// ],
|
|
14392
|
+
// }
|
|
14393
|
+
// With id='MINE-456':
|
|
14394
|
+
// Result: Modules > Mines > MINE-456 (clickable to /app/mines/MINE-456) > Evaluation
|
|
14395
|
+
|
|
14396
|
+
// 5. Dynamic Links using functions
|
|
14397
|
+
// 'producers': {
|
|
14398
|
+
// path: [
|
|
14399
|
+
// 'modules',
|
|
14400
|
+
// {
|
|
14401
|
+
// key: 'producers',
|
|
14402
|
+
// link: (view) => `/app/${view}`, // ← Uses 'view' parameter
|
|
14403
|
+
// useRedirect: true
|
|
14404
|
+
// }
|
|
14405
|
+
// ],
|
|
14406
|
+
// includeId: true,
|
|
14407
|
+
// }
|
|
14408
|
+
// With view='producers':
|
|
14409
|
+
// Result: Modules > Producers (navigates to /app/producers)
|
|
14410
|
+
|
|
14411
|
+
// 6.use Redirect link
|
|
14412
|
+
// 'settings': {
|
|
14413
|
+
// path: [
|
|
14414
|
+
// {
|
|
14415
|
+
// key: 'settings',
|
|
14416
|
+
// link: '/app/view/settings',
|
|
14417
|
+
// useRedirect: true // ← Wraps with getRedirectLink()
|
|
14418
|
+
// }
|
|
14419
|
+
// ],
|
|
14420
|
+
// }
|
|
14421
|
+
// Navigation will use getRedirectLink('/app/view/settings')
|
|
14422
|
+
|
|
14423
|
+
// 7.Conditional Rendering
|
|
14424
|
+
// 'entities': {
|
|
14425
|
+
// condition: (opts) => opts.isDataStore, // ← Only shows if isDataStore=true
|
|
14426
|
+
// path: [
|
|
14427
|
+
// 'data',
|
|
14428
|
+
// { key: 'data-store', link: '/app/data-store', useRedirect: true },
|
|
14429
|
+
// { key: 'entities', link: '/app/data-store/entities', useRedirect: true },
|
|
14430
|
+
// ],
|
|
14431
|
+
// }
|
|
14432
|
+
// With isDataStore=false: No breadcrumbs shown
|
|
14433
|
+
// With isDataStore=true: Data > Store > Entities
|
|
14434
|
+
|
|
14435
|
+
// 8.Conditional Fallback
|
|
14436
|
+
// 'locations': {
|
|
14437
|
+
// condition: (opts) => opts.isDataStore,
|
|
14438
|
+
// path: [
|
|
14439
|
+
// 'data',
|
|
14440
|
+
// { key: 'data-store', link: '/app/data-store', useRedirect: true },
|
|
14441
|
+
// { key: 'locations', link: '/app/data-store/locations', useRedirect: true },
|
|
14442
|
+
// ],
|
|
14443
|
+
// fallback: { // ← Alternative when condition is false
|
|
14444
|
+
// path: [
|
|
14445
|
+
// 'modules',
|
|
14446
|
+
// 'linkedSubjects',
|
|
14447
|
+
// { key: 'locations', link: '/app/locations', useRedirect: true },
|
|
14448
|
+
// ],
|
|
14449
|
+
// includeId: true,
|
|
14450
|
+
// },
|
|
14451
|
+
// }
|
|
14452
|
+
// isDataStore=true: Data > Store > Locations
|
|
14453
|
+
// isDataStore=false: Modules > Associated Information > Locations > {id}
|
|
14454
|
+
|
|
14455
|
+
// 9. Suffix items
|
|
14456
|
+
// 'mine-monitoring': {
|
|
14457
|
+
// path: [
|
|
14458
|
+
// 'modules',
|
|
14459
|
+
// { key: 'mines', link: '/app/mines' }
|
|
14460
|
+
// ],
|
|
14461
|
+
// includeId: true,
|
|
14462
|
+
// suffix: ['visits'], // ← Added at the end
|
|
14463
|
+
// }
|
|
14464
|
+
// With id='MINE-789':
|
|
14465
|
+
// Result: Modules > Mines > MINE-789 > Visits
|
|
14466
|
+
|
|
14467
|
+
// 10. Complex multi level path
|
|
14468
|
+
// 'monitoringReport': {
|
|
14469
|
+
// path: [
|
|
14470
|
+
// 'modules', // Static label
|
|
14471
|
+
// { key: 'mines', link: '/app/mines' }, // Clickable parent
|
|
14472
|
+
// { key: 'id', link: (id) => `/app/mines/${id}` }, // Dynamic ID with link
|
|
14473
|
+
// 'monitoringReport', // Static label at end
|
|
14474
|
+
// ],
|
|
14475
|
+
// }
|
|
14476
|
+
// With id='MINE-999':
|
|
14477
|
+
// Result: Modules > Mines (→/app/mines) > MINE-999 (→/app/mines/MINE-999) > Executive Monitoring Report
|
|
14478
|
+
|
|
14479
|
+
// 11. Access multiple options in condition
|
|
14480
|
+
// 'custom-view': {
|
|
14481
|
+
// condition: (opts) => opts.isDataStore && opts.isEdit && opts.id,
|
|
14482
|
+
// path: ['data', 'custom'],
|
|
14483
|
+
// }
|
|
14484
|
+
// Available in opts: { isDataStore, isAnalysis, isEdit, isView, id, view }
|
|
14485
|
+
|
|
14142
14486
|
exports.ErrorFormat = ErrorFormat;
|
|
14143
14487
|
exports.MessageTypes = MessageTypes;
|
|
14144
14488
|
exports.StorageManager = StorageManager;
|
|
14145
14489
|
exports.assignParamsToUrl = assignParamsToUrl;
|
|
14146
14490
|
exports.btn = button;
|
|
14147
14491
|
exports.buildActionWidgetsConfig = buildActionWidgetsConfig;
|
|
14492
|
+
exports.buildBreadCrumbsHelper = buildBreadCrumbs;
|
|
14148
14493
|
exports.buildBreadcrumbs = buildBreadcrumbs;
|
|
14149
14494
|
exports.buildKeyIndicatorsConfig = buildKeyIndicatorsConfig;
|
|
14150
14495
|
exports.buildQueryString = buildQueryString;
|
|
@@ -14209,6 +14554,7 @@ exports.modules = modules;
|
|
|
14209
14554
|
exports.nowToIso = nowToIso;
|
|
14210
14555
|
exports.processConfig = processConfig;
|
|
14211
14556
|
exports.propHasValue = propHasValue;
|
|
14557
|
+
exports.renderBreadCrumbs = renderBreadCrumbs;
|
|
14212
14558
|
exports.renderDateFormatted = renderDateFormatted;
|
|
14213
14559
|
exports.renderNumber = renderNumber;
|
|
14214
14560
|
exports.renderPercentage = renderPercentage;
|