datastake-daf 0.6.766 → 0.6.767
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 +174 -106
- package/dist/pages/index.js +102 -31
- package/dist/utils/index.js +16 -1
- package/package.json +4 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -2
- package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +31 -1
- package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +8 -4
- package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/create.jsx +106 -0
- package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +115 -0
- package/src/@daf/hooks/useMapHelper.js +5 -0
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +5 -2
- package/src/@daf/pages/Events/helper.js +0 -1
- package/src/@daf/pages/Locations/MineSite/columns.js +1 -1
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +5 -1
- package/src/constants/locales/en/translation.js +5 -0
- package/src/constants/locales/fr/translation.js +5 -0
package/dist/components/index.js
CHANGED
|
@@ -9522,29 +9522,24 @@ const processConditionalTableKeys = (tableKeys, item) => {
|
|
|
9522
9522
|
});
|
|
9523
9523
|
return processedKeys;
|
|
9524
9524
|
};
|
|
9525
|
-
const renderFieldData =
|
|
9526
|
-
let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
|
|
9527
|
-
let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
|
|
9528
|
-
let app = arguments.length > 6 ? arguments[6] : undefined;
|
|
9529
|
-
let allValues = arguments.length > 7 ? arguments[7] : undefined;
|
|
9530
|
-
let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
|
|
9525
|
+
const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
|
|
9531
9526
|
switch (type) {
|
|
9532
9527
|
case 'year':
|
|
9533
9528
|
return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
|
|
9534
9529
|
case 'date':
|
|
9535
9530
|
{
|
|
9536
|
-
const language = user
|
|
9531
|
+
const language = user?.language && user?.language === 'sp' ? 'es' : user?.language;
|
|
9537
9532
|
return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
|
|
9538
9533
|
}
|
|
9539
9534
|
case 'select':
|
|
9540
9535
|
{
|
|
9541
|
-
const options =
|
|
9536
|
+
const options = config?.options || [];
|
|
9542
9537
|
const option = findOptions(value, options);
|
|
9543
9538
|
return option;
|
|
9544
9539
|
}
|
|
9545
9540
|
case 'multiselect':
|
|
9546
9541
|
{
|
|
9547
|
-
const options =
|
|
9542
|
+
const options = config?.options || [];
|
|
9548
9543
|
const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
|
|
9549
9544
|
const option = findOptions(_val, options);
|
|
9550
9545
|
return option.join(', ');
|
|
@@ -9559,7 +9554,7 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9559
9554
|
formValues: formValues
|
|
9560
9555
|
});
|
|
9561
9556
|
case 'percentage':
|
|
9562
|
-
return value === '-' || value === null || value === undefined ? '-' :
|
|
9557
|
+
return value === '-' || value === null || value === undefined ? '-' : `${value} %`;
|
|
9563
9558
|
case 'geolocation':
|
|
9564
9559
|
{
|
|
9565
9560
|
const val = JSON.parse(value) || {};
|
|
@@ -9573,7 +9568,7 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9573
9568
|
case 'upload':
|
|
9574
9569
|
case 'videoUpload':
|
|
9575
9570
|
{
|
|
9576
|
-
const documentName = allValues
|
|
9571
|
+
const documentName = allValues?.map(item => item?.name).join(', ');
|
|
9577
9572
|
return documentName;
|
|
9578
9573
|
}
|
|
9579
9574
|
default:
|
|
@@ -9581,27 +9576,25 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9581
9576
|
}
|
|
9582
9577
|
};
|
|
9583
9578
|
|
|
9584
|
-
const renderValue =
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
if (!(config !== null && config !== void 0 && config.inputs)) return null;
|
|
9579
|
+
const renderValue = ({
|
|
9580
|
+
value,
|
|
9581
|
+
hasChildren,
|
|
9582
|
+
config,
|
|
9583
|
+
user,
|
|
9584
|
+
getApiBaseUrl = () => {},
|
|
9585
|
+
getAppHeader = () => {},
|
|
9586
|
+
app,
|
|
9587
|
+
allData = {}
|
|
9588
|
+
}) => {
|
|
9589
|
+
if (config?.type === 'groupInputs') {
|
|
9590
|
+
if (!config?.inputs) return null;
|
|
9597
9591
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
9598
|
-
|
|
9599
|
-
const
|
|
9600
|
-
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9592
|
+
const positionA = config.inputs[a]?.position || 0;
|
|
9593
|
+
const positionB = config.inputs[b]?.position || 0;
|
|
9601
9594
|
return positionA - positionB;
|
|
9602
9595
|
});
|
|
9603
9596
|
const values = inputKeys.map(inputKey => {
|
|
9604
|
-
let inputValue = value
|
|
9597
|
+
let inputValue = value?.[inputKey];
|
|
9605
9598
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
9606
9599
|
return '';
|
|
9607
9600
|
} else if (typeof inputValue === 'object' && inputValue !== null) {
|
|
@@ -9642,8 +9635,8 @@ const renderValue = _ref => {
|
|
|
9642
9635
|
} else {
|
|
9643
9636
|
displayValue = String(value);
|
|
9644
9637
|
}
|
|
9645
|
-
const fieldType =
|
|
9646
|
-
let cssClass =
|
|
9638
|
+
const fieldType = config?.type || 'text';
|
|
9639
|
+
let cssClass = `tree-value ${fieldType}-type`;
|
|
9647
9640
|
if (displayValue === '-') {
|
|
9648
9641
|
cssClass += ' empty';
|
|
9649
9642
|
}
|
|
@@ -9653,21 +9646,19 @@ const renderValue = _ref => {
|
|
|
9653
9646
|
children: displayValue
|
|
9654
9647
|
});
|
|
9655
9648
|
};
|
|
9656
|
-
const determineHasChildren =
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
} = _ref2;
|
|
9662
|
-
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9649
|
+
const determineHasChildren = ({
|
|
9650
|
+
config,
|
|
9651
|
+
level
|
|
9652
|
+
}) => {
|
|
9653
|
+
if (config?.type === 'groupInputs') {
|
|
9663
9654
|
return false;
|
|
9664
9655
|
}
|
|
9665
|
-
if (
|
|
9656
|
+
if (config?.type === 'header' && config?.inputs && Object.keys(config.inputs).length > 0) {
|
|
9666
9657
|
return true;
|
|
9667
9658
|
}
|
|
9668
|
-
return
|
|
9659
|
+
return config?.inputs || config?.type === 'group' || config?.type === 'dataLinkGroup' || config?.type === 'section' || config?.type === 'ajaxSubGroup' ||
|
|
9669
9660
|
// Add this line
|
|
9670
|
-
|
|
9661
|
+
config?.type === 'dataLink' && config?.meta?.tableKeys || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
|
|
9671
9662
|
};
|
|
9672
9663
|
|
|
9673
9664
|
const sortByPosition = (items, getConfig) => {
|
|
@@ -10156,37 +10147,42 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10156
10147
|
}
|
|
10157
10148
|
};
|
|
10158
10149
|
|
|
10159
|
-
const handleDataLinkWithTableKeys =
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10150
|
+
const handleDataLinkWithTableKeys = _ref => {
|
|
10151
|
+
var _inputConfig$meta, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
|
|
10152
|
+
let {
|
|
10153
|
+
inputConfig,
|
|
10154
|
+
inputKey,
|
|
10155
|
+
value,
|
|
10156
|
+
level,
|
|
10157
|
+
t,
|
|
10158
|
+
rootForm,
|
|
10159
|
+
allData,
|
|
10160
|
+
user,
|
|
10161
|
+
getApiBaseUrl = () => {},
|
|
10162
|
+
getAppHeader = () => {},
|
|
10163
|
+
app,
|
|
10164
|
+
TreeNodeComponent
|
|
10165
|
+
} = _ref;
|
|
10166
|
+
if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
|
|
10174
10167
|
return null;
|
|
10175
10168
|
}
|
|
10176
10169
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
10177
|
-
const isAjaxModal = React.useMemo(() =>
|
|
10170
|
+
const isAjaxModal = React.useMemo(() => {
|
|
10171
|
+
var _inputConfig$meta2;
|
|
10172
|
+
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
10173
|
+
}, [inputConfig]);
|
|
10178
10174
|
const ajaxModalValues = useAjaxModal$2({
|
|
10179
10175
|
name: inputKey,
|
|
10180
10176
|
user,
|
|
10181
|
-
namespace: inputConfig
|
|
10182
|
-
skipFetch: inputConfig
|
|
10177
|
+
namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
|
|
10178
|
+
skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
|
|
10183
10179
|
isAjaxModal,
|
|
10184
|
-
formScope: inputConfig
|
|
10180
|
+
formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
|
|
10185
10181
|
APP: app,
|
|
10186
10182
|
apiBaseUrl: getApiBaseUrl(),
|
|
10187
10183
|
_getAppHeader: getAppHeader
|
|
10188
10184
|
});
|
|
10189
|
-
const dataLinkForm = ajaxModalValues
|
|
10185
|
+
const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
|
|
10190
10186
|
const createInputsAndValues = item => {
|
|
10191
10187
|
const inputs = {};
|
|
10192
10188
|
const values = {};
|
|
@@ -10199,19 +10195,20 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10199
10195
|
};
|
|
10200
10196
|
const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
|
|
10201
10197
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10202
|
-
const itemValue = itemToCheck
|
|
10198
|
+
const itemValue = itemToCheck === null || itemToCheck === void 0 ? void 0 : itemToCheck[fieldKey];
|
|
10203
10199
|
return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
|
|
10204
10200
|
}
|
|
10205
10201
|
return false;
|
|
10206
10202
|
};
|
|
10207
10203
|
const processedTableKeys = processConditionalTableKeys(tableKeys, item);
|
|
10208
10204
|
processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
|
|
10209
|
-
|
|
10205
|
+
var _dataLinkForm$identif;
|
|
10206
|
+
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]);
|
|
10210
10207
|
if (formInputConfig) {
|
|
10211
|
-
|
|
10212
|
-
|
|
10208
|
+
var _item$linking, _formInputConfig$meta, _formInputConfig$tabl;
|
|
10209
|
+
inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10213
10210
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
10214
|
-
};
|
|
10211
|
+
});
|
|
10215
10212
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10216
10213
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10217
10214
|
let resolvedLabel = null;
|
|
@@ -10219,7 +10216,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10219
10216
|
const parts = labelKey.split(' is ');
|
|
10220
10217
|
if (parts.length === 2) {
|
|
10221
10218
|
const [conditionKey, conditionValue] = parts;
|
|
10222
|
-
if (item
|
|
10219
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
10223
10220
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10224
10221
|
break;
|
|
10225
10222
|
}
|
|
@@ -10227,16 +10224,17 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10227
10224
|
}
|
|
10228
10225
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
10229
10226
|
}
|
|
10230
|
-
values[tableKey] = item
|
|
10227
|
+
values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$meta = formInputConfig.meta) === null || _formInputConfig$meta === void 0 ? void 0 : _formInputConfig$meta.onNewSetValueKey] || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl = formInputConfig.tableLabel) === null || _formInputConfig$tabl === void 0 ? void 0 : _formInputConfig$tabl.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[tableKey]);
|
|
10231
10228
|
} else {
|
|
10229
|
+
var _item$linking2;
|
|
10232
10230
|
inputs[tableKey] = {
|
|
10233
10231
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
10234
|
-
type: inputConfig
|
|
10232
|
+
type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
|
|
10235
10233
|
};
|
|
10236
|
-
values[tableKey] = item
|
|
10234
|
+
values[tableKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
|
|
10237
10235
|
}
|
|
10238
10236
|
});
|
|
10239
|
-
if (dataLinkForm
|
|
10237
|
+
if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
|
|
10240
10238
|
Object.keys(dataLinkForm.identification).filter(fieldKey => {
|
|
10241
10239
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10242
10240
|
return !isUploadFieldEmpty(fieldKey, item);
|
|
@@ -10246,11 +10244,11 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10246
10244
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10247
10245
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10248
10246
|
}).forEach(fieldKey => {
|
|
10247
|
+
var _item$linking3, _formInputConfig$tabl2;
|
|
10249
10248
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10250
|
-
inputs[fieldKey] = {
|
|
10251
|
-
...formInputConfig,
|
|
10249
|
+
inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10252
10250
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10253
|
-
};
|
|
10251
|
+
});
|
|
10254
10252
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10255
10253
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10256
10254
|
let resolvedLabel = null;
|
|
@@ -10258,7 +10256,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10258
10256
|
const parts = labelKey.split(' is ');
|
|
10259
10257
|
if (parts.length === 2) {
|
|
10260
10258
|
const [conditionKey, conditionValue] = parts;
|
|
10261
|
-
if (item
|
|
10259
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
10262
10260
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10263
10261
|
break;
|
|
10264
10262
|
}
|
|
@@ -10266,7 +10264,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10266
10264
|
}
|
|
10267
10265
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10268
10266
|
}
|
|
10269
|
-
values[fieldKey] = item
|
|
10267
|
+
values[fieldKey] = (item === null || item === void 0 || (_item$linking3 = item.linking) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3.SCL) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking3 === void 0 ? void 0 : _item$linking3.name) || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl2 = formInputConfig.tableLabel) === null || _formInputConfig$tabl2 === void 0 ? void 0 : _formInputConfig$tabl2.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
|
|
10270
10268
|
});
|
|
10271
10269
|
}
|
|
10272
10270
|
return {
|
|
@@ -10276,7 +10274,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10276
10274
|
};
|
|
10277
10275
|
if (Array.isArray(value)) {
|
|
10278
10276
|
return value.map((item, itemIndex) => {
|
|
10279
|
-
const datastakeIdValue = item
|
|
10277
|
+
const datastakeIdValue = item === null || item === void 0 ? void 0 : item.datastakeId;
|
|
10280
10278
|
const {
|
|
10281
10279
|
inputs,
|
|
10282
10280
|
values
|
|
@@ -10285,9 +10283,9 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10285
10283
|
return null;
|
|
10286
10284
|
}
|
|
10287
10285
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10288
|
-
nodeKey: datastakeIdValue || t(
|
|
10286
|
+
nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10289
10287
|
config: {
|
|
10290
|
-
label: datastakeIdValue || t(
|
|
10288
|
+
label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10291
10289
|
type: 'custom-datalink',
|
|
10292
10290
|
inputs: inputs
|
|
10293
10291
|
},
|
|
@@ -10301,10 +10299,10 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10301
10299
|
getApiBaseUrl: getApiBaseUrl,
|
|
10302
10300
|
getAppHeader: getAppHeader,
|
|
10303
10301
|
app: app
|
|
10304
|
-
},
|
|
10302
|
+
}, "".concat(inputKey, "-").concat(itemIndex));
|
|
10305
10303
|
});
|
|
10306
10304
|
} else {
|
|
10307
|
-
const datastakeIdValue = value
|
|
10305
|
+
const datastakeIdValue = value === null || value === void 0 ? void 0 : value.datastakeId;
|
|
10308
10306
|
const {
|
|
10309
10307
|
inputs,
|
|
10310
10308
|
values
|
|
@@ -10329,7 +10327,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10329
10327
|
getApiBaseUrl: getApiBaseUrl,
|
|
10330
10328
|
getAppHeader: getAppHeader,
|
|
10331
10329
|
app: app
|
|
10332
|
-
},
|
|
10330
|
+
}, "".concat(inputKey, "-single"));
|
|
10333
10331
|
}
|
|
10334
10332
|
};
|
|
10335
10333
|
|
|
@@ -12731,7 +12729,12 @@ const defaultMapConfig = {
|
|
|
12731
12729
|
maxZoom: 18,
|
|
12732
12730
|
preferCanvas: true,
|
|
12733
12731
|
zoomControl: false,
|
|
12734
|
-
maxBounds: maxBounds
|
|
12732
|
+
maxBounds: maxBounds,
|
|
12733
|
+
zoomSnap: 0.5,
|
|
12734
|
+
zoomDelta: 0.5,
|
|
12735
|
+
wheelPxPerZoomLevel: 150,
|
|
12736
|
+
zoomAnimation: true,
|
|
12737
|
+
zoomAnimationThreshold: 10
|
|
12735
12738
|
};
|
|
12736
12739
|
const filterValidGPS$1 = data => {
|
|
12737
12740
|
const latCheck = lat => lat > -90 || lat < 90;
|
|
@@ -13632,7 +13635,7 @@ function StakeholderIcon$1({
|
|
|
13632
13635
|
onClickLink(data);
|
|
13633
13636
|
}
|
|
13634
13637
|
}),
|
|
13635
|
-
getPopupContainer: () => document.getElementById(
|
|
13638
|
+
getPopupContainer: () => document.getElementById("map"),
|
|
13636
13639
|
children: /*#__PURE__*/jsxRuntime.jsx(StakeholderMarker, {
|
|
13637
13640
|
className: `${data.type} ${isSelected ? "selected" : selectedMarkersId.length > 0 ? "unselected" : ""}
|
|
13638
13641
|
${isSmall ? "small" : isMedium ? "medium" : "large"}
|
|
@@ -13835,8 +13838,7 @@ function LocationIcon({
|
|
|
13835
13838
|
// isHovering
|
|
13836
13839
|
// }
|
|
13837
13840
|
,
|
|
13838
|
-
|
|
13839
|
-
getPopupContainer: () => document.getElementById(i),
|
|
13841
|
+
getPopupContainer: () => document.getElementById("map"),
|
|
13840
13842
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
13841
13843
|
style: {
|
|
13842
13844
|
position: "relative",
|
|
@@ -13937,6 +13939,7 @@ function StakeholderIcon({
|
|
|
13937
13939
|
link,
|
|
13938
13940
|
onClickLink: () => onClickLink(marker)
|
|
13939
13941
|
}),
|
|
13942
|
+
getPopupContainer: () => document.getElementById("map"),
|
|
13940
13943
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13941
13944
|
style: {
|
|
13942
13945
|
position: "absolute",
|
|
@@ -13978,6 +13981,7 @@ function StakeholderIcon({
|
|
|
13978
13981
|
link,
|
|
13979
13982
|
onClickLink: () => onClickLink(marker)
|
|
13980
13983
|
}),
|
|
13984
|
+
getPopupContainer: () => document.getElementById("map"),
|
|
13981
13985
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13982
13986
|
style: {
|
|
13983
13987
|
position: "absolute",
|
|
@@ -14013,6 +14017,7 @@ function StakeholderIcon({
|
|
|
14013
14017
|
link,
|
|
14014
14018
|
onClickLink: () => onClickLink(marker)
|
|
14015
14019
|
}),
|
|
14020
|
+
getPopupContainer: () => document.getElementById("map"),
|
|
14016
14021
|
children: /*#__PURE__*/jsxRuntime.jsx(Style$K
|
|
14017
14022
|
// onClick={toggleOpen}
|
|
14018
14023
|
, {
|
|
@@ -14736,7 +14741,13 @@ const useMap$1 = ({
|
|
|
14736
14741
|
if (mapRef) {
|
|
14737
14742
|
L__namespace.control.scale().addTo(mapRef);
|
|
14738
14743
|
L__namespace.tileLayer(TILE_LAYER_URL, {
|
|
14739
|
-
access_token: MAP_TOKEN
|
|
14744
|
+
access_token: MAP_TOKEN,
|
|
14745
|
+
keepBuffer: 4,
|
|
14746
|
+
updateWhenZooming: false,
|
|
14747
|
+
updateInterval: 200,
|
|
14748
|
+
maxNativeZoom: 18,
|
|
14749
|
+
tileSize: 256,
|
|
14750
|
+
fadeAnimation: true
|
|
14740
14751
|
}).addTo(mapRef);
|
|
14741
14752
|
}
|
|
14742
14753
|
}, [mapRef]);
|
|
@@ -14800,6 +14811,23 @@ const useMap$1 = ({
|
|
|
14800
14811
|
mapRef.setView([marker.coordinates[0], marker.coordinates[1]], getZoom(mapRef));
|
|
14801
14812
|
}
|
|
14802
14813
|
}, [activeMarker, mapRef]);
|
|
14814
|
+
React.useEffect(() => {
|
|
14815
|
+
if (mapRef && type === "chain") {
|
|
14816
|
+
const handleMapClick = e => {
|
|
14817
|
+
const clickedElement = e.originalEvent.target;
|
|
14818
|
+
const isMarkerClick = clickedElement.closest('.marker-chain') || clickedElement.closest('.leaflet-marker-icon');
|
|
14819
|
+
if (!isMarkerClick && selectedMarkersId.length > 0) {
|
|
14820
|
+
setSelectedMarkersId([]);
|
|
14821
|
+
openPopupIdRef.current = null;
|
|
14822
|
+
setMarkerWithPopup(null);
|
|
14823
|
+
}
|
|
14824
|
+
};
|
|
14825
|
+
mapRef.on('click', handleMapClick);
|
|
14826
|
+
return () => {
|
|
14827
|
+
mapRef.off('click', handleMapClick);
|
|
14828
|
+
};
|
|
14829
|
+
}
|
|
14830
|
+
}, [mapRef, type, selectedMarkersId]);
|
|
14803
14831
|
return {
|
|
14804
14832
|
container,
|
|
14805
14833
|
activeMarker,
|
|
@@ -49175,17 +49203,23 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
|
|
|
49175
49203
|
}
|
|
49176
49204
|
return result;
|
|
49177
49205
|
}, [nodes.length, mandatoryNodesToFit?.length, mandatoryNodesToFit]);
|
|
49206
|
+
|
|
49207
|
+
// In BaseGraph.jsx, replace the useEffect with:
|
|
49178
49208
|
React.useEffect(() => {
|
|
49179
49209
|
if (nodesToFit.length === 0) return;
|
|
49180
|
-
|
|
49210
|
+
|
|
49211
|
+
// Use setTimeout instead of requestAnimationFrame to ensure nodes are rendered
|
|
49212
|
+
const timer = setTimeout(() => {
|
|
49181
49213
|
fitView({
|
|
49182
49214
|
padding: 0.4,
|
|
49183
49215
|
nodes: [...nodesToFit],
|
|
49184
49216
|
// duration: withDuration ? 300 : undefined,
|
|
49185
49217
|
maxZoom: 0.9
|
|
49186
49218
|
});
|
|
49187
|
-
});
|
|
49188
|
-
|
|
49219
|
+
}, 100); // Small delay to ensure nodes are rendered
|
|
49220
|
+
|
|
49221
|
+
return () => clearTimeout(timer);
|
|
49222
|
+
}, [nodesToFit.length, nodesToFit.map(n => `${n.id}-${n.width}-${n.height}`).join(','), withDuration]);
|
|
49189
49223
|
return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
|
|
49190
49224
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49191
49225
|
style: {
|
|
@@ -49214,8 +49248,9 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
|
|
|
49214
49248
|
fitView: true // zoom out on default
|
|
49215
49249
|
,
|
|
49216
49250
|
fitViewOptions: {
|
|
49217
|
-
padding: 0.2
|
|
49218
|
-
//
|
|
49251
|
+
padding: 0.2,
|
|
49252
|
+
//zoom out on default
|
|
49253
|
+
duration: withDuration ? 300 : undefined
|
|
49219
49254
|
},
|
|
49220
49255
|
...props,
|
|
49221
49256
|
children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
|
|
@@ -49418,7 +49453,8 @@ function TradeRelationship(_ref) {
|
|
|
49418
49453
|
filtersConfig,
|
|
49419
49454
|
onFilterChange = () => {},
|
|
49420
49455
|
renderTooltipItems = () => [],
|
|
49421
|
-
getTotal = () => 0
|
|
49456
|
+
getTotal = () => 0,
|
|
49457
|
+
onRenderComplete = () => {}
|
|
49422
49458
|
} = _ref;
|
|
49423
49459
|
const reactFlowWrapper = React.useRef(null);
|
|
49424
49460
|
const [nodes, setNodes] = react.useNodesState([]);
|
|
@@ -49431,6 +49467,23 @@ function TradeRelationship(_ref) {
|
|
|
49431
49467
|
const [activeNode, setActiveNode] = React.useState(null);
|
|
49432
49468
|
// const [initCenter, setInitCenter] = useState(true);
|
|
49433
49469
|
const [associatedNodes, setAssociatedNodes] = React.useState(null);
|
|
49470
|
+
const isFullyRenderedRef = React.useRef(false);
|
|
49471
|
+
const [isFullyRendered, setIsFullyRendered] = React.useState(false);
|
|
49472
|
+
React.useEffect(() => {
|
|
49473
|
+
isFullyRenderedRef.current = false;
|
|
49474
|
+
setIsFullyRendered(false);
|
|
49475
|
+
setActiveNode(null);
|
|
49476
|
+
}, [data]);
|
|
49477
|
+
React.useEffect(() => {
|
|
49478
|
+
if (nodes.length > 0 && edges.length > 0 && !isFullyRenderedRef.current) {
|
|
49479
|
+
const timeoutId = setTimeout(() => {
|
|
49480
|
+
isFullyRenderedRef.current = true;
|
|
49481
|
+
setIsFullyRendered(true);
|
|
49482
|
+
onRenderComplete(true);
|
|
49483
|
+
}, 200);
|
|
49484
|
+
return () => clearTimeout(timeoutId);
|
|
49485
|
+
}
|
|
49486
|
+
}, [nodes.length, edges.length, associatedNodes]);
|
|
49434
49487
|
React.useEffect(() => {
|
|
49435
49488
|
setActiveNode(null);
|
|
49436
49489
|
}, [data]);
|
|
@@ -49455,7 +49508,7 @@ function TradeRelationship(_ref) {
|
|
|
49455
49508
|
})
|
|
49456
49509
|
})), [edges, activeNode, associatedNodes]);
|
|
49457
49510
|
React.useEffect(() => {
|
|
49458
|
-
var _data$sources;
|
|
49511
|
+
var _data$sources, _data$id;
|
|
49459
49512
|
let yInit = 0;
|
|
49460
49513
|
let xInit = 0;
|
|
49461
49514
|
const isBilateral = (data === null || data === void 0 || (_data$sources = data.sources) === null || _data$sources === void 0 ? void 0 : _data$sources.length) >= 1;
|
|
@@ -49467,7 +49520,7 @@ function TradeRelationship(_ref) {
|
|
|
49467
49520
|
return;
|
|
49468
49521
|
}
|
|
49469
49522
|
const _nodes = [{
|
|
49470
|
-
id: data.id,
|
|
49523
|
+
id: (_data$id = data.id) === null || _data$id === void 0 ? void 0 : _data$id.toString(),
|
|
49471
49524
|
type: "expandedNode",
|
|
49472
49525
|
position: {
|
|
49473
49526
|
x: xInit,
|
|
@@ -49478,13 +49531,13 @@ function TradeRelationship(_ref) {
|
|
|
49478
49531
|
const _edges = [];
|
|
49479
49532
|
if (isBilateral) {
|
|
49480
49533
|
(data.sources || []).forEach(source => {
|
|
49481
|
-
var _data$
|
|
49534
|
+
var _data$id2;
|
|
49482
49535
|
const hasPrev = false;
|
|
49483
|
-
|
|
49536
|
+
const edge = {
|
|
49484
49537
|
id: "e-".concat(data.id, "-").concat(source),
|
|
49485
|
-
source: source,
|
|
49486
|
-
type: "
|
|
49487
|
-
target: data === null || data === void 0 || (_data$
|
|
49538
|
+
source: source === null || source === void 0 ? void 0 : source.toString(),
|
|
49539
|
+
type: "defaultEdge",
|
|
49540
|
+
target: data === null || data === void 0 || (_data$id2 = data.id) === null || _data$id2 === void 0 ? void 0 : _data$id2.toString(),
|
|
49488
49541
|
sourceHandle: "left",
|
|
49489
49542
|
targetHandle: "right",
|
|
49490
49543
|
data: _objectSpread2(_objectSpread2({
|
|
@@ -49497,7 +49550,8 @@ function TradeRelationship(_ref) {
|
|
|
49497
49550
|
tooltipTitle,
|
|
49498
49551
|
moreLeft: false
|
|
49499
49552
|
})
|
|
49500
|
-
}
|
|
49553
|
+
};
|
|
49554
|
+
_edges.push(edge);
|
|
49501
49555
|
});
|
|
49502
49556
|
}
|
|
49503
49557
|
const mapChildren = _ref2 => {
|
|
@@ -49541,7 +49595,7 @@ function TradeRelationship(_ref) {
|
|
|
49541
49595
|
var _ch$id2, _ch$id3;
|
|
49542
49596
|
const hasPrev = _prevNodes.find(p => p.id === source);
|
|
49543
49597
|
const isCustom = !hasPrev ? true : prevChildren.includes(source) ? false : true;
|
|
49544
|
-
|
|
49598
|
+
const edge = {
|
|
49545
49599
|
id: "e-".concat(ch.id, "-").concat(source),
|
|
49546
49600
|
source: hasPrev ? source : ch === null || ch === void 0 || (_ch$id2 = ch.id) === null || _ch$id2 === void 0 ? void 0 : _ch$id2.toString(),
|
|
49547
49601
|
type: isCustom ? "verticalPath" : "defaultEdge",
|
|
@@ -49559,7 +49613,8 @@ function TradeRelationship(_ref) {
|
|
|
49559
49613
|
tooltipTitle,
|
|
49560
49614
|
moreLeft: prevChildren.length > children.length
|
|
49561
49615
|
})
|
|
49562
|
-
}
|
|
49616
|
+
};
|
|
49617
|
+
_edges.push(edge);
|
|
49563
49618
|
if (isCustom) {
|
|
49564
49619
|
customIndex += 1;
|
|
49565
49620
|
}
|
|
@@ -49598,11 +49653,24 @@ function TradeRelationship(_ref) {
|
|
|
49598
49653
|
prevChildren: !isBilateral ? [data.id] : [],
|
|
49599
49654
|
maxHeight: 0
|
|
49600
49655
|
});
|
|
49656
|
+
|
|
49657
|
+
// Check for potential ID mismatches
|
|
49658
|
+
const nodeIds = _nodes.map(n => n.id);
|
|
49659
|
+
_edges.filter(e => {
|
|
49660
|
+
const sourceExists = nodeIds.includes(e.source);
|
|
49661
|
+
const targetExists = nodeIds.includes(e.target);
|
|
49662
|
+
return !sourceExists || !targetExists;
|
|
49663
|
+
});
|
|
49664
|
+
|
|
49665
|
+
// Set nodes first
|
|
49601
49666
|
setNodes(_nodes);
|
|
49602
|
-
|
|
49603
|
-
|
|
49667
|
+
const timeoutId = setTimeout(() => {
|
|
49668
|
+
setEdges(_edges);
|
|
49669
|
+
}, 100); // 100ms is imperceptible to users but ensures React Flow is ready
|
|
49604
49670
|
|
|
49605
|
-
|
|
49671
|
+
// Cleanup to prevent memory leaks if component unmounts quickly
|
|
49672
|
+
return () => clearTimeout(timeoutId);
|
|
49673
|
+
}, [data, activeNode]);
|
|
49606
49674
|
React.useEffect(() => {
|
|
49607
49675
|
if (activeNode) {
|
|
49608
49676
|
let _associatedNodesRight = [activeNode];
|
|
@@ -49669,7 +49737,7 @@ function TradeRelationship(_ref) {
|
|
|
49669
49737
|
});
|
|
49670
49738
|
},
|
|
49671
49739
|
ref: reactFlowWrapper
|
|
49672
|
-
});
|
|
49740
|
+
}, JSON.stringify(nodes) + JSON.stringify(edges));
|
|
49673
49741
|
}
|
|
49674
49742
|
var index$1 = withProvider(TradeRelationship);
|
|
49675
49743
|
|