datastake-daf 0.6.814 → 0.6.815

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.
@@ -16,6 +16,7 @@ var reactCollapsed = require('react-collapsed');
16
16
  var L$1 = require('leaflet');
17
17
  var countryCityLocation = require('country-city-location');
18
18
  var client = require('react-dom/client');
19
+ var reactDom = require('react-dom');
19
20
  require('@elfalem/leaflet-curve');
20
21
  var react = require('@xyflow/react');
21
22
  var g2plot = require('@antv/g2plot');
@@ -9401,8 +9402,8 @@ function LocationIcon({
9401
9402
  activeMarker,
9402
9403
  setActiveMarker
9403
9404
  }) {
9404
- const rootsMapRef = React.useRef(new Map());
9405
9405
  const markersRef = React.useRef([]);
9406
+ const [portalContainers, setPortalContainers] = React.useState([]);
9406
9407
  const isSelected = selectedMarkersId.includes(data.datastakeId);
9407
9408
  const Marker = React.useMemo(() => {
9408
9409
  if (isMineSite(data.type)) {
@@ -9410,7 +9411,7 @@ function LocationIcon({
9410
9411
  }
9411
9412
  return VillageMarker;
9412
9413
  }, [data.type]);
9413
- const [isHovering, setIsHovering] = React.useState(false);
9414
+ React.useState(false);
9414
9415
  const linkedNodesData = React.useMemo(() => {
9415
9416
  const nodes = [];
9416
9417
  const links = data.links || [];
@@ -9475,31 +9476,32 @@ function LocationIcon({
9475
9476
  return nodes;
9476
9477
  }, [JSON.stringify(allData), JSON.stringify(data.links), JSON.stringify(data.stakeholders), zoom]);
9477
9478
  const stakeholdersOfLocation = React.useMemo(() => {
9478
- return data?.stakeholders || [];
9479
- }, [data.stakeholders, zoom]);
9479
+ return (data?.stakeholders || []).filter(stakeholder => {
9480
+ if (!stakeholder.links || stakeholder.links.length === 0) {
9481
+ return true;
9482
+ }
9483
+ const locationsWithThisStakeholder = allData.filter(loc => loc.stakeholders?.some(s => s.datastakeId === stakeholder.datastakeId)).map(loc => loc.datastakeId);
9484
+ const primaryLocation = locationsWithThisStakeholder.sort()[0];
9485
+ return data.datastakeId === primaryLocation;
9486
+ });
9487
+ }, [data.stakeholders, data.datastakeId, allData, zoom]);
9480
9488
  React.useEffect(() => {
9481
- const currentRoots = rootsMapRef.current;
9482
- const currentMarkers = markersRef.current;
9483
- currentMarkers.forEach(marker => {
9484
- if (mapRef.hasLayer(marker)) {
9489
+ markersRef.current.forEach(marker => {
9490
+ if (mapRef && mapRef.hasLayer(marker)) {
9485
9491
  mapRef.removeLayer(marker);
9486
9492
  }
9487
9493
  });
9488
- currentRoots.forEach(root => {
9489
- root.unmount();
9490
- });
9491
- currentRoots.clear();
9492
9494
  markersRef.current = [];
9493
-
9494
- // Only create stakeholder markers if this location or any of its stakeholders are selected
9495
+ setPortalContainers([]);
9495
9496
  const shouldShowStakeholders = isSelected || stakeholdersOfLocation.some(stk => selectedMarkersId.includes(stk.datastakeId));
9496
9497
  if (!shouldShowStakeholders || selectedMarkersId.length === 0) {
9497
9498
  return;
9498
9499
  }
9499
9500
 
9500
- // Create new markers only when selected
9501
+ // Create markers and store their container references
9502
+ const containers = [];
9501
9503
  stakeholdersOfLocation.forEach((stakeholder, index) => {
9502
- const markerId = `${stakeholder.datastakeId}`;
9504
+ const markerId = `${data.datastakeId}-${stakeholder.datastakeId}`;
9503
9505
  const {
9504
9506
  x,
9505
9507
  y,
@@ -9522,41 +9524,29 @@ function LocationIcon({
9522
9524
  const pathLocLatLng = mapRef.layerPointToLatLng(pathLocPoint);
9523
9525
  const isForceOpen = activeMarker?.datastakeId === data.datastakeId;
9524
9526
  const iconSize = isSmallMarker(zoom) || isExtraSmallMarker(zoom) ? [11, 11] : [25, 25];
9527
+
9528
+ // Create container div
9529
+ const containerDiv = document.createElement('div');
9530
+ containerDiv.id = markerId;
9525
9531
  const marker = L__namespace.marker(stakeholderLatLng, {
9526
9532
  icon: L__namespace.divIcon({
9527
- html: `<div id="${markerId}"></div>`,
9533
+ html: containerDiv.outerHTML,
9528
9534
  className: "marker-chain",
9529
9535
  iconSize: iconSize
9530
9536
  })
9531
9537
  }).addTo(mapRef);
9532
9538
  markersRef.current.push(marker);
9533
- setTimeout(() => {
9534
- const div = document.getElementById(markerId);
9535
- if (div && !rootsMapRef.current.has(markerId)) {
9536
- const root = client.createRoot(div);
9537
- rootsMapRef.current.set(markerId, root);
9538
- root.render( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
9539
- data: stakeholder,
9540
- zoom: zoom,
9541
- allData: allData,
9542
- link: link,
9543
- parentId: data.datastakeId,
9544
- renderTooltip: renderTooltip,
9545
- onClickLink: onClickLink,
9546
- selectedMarkersId: selectedMarkersId,
9547
- handleSelectMarker: handleSelectMarker,
9548
- mapRef: mapRef,
9549
- radius: radius,
9550
- index: index,
9551
- x: x,
9552
- y: y,
9553
- openPopupIdRef: openPopupIdRef,
9554
- polylinesRef: polylinesRef,
9555
- isForceOpen: isForceOpen,
9556
- activeMarker: activeMarker
9557
- }));
9558
- }
9559
- }, 0);
9539
+
9540
+ // Store container info for portal rendering
9541
+ containers.push({
9542
+ markerId,
9543
+ stakeholder,
9544
+ x,
9545
+ y,
9546
+ radius,
9547
+ index,
9548
+ isForceOpen
9549
+ });
9560
9550
  setMapMarkers(prev => {
9561
9551
  const array = [...prev, {
9562
9552
  id: marker._leaflet_id,
@@ -9588,17 +9578,19 @@ function LocationIcon({
9588
9578
  animated: true
9589
9579
  });
9590
9580
  });
9581
+
9582
+ // Update portal containers after markers are created
9583
+ setTimeout(() => {
9584
+ setPortalContainers(containers);
9585
+ }, 0);
9591
9586
  return () => {
9592
9587
  markersRef.current.forEach(marker => {
9593
- if (mapRef.hasLayer(marker)) {
9588
+ if (mapRef && mapRef.hasLayer(marker)) {
9594
9589
  mapRef.removeLayer(marker);
9595
9590
  }
9596
9591
  });
9597
- rootsMapRef.current.forEach(root => {
9598
- root.unmount();
9599
- });
9600
- rootsMapRef.current.clear();
9601
9592
  markersRef.current = [];
9593
+ setPortalContainers([]);
9602
9594
  };
9603
9595
  }, [stakeholdersOfLocation, selectedMarkersId, activeMarker, zoom]);
9604
9596
 
@@ -9682,57 +9674,81 @@ function LocationIcon({
9682
9674
  });
9683
9675
  });
9684
9676
  }, [linkedNodesData, selectedMarkersId, zoom, stakeholdersOfLocation, isSelected]);
9685
- return /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
9686
- content: renderTooltipJsx({
9687
- title: data.name,
9688
- subTitle: data.subTitle,
9689
- total: data.sources,
9690
- className: "pt-0 pb-0",
9691
- items: renderTooltip(data),
9692
- link,
9693
- onClickLink: () => onClickLink(data),
9694
- isNewTab: true
9695
- })
9696
- // open={
9697
- // (!openPopupIdRef.current || openPopupIdRef.current === data.datastakeId) &&
9698
- // isHovering
9699
- // }
9700
- ,
9701
- getPopupContainer: triggerNode => {
9702
- const mapElement = document.getElementById("map");
9703
- return mapElement || triggerNode.parentElement || document.body;
9704
- },
9705
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
9706
- style: {
9707
- position: "relative",
9708
- display: "inline-block"
9677
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
9678
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
9679
+ content: renderTooltipJsx({
9680
+ title: data.name,
9681
+ subTitle: data.subTitle,
9682
+ total: data.sources,
9683
+ className: "pt-0 pb-0",
9684
+ items: renderTooltip(data),
9685
+ link,
9686
+ onClickLink: () => onClickLink(data),
9687
+ isNewTab: true
9688
+ }),
9689
+ getPopupContainer: triggerNode => {
9690
+ const mapElement = document.getElementById("map");
9691
+ return mapElement || triggerNode.parentElement || document.body;
9709
9692
  },
9710
- children: [(isSelected || selectedMarkersId.length === 0) && /*#__PURE__*/jsxRuntime.jsx("div", {
9693
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
9711
9694
  style: {
9712
- position: "absolute",
9713
- bottom: "0",
9714
- left: "50%",
9715
- transform: "translateX(-50%)",
9716
- width: "12px",
9717
- height: "6px",
9718
- background: "rgba(0,0,0,0.15)",
9719
- borderRadius: "50%",
9720
- filter: "blur(3px)"
9721
- }
9722
- }), /*#__PURE__*/jsxRuntime.jsx(Marker, {
9723
- isSelected: isSelected,
9724
- onClick: () => {
9725
- handleSelectMarker(data);
9726
- setActiveMarker(isSelected ? null : data);
9695
+ position: "relative",
9696
+ display: "inline-block"
9727
9697
  },
9698
+ children: [(isSelected || selectedMarkersId.length === 0) && /*#__PURE__*/jsxRuntime.jsx("div", {
9699
+ style: {
9700
+ position: "absolute",
9701
+ bottom: "0",
9702
+ left: "50%",
9703
+ transform: "translateX(-50%)",
9704
+ width: "12px",
9705
+ height: "6px",
9706
+ background: "rgba(0,0,0,0.15)",
9707
+ borderRadius: "50%",
9708
+ filter: "blur(3px)"
9709
+ }
9710
+ }), /*#__PURE__*/jsxRuntime.jsx(Marker, {
9711
+ isSelected: isSelected,
9712
+ onClick: () => {
9713
+ handleSelectMarker(data);
9714
+ setActiveMarker(isSelected ? null : data);
9715
+ },
9716
+ zoom: zoom,
9717
+ selectedMarkersId: selectedMarkersId
9718
+ })]
9719
+ })
9720
+ }), portalContainers.map(({
9721
+ markerId,
9722
+ stakeholder,
9723
+ x,
9724
+ y,
9725
+ radius,
9726
+ index,
9727
+ isForceOpen
9728
+ }) => {
9729
+ const container = document.getElementById(markerId);
9730
+ if (!container) return null;
9731
+ return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
9732
+ data: stakeholder,
9728
9733
  zoom: zoom,
9729
- onMouseEnter: () => setIsHovering(true),
9730
- onMouseLeave: () => {
9731
- setIsHovering(false);
9732
- },
9733
- selectedMarkersId: selectedMarkersId
9734
- })]
9735
- })
9734
+ allData: allData,
9735
+ link: link,
9736
+ parentId: data.datastakeId,
9737
+ renderTooltip: renderTooltip,
9738
+ onClickLink: onClickLink,
9739
+ selectedMarkersId: selectedMarkersId,
9740
+ handleSelectMarker: handleSelectMarker,
9741
+ mapRef: mapRef,
9742
+ radius: radius,
9743
+ index: index,
9744
+ x: x,
9745
+ y: y,
9746
+ openPopupIdRef: openPopupIdRef,
9747
+ polylinesRef: polylinesRef,
9748
+ isForceOpen: isForceOpen,
9749
+ activeMarker: activeMarker
9750
+ }, markerId), container);
9751
+ })]
9736
9752
  });
9737
9753
  }
9738
9754
 
@@ -14160,7 +14176,7 @@ const getTabs = t => {
14160
14176
  label: t("Events")
14161
14177
  }];
14162
14178
  };
14163
- const getFiltersConfig$b = ({
14179
+ const getFiltersConfig$c = ({
14164
14180
  t,
14165
14181
  filters,
14166
14182
  activeTab,
@@ -14395,7 +14411,7 @@ function MineSites({
14395
14411
  config: dataFetchConfig
14396
14412
  });
14397
14413
  const tabs = React.useMemo(() => getTabs(t), [t]);
14398
- const filtersConfig = React.useMemo(() => getFiltersConfig$b({
14414
+ const filtersConfig = React.useMemo(() => getFiltersConfig$c({
14399
14415
  t,
14400
14416
  filters,
14401
14417
  options,
@@ -15548,7 +15564,12 @@ function DAFTable({
15548
15564
  doEmptyRows,
15549
15565
  ...rest
15550
15566
  }) {
15551
- const [source, setSource] = React.useState([]);
15567
+ const source = React.useMemo(() => {
15568
+ if (data && Array.isArray(data)) {
15569
+ return data;
15570
+ }
15571
+ return [];
15572
+ }, [data]);
15552
15573
  const projectData = (projects || []).find(p => p.id === selectedProject);
15553
15574
  const [filtersInit, setFiltersInit] = React.useState(!loading);
15554
15575
  React.useEffect(() => {
@@ -15593,11 +15614,13 @@ function DAFTable({
15593
15614
  }
15594
15615
  } : filtersConfig;
15595
15616
  }, [sourcesKey, sources, filtersConfig, t]);
15596
- React.useEffect(() => {
15597
- if (data && Array.isArray(data)) {
15598
- setSource(data);
15599
- }
15600
- }, [data, data.length]);
15617
+
15618
+ // useEffect(() => {
15619
+ // if (data && Array.isArray(data)) {
15620
+ // setSource(data);
15621
+ // }
15622
+ // }, [data, data.length]);
15623
+
15601
15624
  const paginationPageSize = pagination?.pageSize;
15602
15625
  const dataSource = React.useMemo(() => {
15603
15626
  const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
@@ -16087,7 +16110,7 @@ const NavigationAction = ({
16087
16110
  });
16088
16111
  };
16089
16112
 
16090
- const getColumns$g = ({
16113
+ const getColumns$h = ({
16091
16114
  t,
16092
16115
  data,
16093
16116
  user,
@@ -16213,7 +16236,7 @@ function OrganisationInformation({
16213
16236
  });
16214
16237
  }, [organisationInfo, data]);
16215
16238
  const columns = React.useMemo(() => {
16216
- return getColumns$g({
16239
+ return getColumns$h({
16217
16240
  t,
16218
16241
  data: tableData,
16219
16242
  user,
@@ -16344,7 +16367,7 @@ const Style$8 = styled__default["default"].div`
16344
16367
  }
16345
16368
  `;
16346
16369
 
16347
- const getColumns$f = ({
16370
+ const getColumns$g = ({
16348
16371
  t = () => {},
16349
16372
  options = {},
16350
16373
  user = {},
@@ -16501,7 +16524,7 @@ function ProductionSites({
16501
16524
  return productionSites?.length > 5 ? ComponentWithFocus : "div";
16502
16525
  }, [productionSites]);
16503
16526
  const columns = React.useMemo(() => {
16504
- return getColumns$f({
16527
+ return getColumns$g({
16505
16528
  t,
16506
16529
  options,
16507
16530
  user,
@@ -16735,7 +16758,7 @@ const getAdminLevelName = (data, level) => {
16735
16758
  return entry?.name || "-";
16736
16759
  };
16737
16760
 
16738
- const getColumns$e = ({
16761
+ const getColumns$f = ({
16739
16762
  t,
16740
16763
  activeTab,
16741
16764
  options,
@@ -17029,7 +17052,7 @@ function AssociatedInformation$1({
17029
17052
  console.log({
17030
17053
  data
17031
17054
  });
17032
- const columns = React.useMemo(() => getColumns$e({
17055
+ const columns = React.useMemo(() => getColumns$f({
17033
17056
  t,
17034
17057
  isMonitoring: false,
17035
17058
  activeTab,
@@ -17413,7 +17436,7 @@ const getPartnershipTypes = t => {
17413
17436
  }];
17414
17437
  };
17415
17438
 
17416
- const getColumns$d = ({
17439
+ const getColumns$e = ({
17417
17440
  t,
17418
17441
  accept,
17419
17442
  decline,
@@ -40799,7 +40822,7 @@ const PartnersTable = ({
40799
40822
  setTotalRequests,
40800
40823
  t
40801
40824
  });
40802
- const columns = React.useMemo(() => getColumns$d({
40825
+ const columns = React.useMemo(() => getColumns$e({
40803
40826
  t,
40804
40827
  accept,
40805
40828
  decline,
@@ -41036,7 +41059,7 @@ const Create = ({
41036
41059
  });
41037
41060
  };
41038
41061
 
41039
- const getFiltersConfig$a = ({
41062
+ const getFiltersConfig$b = ({
41040
41063
  t
41041
41064
  }) => {
41042
41065
  return {
@@ -41067,7 +41090,7 @@ const getFiltersConfig$a = ({
41067
41090
  }
41068
41091
  };
41069
41092
  };
41070
- const getFilterOptions$a = (options, t) => {
41093
+ const getFilterOptions$b = (options, t) => {
41071
41094
  const {
41072
41095
  countries,
41073
41096
  category,
@@ -41078,13 +41101,13 @@ const getFilterOptions$a = (options, t) => {
41078
41101
  category: categoriesOptions || category || []
41079
41102
  };
41080
41103
  };
41081
- const formConfig$8 = {
41104
+ const formConfig$9 = {
41082
41105
  namespace: 'stakeholders',
41083
41106
  view: 'scoping',
41084
41107
  scope: 'create',
41085
41108
  formType: 'stakeholder'
41086
41109
  };
41087
- const viewConfig$8 = {
41110
+ const viewConfig$9 = {
41088
41111
  title: "Stakeholders",
41089
41112
  createTitle: "Create Stakeholder"
41090
41113
  };
@@ -41171,7 +41194,7 @@ function sourceAvatarConfig(items, user, applications) {
41171
41194
  });
41172
41195
  }
41173
41196
 
41174
- const getColumns$c = ({
41197
+ const getColumns$d = ({
41175
41198
  t,
41176
41199
  goTo,
41177
41200
  user,
@@ -41224,7 +41247,8 @@ const getColumns$c = ({
41224
41247
  className: "daf-default-cell"
41225
41248
  });
41226
41249
  }
41227
- const category = findOptions(v, options?.categoriesOptions);
41250
+ const categoriesOptions = [...(options?.categoriesOptions || []), ...(options?.category || [])];
41251
+ const category = findOptions(v, categoriesOptions);
41228
41252
  return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
41229
41253
  title: category,
41230
41254
  children: category
@@ -41241,7 +41265,8 @@ const getColumns$c = ({
41241
41265
  className: "daf-default-cell"
41242
41266
  });
41243
41267
  }
41244
- const subCategory = findOptions(v, options?.subCategoriesOptions);
41268
+ const subCategoriesOptions = [...(options?.subCategoriesOptions || []), ...(options?.subCategory || [])];
41269
+ const subCategory = findOptions(v, subCategoriesOptions);
41245
41270
  return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
41246
41271
  title: subCategory,
41247
41272
  children: subCategory
@@ -41276,7 +41301,7 @@ const getColumns$c = ({
41276
41301
  });
41277
41302
  }
41278
41303
  if (!val || val?.length === 0) {
41279
- return "--";
41304
+ return "-";
41280
41305
  }
41281
41306
  const sources = sourceAvatarConfig(val, user, applications);
41282
41307
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
@@ -41325,7 +41350,7 @@ const getColumns$c = ({
41325
41350
  }
41326
41351
  }].filter(column => column.show !== false);
41327
41352
 
41328
- const getFiltersConfig$9 = ({
41353
+ const getFiltersConfig$a = ({
41329
41354
  t
41330
41355
  }) => {
41331
41356
  return {
@@ -41493,7 +41518,7 @@ const getFiltersConfig$9 = ({
41493
41518
  }
41494
41519
  };
41495
41520
  };
41496
- const getFilterOptions$9 = (options, t) => {
41521
+ const getFilterOptions$a = (options, t) => {
41497
41522
  const {
41498
41523
  statusOptions,
41499
41524
  categoryOptions,
@@ -41515,13 +41540,13 @@ const getFilterOptions$9 = (options, t) => {
41515
41540
  };
41516
41541
  return _default;
41517
41542
  };
41518
- const formConfig$7 = {
41543
+ const formConfig$8 = {
41519
41544
  namespace: 'OPERATOR',
41520
41545
  view: ['scoping', 'new'],
41521
41546
  scope: 'global',
41522
41547
  formType: 'operator'
41523
41548
  };
41524
- const viewConfig$7 = {
41549
+ const viewConfig$8 = {
41525
41550
  title: "Operators",
41526
41551
  createTitle: "Create Operator"
41527
41552
  };
@@ -41562,7 +41587,7 @@ const renderStatusTag = ({
41562
41587
  }
41563
41588
  };
41564
41589
 
41565
- const getColumns$b = ({
41590
+ const getColumns$c = ({
41566
41591
  t,
41567
41592
  goTo,
41568
41593
  user,
@@ -41708,6 +41733,9 @@ const getColumns$b = ({
41708
41733
  className: "daf-default-cell"
41709
41734
  });
41710
41735
  }
41736
+ if (!val || val?.length === 0) {
41737
+ return "-";
41738
+ }
41711
41739
  const sources = sourceAvatarConfig(val, user, applications);
41712
41740
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
41713
41741
  items: sources
@@ -41769,7 +41797,7 @@ const getColumns$b = ({
41769
41797
  }
41770
41798
  }].filter(column => column.show !== false);
41771
41799
 
41772
- const getFiltersConfig$8 = ({
41800
+ const getFiltersConfig$9 = ({
41773
41801
  t
41774
41802
  }) => {
41775
41803
  return {
@@ -41910,7 +41938,7 @@ const getFiltersConfig$8 = ({
41910
41938
  }
41911
41939
  };
41912
41940
  };
41913
- const getFilterOptions$8 = (options, t) => {
41941
+ const getFilterOptions$9 = (options, t) => {
41914
41942
  const {
41915
41943
  statusOptions,
41916
41944
  categoryOptions,
@@ -41937,18 +41965,18 @@ const getFilterOptions$8 = (options, t) => {
41937
41965
  };
41938
41966
  return _default;
41939
41967
  };
41940
- const formConfig$6 = {
41968
+ const formConfig$7 = {
41941
41969
  namespace: 'WORKERS',
41942
41970
  view: ['scoping', 'new'],
41943
41971
  scope: 'global',
41944
41972
  formType: 'worker'
41945
41973
  };
41946
- const viewConfig$6 = {
41974
+ const viewConfig$7 = {
41947
41975
  title: "Workers",
41948
41976
  createTitle: "Create Worker"
41949
41977
  };
41950
41978
 
41951
- const getColumns$a = ({
41979
+ const getColumns$b = ({
41952
41980
  t,
41953
41981
  goTo,
41954
41982
  user,
@@ -42078,6 +42106,9 @@ const getColumns$a = ({
42078
42106
  className: "daf-default-cell"
42079
42107
  });
42080
42108
  }
42109
+ if (!val || val?.length === 0) {
42110
+ return "-";
42111
+ }
42081
42112
  const sources = sourceAvatarConfig(val, user, applications);
42082
42113
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
42083
42114
  items: sources
@@ -42124,7 +42155,7 @@ const getColumns$a = ({
42124
42155
  }
42125
42156
  }].filter(column => column.show !== false);
42126
42157
 
42127
- const getFiltersConfig$7 = ({
42158
+ const getFiltersConfig$8 = ({
42128
42159
  t
42129
42160
  }) => {
42130
42161
  return {
@@ -42276,7 +42307,7 @@ const getFiltersConfig$7 = ({
42276
42307
  }
42277
42308
  };
42278
42309
  };
42279
- const getFilterOptions$7 = (options, t) => {
42310
+ const getFilterOptions$8 = (options, t) => {
42280
42311
  const {
42281
42312
  timeframe = [],
42282
42313
  status,
@@ -42302,13 +42333,13 @@ const getFilterOptions$7 = (options, t) => {
42302
42333
  }]
42303
42334
  };
42304
42335
  };
42305
- const formConfig$5 = {
42336
+ const formConfig$6 = {
42306
42337
  namespace: 'event',
42307
42338
  view: 'scoping',
42308
42339
  scope: 'create',
42309
42340
  formType: 'event'
42310
42341
  };
42311
- const viewConfig$5 = {
42342
+ const viewConfig$6 = {
42312
42343
  title: "Events",
42313
42344
  createTitle: "Create Event"
42314
42345
  };
@@ -42435,7 +42466,7 @@ MoreTags.propTypes = {
42435
42466
  limit: PropTypes__default["default"].number
42436
42467
  };
42437
42468
 
42438
- const getColumns$9 = ({
42469
+ const getColumns$a = ({
42439
42470
  t,
42440
42471
  goTo,
42441
42472
  user,
@@ -42597,6 +42628,9 @@ const getColumns$9 = ({
42597
42628
  className: "daf-default-cell"
42598
42629
  });
42599
42630
  }
42631
+ if (!val || val?.length === 0) {
42632
+ return "-";
42633
+ }
42600
42634
  const sources = sourceAvatarConfig(val, user, applications);
42601
42635
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
42602
42636
  items: sources
@@ -42667,7 +42701,7 @@ const getColumns$9 = ({
42667
42701
  }
42668
42702
  }].filter(column => column.show !== false);
42669
42703
 
42670
- const getFiltersConfig$6 = ({
42704
+ const getFiltersConfig$7 = ({
42671
42705
  t
42672
42706
  }) => {
42673
42707
  return {
@@ -42839,7 +42873,7 @@ const getFiltersConfig$6 = ({
42839
42873
  }
42840
42874
  };
42841
42875
  };
42842
- const getFilterOptions$6 = (options, t) => {
42876
+ const getFilterOptions$7 = (options, t) => {
42843
42877
  const {
42844
42878
  timeframe = [],
42845
42879
  statusOptions,
@@ -42872,13 +42906,13 @@ const getFilterOptions$6 = (options, t) => {
42872
42906
  };
42873
42907
  return _default;
42874
42908
  };
42875
- const formConfig$4 = {
42909
+ const formConfig$5 = {
42876
42910
  namespace: 'corrective-actions',
42877
42911
  view: 'corrective-actions',
42878
42912
  scope: 'createActivity',
42879
42913
  formType: 'activity'
42880
42914
  };
42881
- const viewConfig$4 = {
42915
+ const viewConfig$5 = {
42882
42916
  title: "Activities",
42883
42917
  createTitle: "Create Activity"
42884
42918
  };
@@ -42892,7 +42926,7 @@ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = fa
42892
42926
  return eventCategoryObject[key] || null;
42893
42927
  };
42894
42928
 
42895
- const getColumns$8 = ({
42929
+ const getColumns$9 = ({
42896
42930
  t,
42897
42931
  goTo,
42898
42932
  user,
@@ -43039,6 +43073,9 @@ const getColumns$8 = ({
43039
43073
  className: "daf-default-cell"
43040
43074
  });
43041
43075
  }
43076
+ if (!val || val?.length === 0) {
43077
+ return "-";
43078
+ }
43042
43079
  const sources = sourceAvatarConfig(val, user, applications);
43043
43080
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
43044
43081
  items: sources
@@ -43102,7 +43139,7 @@ const getColumns$8 = ({
43102
43139
  }
43103
43140
  }].filter(column => column.show !== false);
43104
43141
 
43105
- const getFiltersConfig$5 = ({
43142
+ const getFiltersConfig$6 = ({
43106
43143
  t
43107
43144
  }) => {
43108
43145
  return {
@@ -43273,7 +43310,7 @@ const getFiltersConfig$5 = ({
43273
43310
  }
43274
43311
  };
43275
43312
  };
43276
- const getFilterOptions$5 = (options, t) => {
43313
+ const getFilterOptions$6 = (options, t) => {
43277
43314
  const {
43278
43315
  timeframe = [],
43279
43316
  statusOptions,
@@ -43306,18 +43343,18 @@ const getFilterOptions$5 = (options, t) => {
43306
43343
  };
43307
43344
  return _default;
43308
43345
  };
43309
- const formConfig$3 = {
43346
+ const formConfig$4 = {
43310
43347
  namespace: 'incident',
43311
43348
  view: 'incident',
43312
43349
  scope: 'createIncident',
43313
43350
  formType: 'incident'
43314
43351
  };
43315
- const viewConfig$3 = {
43352
+ const viewConfig$4 = {
43316
43353
  title: "Incidents",
43317
43354
  createTitle: "Create Incident"
43318
43355
  };
43319
43356
 
43320
- const getColumns$7 = ({
43357
+ const getColumns$8 = ({
43321
43358
  t,
43322
43359
  goTo,
43323
43360
  user,
@@ -43464,6 +43501,423 @@ const getColumns$7 = ({
43464
43501
  className: "daf-default-cell"
43465
43502
  });
43466
43503
  }
43504
+ if (!val || val?.length === 0) {
43505
+ return "-";
43506
+ }
43507
+ const sources = sourceAvatarConfig(val, user, applications);
43508
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
43509
+ items: sources
43510
+ });
43511
+ }
43512
+ }, {
43513
+ title: t("Status"),
43514
+ dataIndex: "status",
43515
+ key: "status",
43516
+ show: activeTab === "own",
43517
+ render: (val, all) => {
43518
+ if (all.empty) {
43519
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43520
+ className: "daf-default-cell"
43521
+ });
43522
+ }
43523
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
43524
+ return renderStatusTag({
43525
+ value: _val,
43526
+ t
43527
+ });
43528
+ }
43529
+ }, {
43530
+ title: t("Last Update"),
43531
+ dataIndex: "updatedAt",
43532
+ key: "updatedAt",
43533
+ render: (date, all) => {
43534
+ if (all.empty) {
43535
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43536
+ className: "daf-default-cell"
43537
+ });
43538
+ }
43539
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
43540
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43541
+ title: _date,
43542
+ children: _date
43543
+ });
43544
+ },
43545
+ ellipsis: true
43546
+ }, {
43547
+ id: 'actions',
43548
+ title: "",
43549
+ width: 60,
43550
+ render: (_, all) => {
43551
+ if (all.empty) {
43552
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43553
+ className: "daf-default-cell"
43554
+ });
43555
+ }
43556
+ const onClick = () => {
43557
+ let link = `/app/view/${subject}/${all.datastakeId}`;
43558
+ if (activeTab === "shared") {
43559
+ link += `?sourceId=${all?.authorId?.id}`;
43560
+ }
43561
+ goTo(getRedirectLink(link));
43562
+ };
43563
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
43564
+ onClick: onClick,
43565
+ theme: theme
43566
+ });
43567
+ }
43568
+ }].filter(column => column.show !== false);
43569
+
43570
+ const getFiltersConfig$5 = ({
43571
+ t
43572
+ }) => {
43573
+ return {
43574
+ timeframe: {
43575
+ type: "timeframe",
43576
+ label: "Timeframe",
43577
+ style: {
43578
+ flex: 1
43579
+ },
43580
+ t: t
43581
+ },
43582
+ country: {
43583
+ type: 'select',
43584
+ label: 'Country',
43585
+ placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
43586
+ style: {
43587
+ flex: 1
43588
+ },
43589
+ labelStyle: {
43590
+ flex: 1
43591
+ },
43592
+ getLabel: option => option.label,
43593
+ getValue: option => option.value
43594
+ },
43595
+ administrativeLevel1: {
43596
+ type: 'ajaxSelect',
43597
+ label: ({
43598
+ t = s => s,
43599
+ options = {},
43600
+ filters = {},
43601
+ language = 'en'
43602
+ }) => {
43603
+ const {
43604
+ administrativeLevel1
43605
+ } = options;
43606
+ if (administrativeLevel1) {
43607
+ if (options.country) {
43608
+ const _item = administrativeLevel1[filters.country];
43609
+ if (_item) {
43610
+ if (_item[language]) {
43611
+ return _item[language];
43612
+ }
43613
+ }
43614
+ }
43615
+ }
43616
+ return t('Province');
43617
+ },
43618
+ placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
43619
+ filters: data => ({
43620
+ country: data.country,
43621
+ level: 'level_1'
43622
+ }),
43623
+ show: data => !data.country,
43624
+ disabled: data => !data.country,
43625
+ mapper: {
43626
+ label: "name",
43627
+ value: "id"
43628
+ },
43629
+ method: 'getOptions',
43630
+ entity: 'AdministrativeLevel',
43631
+ style: {
43632
+ flex: 1
43633
+ },
43634
+ labelStyle: {
43635
+ flex: 1
43636
+ }
43637
+ },
43638
+ administrativeLevel2: {
43639
+ type: 'ajaxSelect',
43640
+ label: ({
43641
+ t = s => s,
43642
+ options = {},
43643
+ filters = {},
43644
+ language = 'en'
43645
+ }) => {
43646
+ const {
43647
+ administrativeLevel2
43648
+ } = options;
43649
+ if (administrativeLevel2) {
43650
+ if (options.country) {
43651
+ const _item = administrativeLevel2[filters.country];
43652
+ if (_item) {
43653
+ if (_item[language]) {
43654
+ return _item[language];
43655
+ }
43656
+ }
43657
+ }
43658
+ }
43659
+ return t('Province');
43660
+ },
43661
+ show: data => !(data.country && data.administrativeLevel1),
43662
+ placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
43663
+ filters: data => ({
43664
+ country: data.country,
43665
+ level: 'level_2',
43666
+ administrativeLevel1: data.administrativeLevel1
43667
+ }),
43668
+ disabled: data => !(data.country && data.administrativeLevel1),
43669
+ mapper: {
43670
+ label: "name",
43671
+ value: "id"
43672
+ },
43673
+ method: 'getOptions',
43674
+ entity: 'AdministrativeLevel',
43675
+ style: {
43676
+ flex: 1
43677
+ },
43678
+ labelStyle: {
43679
+ flex: 1
43680
+ }
43681
+ },
43682
+ eventCategory: {
43683
+ type: 'select',
43684
+ label: 'Category',
43685
+ placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
43686
+ style: {
43687
+ flex: 1
43688
+ },
43689
+ labelStyle: {
43690
+ flex: 1
43691
+ },
43692
+ getLabel: option => option.label,
43693
+ getValue: option => option.value,
43694
+ filterOptions: val => {
43695
+ if (val) {
43696
+ const {
43697
+ option,
43698
+ filters
43699
+ } = val;
43700
+ if (filters && option) {
43701
+ const {
43702
+ filters: optionFilters
43703
+ } = option;
43704
+ if (Array.isArray(optionFilters) && optionFilters.length) {
43705
+ const {
43706
+ value,
43707
+ condition
43708
+ } = optionFilters[0];
43709
+ if (condition === 'includes') {
43710
+ return value.includes('corporation');
43711
+ }
43712
+ }
43713
+ }
43714
+ }
43715
+ return true;
43716
+ }
43717
+ },
43718
+ // positionInTheMineralSupplyChain: {
43719
+ // type: 'select',
43720
+ // label: 'Position',
43721
+ // placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
43722
+ // style: { flex: 1 },
43723
+ // labelStyle: { flex: 1 },
43724
+ // getLabel: (option) => option.label,
43725
+ // getValue: (option) => option.value,
43726
+ // },
43727
+ status: {
43728
+ type: "select",
43729
+ label: "Status",
43730
+ placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
43731
+ style: {
43732
+ flex: 1
43733
+ },
43734
+ labelStyle: {
43735
+ fley: 1
43736
+ },
43737
+ getLabel: option => option.label,
43738
+ getValue: option => option.value
43739
+ }
43740
+ };
43741
+ };
43742
+ const getFilterOptions$5 = (options, t) => {
43743
+ const {
43744
+ timeframe = [],
43745
+ statusOptions,
43746
+ categoryOptions,
43747
+ countries,
43748
+ subCategory,
43749
+ category,
43750
+ stakeholderCategoryOptions,
43751
+ stakeholderSubCategoriesOptions,
43752
+ administrativeLevel1,
43753
+ administrativeLevel2,
43754
+ positionInMineralSupplyChainOptions,
43755
+ subCategoriesOptions,
43756
+ eventCategoryOptions
43757
+ } = options || {};
43758
+ const _categoryOptions = (eventCategoryOptions || categoryOptions || [])?.map(item => ({
43759
+ value: item.value,
43760
+ label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
43761
+ }));
43762
+ const _default = {
43763
+ timeframe: timeframe,
43764
+ status: getStatusOptions(t) || [],
43765
+ eventCategory: _categoryOptions || [],
43766
+ country: countries || [],
43767
+ subCategory: subCategoriesOptions || [],
43768
+ // category: category,
43769
+ administrativeLevel1,
43770
+ administrativeLevel2
43771
+ // positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions || [],
43772
+ };
43773
+ return _default;
43774
+ };
43775
+ const formConfig$3 = {
43776
+ namespace: 'testimonials',
43777
+ view: 'testimonials',
43778
+ scope: 'create',
43779
+ formType: 'testimonial'
43780
+ };
43781
+ const viewConfig$3 = {
43782
+ title: "Testimonials",
43783
+ createTitle: "New Testimonial"
43784
+ };
43785
+
43786
+ const getColumns$7 = ({
43787
+ t,
43788
+ goTo,
43789
+ user,
43790
+ options,
43791
+ activeTab,
43792
+ getRedirectLink,
43793
+ theme,
43794
+ subject,
43795
+ data,
43796
+ applications
43797
+ }) => [{
43798
+ dataIndex: 'datastakeId',
43799
+ title: t('ID'),
43800
+ ellipsis: true,
43801
+ show: true,
43802
+ key: "datastakeId",
43803
+ sorter: () => 0 + 0,
43804
+ render: (v, all) => {
43805
+ if (all.empty) {
43806
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43807
+ className: "daf-default-cell"
43808
+ });
43809
+ }
43810
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43811
+ title: v,
43812
+ children: v
43813
+ });
43814
+ }
43815
+ }, {
43816
+ dataIndex: 'name',
43817
+ title: t('Title'),
43818
+ ellipsis: true,
43819
+ show: true,
43820
+ key: "name",
43821
+ sorter: () => 0 + 0,
43822
+ render: (v, all) => {
43823
+ if (all.empty) {
43824
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43825
+ className: "daf-default-cell"
43826
+ });
43827
+ }
43828
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43829
+ title: v,
43830
+ children: v
43831
+ });
43832
+ }
43833
+ }, {
43834
+ title: t("type"),
43835
+ dataIndex: "typeOfTestimonials",
43836
+ key: "typeOfTestimonials",
43837
+ sorter: () => 0 + 0,
43838
+ show: true,
43839
+ render: (title, all) => {
43840
+ if (all.empty) {
43841
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43842
+ className: "daf-default-cell"
43843
+ });
43844
+ }
43845
+ const type = findOptions(title, data?.options?.testimonialsType);
43846
+ return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43847
+ title: type,
43848
+ children: type
43849
+ }) : '-';
43850
+ },
43851
+ ellipsis: true
43852
+ }, {
43853
+ title: t("Date"),
43854
+ dataIndex: "date",
43855
+ key: "date",
43856
+ sorter: () => 0 + 0,
43857
+ render: (date, all) => {
43858
+ if (all.empty) {
43859
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43860
+ className: "daf-default-cell"
43861
+ });
43862
+ }
43863
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
43864
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43865
+ title: _date,
43866
+ children: _date
43867
+ });
43868
+ },
43869
+ ellipsis: true
43870
+ }, {
43871
+ dataIndex: 'mineSite',
43872
+ title: t('Location'),
43873
+ ellipsis: true,
43874
+ show: true,
43875
+ render: (v, all) => {
43876
+ if (all.empty) {
43877
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43878
+ className: "daf-default-cell"
43879
+ });
43880
+ }
43881
+
43882
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
43883
+ const mineSite = all?.location?.name;
43884
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43885
+ title: mineSite,
43886
+ children: mineSite
43887
+ }) : '-';
43888
+ }
43889
+ }, {
43890
+ dataIndex: 'eventCategory',
43891
+ title: t('Category'),
43892
+ ellipsis: true,
43893
+ show: true,
43894
+ render: (v, all) => {
43895
+ if (all.empty) {
43896
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43897
+ className: "daf-default-cell"
43898
+ });
43899
+ }
43900
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions || data?.options?.categoryOptions);
43901
+ const categoryValue = getEventCategoryBySubject(eventCategory, subject);
43902
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43903
+ title: categoryValue,
43904
+ children: categoryValue
43905
+ }) : '-';
43906
+ }
43907
+ }, {
43908
+ title: t("Sources"),
43909
+ dataIndex: "sources",
43910
+ key: "sources",
43911
+ show: activeTab !== "own",
43912
+ render: (val, all) => {
43913
+ if (all.empty) {
43914
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
43915
+ className: "daf-default-cell"
43916
+ });
43917
+ }
43918
+ if (!val || val?.length === 0) {
43919
+ return "-";
43920
+ }
43467
43921
  const sources = sourceAvatarConfig(val, user, applications);
43468
43922
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
43469
43923
  items: sources
@@ -43703,6 +44157,9 @@ const getColumns$6 = ({
43703
44157
  className: "daf-default-cell"
43704
44158
  });
43705
44159
  }
44160
+ if (!val || val?.length === 0) {
44161
+ return "-";
44162
+ }
43706
44163
  const sources = sourceAvatarConfig(val, user, applications);
43707
44164
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
43708
44165
  items: sources
@@ -44166,16 +44623,19 @@ const getColumns$5 = ({
44166
44623
  }
44167
44624
  }, {
44168
44625
  title: t("Sources"),
44169
- dataIndex: 'sources',
44170
- ellipsis: true,
44626
+ dataIndex: "sources",
44627
+ key: "sources",
44171
44628
  show: activeTab !== "own",
44172
- render: (v, all) => {
44629
+ render: (val, all) => {
44173
44630
  if (all.empty) {
44174
44631
  return /*#__PURE__*/jsxRuntime.jsx("div", {
44175
44632
  className: "daf-default-cell"
44176
44633
  });
44177
44634
  }
44178
- const sources = sourceAvatarConfig(v, user, applications);
44635
+ if (!val || val?.length === 0) {
44636
+ return "-";
44637
+ }
44638
+ const sources = sourceAvatarConfig(val, user, applications);
44179
44639
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
44180
44640
  items: sources
44181
44641
  });
@@ -44375,48 +44835,55 @@ const getColumns$4 = ({
44375
44835
 
44376
44836
  const FILTER_REGISTRY = {
44377
44837
  stakeholders: {
44838
+ config: getFiltersConfig$b,
44839
+ options: getFilterOptions$b,
44840
+ formConfig: formConfig$9,
44841
+ viewConfig: viewConfig$9,
44842
+ columns: getColumns$d
44843
+ },
44844
+ workers: {
44845
+ config: getFiltersConfig$9,
44846
+ options: getFilterOptions$9,
44847
+ formConfig: formConfig$7,
44848
+ viewConfig: viewConfig$7,
44849
+ columns: getColumns$b
44850
+ },
44851
+ operators: {
44378
44852
  config: getFiltersConfig$a,
44379
44853
  options: getFilterOptions$a,
44380
44854
  formConfig: formConfig$8,
44381
44855
  viewConfig: viewConfig$8,
44382
44856
  columns: getColumns$c
44383
44857
  },
44384
- workers: {
44858
+ events: {
44385
44859
  config: getFiltersConfig$8,
44386
44860
  options: getFilterOptions$8,
44387
44861
  formConfig: formConfig$6,
44388
44862
  viewConfig: viewConfig$6,
44389
44863
  columns: getColumns$a
44390
44864
  },
44391
- operators: {
44392
- config: getFiltersConfig$9,
44393
- options: getFilterOptions$9,
44394
- formConfig: formConfig$7,
44395
- viewConfig: viewConfig$7,
44396
- columns: getColumns$b
44397
- },
44398
- events: {
44865
+ activities: {
44399
44866
  config: getFiltersConfig$7,
44400
44867
  options: getFilterOptions$7,
44401
44868
  formConfig: formConfig$5,
44402
44869
  viewConfig: viewConfig$5,
44403
44870
  columns: getColumns$9
44404
44871
  },
44405
- activities: {
44406
- config: getFiltersConfig$6,
44407
- options: getFilterOptions$6,
44408
- formConfig: formConfig$4,
44409
- viewConfig: viewConfig$4,
44410
- columns: getColumns$8
44411
- },
44412
44872
  'corrective-actions': {
44873
+ config: getFiltersConfig$7,
44874
+ options: getFilterOptions$7,
44875
+ formConfig: formConfig$5,
44876
+ viewConfig: viewConfig$5,
44877
+ columns: getColumns$9
44878
+ },
44879
+ incidents: {
44413
44880
  config: getFiltersConfig$6,
44414
44881
  options: getFilterOptions$6,
44415
44882
  formConfig: formConfig$4,
44416
44883
  viewConfig: viewConfig$4,
44417
44884
  columns: getColumns$8
44418
44885
  },
44419
- incidents: {
44886
+ testimonials: {
44420
44887
  config: getFiltersConfig$5,
44421
44888
  options: getFilterOptions$5,
44422
44889
  formConfig: formConfig$3,