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/components/index.js
CHANGED
|
@@ -9689,28 +9689,30 @@ const handleSectionChildren = _ref => {
|
|
|
9689
9689
|
});
|
|
9690
9690
|
};
|
|
9691
9691
|
|
|
9692
|
-
const handleArrayChildren =
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9692
|
+
const handleArrayChildren = _ref => {
|
|
9693
|
+
let {
|
|
9694
|
+
value,
|
|
9695
|
+
config,
|
|
9696
|
+
label,
|
|
9697
|
+
level,
|
|
9698
|
+
t,
|
|
9699
|
+
rootForm,
|
|
9700
|
+
allData,
|
|
9701
|
+
user,
|
|
9702
|
+
getApiBaseUrl = () => {},
|
|
9703
|
+
getAppHeader = () => {},
|
|
9704
|
+
app,
|
|
9705
|
+
TreeNodeComponent
|
|
9706
|
+
} = _ref;
|
|
9706
9707
|
if (!Array.isArray(value)) {
|
|
9707
9708
|
return null;
|
|
9708
9709
|
}
|
|
9709
9710
|
return value.map((item, itemIndex) => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9710
9711
|
className: "array-item",
|
|
9711
9712
|
children: Object.keys(config.inputs).sort((a, b) => {
|
|
9712
|
-
|
|
9713
|
-
const
|
|
9713
|
+
var _config$inputs$a, _config$inputs$b;
|
|
9714
|
+
const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
|
|
9715
|
+
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9714
9716
|
return positionA - positionB;
|
|
9715
9717
|
}).map(subInputKey => {
|
|
9716
9718
|
const subInputConfig = config.inputs[subInputKey];
|
|
@@ -9728,9 +9730,9 @@ const handleArrayChildren = ({
|
|
|
9728
9730
|
getApiBaseUrl: getApiBaseUrl,
|
|
9729
9731
|
getAppHeader: getAppHeader,
|
|
9730
9732
|
app: app
|
|
9731
|
-
},
|
|
9733
|
+
}, "".concat(itemIndex, "-").concat(subInputKey));
|
|
9732
9734
|
})
|
|
9733
|
-
},
|
|
9735
|
+
}, "".concat(itemIndex)));
|
|
9734
9736
|
};
|
|
9735
9737
|
|
|
9736
9738
|
const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
|
|
@@ -9875,44 +9877,44 @@ function useAjaxModal$2({
|
|
|
9875
9877
|
}
|
|
9876
9878
|
|
|
9877
9879
|
const mergeObject = obj => {
|
|
9878
|
-
return Object.entries(obj || {}).reduce((acc,
|
|
9879
|
-
let [key, value] = _ref;
|
|
9880
|
+
return Object.entries(obj || {}).reduce((acc, [key, value]) => {
|
|
9880
9881
|
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
9881
|
-
return
|
|
9882
|
+
return {
|
|
9883
|
+
...acc,
|
|
9884
|
+
...value
|
|
9885
|
+
};
|
|
9882
9886
|
}
|
|
9883
|
-
return
|
|
9887
|
+
return {
|
|
9888
|
+
...acc,
|
|
9884
9889
|
[key]: value
|
|
9885
|
-
}
|
|
9890
|
+
};
|
|
9886
9891
|
}, {});
|
|
9887
9892
|
};
|
|
9888
|
-
const handleDataLinkGroupWithTableKeys =
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
TreeNodeComponent
|
|
9904
|
-
} = _ref2;
|
|
9893
|
+
const handleDataLinkGroupWithTableKeys = ({
|
|
9894
|
+
config,
|
|
9895
|
+
inputConfig,
|
|
9896
|
+
inputKey,
|
|
9897
|
+
value,
|
|
9898
|
+
level,
|
|
9899
|
+
t,
|
|
9900
|
+
rootForm,
|
|
9901
|
+
allData,
|
|
9902
|
+
user,
|
|
9903
|
+
getApiBaseUrl = () => {},
|
|
9904
|
+
getAppHeader = () => {},
|
|
9905
|
+
app,
|
|
9906
|
+
TreeNodeComponent
|
|
9907
|
+
}) => {
|
|
9905
9908
|
if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
|
|
9906
9909
|
return null;
|
|
9907
9910
|
}
|
|
9908
|
-
if (
|
|
9911
|
+
if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
|
|
9909
9912
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
9910
9913
|
const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
|
|
9911
9914
|
const otherConfig = config.inputs[otherInputKey];
|
|
9912
|
-
if (
|
|
9913
|
-
|
|
9914
|
-
const
|
|
9915
|
-
const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
|
|
9915
|
+
if (otherConfig?.type === 'dataLink') {
|
|
9916
|
+
const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
|
|
9917
|
+
const additionalTableKeys = config.meta?.additionalTableKeys || [];
|
|
9916
9918
|
const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
|
|
9917
9919
|
return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
|
|
9918
9920
|
}
|
|
@@ -9926,26 +9928,23 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
9926
9928
|
return null;
|
|
9927
9929
|
}
|
|
9928
9930
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
9929
|
-
const additionalTableKeys =
|
|
9931
|
+
const additionalTableKeys = config.meta?.additionalTableKeys || [];
|
|
9930
9932
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
9931
9933
|
const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
|
|
9932
9934
|
[...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
|
|
9933
|
-
const isAjaxModal = React.useMemo(() =>
|
|
9934
|
-
var _inputConfig$meta2;
|
|
9935
|
-
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
9936
|
-
}, [inputConfig]);
|
|
9935
|
+
const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
|
|
9937
9936
|
const ajaxModalValues = useAjaxModal$2({
|
|
9938
9937
|
name: inputKey,
|
|
9939
9938
|
user,
|
|
9940
|
-
namespace: inputConfig
|
|
9941
|
-
skipFetch: inputConfig
|
|
9939
|
+
namespace: inputConfig?.meta?.namespace,
|
|
9940
|
+
skipFetch: inputConfig?.meta?.skipFetch,
|
|
9942
9941
|
isAjaxModal,
|
|
9943
|
-
formScope: inputConfig
|
|
9942
|
+
formScope: inputConfig?.meta?.formScope,
|
|
9944
9943
|
APP: app,
|
|
9945
9944
|
apiBaseUrl: getApiBaseUrl(),
|
|
9946
9945
|
_getAppHeader: getAppHeader
|
|
9947
9946
|
});
|
|
9948
|
-
const dataLinkForm = ajaxModalValues
|
|
9947
|
+
const dataLinkForm = ajaxModalValues?.form;
|
|
9949
9948
|
const createInputsAndValues = item => {
|
|
9950
9949
|
const inputs = {};
|
|
9951
9950
|
const values = {};
|
|
@@ -9957,12 +9956,12 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
9957
9956
|
'videos': 'Video'
|
|
9958
9957
|
};
|
|
9959
9958
|
tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
|
|
9960
|
-
|
|
9961
|
-
const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
|
|
9959
|
+
const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
|
|
9962
9960
|
if (formInputConfig) {
|
|
9963
|
-
inputs[tableKey] =
|
|
9961
|
+
inputs[tableKey] = {
|
|
9962
|
+
...formInputConfig,
|
|
9964
9963
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
9965
|
-
}
|
|
9964
|
+
};
|
|
9966
9965
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
9967
9966
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
9968
9967
|
let resolvedLabel = null;
|
|
@@ -9970,7 +9969,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
9970
9969
|
const parts = labelKey.split(' is ');
|
|
9971
9970
|
if (parts.length === 2) {
|
|
9972
9971
|
const [conditionKey, conditionValue] = parts;
|
|
9973
|
-
if (
|
|
9972
|
+
if (item?.[conditionKey] === conditionValue) {
|
|
9974
9973
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
9975
9974
|
break;
|
|
9976
9975
|
}
|
|
@@ -9978,37 +9977,37 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
9978
9977
|
}
|
|
9979
9978
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
9980
9979
|
}
|
|
9981
|
-
values[tableKey] = item
|
|
9980
|
+
values[tableKey] = item?.[tableKey];
|
|
9982
9981
|
} else {
|
|
9983
|
-
var _item$linking;
|
|
9984
9982
|
inputs[tableKey] = {
|
|
9985
9983
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
9986
|
-
type: inputConfig
|
|
9984
|
+
type: inputConfig?.type
|
|
9987
9985
|
};
|
|
9988
|
-
values[tableKey] =
|
|
9986
|
+
values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
|
|
9989
9987
|
}
|
|
9990
9988
|
});
|
|
9991
9989
|
siblingInputsMatchingTableKeys.forEach(siblingKey => {
|
|
9992
9990
|
const siblingConfig = config.inputs[siblingKey];
|
|
9993
9991
|
if (siblingConfig) {
|
|
9994
|
-
inputs[siblingKey] =
|
|
9992
|
+
inputs[siblingKey] = {
|
|
9993
|
+
...siblingConfig,
|
|
9995
9994
|
label: siblingConfig.label || siblingKey
|
|
9996
|
-
}
|
|
9997
|
-
values[siblingKey] = item
|
|
9995
|
+
};
|
|
9996
|
+
values[siblingKey] = item?.[siblingKey];
|
|
9998
9997
|
}
|
|
9999
9998
|
});
|
|
10000
|
-
if (dataLinkForm
|
|
9999
|
+
if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
|
|
10001
10000
|
Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
|
|
10002
10001
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10003
10002
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10004
10003
|
}).forEach(fieldKey => {
|
|
10005
|
-
var _item$linking2;
|
|
10006
10004
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10007
|
-
inputs[fieldKey] =
|
|
10005
|
+
inputs[fieldKey] = {
|
|
10006
|
+
...formInputConfig,
|
|
10008
10007
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10009
|
-
}
|
|
10010
|
-
if (formInputConfig
|
|
10011
|
-
const dynamicLabelKeys = Object.keys(formInputConfig
|
|
10008
|
+
};
|
|
10009
|
+
if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
|
|
10010
|
+
const dynamicLabelKeys = Object.keys(formInputConfig?.label);
|
|
10012
10011
|
let resolvedLabel = null;
|
|
10013
10012
|
for (const labelKey of dynamicLabelKeys) {
|
|
10014
10013
|
const parts = labelKey.split(' is ');
|
|
@@ -10017,7 +10016,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10017
10016
|
const flattenedItem = Object.assign({}, item.location, {
|
|
10018
10017
|
address: item.address
|
|
10019
10018
|
});
|
|
10020
|
-
if (
|
|
10019
|
+
if (flattenedItem?.[conditionKey] === conditionValue) {
|
|
10021
10020
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10022
10021
|
break;
|
|
10023
10022
|
}
|
|
@@ -10025,7 +10024,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10025
10024
|
}
|
|
10026
10025
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10027
10026
|
}
|
|
10028
|
-
values[fieldKey] =
|
|
10027
|
+
values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
|
|
10029
10028
|
});
|
|
10030
10029
|
}
|
|
10031
10030
|
return {
|
|
@@ -10035,17 +10034,16 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10035
10034
|
};
|
|
10036
10035
|
if (Array.isArray(value)) {
|
|
10037
10036
|
return value.map((item, itemIndex) => {
|
|
10038
|
-
var _merged$inputKey;
|
|
10039
10037
|
const merged = mergeObject(item);
|
|
10040
|
-
const datastakeIdValue =
|
|
10038
|
+
const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
|
|
10041
10039
|
const {
|
|
10042
10040
|
inputs,
|
|
10043
10041
|
values
|
|
10044
10042
|
} = createInputsAndValues(merged);
|
|
10045
10043
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10046
|
-
nodeKey: datastakeIdValue || t(
|
|
10044
|
+
nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10047
10045
|
config: {
|
|
10048
|
-
label: datastakeIdValue || t(
|
|
10046
|
+
label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10049
10047
|
type: 'custom-datalink-group',
|
|
10050
10048
|
inputs: inputs
|
|
10051
10049
|
},
|
|
@@ -10059,12 +10057,11 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10059
10057
|
getApiBaseUrl: getApiBaseUrl,
|
|
10060
10058
|
getAppHeader: getAppHeader,
|
|
10061
10059
|
app: app
|
|
10062
|
-
},
|
|
10060
|
+
}, `${inputKey}-${itemIndex}`);
|
|
10063
10061
|
});
|
|
10064
10062
|
} else {
|
|
10065
|
-
var _merged$inputKey2;
|
|
10066
10063
|
const merged = mergeObject(value);
|
|
10067
|
-
const datastakeIdValue =
|
|
10064
|
+
const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
|
|
10068
10065
|
const {
|
|
10069
10066
|
inputs,
|
|
10070
10067
|
values
|
|
@@ -10086,7 +10083,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10086
10083
|
getApiBaseUrl: getApiBaseUrl,
|
|
10087
10084
|
getAppHeader: getAppHeader,
|
|
10088
10085
|
app: app
|
|
10089
|
-
},
|
|
10086
|
+
}, `${inputKey}-group`);
|
|
10090
10087
|
}
|
|
10091
10088
|
};
|
|
10092
10089
|
|
|
@@ -30406,6 +30403,7 @@ const EditForm$1 = _ref => {
|
|
|
30406
30403
|
}), changeLinking, changeInputMeta, t, highlightMandatory)
|
|
30407
30404
|
}, i);
|
|
30408
30405
|
} else {
|
|
30406
|
+
var _input$meta16;
|
|
30409
30407
|
const inputId = input.dataId || k;
|
|
30410
30408
|
const value = values[inputId];
|
|
30411
30409
|
const commentValue = (inputsMeta[k] || {}).comment;
|
|
@@ -30419,7 +30417,7 @@ const EditForm$1 = _ref => {
|
|
|
30419
30417
|
children: [getFormTitles$1(formTitles, inputData.name, i), /*#__PURE__*/jsxRuntime.jsx(GetFormItem$1, {
|
|
30420
30418
|
inputKey: k,
|
|
30421
30419
|
inputData: inputData,
|
|
30422
|
-
inputId: inputId,
|
|
30420
|
+
inputId: (input === null || input === void 0 ? void 0 : input.type) === "dataLink" ? (input === null || input === void 0 || (_input$meta16 = input.meta) === null || _input$meta16 === void 0 ? void 0 : _input$meta16.path) || inputId : inputId,
|
|
30423
30421
|
input: input,
|
|
30424
30422
|
highlightMandatory: highlightMandatory,
|
|
30425
30423
|
changeInputMeta: changeInputMeta,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const defaultBreadCrumbsLabels = {
|
|
6
|
+
events: "Events",
|
|
7
|
+
accounts: "Accounts",
|
|
8
|
+
modules: "Modules",
|
|
9
|
+
settings: "Settings",
|
|
10
|
+
user: "Users",
|
|
11
|
+
analysis: "Analysis",
|
|
12
|
+
'data-store': "Data Store",
|
|
13
|
+
data: "Data",
|
|
14
|
+
partners: "Partners",
|
|
15
|
+
locations: "Locations",
|
|
16
|
+
'information-channels': 'Channels',
|
|
17
|
+
'find-information': 'Query',
|
|
18
|
+
stakeholders: "Stakeholders",
|
|
19
|
+
documents: "Documents",
|
|
20
|
+
mines: "Mines",
|
|
21
|
+
summary: "Summary",
|
|
22
|
+
edit: "Edit",
|
|
23
|
+
details: "Details"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.defaultBreadCrumbsLabels = defaultBreadCrumbsLabels;
|