datastake-daf 0.6.759 → 0.6.761

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 (45) hide show
  1. package/dist/components/index.js +2464 -2707
  2. package/dist/constants/index.js +76 -0
  3. package/dist/pages/index.js +136 -314
  4. package/dist/services/index.js +91 -0
  5. package/dist/utils/index.js +388 -0
  6. package/package.json +1 -1
  7. package/rollup.config.js +20 -0
  8. package/src/@daf/core/components/EditForm/storyConfig2.js +866 -25029
  9. package/src/@daf/core/components/Screens/FindInformation/index.js +2 -1
  10. package/src/@daf/core/components/Screens/Users/columns.js +0 -6
  11. package/src/@daf/core/components/Table/NavigationAction/index.jsx +24 -0
  12. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  13. package/src/@daf/pages/Dashboards/UserDashboard/config.js +3 -3
  14. package/src/@daf/pages/Documents/columns.js +5 -22
  15. package/src/@daf/pages/Documents/index.jsx +2 -3
  16. package/src/@daf/pages/Events/Activities/columns.js +7 -59
  17. package/src/@daf/pages/Events/Activities/index.jsx +2 -3
  18. package/src/@daf/pages/Events/Incidents/columns.js +7 -61
  19. package/src/@daf/pages/Events/Incidents/index.jsx +2 -3
  20. package/src/@daf/pages/Events/columns.js +6 -47
  21. package/src/@daf/pages/Events/helper.js +14 -0
  22. package/src/@daf/pages/Events/index.jsx +2 -3
  23. package/src/@daf/pages/Locations/MineSite/columns.js +7 -12
  24. package/src/@daf/pages/Locations/MineSite/index.jsx +5 -4
  25. package/src/@daf/pages/Locations/columns.js +6 -32
  26. package/src/@daf/pages/Locations/index.jsx +2 -3
  27. package/src/@daf/pages/Partners/index.jsx +11 -0
  28. package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -8
  29. package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -2
  30. package/src/@daf/pages/Stakeholders/Workers/columns.js +10 -49
  31. package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -3
  32. package/src/@daf/pages/Stakeholders/columns.js +4 -25
  33. package/src/@daf/pages/Stakeholders/index.jsx +2 -3
  34. package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +0 -1
  35. package/src/@daf/pages/Summary/Minesite/index.jsx +2 -0
  36. package/src/@daf/pages/Summary/Operator/index.jsx +3 -1
  37. package/src/@daf/services/PartnerService.js +76 -0
  38. package/src/@daf/utils/tags.js +26 -0
  39. package/src/constants/breadCrumbs.js +22 -0
  40. package/src/constants.js +2 -0
  41. package/src/helpers/breadCrumbs.js +347 -0
  42. package/src/index.js +1 -1
  43. package/src/services.js +2 -1
  44. package/src/utils.js +5 -1
  45. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -1530,6 +1530,96 @@ class OperatorService extends BaseService {
1530
1530
  }
1531
1531
  var OperatorService$1 = createLazyService(OperatorService);
1532
1532
 
1533
+ class PartnerService extends BaseService {
1534
+ get(tab, filters) {
1535
+ const {
1536
+ page,
1537
+ pageSize,
1538
+ search,
1539
+ searchParams,
1540
+ ...rest
1541
+ } = filters;
1542
+ const params = {
1543
+ filters: rest,
1544
+ pagination: {
1545
+ skip: page,
1546
+ take: pageSize
1547
+ }
1548
+ };
1549
+ if (search && searchParams.length > 0) {
1550
+ params.search = {
1551
+ qs: search,
1552
+ fields: searchParams
1553
+ };
1554
+ }
1555
+ return this.apiGet({
1556
+ url: "/partner",
1557
+ isApp: true,
1558
+ params
1559
+ });
1560
+ }
1561
+ create(data) {
1562
+ return this.apiPost({
1563
+ url: "/partner",
1564
+ isApp: true,
1565
+ data
1566
+ });
1567
+ }
1568
+ accept(id) {
1569
+ return this.apiPut({
1570
+ url: `/partner/approve/${id}`,
1571
+ isApp: true
1572
+ });
1573
+ }
1574
+ activate(id) {
1575
+ return this.apiPut({
1576
+ url: `/partner/activate/${id}`,
1577
+ isApp: true
1578
+ });
1579
+ }
1580
+ decline(id) {
1581
+ return this.apiPut({
1582
+ url: `/partner/decline/${id}`,
1583
+ isApp: true
1584
+ });
1585
+ }
1586
+ suspend(id) {
1587
+ return this.apiPut({
1588
+ url: `/partner/suspend/${id}`,
1589
+ isApp: true
1590
+ });
1591
+ }
1592
+ block(id) {
1593
+ return this.apiPut({
1594
+ url: `/partner/block/${id}`,
1595
+ isApp: true
1596
+ });
1597
+ }
1598
+ resendInvite(id) {
1599
+ return this.apiPut({
1600
+ url: `/partner/resendInvite/${id}`,
1601
+ isApp: true
1602
+ });
1603
+ }
1604
+ getSubjectSources({
1605
+ id,
1606
+ namespace = "stakeholder"
1607
+ }) {
1608
+ return this.apiGet({
1609
+ url: `/${namespace}/sources-for-subject/${id}`,
1610
+ isApp: true
1611
+ });
1612
+ }
1613
+ update(id, data) {
1614
+ return this.apiPut({
1615
+ url: `/partner/${id}`,
1616
+ isApp: true,
1617
+ data
1618
+ });
1619
+ }
1620
+ }
1621
+ var PartnerService$1 = createLazyService(PartnerService);
1622
+
1533
1623
  exports.AdminService = AdminService$1;
1534
1624
  exports.AuthenticationService = AuthenticationService$1;
1535
1625
  exports.BaseHTTPService = BaseHTTPService;
@@ -1542,6 +1632,7 @@ exports.ErrorService = ErrorService;
1542
1632
  exports.LinkedSubjectsService = LinkedSubjects;
1543
1633
  exports.NotificationService = NotificationService$1;
1544
1634
  exports.OperatorService = OperatorService$1;
1635
+ exports.PartnerService = PartnerService$1;
1545
1636
  exports.QueryService = QueryService$1;
1546
1637
  exports.SourceService = SourceService$1;
1547
1638
  exports.UserService = UserService$1;
@@ -14164,12 +14164,398 @@ function buildBreadcrumbs({
14164
14164
  }];
14165
14165
  }
14166
14166
 
14167
+ const buildBreadCrumbs = ({
14168
+ config,
14169
+ items,
14170
+ t,
14171
+ breadCrumbsLabels,
14172
+ id,
14173
+ getRedirectLink,
14174
+ createOnClick,
14175
+ goTo,
14176
+ view,
14177
+ skipInteractions = false
14178
+ }) => {
14179
+ const pathConfig = config.path || [];
14180
+ pathConfig.forEach(pathItem => {
14181
+ if (typeof pathItem === 'string') {
14182
+ items.push({
14183
+ label: t(breadCrumbsLabels[pathItem]),
14184
+ onClick: () => {}
14185
+ });
14186
+ } else if (typeof pathItem === 'object') {
14187
+ const {
14188
+ key,
14189
+ link,
14190
+ useRedirect
14191
+ } = pathItem;
14192
+ if (key === 'id' && id) {
14193
+ const resolvedLink = typeof link === 'function' ? link(id) : link;
14194
+ const finalLink = useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
14195
+ items.push({
14196
+ label: id,
14197
+ onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
14198
+ });
14199
+ } else {
14200
+ const resolvedLink = typeof link === 'function' ? link(view, id) : link;
14201
+ const finalLink = resolvedLink && useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
14202
+ items.push({
14203
+ label: t(breadCrumbsLabels[key]),
14204
+ onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
14205
+ });
14206
+ }
14207
+ }
14208
+ });
14209
+ if (config.includeId && id && id !== 'user') {
14210
+ items.push({
14211
+ label: id,
14212
+ onClick: () => {}
14213
+ });
14214
+ }
14215
+ if (config.suffix) {
14216
+ config.suffix.forEach(suffixItem => {
14217
+ items.push({
14218
+ label: t(breadCrumbsLabels[suffixItem]),
14219
+ onClick: () => {}
14220
+ });
14221
+ });
14222
+ }
14223
+ };
14224
+ const renderBreadCrumbs = ({
14225
+ t = () => {},
14226
+ goTo = () => {},
14227
+ view,
14228
+ isAnalysis = false,
14229
+ isEdit = false,
14230
+ isView = false,
14231
+ isDataStore = false,
14232
+ id,
14233
+ addedItems = [],
14234
+ changeNotificationState,
14235
+ breadCrumbConfig = {},
14236
+ breadCrumbsLabels = {},
14237
+ getRedirectLink = () => {},
14238
+ condition,
14239
+ conditionFallback = 'show-non-interactive' // 'show-non-interactive' | 'hide' | 'show-simplified'
14240
+ }) => {
14241
+ const items = [];
14242
+ const createOnClick = callback => {
14243
+ if (!callback) return () => {};
14244
+ return () => {
14245
+ if (changeNotificationState) {
14246
+ changeNotificationState({
14247
+ onYes: callback
14248
+ });
14249
+ } else {
14250
+ callback();
14251
+ }
14252
+ };
14253
+ };
14254
+ const evaluateCondition = (cond, context) => {
14255
+ if (cond === undefined) return true; // No condition = always pass
14256
+ if (typeof cond === 'function') return cond(context); // Function condition
14257
+ return Boolean(cond); // Boolean condition
14258
+ };
14259
+ const config = breadCrumbConfig[view];
14260
+ console.log({
14261
+ config,
14262
+ breadCrumbConfig,
14263
+ breadCrumbsLabels,
14264
+ condition
14265
+ });
14266
+ if (config) {
14267
+ const conditionContext = {
14268
+ isDataStore,
14269
+ isAnalysis,
14270
+ isEdit,
14271
+ isView,
14272
+ id,
14273
+ view,
14274
+ t,
14275
+ goTo,
14276
+ getRedirectLink,
14277
+ changeNotificationState,
14278
+ addedItems
14279
+ };
14280
+ const externalConditionPassed = evaluateCondition(condition, conditionContext);
14281
+ const configConditionPassed = evaluateCondition(config.condition, conditionContext);
14282
+ if (!configConditionPassed) {
14283
+ if (config.fallback) {
14284
+ buildBreadCrumbs({
14285
+ config: config.fallback,
14286
+ items,
14287
+ t,
14288
+ breadCrumbsLabels,
14289
+ id,
14290
+ getRedirectLink,
14291
+ createOnClick,
14292
+ goTo,
14293
+ view
14294
+ });
14295
+ }
14296
+ } else if (!externalConditionPassed) {
14297
+ if (config.fallback) {
14298
+ // Use config fallback when prop condition fails
14299
+ buildBreadCrumbs({
14300
+ config: config.fallback,
14301
+ items,
14302
+ t,
14303
+ breadCrumbsLabels,
14304
+ id,
14305
+ getRedirectLink,
14306
+ createOnClick,
14307
+ goTo,
14308
+ view
14309
+ });
14310
+ } else {
14311
+ switch (conditionFallback) {
14312
+ case 'hide':
14313
+ break;
14314
+ case 'show-simplified':
14315
+ {
14316
+ const simplifiedConfig = {
14317
+ ...config,
14318
+ path: config.path.slice(0, 2),
14319
+ includeId: false,
14320
+ suffix: undefined
14321
+ };
14322
+ buildBreadCrumbs({
14323
+ config: simplifiedConfig,
14324
+ items,
14325
+ t,
14326
+ breadCrumbsLabels,
14327
+ id,
14328
+ getRedirectLink,
14329
+ createOnClick,
14330
+ goTo,
14331
+ view
14332
+ });
14333
+ break;
14334
+ }
14335
+ case 'show-non-interactive':
14336
+ default:
14337
+ buildBreadCrumbs({
14338
+ config,
14339
+ items,
14340
+ t,
14341
+ breadCrumbsLabels,
14342
+ id,
14343
+ getRedirectLink,
14344
+ createOnClick,
14345
+ goTo,
14346
+ view,
14347
+ skipInteractions: true
14348
+ });
14349
+ break;
14350
+ }
14351
+ }
14352
+ } else {
14353
+ buildBreadCrumbs({
14354
+ config,
14355
+ items,
14356
+ t,
14357
+ breadCrumbsLabels,
14358
+ id,
14359
+ getRedirectLink,
14360
+ createOnClick,
14361
+ goTo,
14362
+ view
14363
+ });
14364
+ }
14365
+ }
14366
+ if (isView) {
14367
+ items.push({
14368
+ label: t(breadCrumbsLabels.details)
14369
+ });
14370
+ } else if (isEdit) {
14371
+ items.push({
14372
+ label: t(breadCrumbsLabels.edit)
14373
+ });
14374
+ } else if (isAnalysis) {
14375
+ items.push({
14376
+ label: t(breadCrumbsLabels.summary)
14377
+ });
14378
+ }
14379
+ items.push(...addedItems);
14380
+ return items.filter(v => !!v.label);
14381
+ };
14382
+
14383
+ // Breadcrumbs Config Helper
14384
+
14385
+ // 1.Simple static path
14386
+ // 'country-overview': {
14387
+ // path: ['analysis', 'country-overview'],
14388
+ // }
14389
+ // Result: Analysis > Country Overview
14390
+ // Neither is clickable
14391
+
14392
+ // 2.Clickable Parents with Links
14393
+ // 'mines': {
14394
+ // path: [
14395
+ // 'modules', // Not clickable
14396
+ // { key: 'mines', link: '/app/mines' } // Clickable, navigates to /app/mines
14397
+ // ],
14398
+ // }
14399
+ // Result: Modules > Mines (clickable)
14400
+
14401
+ // 3.Include ID at the end
14402
+ // 'partners': {
14403
+ // path: ['modules', { key: 'partners', link: '/app/partners', useRedirect: true }],
14404
+ // includeId: true, // ← ID will be added at the end
14405
+ // }
14406
+ // With id='ABC123':
14407
+ // Result: Modules > Partners (clickable) > ABC123 (not clickable)
14408
+
14409
+ // 4.Dynamic Id in the middle
14410
+ // 'mine-evaluation': {
14411
+ // path: [
14412
+ // 'modules',
14413
+ // { key: 'mines', link: '/app/mines' },
14414
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // ← ID here
14415
+ // 'evaluation',
14416
+ // ],
14417
+ // }
14418
+ // With id='MINE-456':
14419
+ // Result: Modules > Mines > MINE-456 (clickable to /app/mines/MINE-456) > Evaluation
14420
+
14421
+ // 5. Dynamic Links using functions
14422
+ // 'producers': {
14423
+ // path: [
14424
+ // 'modules',
14425
+ // {
14426
+ // key: 'producers',
14427
+ // link: (view) => `/app/${view}`, // ← Uses 'view' parameter
14428
+ // useRedirect: true
14429
+ // }
14430
+ // ],
14431
+ // includeId: true,
14432
+ // }
14433
+ // With view='producers':
14434
+ // Result: Modules > Producers (navigates to /app/producers)
14435
+
14436
+ // 6.use Redirect link
14437
+ // 'settings': {
14438
+ // path: [
14439
+ // {
14440
+ // key: 'settings',
14441
+ // link: '/app/view/settings',
14442
+ // useRedirect: true // ← Wraps with getRedirectLink()
14443
+ // }
14444
+ // ],
14445
+ // }
14446
+ // Navigation will use getRedirectLink('/app/view/settings')
14447
+
14448
+ // 7.Conditional Rendering
14449
+ // 'entities': {
14450
+ // condition: (opts) => opts.isDataStore, // ← Only shows if isDataStore=true
14451
+ // path: [
14452
+ // 'data',
14453
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
14454
+ // { key: 'entities', link: '/app/data-store/entities', useRedirect: true },
14455
+ // ],
14456
+ // }
14457
+ // With isDataStore=false: No breadcrumbs shown
14458
+ // With isDataStore=true: Data > Store > Entities
14459
+
14460
+ // 8.Conditional Fallback
14461
+ // 'locations': {
14462
+ // condition: (opts) => opts.isDataStore,
14463
+ // path: [
14464
+ // 'data',
14465
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
14466
+ // { key: 'locations', link: '/app/data-store/locations', useRedirect: true },
14467
+ // ],
14468
+ // fallback: { // ← Alternative when condition is false
14469
+ // path: [
14470
+ // 'modules',
14471
+ // 'linkedSubjects',
14472
+ // { key: 'locations', link: '/app/locations', useRedirect: true },
14473
+ // ],
14474
+ // includeId: true,
14475
+ // },
14476
+ // }
14477
+ // isDataStore=true: Data > Store > Locations
14478
+ // isDataStore=false: Modules > Associated Information > Locations > {id}
14479
+
14480
+ // 9. Suffix items
14481
+ // 'mine-monitoring': {
14482
+ // path: [
14483
+ // 'modules',
14484
+ // { key: 'mines', link: '/app/mines' }
14485
+ // ],
14486
+ // includeId: true,
14487
+ // suffix: ['visits'], // ← Added at the end
14488
+ // }
14489
+ // With id='MINE-789':
14490
+ // Result: Modules > Mines > MINE-789 > Visits
14491
+
14492
+ // 10. Complex multi level path
14493
+ // 'monitoringReport': {
14494
+ // path: [
14495
+ // 'modules', // Static label
14496
+ // { key: 'mines', link: '/app/mines' }, // Clickable parent
14497
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // Dynamic ID with link
14498
+ // 'monitoringReport', // Static label at end
14499
+ // ],
14500
+ // }
14501
+ // With id='MINE-999':
14502
+ // Result: Modules > Mines (→/app/mines) > MINE-999 (→/app/mines/MINE-999) > Executive Monitoring Report
14503
+
14504
+ // 11. Access multiple options in condition
14505
+ // 'custom-view': {
14506
+ // condition: (opts) => opts.isDataStore && opts.isEdit && opts.id,
14507
+ // path: ['data', 'custom'],
14508
+ // }
14509
+ // Available in opts: { isDataStore, isAnalysis, isEdit, isView, id, view }
14510
+
14511
+ /**
14512
+ * Copies text content from an element to the clipboard.
14513
+ *
14514
+ * This function takes an element ID, selects the text content from that element,
14515
+ * and copies it to the clipboard. It handles browser compatibility issues
14516
+ * between IE and modern browsers.
14517
+ *
14518
+ * @param {string} id - The ID of the HTML element containing text to copy
14519
+ * @returns {boolean} - Returns true if copying succeeded, false otherwise
14520
+ *
14521
+ * @example
14522
+ * // HTML: <input id="myText" value="Text to copy" />
14523
+ * copyToClipboard('myText'); // Copies "Text to copy" to clipboard
14524
+ */
14525
+
14526
+ const copyToClipboard = id => {
14527
+ let text = document.getElementById(id);
14528
+ text.select();
14529
+ text = text.value;
14530
+ if (window.clipboardData && window.clipboardData.setData) {
14531
+ // IE: prevent textarea being shown while dialog is visible
14532
+ return window.clipboardData.setData("Text", text);
14533
+ } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
14534
+ var textarea = document.createElement("textarea");
14535
+ textarea.textContent = text;
14536
+ // Prevent scrolling to bottom of page in MS Edge
14537
+ textarea.style.position = "fixed";
14538
+ document.body.appendChild(textarea);
14539
+ textarea.select();
14540
+ try {
14541
+ // Security exception may be thrown by some browsers
14542
+ return document.execCommand("copy");
14543
+ } catch (ex) {
14544
+ console.warn("Copy to clipboard failed.", ex);
14545
+ return false;
14546
+ } finally {
14547
+ document.body.removeChild(textarea);
14548
+ }
14549
+ }
14550
+ };
14551
+
14167
14552
  exports.ErrorFormat = ErrorFormat;
14168
14553
  exports.MessageTypes = MessageTypes;
14169
14554
  exports.StorageManager = StorageManager;
14170
14555
  exports.assignParamsToUrl = assignParamsToUrl;
14171
14556
  exports.btn = button;
14172
14557
  exports.buildActionWidgetsConfig = buildActionWidgetsConfig;
14558
+ exports.buildBreadCrumbsHelper = buildBreadCrumbs;
14173
14559
  exports.buildBreadcrumbs = buildBreadcrumbs;
14174
14560
  exports.buildKeyIndicatorsConfig = buildKeyIndicatorsConfig;
14175
14561
  exports.buildQueryString = buildQueryString;
@@ -14181,6 +14567,7 @@ exports.captureElementsAsImages = captureElementsAsImages;
14181
14567
  exports.changeInputMeta = changeInputMeta;
14182
14568
  exports.cleanJSON = cleanJSON;
14183
14569
  exports.convertUndefinedToNull = convertUndefinedToNull;
14570
+ exports.copyToClipboard = copyToClipboard;
14184
14571
  exports.createAdminTheme = createAdminTheme;
14185
14572
  exports.createDocument = createDocument;
14186
14573
  exports.createErrorHandler = createErrorHandler;
@@ -14234,6 +14621,7 @@ exports.modules = modules;
14234
14621
  exports.nowToIso = nowToIso;
14235
14622
  exports.processConfig = processConfig;
14236
14623
  exports.propHasValue = propHasValue;
14624
+ exports.renderBreadCrumbs = renderBreadCrumbs;
14237
14625
  exports.renderDateFormatted = renderDateFormatted;
14238
14626
  exports.renderNumber = renderNumber;
14239
14627
  exports.renderPercentage = renderPercentage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.759",
3
+ "version": "0.6.761",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
package/rollup.config.js CHANGED
@@ -103,6 +103,26 @@ export default [
103
103
  requireReturnsDefault: "auto",
104
104
  }),
105
105
  ],
106
+ },
107
+ {
108
+ input: "src/constants.js",
109
+ output: [
110
+ {
111
+ file: "dist/constants/index.js",
112
+ format: "cjs",
113
+ },
114
+ ],
115
+ external,
116
+ plugins: [
117
+ nodePolyfills(),
118
+ resolve({ browser: true }),
119
+ babel({ exclude: "node_modules/**", babelrc: true }),
120
+ peerDep(),
121
+ commonjs({
122
+ include: /node_modules/,
123
+ requireReturnsDefault: "auto",
124
+ }),
125
+ ],
106
126
  },
107
127
  {
108
128
  input: "src/services.js",