datastake-daf 0.6.782 → 0.6.784

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 (58) hide show
  1. package/dist/components/index.js +400 -328
  2. package/dist/hooks/index.js +3 -1
  3. package/dist/pages/index.js +3035 -685
  4. package/dist/utils/index.js +22 -0
  5. package/package.json +1 -1
  6. package/src/@daf/core/components/Charts/BarChart/index.jsx +1 -1
  7. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +9 -76
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +116 -8
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/utils.js +73 -17
  10. package/src/@daf/core/components/Dashboard/Map/helper.js +1 -0
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +64 -29
  12. package/src/@daf/core/components/Dashboard/Map/style.js +20 -5
  13. package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -0
  14. package/src/@daf/core/components/Select/MultiSelect/index.jsx +4 -2
  15. package/src/@daf/core/components/Select/MultiSelect/style.js +15 -0
  16. package/src/@daf/hooks/useGetQueryParams.js +3 -1
  17. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +6 -7
  18. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/index.jsx +1 -1
  19. package/src/@daf/pages/Documents/config.js +5 -5
  20. package/src/@daf/pages/Events/Activities/columns.js +5 -0
  21. package/src/@daf/pages/Events/Activities/config.js +21 -17
  22. package/src/@daf/pages/Events/Incidents/columns.js +5 -0
  23. package/src/@daf/pages/Events/Incidents/config.js +14 -11
  24. package/src/@daf/pages/Events/columns.js +6 -0
  25. package/src/@daf/pages/Events/config.js +0 -16
  26. package/src/@daf/pages/Locations/MineSite/columns.js +5 -1
  27. package/src/@daf/pages/Locations/MineSite/config.js +21 -24
  28. package/src/@daf/pages/Partners/columns.js +3 -1
  29. package/src/@daf/pages/Partners/config.js +13 -9
  30. package/src/@daf/pages/Partners/create.jsx +5 -2
  31. package/src/@daf/pages/Partners/edit.jsx +4 -2
  32. package/src/@daf/pages/Stakeholders/Operators/columns.js +6 -0
  33. package/src/@daf/pages/Stakeholders/Operators/config.js +8 -8
  34. package/src/@daf/pages/Stakeholders/Workers/columns.js +19 -13
  35. package/src/@daf/pages/Stakeholders/Workers/config.js +8 -23
  36. package/src/@daf/pages/Summary/Minesite/index.jsx +6 -4
  37. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +2 -0
  38. package/src/@daf/pages/Summary/Operator/index.jsx +6 -3
  39. package/src/@daf/pages/TablePage/index.jsx +8 -2
  40. package/src/@daf/pages/Template/components/LinkingTemplate/columns.js +95 -0
  41. package/src/@daf/pages/Template/components/LinkingTemplate/config.js +88 -0
  42. package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +121 -0
  43. package/src/@daf/pages/Template/index.jsx +10 -0
  44. package/src/@daf/pages/View/hooks/useCallToGetData.js +73 -0
  45. package/src/@daf/pages/View/hooks/usePrepareForm.js +86 -0
  46. package/src/@daf/pages/View/hooks/useSubmitSubject.js +40 -0
  47. package/src/@daf/pages/View/hooks/useViewActions.js +83 -0
  48. package/src/@daf/pages/View/hooks/useViewPermissions.js +74 -0
  49. package/src/@daf/pages/View/hooks/useViewUrlParams.js +93 -0
  50. package/src/@daf/pages/View/index.jsx +326 -0
  51. package/src/@daf/utils/object.js +3 -1
  52. package/src/constants/locales/en/translation.js +3 -0
  53. package/src/constants/locales/fr/translation.js +3 -0
  54. package/src/constants/locales/sp/translation.js +3 -0
  55. package/src/pages.js +4 -1
  56. package/src/utils.js +1 -1
  57. package/dist/style/datastake/mapbox-gl.css +0 -330
  58. package/src/@daf/hooks/useViewFormUrlParams.js +0 -84
@@ -7835,6 +7835,17 @@ GoToSelect.propTypes = {
7835
7835
  t: PropTypes__default["default"].func
7836
7836
  };
7837
7837
 
7838
+ const MultiSelectStyled = styled__default["default"](antd.Select)`
7839
+ &.ant-select-single {
7840
+ .ant-select-selector {
7841
+ padding-inline-end: 24px !important;
7842
+ padding: 0 !important;
7843
+ max-width: 56px !important;
7844
+ width: 56px !important;
7845
+ }
7846
+ }
7847
+ `;
7848
+
7838
7849
  const _excluded$v = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
7839
7850
  const {
7840
7851
  useToken: useToken$n
@@ -7975,7 +7986,7 @@ function Multiselect(_ref) {
7975
7986
  });
7976
7987
  }
7977
7988
  };
7978
- return /*#__PURE__*/jsxRuntime.jsx(antd.Select, _objectSpread2(_objectSpread2({
7989
+ return /*#__PURE__*/jsxRuntime.jsx(MultiSelectStyled, _objectSpread2(_objectSpread2({
7979
7990
  mode: isSingle ? undefined : "multiple",
7980
7991
  value: selectValue,
7981
7992
  onChange: onSelectChange,
@@ -8033,7 +8044,8 @@ function Multiselect(_ref) {
8033
8044
  border: "1px solid ".concat(token.baseGray40),
8034
8045
  display: "flex",
8035
8046
  alignItems: "center",
8036
- justifyContent: "center"
8047
+ justifyContent: "center",
8048
+ padding: 0
8037
8049
  },
8038
8050
  children: (option === null || option === void 0 ? void 0 : option.avatar) || getFirstChar(option === null || option === void 0 ? void 0 : option.label)
8039
8051
  }, value);
@@ -8486,22 +8498,20 @@ const useHeader = _ref => {
8486
8498
  const {
8487
8499
  useToken: useToken$m
8488
8500
  } = antd.theme;
8489
- function BreadCrumbs(_ref) {
8490
- let {
8491
- breadcrumbs = [],
8492
- mainContWidth = 0
8493
- } = _ref;
8501
+ function BreadCrumbs({
8502
+ breadcrumbs = [],
8503
+ mainContWidth = 0
8504
+ }) {
8494
8505
  const [splitIndex, setSplitIndex] = React.useState(0);
8495
8506
  const {
8496
8507
  token
8497
8508
  } = useToken$m();
8498
- const _renderBreadcrumb = function (b, i, isLast) {
8499
- let noOnClickLast = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
8509
+ const _renderBreadcrumb = (b, i, isLast, noOnClickLast = false) => {
8500
8510
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
8501
8511
  className: "flex breadcrumb-item",
8502
- onClick: noOnClickLast && isLast ? undefined : b === null || b === void 0 ? void 0 : b.onClick,
8512
+ onClick: noOnClickLast && isLast ? undefined : b?.onClick,
8503
8513
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
8504
- children: b === null || b === void 0 ? void 0 : b.label
8514
+ children: b?.label
8505
8515
  }), !isLast && /*#__PURE__*/jsxRuntime.jsx("div", {
8506
8516
  className: "flex flex-column justify-content-center",
8507
8517
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -8511,7 +8521,7 @@ function BreadCrumbs(_ref) {
8511
8521
  color: token.baseGray50
8512
8522
  })
8513
8523
  })]
8514
- }, "breadcrumb-item-".concat(i));
8524
+ }, `breadcrumb-item-${i}`);
8515
8525
  };
8516
8526
  React.useEffect(() => {
8517
8527
  const _placeholderCont = document.getElementById("header-breadcrumbs");
@@ -8554,7 +8564,7 @@ function BreadCrumbs(_ref) {
8554
8564
  placement: "bottomRight",
8555
8565
  menu: {
8556
8566
  items: groupedBreadCrumbs[2].map((it, i) => ({
8557
- key: "items-".concat(i),
8567
+ key: `items-${i}`,
8558
8568
  label: it.label,
8559
8569
  onClick: it.onClick
8560
8570
  }))
@@ -9546,29 +9556,24 @@ const processConditionalTableKeys = (tableKeys, item) => {
9546
9556
  });
9547
9557
  return processedKeys;
9548
9558
  };
9549
- const renderFieldData = function (type, value, user, config) {
9550
- let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
9551
- let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
9552
- let app = arguments.length > 6 ? arguments[6] : undefined;
9553
- let allValues = arguments.length > 7 ? arguments[7] : undefined;
9554
- let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
9559
+ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
9555
9560
  switch (type) {
9556
9561
  case 'year':
9557
9562
  return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
9558
9563
  case 'date':
9559
9564
  {
9560
- const language = user !== null && user !== void 0 && user.language && (user === null || user === void 0 ? void 0 : user.language) === 'sp' ? 'es' : user === null || user === void 0 ? void 0 : user.language;
9565
+ const language = user?.language && user?.language === 'sp' ? 'es' : user?.language;
9561
9566
  return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
9562
9567
  }
9563
9568
  case 'select':
9564
9569
  {
9565
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9570
+ const options = config?.options || [];
9566
9571
  const option = findOptions(value, options);
9567
9572
  return option;
9568
9573
  }
9569
9574
  case 'multiselect':
9570
9575
  {
9571
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9576
+ const options = config?.options || [];
9572
9577
  const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
9573
9578
  const option = findOptions(_val, options);
9574
9579
  return option.join(', ');
@@ -9583,7 +9588,7 @@ const renderFieldData = function (type, value, user, config) {
9583
9588
  formValues: formValues
9584
9589
  });
9585
9590
  case 'percentage':
9586
- return value === '-' || value === null || value === undefined ? '-' : "".concat(value, " %");
9591
+ return value === '-' || value === null || value === undefined ? '-' : `${value} %`;
9587
9592
  case 'geolocation':
9588
9593
  {
9589
9594
  const val = JSON.parse(value) || {};
@@ -9597,7 +9602,7 @@ const renderFieldData = function (type, value, user, config) {
9597
9602
  case 'upload':
9598
9603
  case 'videoUpload':
9599
9604
  {
9600
- const documentName = allValues === null || allValues === void 0 ? void 0 : allValues.map(item => item === null || item === void 0 ? void 0 : item.name).join(', ');
9605
+ const documentName = allValues?.map(item => item?.name).join(', ');
9601
9606
  return documentName;
9602
9607
  }
9603
9608
  default:
@@ -9776,28 +9781,30 @@ const handleSectionChildren = ({
9776
9781
  });
9777
9782
  };
9778
9783
 
9779
- const handleArrayChildren = ({
9780
- value,
9781
- config,
9782
- label,
9783
- level,
9784
- t,
9785
- rootForm,
9786
- allData,
9787
- user,
9788
- getApiBaseUrl = () => {},
9789
- getAppHeader = () => {},
9790
- app,
9791
- TreeNodeComponent
9792
- }) => {
9784
+ const handleArrayChildren = _ref => {
9785
+ let {
9786
+ value,
9787
+ config,
9788
+ label,
9789
+ level,
9790
+ t,
9791
+ rootForm,
9792
+ allData,
9793
+ user,
9794
+ getApiBaseUrl = () => {},
9795
+ getAppHeader = () => {},
9796
+ app,
9797
+ TreeNodeComponent
9798
+ } = _ref;
9793
9799
  if (!Array.isArray(value)) {
9794
9800
  return null;
9795
9801
  }
9796
9802
  return value.map((item, itemIndex) => /*#__PURE__*/jsxRuntime.jsx("div", {
9797
9803
  className: "array-item",
9798
9804
  children: Object.keys(config.inputs).sort((a, b) => {
9799
- const positionA = config.inputs[a]?.position || 0;
9800
- const positionB = config.inputs[b]?.position || 0;
9805
+ var _config$inputs$a, _config$inputs$b;
9806
+ const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
9807
+ const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
9801
9808
  return positionA - positionB;
9802
9809
  }).map(subInputKey => {
9803
9810
  const subInputConfig = config.inputs[subInputKey];
@@ -9815,9 +9822,9 @@ const handleArrayChildren = ({
9815
9822
  getApiBaseUrl: getApiBaseUrl,
9816
9823
  getAppHeader: getAppHeader,
9817
9824
  app: app
9818
- }, `${itemIndex}-${subInputKey}`);
9825
+ }, "".concat(itemIndex, "-").concat(subInputKey));
9819
9826
  })
9820
- }, `${itemIndex}`));
9827
+ }, "".concat(itemIndex)));
9821
9828
  };
9822
9829
 
9823
9830
  const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
@@ -9962,44 +9969,44 @@ function useAjaxModal$2({
9962
9969
  }
9963
9970
 
9964
9971
  const mergeObject = obj => {
9965
- return Object.entries(obj || {}).reduce((acc, [key, value]) => {
9972
+ return Object.entries(obj || {}).reduce((acc, _ref) => {
9973
+ let [key, value] = _ref;
9966
9974
  if (typeof value === "object" && !Array.isArray(value) && value !== null) {
9967
- return {
9968
- ...acc,
9969
- ...value
9970
- };
9975
+ return _objectSpread2(_objectSpread2({}, acc), value);
9971
9976
  }
9972
- return {
9973
- ...acc,
9977
+ return _objectSpread2(_objectSpread2({}, acc), {}, {
9974
9978
  [key]: value
9975
- };
9979
+ });
9976
9980
  }, {});
9977
9981
  };
9978
- const handleDataLinkGroupWithTableKeys = ({
9979
- config,
9980
- inputConfig,
9981
- inputKey,
9982
- value,
9983
- level,
9984
- t,
9985
- rootForm,
9986
- allData,
9987
- user,
9988
- getApiBaseUrl = () => {},
9989
- getAppHeader = () => {},
9990
- app,
9991
- TreeNodeComponent
9992
- }) => {
9982
+ const handleDataLinkGroupWithTableKeys = _ref2 => {
9983
+ var _inputConfig$meta, _config$meta2, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
9984
+ let {
9985
+ config,
9986
+ inputConfig,
9987
+ inputKey,
9988
+ value,
9989
+ level,
9990
+ t,
9991
+ rootForm,
9992
+ allData,
9993
+ user,
9994
+ getApiBaseUrl = () => {},
9995
+ getAppHeader = () => {},
9996
+ app,
9997
+ TreeNodeComponent
9998
+ } = _ref2;
9993
9999
  if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
9994
10000
  return null;
9995
10001
  }
9996
- if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
10002
+ 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)) {
9997
10003
  const parentInputKeys = Object.keys(config.inputs || {});
9998
10004
  const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
9999
10005
  const otherConfig = config.inputs[otherInputKey];
10000
- if (otherConfig?.type === 'dataLink') {
10001
- const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
10002
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
10006
+ if ((otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.type) === 'dataLink') {
10007
+ var _otherConfig$meta, _config$meta;
10008
+ const siblingTableKeys = (otherConfig === null || otherConfig === void 0 || (_otherConfig$meta = otherConfig.meta) === null || _otherConfig$meta === void 0 ? void 0 : _otherConfig$meta.tableKeys) || [];
10009
+ const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
10003
10010
  const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
10004
10011
  return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
10005
10012
  }
@@ -10013,23 +10020,26 @@ const handleDataLinkGroupWithTableKeys = ({
10013
10020
  return null;
10014
10021
  }
10015
10022
  const tableKeys = inputConfig.meta.tableKeys;
10016
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
10023
+ const additionalTableKeys = ((_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.additionalTableKeys) || [];
10017
10024
  const parentInputKeys = Object.keys(config.inputs || {});
10018
10025
  const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
10019
10026
  [...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
10020
- const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
10027
+ const isAjaxModal = React.useMemo(() => {
10028
+ var _inputConfig$meta2;
10029
+ return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
10030
+ }, [inputConfig]);
10021
10031
  const ajaxModalValues = useAjaxModal$2({
10022
10032
  name: inputKey,
10023
10033
  user,
10024
- namespace: inputConfig?.meta?.namespace,
10025
- skipFetch: inputConfig?.meta?.skipFetch,
10034
+ namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
10035
+ skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
10026
10036
  isAjaxModal,
10027
- formScope: inputConfig?.meta?.formScope,
10037
+ formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
10028
10038
  APP: app,
10029
10039
  apiBaseUrl: getApiBaseUrl(),
10030
10040
  _getAppHeader: getAppHeader
10031
10041
  });
10032
- const dataLinkForm = ajaxModalValues?.form;
10042
+ const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
10033
10043
  const createInputsAndValues = item => {
10034
10044
  const inputs = {};
10035
10045
  const values = {};
@@ -10041,12 +10051,12 @@ const handleDataLinkGroupWithTableKeys = ({
10041
10051
  'videos': 'Video'
10042
10052
  };
10043
10053
  tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
10044
- const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
10054
+ var _dataLinkForm$identif;
10055
+ 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]);
10045
10056
  if (formInputConfig) {
10046
- inputs[tableKey] = {
10047
- ...formInputConfig,
10057
+ inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10048
10058
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
10049
- };
10059
+ });
10050
10060
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10051
10061
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10052
10062
  let resolvedLabel = null;
@@ -10054,7 +10064,7 @@ const handleDataLinkGroupWithTableKeys = ({
10054
10064
  const parts = labelKey.split(' is ');
10055
10065
  if (parts.length === 2) {
10056
10066
  const [conditionKey, conditionValue] = parts;
10057
- if (item?.[conditionKey] === conditionValue) {
10067
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10058
10068
  resolvedLabel = formInputConfig.label[labelKey];
10059
10069
  break;
10060
10070
  }
@@ -10062,37 +10072,37 @@ const handleDataLinkGroupWithTableKeys = ({
10062
10072
  }
10063
10073
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
10064
10074
  }
10065
- values[tableKey] = item?.[tableKey];
10075
+ values[tableKey] = item === null || item === void 0 ? void 0 : item[tableKey];
10066
10076
  } else {
10077
+ var _item$linking;
10067
10078
  inputs[tableKey] = {
10068
10079
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
10069
- type: inputConfig?.type
10080
+ type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10070
10081
  };
10071
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
10082
+ 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 === null || item === void 0 ? void 0 : item[tableKey]);
10072
10083
  }
10073
10084
  });
10074
10085
  siblingInputsMatchingTableKeys.forEach(siblingKey => {
10075
10086
  const siblingConfig = config.inputs[siblingKey];
10076
10087
  if (siblingConfig) {
10077
- inputs[siblingKey] = {
10078
- ...siblingConfig,
10088
+ inputs[siblingKey] = _objectSpread2(_objectSpread2({}, siblingConfig), {}, {
10079
10089
  label: siblingConfig.label || siblingKey
10080
- };
10081
- values[siblingKey] = item?.[siblingKey];
10090
+ });
10091
+ values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
10082
10092
  }
10083
10093
  });
10084
- if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10094
+ if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10085
10095
  Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
10086
10096
  const formInputConfig = dataLinkForm.identification[fieldKey];
10087
10097
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10088
10098
  }).forEach(fieldKey => {
10099
+ var _item$linking2;
10089
10100
  const formInputConfig = dataLinkForm.identification[fieldKey];
10090
- inputs[fieldKey] = {
10091
- ...formInputConfig,
10101
+ inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10092
10102
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10093
- };
10094
- if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
10095
- const dynamicLabelKeys = Object.keys(formInputConfig?.label);
10103
+ });
10104
+ if (formInputConfig !== null && formInputConfig !== void 0 && formInputConfig.label && typeof (formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label) === 'object') {
10105
+ const dynamicLabelKeys = Object.keys(formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label);
10096
10106
  let resolvedLabel = null;
10097
10107
  for (const labelKey of dynamicLabelKeys) {
10098
10108
  const parts = labelKey.split(' is ');
@@ -10101,7 +10111,7 @@ const handleDataLinkGroupWithTableKeys = ({
10101
10111
  const flattenedItem = Object.assign({}, item.location, {
10102
10112
  address: item.address
10103
10113
  });
10104
- if (flattenedItem?.[conditionKey] === conditionValue) {
10114
+ if ((flattenedItem === null || flattenedItem === void 0 ? void 0 : flattenedItem[conditionKey]) === conditionValue) {
10105
10115
  resolvedLabel = formInputConfig.label[labelKey];
10106
10116
  break;
10107
10117
  }
@@ -10109,7 +10119,7 @@ const handleDataLinkGroupWithTableKeys = ({
10109
10119
  }
10110
10120
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10111
10121
  }
10112
- values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
10122
+ values[fieldKey] = (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[fieldKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10113
10123
  });
10114
10124
  }
10115
10125
  return {
@@ -10119,16 +10129,17 @@ const handleDataLinkGroupWithTableKeys = ({
10119
10129
  };
10120
10130
  if (Array.isArray(value)) {
10121
10131
  return value.map((item, itemIndex) => {
10132
+ var _merged$inputKey;
10122
10133
  const merged = mergeObject(item);
10123
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10134
+ const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey = merged[inputKey]) === null || _merged$inputKey === void 0 ? void 0 : _merged$inputKey.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10124
10135
  const {
10125
10136
  inputs,
10126
10137
  values
10127
10138
  } = createInputsAndValues(merged);
10128
10139
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10129
- nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10140
+ nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10130
10141
  config: {
10131
- label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10142
+ label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10132
10143
  type: 'custom-datalink-group',
10133
10144
  inputs: inputs
10134
10145
  },
@@ -10142,11 +10153,12 @@ const handleDataLinkGroupWithTableKeys = ({
10142
10153
  getApiBaseUrl: getApiBaseUrl,
10143
10154
  getAppHeader: getAppHeader,
10144
10155
  app: app
10145
- }, `${inputKey}-${itemIndex}`);
10156
+ }, "".concat(inputKey, "-").concat(itemIndex));
10146
10157
  });
10147
10158
  } else {
10159
+ var _merged$inputKey2;
10148
10160
  const merged = mergeObject(value);
10149
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10161
+ const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey2 = merged[inputKey]) === null || _merged$inputKey2 === void 0 ? void 0 : _merged$inputKey2.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10150
10162
  const {
10151
10163
  inputs,
10152
10164
  values
@@ -10168,7 +10180,7 @@ const handleDataLinkGroupWithTableKeys = ({
10168
10180
  getApiBaseUrl: getApiBaseUrl,
10169
10181
  getAppHeader: getAppHeader,
10170
10182
  app: app
10171
- }, `${inputKey}-group`);
10183
+ }, "".concat(inputKey, "-group"));
10172
10184
  }
10173
10185
  };
10174
10186
 
@@ -12465,6 +12477,8 @@ const Style$M = styled__default["default"].div`
12465
12477
  width: 100%;
12466
12478
  height: 472px;
12467
12479
 
12480
+
12481
+
12468
12482
  .filter-cont {
12469
12483
  position: absolute;
12470
12484
  top: 24px;
@@ -12567,11 +12581,24 @@ const Style$M = styled__default["default"].div`
12567
12581
  align-items: center;
12568
12582
  }
12569
12583
 
12570
- .marker-chain {
12571
- display: flex;
12572
- align-items: center;
12573
- justify-content: center;
12574
- }
12584
+ .marker-chain {
12585
+ display: flex;
12586
+ align-items: center;
12587
+ justify-content: center;
12588
+ }
12589
+
12590
+ .animated-polyline {
12591
+ stroke-dasharray: 10 10;
12592
+ animation: dash-flow 1.5s linear infinite;
12593
+ stroke-linecap: round;
12594
+ }
12595
+
12596
+ @keyframes dash-flow {
12597
+ to {
12598
+ stroke-dashoffset: -20;
12599
+ }
12600
+ }
12601
+
12575
12602
 
12576
12603
  }
12577
12604
 
@@ -13017,18 +13044,15 @@ const VILLAGE = "village";
13017
13044
  const EXPORTER = "exporter";
13018
13045
  const PROCESSOR = "mineralProcessor";
13019
13046
  const DEPOT = "depot";
13047
+ const OPERATOR = "miningOperator";
13020
13048
  const MAX_EXTRA_SMALL_ZOOM_THRESHOLD = 2;
13021
13049
  const MAX_SMALL_ZOOM_THRESHOLD = 3;
13022
13050
  const MAX_MEDIUM_ZOOM_THRESHOLD = 6;
13023
13051
  const LOCATION_TYPES = [MINE_SITE, VILLAGE];
13024
- const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT];
13052
+ const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT, OPERATOR];
13025
13053
  const RADIUS_SMALL = 15;
13026
13054
  const RADIUS_MEDIUM = 35;
13027
13055
  const RADIUS_LARGE = 60;
13028
- const RADIUS_CURVE_SMALL = 10;
13029
- const RADIUS_CURVE_MEDIUM = 15;
13030
- const RADIUS_CURVE_LARGE = 20;
13031
- const TENSION = 0.2;
13032
13056
  function isLocation(type) {
13033
13057
  return LOCATION_TYPES.includes(type);
13034
13058
  }
@@ -13085,7 +13109,6 @@ function getStakeholderPosition({
13085
13109
  const isLarge = isLargeMarker(zoom);
13086
13110
  let radius;
13087
13111
  let center = {
13088
- // NOT BEING USED FOR NOW AND MAYBE NEVER
13089
13112
  left: 0,
13090
13113
  top: 0
13091
13114
  };
@@ -13109,6 +13132,25 @@ function getStakeholderPosition({
13109
13132
  angleDeg
13110
13133
  };
13111
13134
  }
13135
+ function applyAnimationDirect(el, isShortLink, lineFlow = "downstream") {
13136
+ if (!(el instanceof SVGElement) || isShortLink) return;
13137
+ el.style.strokeDasharray = "10, 10";
13138
+ el.style.strokeDashoffset = "0";
13139
+ el.style.animation = `dash-flow 1.2s linear infinite ${lineFlow === "upstream" && "reverse"}`;
13140
+ el.classList.add('animated-polyline');
13141
+ }
13142
+ function removeAnimationFromElement(element) {
13143
+ if (!element) return;
13144
+ element.classList.remove('animated-polyline');
13145
+ element.style.animation = '';
13146
+ element.style.strokeDasharray = '';
13147
+ }
13148
+ function applyAnimationToPolyline(polyline, isShortLink) {
13149
+ const element = polyline.getElement();
13150
+ if (element) {
13151
+ applyAnimationDirect(element, isShortLink);
13152
+ }
13153
+ }
13112
13154
  function createPolyline({
13113
13155
  L,
13114
13156
  startLatLng,
@@ -13118,109 +13160,47 @@ function createPolyline({
13118
13160
  zoom,
13119
13161
  listOfPolylines = [],
13120
13162
  isFromStakeholder = false,
13121
- isForceOpen = false
13163
+ isForceOpen = false,
13164
+ stakeholderType = null,
13165
+ animated = false,
13166
+ mapRef
13122
13167
  }) {
13123
- const width = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
13124
- const coordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
13125
- const style = {
13168
+ const lineWidth = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
13169
+ const isShortLink = stakeholderType === OPERATOR || isFromStakeholder;
13170
+ const shouldAnimate = animated;
13171
+ const lineCoordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
13172
+ const polylineStyle = {
13126
13173
  color: "var(--base-gray-70)",
13127
- weight: width,
13128
- opacity: 0.5,
13129
- smoothFactor: 1,
13174
+ weight: lineWidth,
13175
+ opacity: isSelected ? 1 : 0.5,
13176
+ smoothFactor: 0,
13130
13177
  id,
13131
- dashArray: !isSelected ? "5, 5" : "0, 0"
13178
+ dashArray: isShortLink ? "0, 0" : shouldAnimate ? "10, 10" : !isSelected ? "5, 5" : "10, 10",
13179
+ renderer: L.svg()
13132
13180
  };
13133
- const newPolyline = L.polyline(coordinates, style);
13134
- if (listOfPolylines.find(p => p.options.id === id)) {
13135
- const polylineToUpdateCoordinates = listOfPolylines.find(p => p.options.id === id);
13136
- polylineToUpdateCoordinates.setLatLngs(coordinates);
13137
- polylineToUpdateCoordinates.setStyle(style);
13138
- } else {
13139
- listOfPolylines.push(newPolyline);
13140
- }
13141
- return newPolyline;
13142
- }
13143
- function createCurvePath({
13144
- zoom,
13145
- totalMarkers,
13146
- markerIndex
13147
- }) {
13148
- const radius = getCurvePointRadius(zoom);
13149
- const {
13150
- x,
13151
- y,
13152
- angleDeg
13153
- } = getAngleDeg(totalMarkers, markerIndex, radius);
13154
- return {
13155
- x,
13156
- y,
13157
- angleDeg
13158
- };
13159
- }
13160
- function getCurvePointRadius(zoom) {
13161
- const isSmall = isSmallMarker(zoom) || isExtraSmallMarker(zoom);
13162
- const isMedium = isMediumMarker(zoom);
13163
- if (isSmall) {
13164
- return RADIUS_SMALL + RADIUS_CURVE_SMALL;
13165
- } else if (isMedium) {
13166
- return RADIUS_MEDIUM + RADIUS_CURVE_MEDIUM;
13167
- } else {
13168
- return RADIUS_LARGE + RADIUS_CURVE_LARGE;
13169
- }
13170
- }
13171
- function buildSmoothCurve(layerPoints, mapRef) {
13172
- const path = [];
13173
- for (let i = 0; i < layerPoints.length - 1; i++) {
13174
- const p0 = layerPoints[i];
13175
- const p1 = layerPoints[i + 1];
13176
- const pPrev = layerPoints[i - 1] || p0;
13177
- const pNext = layerPoints[i + 2] || p1;
13178
- const cp1 = L__namespace.point(p0.x + (p1.x - pPrev.x) * TENSION, p0.y + (p1.y - pPrev.y) * TENSION);
13179
- const cp2 = L__namespace.point(p1.x - (pNext.x - p0.x) * TENSION, p1.y - (pNext.y - p0.y) * TENSION);
13180
- if (i === 0) {
13181
- path.push("M", [mapRef.layerPointToLatLng(p0).lat, mapRef.layerPointToLatLng(p0).lng]);
13181
+ const existingPolyline = listOfPolylines.find(p => p.options.id === id);
13182
+ if (existingPolyline) {
13183
+ removeAnimationFromElement(existingPolyline.getElement());
13184
+ existingPolyline.setLatLngs(lineCoordinates);
13185
+ existingPolyline.setStyle(polylineStyle);
13186
+ if (shouldAnimate && isSelected) {
13187
+ existingPolyline.once('add', () => {
13188
+ applyAnimationToPolyline(existingPolyline, isShortLink);
13189
+ });
13190
+ applyAnimationToPolyline(existingPolyline, isShortLink);
13182
13191
  }
13183
- path.push("C", [mapRef.layerPointToLatLng(cp1).lat, mapRef.layerPointToLatLng(cp1).lng], [mapRef.layerPointToLatLng(cp2).lat, mapRef.layerPointToLatLng(cp2).lng], [mapRef.layerPointToLatLng(p1).lat, mapRef.layerPointToLatLng(p1).lng]);
13192
+ return existingPolyline;
13184
13193
  }
13185
- return path;
13186
- }
13187
- function getSiblingCurveStrength(zoom) {
13188
- if (isExtraSmallMarker(zoom)) return RADIUS_CURVE_SMALL / 2;
13189
- if (isSmallMarker(zoom)) return RADIUS_CURVE_MEDIUM;
13190
- if (isMediumMarker(zoom)) return RADIUS_CURVE_LARGE;
13191
- return RADIUS_CURVE_LARGE;
13192
- }
13193
- function buildCurveWIthTwoSiblings({
13194
- mapRef,
13195
- startLatLng,
13196
- endLatLng,
13197
- zoom,
13198
- isSelected,
13199
- id
13200
- }) {
13201
- const fromPoint = mapRef.latLngToLayerPoint(startLatLng);
13202
- const toPoint = mapRef.latLngToLayerPoint(endLatLng);
13203
- const midX = (fromPoint.x + toPoint.x) / 2;
13204
- const midY = (fromPoint.y + toPoint.y) / 2 + (isSmallMarker(zoom) ? RADIUS_CURVE_SMALL / 2 : 0);
13205
- const dx = toPoint.x - fromPoint.x;
13206
- const dy = toPoint.y - fromPoint.y;
13207
- const normal = L__namespace.point(-dy, dx);
13208
- const length = Math.sqrt(normal.x ** 2 + normal.y ** 2) || 1;
13209
- const normalized = normal.multiplyBy(1 / length);
13210
- const curveStrength = getSiblingCurveStrength(zoom);
13211
- const controlPoint = L__namespace.point(midX, midY).add(normalized.multiplyBy(curveStrength));
13212
- const latlngs = [startLatLng, mapRef.layerPointToLatLng(controlPoint), endLatLng];
13213
- const layerPoints = latlngs.map(latlng => mapRef.latLngToLayerPoint(latlng));
13214
- const path = buildSmoothCurve(layerPoints, mapRef);
13215
- const curve = L__namespace.curve(path, {
13216
- color: "var(--base-gray-70)",
13217
- weight: isExtraSmallMarker(zoom) ? 0 : 1.2,
13218
- opacity: 0.5,
13219
- smoothFactor: 1,
13220
- id,
13221
- dashArray: !isSelected ? "5, 5" : "0, 0"
13222
- });
13223
- mapRef.addLayer(curve);
13194
+ const newPolyline = L.polyline(lineCoordinates, polylineStyle);
13195
+ newPolyline.addTo(mapRef);
13196
+ listOfPolylines.push(newPolyline);
13197
+ if (shouldAnimate && isSelected) {
13198
+ newPolyline.once('add', () => {
13199
+ applyAnimationToPolyline(newPolyline, isShortLink);
13200
+ });
13201
+ applyAnimationToPolyline(newPolyline, isShortLink);
13202
+ }
13203
+ return newPolyline;
13224
13204
  }
13225
13205
 
13226
13206
  const StakeholderMarker = styled__default["default"].div`
@@ -13522,6 +13502,9 @@ function StakeholderIcon$1({
13522
13502
  return null;
13523
13503
  }, [parentId, allData]);
13524
13504
  React.useEffect(() => {
13505
+ if (selectedMarkersId.length === 0 || !isSelected) {
13506
+ return;
13507
+ }
13525
13508
  linkNodesData.map(node => {
13526
13509
  const isConnectingToStakeholder = node.isStakeholder;
13527
13510
  const id = `${data.datastakeId}-${node.stakeholderId || node.datastakeId}`;
@@ -13533,8 +13516,6 @@ function StakeholderIcon$1({
13533
13516
  const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
13534
13517
  const stakeholderLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
13535
13518
  let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
13536
- const areNextToEachOther = targetMarkerIndex === index + 1 || targetMarkerIndex === index - 1 || index === 0 && targetMarkerIndex === node.totalStakeholders - 1 || targetMarkerIndex === 0 && index === node.totalStakeholders - 1;
13537
- const areOnlyTwoSiblings = node.totalStakeholders === 2;
13538
13519
  if (isExtraSmallMarker(zoom) && !isForceOpen) {
13539
13520
  createPolyline({
13540
13521
  L: L__namespace,
@@ -13544,7 +13525,8 @@ function StakeholderIcon$1({
13544
13525
  zoom,
13545
13526
  isSelected,
13546
13527
  id,
13547
- listOfPolylines: polylinesRef.current
13528
+ listOfPolylines: polylinesRef.current,
13529
+ animated: true
13548
13530
  });
13549
13531
  return;
13550
13532
  }
@@ -13562,61 +13544,8 @@ function StakeholderIcon$1({
13562
13544
  const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
13563
13545
  const endPoint = L__namespace.point(x + nodePoint.x + center.left, y + nodePoint.y + center.top);
13564
13546
  endLatLng = mapRef.layerPointToLatLng(endPoint);
13565
- if (isSibling && (!areNextToEachOther || areOnlyTwoSiblings)) {
13566
- if (areOnlyTwoSiblings) {
13567
- buildCurveWIthTwoSiblings({
13568
- mapRef,
13569
- startLatLng: stakeholderLatLng,
13570
- endLatLng,
13571
- zoom,
13572
- isSelected,
13573
- id
13574
- });
13575
- return;
13576
- }
13577
- const total = node.totalStakeholders;
13578
- let from = index;
13579
- let to = targetMarkerIndex;
13580
- let flip = false;
13581
- const forwardDistance = (to - from + total) % total;
13582
- const backwardDistance = (from - to + total) % total;
13583
- if (backwardDistance < forwardDistance) {
13584
- [from, to] = [to, from];
13585
- flip = true;
13586
- }
13587
- const intermediateIndices = [];
13588
- for (let i = 1; i < (to - from + total) % total; i++) {
13589
- intermediateIndices.push((from + i) % total);
13590
- }
13591
- const indices = [from, ...intermediateIndices, to];
13592
- const intermediatePoints = [];
13593
- for (const i of indices) {
13594
- const {
13595
- x,
13596
- y
13597
- } = createCurvePath({
13598
- zoom,
13599
- totalMarkers: node.totalStakeholders,
13600
- markerIndex: i
13601
- });
13602
- const point = centerPoint.add(L__namespace.point(x, y));
13603
- const latlng = mapRef.layerPointToLatLng(point);
13604
- intermediatePoints.push(latlng);
13605
- }
13606
- const latlngs = flip ? [endLatLng, ...intermediatePoints, stakeholderLatLng] : [stakeholderLatLng, ...intermediatePoints, endLatLng];
13607
- const layerPoints = latlngs.map(latlng => mapRef.latLngToLayerPoint(latlng));
13608
- const path = buildSmoothCurve(layerPoints, mapRef);
13609
- const curve = L__namespace?.curve?.(path, {
13610
- color: "var(--base-gray-70)",
13611
- weight: isExtraSmallMarker(zoom) ? 0 : 1,
13612
- opacity: isSelected ? 1 : 0.5,
13613
- smoothFactor: 1,
13614
- id
13615
- });
13616
- mapRef.addLayer(curve);
13617
- return;
13618
- }
13619
13547
  }
13548
+ // Always use straight lines
13620
13549
  createPolyline({
13621
13550
  L: L__namespace,
13622
13551
  mapRef,
@@ -13626,10 +13555,11 @@ function StakeholderIcon$1({
13626
13555
  isFromStakeholder: false,
13627
13556
  isSelected,
13628
13557
  id,
13629
- listOfPolylines: polylinesRef.current
13558
+ listOfPolylines: polylinesRef.current,
13559
+ animated: true
13630
13560
  });
13631
13561
  });
13632
- }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen]);
13562
+ }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen, selectedMarkersId]);
13633
13563
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
13634
13564
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
13635
13565
  content: renderTooltipJsx({
@@ -13641,7 +13571,8 @@ function StakeholderIcon$1({
13641
13571
  link,
13642
13572
  onClickLink: () => {
13643
13573
  onClickLink(data);
13644
- }
13574
+ },
13575
+ isNewTab: true
13645
13576
  }),
13646
13577
  getPopupContainer: triggerNode => {
13647
13578
  const mapElement = document.getElementById("map");
@@ -13696,6 +13627,8 @@ function LocationIcon({
13696
13627
  const linkedNodesData = React.useMemo(() => {
13697
13628
  const nodes = [];
13698
13629
  const links = data.links || [];
13630
+
13631
+ // Add links from the location itself
13699
13632
  links.forEach(link => {
13700
13633
  allData.forEach(d => {
13701
13634
  if (d.datastakeId === link) {
@@ -13715,8 +13648,45 @@ function LocationIcon({
13715
13648
  }
13716
13649
  });
13717
13650
  });
13651
+
13652
+ // ADD: Also include links from this location's stakeholders
13653
+ const stakeholders = data.stakeholders || [];
13654
+ stakeholders.forEach(stakeholder => {
13655
+ const stakeholderLinks = stakeholder.links || [];
13656
+ stakeholderLinks.forEach(link => {
13657
+ allData.forEach(d => {
13658
+ // Check if it's a direct location link
13659
+ if (d.datastakeId === link) {
13660
+ // Avoid duplicates
13661
+ if (!nodes.find(n => n.datastakeId === link && !n.isStakeholder)) {
13662
+ nodes.push({
13663
+ ...d,
13664
+ fromStakeholderId: stakeholder.datastakeId
13665
+ });
13666
+ }
13667
+ }
13668
+ // Check if it's a stakeholder link
13669
+ if (d.stakeholders && d.stakeholders.length > 0) {
13670
+ d.stakeholders.forEach(targetStakeholder => {
13671
+ if (targetStakeholder.datastakeId === link) {
13672
+ // Avoid duplicates
13673
+ if (!nodes.find(n => n.isStakeholder && n.datastakeId === d.datastakeId && n.stakeholdersIndex === d.stakeholders.indexOf(targetStakeholder))) {
13674
+ nodes.push({
13675
+ ...d,
13676
+ isStakeholder: true,
13677
+ totalStakeholders: d.stakeholders.length,
13678
+ stakeholdersIndex: d.stakeholders.indexOf(targetStakeholder),
13679
+ fromStakeholderId: stakeholder.datastakeId
13680
+ });
13681
+ }
13682
+ }
13683
+ });
13684
+ }
13685
+ });
13686
+ });
13687
+ });
13718
13688
  return nodes;
13719
- }, [JSON.stringify(allData), JSON.stringify(data.links), zoom]);
13689
+ }, [JSON.stringify(allData), JSON.stringify(data.links), JSON.stringify(data.stakeholders), zoom]);
13720
13690
  const stakeholdersOfLocation = React.useMemo(() => {
13721
13691
  return data?.stakeholders || [];
13722
13692
  }, [data.stakeholders, zoom]);
@@ -13734,7 +13704,13 @@ function LocationIcon({
13734
13704
  currentRoots.clear();
13735
13705
  markersRef.current = [];
13736
13706
 
13737
- // Create new markers
13707
+ // Only create stakeholder markers if this location or any of its stakeholders are selected
13708
+ const shouldShowStakeholders = isSelected || stakeholdersOfLocation.some(stk => selectedMarkersId.includes(stk.datastakeId));
13709
+ if (!shouldShowStakeholders || selectedMarkersId.length === 0) {
13710
+ return;
13711
+ }
13712
+
13713
+ // Create new markers only when selected
13738
13714
  stakeholdersOfLocation.forEach((stakeholder, index) => {
13739
13715
  const markerId = `${stakeholder.datastakeId}`;
13740
13716
  const {
@@ -13820,7 +13796,9 @@ function LocationIcon({
13820
13796
  zoom,
13821
13797
  isFromStakeholder: true,
13822
13798
  isForceOpen,
13823
- listOfPolylines: polylinesRef.current
13799
+ listOfPolylines: polylinesRef.current,
13800
+ stakeholderType: stakeholder.type,
13801
+ animated: true
13824
13802
  });
13825
13803
  });
13826
13804
  return () => {
@@ -13835,38 +13813,88 @@ function LocationIcon({
13835
13813
  rootsMapRef.current.clear();
13836
13814
  markersRef.current = [];
13837
13815
  };
13838
- }, [stakeholdersOfLocation, selectedMarkersId, activeMarker]);
13839
- linkedNodesData.map(node => {
13840
- const id = `${data.datastakeId}-${node.datastakeId}`;
13841
- const isConnectingToStakeholder = node.isStakeholder;
13842
- const centerLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
13843
- let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
13844
- const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
13845
- if (isConnectingToStakeholder && !isExtraSmallMarker(zoom)) {
13846
- const {
13847
- x,
13848
- y
13849
- } = getStakeholderPosition({
13816
+ }, [stakeholdersOfLocation, selectedMarkersId, activeMarker, zoom]);
13817
+
13818
+ // Only create polylines for linked nodes when something is selected
13819
+ React.useEffect(() => {
13820
+ if (selectedMarkersId.length === 0) {
13821
+ return;
13822
+ }
13823
+
13824
+ // IMPORTANT: Only draw links if this location is actually selected
13825
+ // Not just highlighted as part of the chain
13826
+ if (!isSelected) {
13827
+ return;
13828
+ }
13829
+
13830
+ // Filter linkedNodesData to only include nodes that are in the selected chain
13831
+ const relevantLinks = linkedNodesData.filter(node => {
13832
+ // Check if the target node (location) is in the selected markers
13833
+ const targetLocationInSelection = selectedMarkersId.includes(node.datastakeId);
13834
+
13835
+ // If connecting to a stakeholder, check if that stakeholder is selected
13836
+ if (node.isStakeholder) {
13837
+ const stakeholderInSelection = node.stakeholdersIndex !== undefined && selectedMarkersId.includes(node.datastakeId);
13838
+ return stakeholderInSelection;
13839
+ }
13840
+ return targetLocationInSelection;
13841
+ });
13842
+ relevantLinks.forEach(node => {
13843
+ const id = node.fromStakeholderId ? `${node.fromStakeholderId}-${node.datastakeId}` : `${data.datastakeId}-${node.datastakeId}`;
13844
+ const isConnectingToStakeholder = node.isStakeholder;
13845
+
13846
+ // If the link is from a stakeholder, start from the stakeholder position
13847
+ let startLatLng;
13848
+ if (node.fromStakeholderId) {
13849
+ // Find the stakeholder index in this location's stakeholders
13850
+ const stakeholderIndex = stakeholdersOfLocation.findIndex(s => s.datastakeId === node.fromStakeholderId);
13851
+ if (stakeholderIndex !== -1) {
13852
+ const {
13853
+ x,
13854
+ y
13855
+ } = getStakeholderPosition({
13856
+ zoom,
13857
+ totalMarkers: stakeholdersOfLocation.length,
13858
+ markerIndex: stakeholderIndex
13859
+ });
13860
+ const centerLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
13861
+ const centerPoint = mapRef.latLngToLayerPoint(centerLatLng);
13862
+ const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
13863
+ startLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
13864
+ } else {
13865
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
13866
+ }
13867
+ } else {
13868
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
13869
+ }
13870
+ let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
13871
+ const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
13872
+ if (isConnectingToStakeholder && !isExtraSmallMarker(zoom)) {
13873
+ const {
13874
+ x,
13875
+ y
13876
+ } = getStakeholderPosition({
13877
+ zoom,
13878
+ totalMarkers: node.totalStakeholders,
13879
+ markerIndex: node.stakeholdersIndex
13880
+ });
13881
+ const nodeLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
13882
+ const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
13883
+ const endPoint = L__namespace.point(x + nodePoint.x, y + nodePoint.y);
13884
+ endLatLng = mapRef.layerPointToLatLng(endPoint);
13885
+ }
13886
+ createPolyline({
13887
+ L: L__namespace,
13888
+ mapRef,
13889
+ startLatLng,
13890
+ endLatLng,
13891
+ isSelected: isConnectingToStakeholderSelected,
13892
+ id,
13850
13893
  zoom,
13851
- totalMarkers: node.totalStakeholders,
13852
- markerIndex: node.stakeholdersIndex
13853
- });
13854
- const nodeLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
13855
- const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
13856
- const endPoint = L__namespace.point(x + nodePoint.x, y + nodePoint.y);
13857
- endLatLng = mapRef.layerPointToLatLng(endPoint);
13858
- }
13859
- createPolyline({
13860
- L: L__namespace,
13861
- mapRef,
13862
- startLatLng: centerLatLng,
13863
- endLatLng,
13864
- isSelected: isConnectingToStakeholderSelected,
13865
- id,
13866
- zoom,
13867
- listOfPolylines: polylinesRef.current
13894
+ listOfPolylines: polylinesRef.current
13895
+ });
13868
13896
  });
13869
- });
13897
+ }, [linkedNodesData, selectedMarkersId, zoom, stakeholdersOfLocation, isSelected]);
13870
13898
  return /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
13871
13899
  content: renderTooltipJsx({
13872
13900
  title: data.name,
@@ -14382,7 +14410,8 @@ function useMapHelper$1({
14382
14410
  link: link,
14383
14411
  onClickLink: onClickLink,
14384
14412
  activeStakeholder: activeStakeholder,
14385
- setActiveStakeholder: setActiveStakeholder
14413
+ setActiveStakeholder: setActiveStakeholder,
14414
+ mapRef: mapRef
14386
14415
  }));
14387
14416
  roots.current.push(root);
14388
14417
  } else if (type === "location") {
@@ -14587,7 +14616,8 @@ const useMap$1 = ({
14587
14616
  MAP_TOKEN
14588
14617
  } = useMapConfig({
14589
14618
  app,
14590
- isSatellite
14619
+ isSatellite,
14620
+ mapRef: container
14591
14621
  });
14592
14622
  const [initialMarkerSetIsDone, setInitialMarkerSetIsDone] = React.useState(false);
14593
14623
  const [mapCenter, setMapCenter] = React.useState([0, 0]);
@@ -14604,6 +14634,8 @@ const useMap$1 = ({
14604
14634
  const graph = new Map();
14605
14635
  const stakeToLoc = new Map();
14606
14636
  const nodeTypes = new Map();
14637
+
14638
+ // Build the graph
14607
14639
  for (const loc of data) {
14608
14640
  const locId = loc.datastakeId;
14609
14641
  nodeTypes.set(locId, loc.type);
@@ -14628,26 +14660,45 @@ const useMap$1 = ({
14628
14660
  }
14629
14661
  }
14630
14662
  const highlightTable = {};
14663
+
14664
+ // Perform BFS/DFS to find all connected nodes in the entire chain
14631
14665
  for (const [node] of graph) {
14632
14666
  const highlighted = new Set();
14633
- highlighted.add(node);
14634
- const nodeIsStakeholder = !isLocation(nodeTypes.get(node));
14635
- if (nodeIsStakeholder && stakeToLoc.has(node)) {
14636
- const parentLoc = stakeToLoc.get(node);
14637
- highlighted.add(parentLoc);
14638
- }
14639
- for (const neighbor of graph.get(node) || []) {
14640
- const neighborIsStakeholder = !isLocation(nodeTypes.get(neighbor));
14641
- if (neighborIsStakeholder && stakeToLoc.has(neighbor)) {
14642
- const neighborParent = stakeToLoc.get(neighbor);
14643
- if (isLocation(nodeTypes.get(node)) && neighborParent === node || nodeIsStakeholder && stakeToLoc.get(node) === neighborParent) {
14644
- highlighted.add(neighbor);
14645
- } else {
14667
+ const queue = [node];
14668
+ const visited = new Set([node]);
14669
+ while (queue.length > 0) {
14670
+ const current = queue.shift();
14671
+ highlighted.add(current);
14672
+
14673
+ // Add parent location if current is stakeholder
14674
+ const currentIsStakeholder = !isLocation(nodeTypes.get(current));
14675
+ if (currentIsStakeholder && stakeToLoc.has(current)) {
14676
+ const parentLoc = stakeToLoc.get(current);
14677
+ if (!visited.has(parentLoc)) {
14678
+ highlighted.add(parentLoc);
14679
+ visited.add(parentLoc);
14680
+ queue.push(parentLoc);
14681
+ }
14682
+ }
14683
+
14684
+ // Traverse all neighbors
14685
+ for (const neighbor of graph.get(current) || []) {
14686
+ if (!visited.has(neighbor)) {
14687
+ visited.add(neighbor);
14688
+ queue.push(neighbor);
14646
14689
  highlighted.add(neighbor);
14647
- highlighted.add(neighborParent);
14690
+
14691
+ // If neighbor is stakeholder, add its parent location
14692
+ const neighborIsStakeholder = !isLocation(nodeTypes.get(neighbor));
14693
+ if (neighborIsStakeholder && stakeToLoc.has(neighbor)) {
14694
+ const neighborParent = stakeToLoc.get(neighbor);
14695
+ if (!visited.has(neighborParent)) {
14696
+ highlighted.add(neighborParent);
14697
+ visited.add(neighborParent);
14698
+ queue.push(neighborParent);
14699
+ }
14700
+ }
14648
14701
  }
14649
- } else {
14650
- highlighted.add(neighbor);
14651
14702
  }
14652
14703
  }
14653
14704
  highlightTable[node] = [...highlighted];
@@ -14685,10 +14736,20 @@ const useMap$1 = ({
14685
14736
  function handleSelectMarker(clickedMarker) {
14686
14737
  setSelectedMarkersId(prev => {
14687
14738
  if (prev.includes(clickedMarker.datastakeId)) {
14739
+ // Deselecting - clear polylines
14688
14740
  openPopupIdRef.current = null;
14689
14741
  setMarkerWithPopup(null);
14690
14742
  return [];
14691
14743
  } else {
14744
+ // CLEAR OLD POLYLINES BEFORE SELECTING NEW MARKER
14745
+ if (polylinesRef.current.length > 0) {
14746
+ polylinesRef.current.forEach(polyline => {
14747
+ if (mapRef.hasLayer(polyline)) {
14748
+ mapRef.removeLayer(polyline);
14749
+ }
14750
+ });
14751
+ polylinesRef.current = [];
14752
+ }
14692
14753
  setMarkerWithPopup(isStakeholder(clickedMarker.type) ? clickedMarker : null);
14693
14754
  const newSelectedMarkersId = highlightTable[clickedMarker.datastakeId];
14694
14755
  openPopupIdRef.current = clickedMarker.datastakeId;
@@ -14712,19 +14773,29 @@ const useMap$1 = ({
14712
14773
  });
14713
14774
  }
14714
14775
  }
14776
+ if (type === "chain" && selectedMarkersId.length === 0) {
14777
+ if (polylinesRef.current.length) {
14778
+ polylinesRef.current.forEach(polyline => {
14779
+ if (mapRef.hasLayer(polyline)) {
14780
+ mapRef.removeLayer(polyline);
14781
+ }
14782
+ });
14783
+ polylinesRef.current = [];
14784
+ }
14785
+ }
14715
14786
  clearMapMarkers();
14716
14787
  if (data) {
14717
- // Filters out locations that are not connected to any stakeholders
14718
- const excludedType = ['village', 'town', 'area', 'territory'];
14719
- const filteredData = data?.filter(obj => !excludedType.includes(obj?.type) && (obj?.stakeholders?.length > 0 || data.some(other => other.datastakeId !== obj.datastakeId && (other.stakeholders || []).some(stk => (stk.links || []).includes(obj.datastakeId)))));
14788
+ const filteredData = data?.filter(obj => obj.type === 'mineSite' || obj?.stakeholders?.length > 0 || data.some(other => other.datastakeId !== obj.datastakeId && (other.stakeholders || []).some(stk => (stk.links || []).includes(obj.datastakeId))));
14720
14789
  const maxTotal = Math.max(...(data || []).map(d => d.total));
14721
14790
  const dataToRender = type === "chain" ? filteredData : data;
14722
14791
  dataToRender.forEach((d, i) => {
14723
14792
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
14724
14793
  });
14725
- polylinesRef.current.forEach(polyline => {
14726
- mapRef.addLayer(polyline);
14727
- });
14794
+ if (selectedMarkersId.length > 0) {
14795
+ polylinesRef.current.forEach(polyline => {
14796
+ mapRef.addLayer(polyline);
14797
+ });
14798
+ }
14728
14799
  mapRef.invalidateSize();
14729
14800
  mapRef.fire("moveend");
14730
14801
  }
@@ -46890,7 +46961,7 @@ function BarChart(_ref) {
46890
46961
  tickMethod: () => {
46891
46962
  return Array.from(new Array(11), (v, i) => i * 10);
46892
46963
  }
46893
- } : {}), xAxisConfig), {}, {
46964
+ } : {}), Object.keys(xAxisConfig).length > 0 ? xAxisConfig : {}), {}, {
46894
46965
  label: _objectSpread2({
46895
46966
  formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedXAxis
46896
46967
  }, xAxisConfig === null || xAxisConfig === void 0 ? void 0 : xAxisConfig.label)
@@ -50745,7 +50816,8 @@ const BaseScreen = _ref => {
50745
50816
  onFilterChange: onFiltersChange,
50746
50817
  showFilters: showFilters,
50747
50818
  defaultFilters: defaultFilters,
50748
- onChange: onTableChange
50819
+ onChange: onTableChange,
50820
+ t: t
50749
50821
  }, rest)), /*#__PURE__*/jsxRuntime.jsx(Pagination, {
50750
50822
  t: t,
50751
50823
  isMobile: isMobile,