datastake-daf 0.6.727 → 0.6.729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +31 -30
- package/dist/hooks/index.js +4872 -192
- package/dist/layouts/index.js +3 -6
- package/dist/pages/index.js +15809 -252
- package/dist/services/index.js +213 -0
- package/dist/utils/index.js +23 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Sidenav/index.jsx +1 -7
- package/src/@daf/core/components/Table/index.jsx +28 -22
- package/src/@daf/hooks/useFilters.js +1 -1
- package/src/@daf/hooks/useGetQueryParams.js +26 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +129 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/config.js +31 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/create.jsx +103 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +140 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/DataCompilation/index.jsx +0 -1
- package/src/@daf/pages/pages/TablePageWithTabs/index.jsx +128 -0
- package/src/@daf/services/LinkedSubjects.js +131 -0
- package/src/@daf/utils/object.js +12 -0
- package/src/hooks.js +2 -1
- package/src/pages.js +6 -1
- package/src/services.js +2 -1
- package/src/utils.js +1 -1
- package/public/assets/favicons/datastake-black.svg +0 -13
- package/public/assets/favicons/datastake-blue.svg +0 -13
- package/public/assets/favicons/datastake-small.svg +0 -4
- package/public/assets/favicons/datastake-smallBlue.svg +0 -4
- package/public/assets/favicons/datastake-white.svg +0 -13
package/dist/services/index.js
CHANGED
|
@@ -4,10 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var axios = require('axios');
|
|
6
6
|
require('antd');
|
|
7
|
+
require('moment');
|
|
8
|
+
require('lodash');
|
|
9
|
+
var dayjs = require('dayjs');
|
|
7
10
|
|
|
8
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
12
|
|
|
10
13
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
14
|
+
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
11
15
|
|
|
12
16
|
const cleanJSON = json => {
|
|
13
17
|
for (let key in json) {
|
|
@@ -1227,6 +1231,214 @@ class DashboardService extends BaseService {
|
|
|
1227
1231
|
}
|
|
1228
1232
|
var DashboardService$1 = createLazyService(DashboardService);
|
|
1229
1233
|
|
|
1234
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1235
|
+
|
|
1236
|
+
function createCommonjsModule(fn, module) {
|
|
1237
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
var customParseFormat = createCommonjsModule(function (module, exports) {
|
|
1241
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
var utc = createCommonjsModule(function (module, exports) {
|
|
1245
|
+
!function(t,i){module.exports=i();}(commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
var localizedFormat = createCommonjsModule(function (module, exports) {
|
|
1249
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var o=this.$locale().formats,n=function(t,o){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,o){return t||o.slice(1)}))}))}(t,void 0===o?{}:o);return i.call(this,n)};}}));
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
createCommonjsModule(function (module, exports) {
|
|
1253
|
+
!function(e,n){module.exports=n(dayjs__default["default"]);}(commonjsGlobal,(function(e){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e),i={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(e){return ""+e+(1===e?"er":"")}};return t.default.locale(i,null,!0),i}));
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
createCommonjsModule(function (module, exports) {
|
|
1257
|
+
!function(e,o){module.exports=o(dayjs__default["default"]);}(commonjsGlobal,(function(e){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(e),d={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(e){return e+"º"}};return s.default.locale(d,null,!0),d}));
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
createCommonjsModule(function (module, exports) {
|
|
1261
|
+
!function(e,n){module.exports=n();}(commonjsGlobal,(function(){return {name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}}));
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
/* eslint-disable no-case-declarations */
|
|
1265
|
+
dayjs__default["default"].extend(customParseFormat);
|
|
1266
|
+
dayjs__default["default"].extend(utc);
|
|
1267
|
+
dayjs__default["default"].extend(utc);
|
|
1268
|
+
dayjs__default["default"].extend(localizedFormat);
|
|
1269
|
+
const isObjectEmpty = obj => {
|
|
1270
|
+
if (obj === null || typeof obj !== "object") {
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
if (Object.keys(obj).length === 0) {
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
return Object.values(obj).every(value => isObjectEmpty(value));
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* Filters and processes the input data by extracting specific properties.
|
|
1281
|
+
* It checks if the 'meta' property is empty and sets it to undefined if so,
|
|
1282
|
+
* then returns the rest of the data merged with the processed 'meta'. Used to clear data
|
|
1283
|
+
* when they are sent to backend.
|
|
1284
|
+
*
|
|
1285
|
+
* @param {Object} data - The input data object containing various properties.
|
|
1286
|
+
* @returns {Object} - The processed data object with filtered properties.
|
|
1287
|
+
*/
|
|
1288
|
+
|
|
1289
|
+
const filterCreateData = data => {
|
|
1290
|
+
// eslint-disable-next-line no-unused-vars
|
|
1291
|
+
const {
|
|
1292
|
+
view,
|
|
1293
|
+
module,
|
|
1294
|
+
scope,
|
|
1295
|
+
form,
|
|
1296
|
+
meta,
|
|
1297
|
+
createdAt,
|
|
1298
|
+
updatedAt,
|
|
1299
|
+
...rest
|
|
1300
|
+
} = data;
|
|
1301
|
+
const _meta = isObjectEmpty(meta) ? undefined : meta;
|
|
1302
|
+
return {
|
|
1303
|
+
...rest,
|
|
1304
|
+
meta: _meta
|
|
1305
|
+
};
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
dayjs__default["default"].extend(utc);
|
|
1309
|
+
const removeKeysFromObject = (obj = {}, keys = []) => {
|
|
1310
|
+
if (typeof obj !== 'object' || obj === null) return obj;
|
|
1311
|
+
const result = {};
|
|
1312
|
+
for (const key of Object.keys(obj)) {
|
|
1313
|
+
if (!keys.includes(key)) {
|
|
1314
|
+
result[key] = obj[key];
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
return result;
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
const getNamespace = namespace => {
|
|
1321
|
+
console.log({
|
|
1322
|
+
namespace
|
|
1323
|
+
});
|
|
1324
|
+
let _namespace = namespace;
|
|
1325
|
+
switch (namespace) {
|
|
1326
|
+
case "locations":
|
|
1327
|
+
_namespace = "location";
|
|
1328
|
+
break;
|
|
1329
|
+
case "stakeholders":
|
|
1330
|
+
_namespace = "stakeholder";
|
|
1331
|
+
break;
|
|
1332
|
+
case "documents":
|
|
1333
|
+
_namespace = "document";
|
|
1334
|
+
break;
|
|
1335
|
+
case "nashirikiEvent":
|
|
1336
|
+
case "events":
|
|
1337
|
+
_namespace = "event";
|
|
1338
|
+
break;
|
|
1339
|
+
}
|
|
1340
|
+
return _namespace;
|
|
1341
|
+
};
|
|
1342
|
+
class LinkedSubjectsService extends BaseService {
|
|
1343
|
+
getForm({
|
|
1344
|
+
namespace
|
|
1345
|
+
}, language = "en") {
|
|
1346
|
+
return this.apiGet({
|
|
1347
|
+
url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
|
|
1348
|
+
isApp: true,
|
|
1349
|
+
params: {
|
|
1350
|
+
scope: namespace === "nashirikiEvent" ? "event" : namespace !== "documents" ? getNamespace(namespace) : "createDocument",
|
|
1351
|
+
language
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
getWithModule({
|
|
1356
|
+
query,
|
|
1357
|
+
signal,
|
|
1358
|
+
namespace
|
|
1359
|
+
}) {
|
|
1360
|
+
const _namespace = getNamespace(namespace);
|
|
1361
|
+
return this.apiGet({
|
|
1362
|
+
url: `/${_namespace}/associated-information`,
|
|
1363
|
+
isApp: true,
|
|
1364
|
+
params: query,
|
|
1365
|
+
signal
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
getOne({
|
|
1369
|
+
id,
|
|
1370
|
+
signal,
|
|
1371
|
+
namespace,
|
|
1372
|
+
sourceId
|
|
1373
|
+
}) {
|
|
1374
|
+
return this.apiGet({
|
|
1375
|
+
url: `/${namespace === "nashirikiEvent" ? "event" : namespace}/${id}`,
|
|
1376
|
+
isApp: true,
|
|
1377
|
+
signal,
|
|
1378
|
+
params: {
|
|
1379
|
+
authorId: sourceId
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
getData(query, namespace) {
|
|
1384
|
+
return this.apiGet({
|
|
1385
|
+
url: `/${namespace}/data`,
|
|
1386
|
+
isApp: true,
|
|
1387
|
+
params: query
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
save(payload, namespace) {
|
|
1391
|
+
if (payload.datastakeId) {
|
|
1392
|
+
let _namespace = getNamespace(namespace);
|
|
1393
|
+
const keysToRemove = ['associatedSubjects', 'authorId', 'channels', 'form', 'createdAt', 'meta', 'module', 'updatedAt', 'published', 'version', 'sbgi'];
|
|
1394
|
+
const filteredData = removeKeysFromObject(payload, keysToRemove);
|
|
1395
|
+
return this.apiPut({
|
|
1396
|
+
url: `/${_namespace}/${filteredData.id}`,
|
|
1397
|
+
isApp: true,
|
|
1398
|
+
data: filterCreateData(filteredData)
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
return this.apiPost({
|
|
1402
|
+
url: `/${getNamespace(namespace)}`,
|
|
1403
|
+
isApp: true,
|
|
1404
|
+
data: payload
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
remove(id, data, namespace, mod) {
|
|
1408
|
+
if (mod) {
|
|
1409
|
+
return this.apiDelete({
|
|
1410
|
+
url: `/${namespace}/${id}`,
|
|
1411
|
+
isApp: true,
|
|
1412
|
+
data: data
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
return this.apiDelete({
|
|
1416
|
+
url: `/${namespace}/${id}/remove`,
|
|
1417
|
+
data: data
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
getLinkedSubjects({
|
|
1421
|
+
namespace,
|
|
1422
|
+
id
|
|
1423
|
+
}) {
|
|
1424
|
+
const _namespace = getNamespace(namespace);
|
|
1425
|
+
return this.apiGet({
|
|
1426
|
+
url: `/${namespace === "events" ? "event" : _namespace}/${id}/linkedSubjects`,
|
|
1427
|
+
isApp: true
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
getOptions() {
|
|
1431
|
+
return this.apiGet({
|
|
1432
|
+
url: `/forms/options`,
|
|
1433
|
+
isApp: true,
|
|
1434
|
+
params: {
|
|
1435
|
+
id: "categoryOptions,locationCategories,countries,category,subCategory,optionPositionSupplyChain"
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
var LinkedSubjects = createLazyService(LinkedSubjectsService);
|
|
1441
|
+
|
|
1230
1442
|
exports.AdminService = AdminService$1;
|
|
1231
1443
|
exports.AuthenticationService = AuthenticationService$1;
|
|
1232
1444
|
exports.BaseHTTPService = BaseHTTPService;
|
|
@@ -1236,6 +1448,7 @@ exports.DashboardService = DashboardService$1;
|
|
|
1236
1448
|
exports.DataStoreService = DataStoreService$1;
|
|
1237
1449
|
exports.ErrorHandler = ErrorHandler;
|
|
1238
1450
|
exports.ErrorService = ErrorService;
|
|
1451
|
+
exports.LinkedSubjectsService = LinkedSubjects;
|
|
1239
1452
|
exports.NotificationService = NotificationService$1;
|
|
1240
1453
|
exports.QueryService = QueryService$1;
|
|
1241
1454
|
exports.SourceService = SourceService$1;
|
package/dist/utils/index.js
CHANGED
|
@@ -5888,6 +5888,28 @@ const changeInputMeta = ({
|
|
|
5888
5888
|
const renderDateFormatted = (value, format = "DD MMM YYYY", locale = "en") => {
|
|
5889
5889
|
return dayjs__default["default"].utc(value, "YYYY-MM-DD").locale(locale).format(format);
|
|
5890
5890
|
};
|
|
5891
|
+
/**
|
|
5892
|
+
* Sorts a form object by its inputs' positions.
|
|
5893
|
+
*
|
|
5894
|
+
* @param {Object} form - The form object containing various inputs.
|
|
5895
|
+
* @returns {Object} - The sorted form object.
|
|
5896
|
+
*/
|
|
5897
|
+
const sortForm = ({
|
|
5898
|
+
form
|
|
5899
|
+
}) => {
|
|
5900
|
+
const _form = Object.keys(form).reduce((all, key) => {
|
|
5901
|
+
const _this = Object.keys(form[key]).sort((a, b) => form[key][a].position - form[key][b].position).reduce((all, k) => {
|
|
5902
|
+
if (k === "scope") {
|
|
5903
|
+
return all;
|
|
5904
|
+
}
|
|
5905
|
+
all[k] = form[key][k];
|
|
5906
|
+
return all;
|
|
5907
|
+
}, {});
|
|
5908
|
+
all[key] = _this;
|
|
5909
|
+
return all;
|
|
5910
|
+
}, {});
|
|
5911
|
+
return _form;
|
|
5912
|
+
};
|
|
5891
5913
|
|
|
5892
5914
|
({
|
|
5893
5915
|
background: PropTypes__default["default"].string,
|
|
@@ -14413,6 +14435,7 @@ exports.renderTooltipJsx = renderTooltipJsx;
|
|
|
14413
14435
|
exports.safeJsonParse = safeJsonParse;
|
|
14414
14436
|
exports.showHideInput = showHideInput;
|
|
14415
14437
|
exports.snakeCaseToTitleCase = snakeCaseToTitleCase;
|
|
14438
|
+
exports.sortForm = sortForm;
|
|
14416
14439
|
exports.splitStringInMultipleLines = splitStringInMultipleLines;
|
|
14417
14440
|
exports.tazamaTheme = tazamaTheme;
|
|
14418
14441
|
exports.tifTheme = tifTheme;
|
package/package.json
CHANGED
|
@@ -24,7 +24,6 @@ export default function Sidenav({
|
|
|
24
24
|
hoverContentSecond,
|
|
25
25
|
t = (s) => s,
|
|
26
26
|
isDatastake = false,
|
|
27
|
-
logoVariant = "white",
|
|
28
27
|
}) {
|
|
29
28
|
return (
|
|
30
29
|
<ConfigProvider
|
|
@@ -73,10 +72,7 @@ export default function Sidenav({
|
|
|
73
72
|
<div className="sidenav-footer">
|
|
74
73
|
<h6>{t("Powered By")}</h6>
|
|
75
74
|
<img
|
|
76
|
-
src={
|
|
77
|
-
poweredByLogo ||
|
|
78
|
-
`/assets/favicons/datastake-${logoVariant}.svg`
|
|
79
|
-
}
|
|
75
|
+
src={poweredByLogo || "/assets/images/datastake-white.svg"}
|
|
80
76
|
alt="logo"
|
|
81
77
|
/>
|
|
82
78
|
</div>
|
|
@@ -285,10 +281,8 @@ Sidenav.propTypes = {
|
|
|
285
281
|
topHoverSecond: propTypes.any,
|
|
286
282
|
hoverItemSecond: propTypes.any,
|
|
287
283
|
widthHoverSecond: propTypes.any,
|
|
288
|
-
poweredByLogo: propTypes.any,
|
|
289
284
|
hoverContentSecond: propTypes.any,
|
|
290
285
|
t: propTypes.any,
|
|
291
286
|
isDatastake: propTypes.any,
|
|
292
|
-
logoVariant: propTypes.oneOf(["white", "black"]),
|
|
293
287
|
};
|
|
294
288
|
|
|
@@ -44,7 +44,7 @@ export default function DAFTable({
|
|
|
44
44
|
if (!filtersInit && !loading) {
|
|
45
45
|
setFiltersInit(true);
|
|
46
46
|
}
|
|
47
|
-
}, [loading]);
|
|
47
|
+
}, [loading, filtersInit]);
|
|
48
48
|
|
|
49
49
|
const sources = useMemo(() => {
|
|
50
50
|
if (projectData) {
|
|
@@ -61,34 +61,40 @@ export default function DAFTable({
|
|
|
61
61
|
return undefined;
|
|
62
62
|
}, [projectData, sourceId, projectSources]);
|
|
63
63
|
|
|
64
|
-
const _selectOptions =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
const _selectOptions = useMemo(() => {
|
|
65
|
+
return typeof sourcesKey === 'string' && sources ? {
|
|
66
|
+
...selectOptions,
|
|
67
|
+
[sourcesKey]: sources,
|
|
68
|
+
} : selectOptions;
|
|
69
|
+
}, [sourcesKey, sources, selectOptions]);
|
|
70
|
+
|
|
71
|
+
const _filtersConfig = useMemo(() => {
|
|
72
|
+
return typeof sourcesKey === 'string' && sources ? {
|
|
73
|
+
...filtersConfig,
|
|
74
|
+
[sourcesKey]: {
|
|
75
|
+
type: "select",
|
|
76
|
+
label: t("Source"),
|
|
77
|
+
placeholder: (t) => `${t("Filter By")} ${t('Source')}`,
|
|
78
|
+
labelStyle: { flex: 1 },
|
|
79
|
+
style: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
},
|
|
82
|
+
getLabel: (opt) => opt.label,
|
|
83
|
+
getValue: (opt) => opt.value,
|
|
77
84
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
} : filtersConfig;
|
|
85
|
+
} : filtersConfig;
|
|
86
|
+
}, [sourcesKey, sources, filtersConfig, t]);
|
|
82
87
|
|
|
83
88
|
useEffect(() => {
|
|
84
89
|
if (data) {
|
|
85
90
|
setSource(data);
|
|
86
91
|
}
|
|
87
|
-
}, [data]);
|
|
92
|
+
}, [data.length]);
|
|
88
93
|
|
|
94
|
+
const paginationPageSize = pagination?.pageSize;
|
|
89
95
|
const dataSource = useMemo(() => {
|
|
90
|
-
const pageSize =
|
|
91
|
-
?
|
|
96
|
+
const pageSize = paginationPageSize
|
|
97
|
+
? paginationPageSize
|
|
92
98
|
: source.length > 10 ? source.length : 10;
|
|
93
99
|
|
|
94
100
|
if (doEmptyRows && pageSize) {
|
|
@@ -101,7 +107,7 @@ export default function DAFTable({
|
|
|
101
107
|
return emptyDataSource.map((empty, i) => source[i] || empty);
|
|
102
108
|
}
|
|
103
109
|
return source;
|
|
104
|
-
}, [source,
|
|
110
|
+
}, [source, paginationPageSize, doEmptyRows]);
|
|
105
111
|
|
|
106
112
|
return <>
|
|
107
113
|
{(showFilters && filtersConfig && onFilterChange && filtersInit) && (
|
|
@@ -91,7 +91,7 @@ export const useFilters = ({
|
|
|
91
91
|
: `${`/app/${module}/${view}`}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
}, [module, view, location.pathname]);
|
|
94
|
+
}, [module, view, location.pathname, goTo, getRedirectLink, doPagination]);
|
|
95
95
|
|
|
96
96
|
const defaultFilters = useMemo(() => {
|
|
97
97
|
const def = {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { safeJsonParse } from "../../helpers/StringHelper.js";
|
|
3
|
+
|
|
4
|
+
export const useGetQueryParams = ({location}) => {
|
|
5
|
+
const queryParams = useMemo(() => {
|
|
6
|
+
const params = new URLSearchParams(location?.search);
|
|
7
|
+
return Object.fromEntries(params.entries());
|
|
8
|
+
}, [location.search]);
|
|
9
|
+
|
|
10
|
+
const params = useMemo(() => {
|
|
11
|
+
const { page, pageSize, search, searchParams: rawSearchParams, ...rest } = queryParams;
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
paginationQuery: { page, pageSize },
|
|
15
|
+
searchParams: {
|
|
16
|
+
qs: search,
|
|
17
|
+
fields: safeJsonParse(rawSearchParams),
|
|
18
|
+
},
|
|
19
|
+
otherParams: {
|
|
20
|
+
...rest,
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, [queryParams]);
|
|
24
|
+
|
|
25
|
+
return params;
|
|
26
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from 'antd';
|
|
3
|
+
import { findOptions } from '../../../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../../../helpers/Forms.js';
|
|
5
|
+
import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
|
|
6
|
+
import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
|
|
7
|
+
|
|
8
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject}) => [
|
|
9
|
+
{
|
|
10
|
+
dataIndex: 'datastakeId',
|
|
11
|
+
title: t('ID'),
|
|
12
|
+
ellipsis: true,
|
|
13
|
+
show: true,
|
|
14
|
+
render: (v, all) => {
|
|
15
|
+
if (all.empty) {
|
|
16
|
+
return <div className="daf-default-cell" />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
dataIndex: 'name',
|
|
24
|
+
title: t('Name'),
|
|
25
|
+
ellipsis: true,
|
|
26
|
+
show: true,
|
|
27
|
+
render: (v, all) => {
|
|
28
|
+
if (all.empty) {
|
|
29
|
+
return <div className="daf-default-cell" />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
dataIndex: 'category',
|
|
37
|
+
title: t('Category'),
|
|
38
|
+
ellipsis: true,
|
|
39
|
+
show: true,
|
|
40
|
+
render: (v, all) => {
|
|
41
|
+
if (all.empty) {
|
|
42
|
+
return <div className="daf-default-cell" />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const category = findOptions(v, options?.categoriesOptions);
|
|
46
|
+
|
|
47
|
+
return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
dataIndex: 'subCategory',
|
|
52
|
+
title: t('Sub Category'),
|
|
53
|
+
ellipsis: true,
|
|
54
|
+
show: true,
|
|
55
|
+
render: (v, all) => {
|
|
56
|
+
if (all.empty) {
|
|
57
|
+
return <div className="daf-default-cell" />
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const subCategory = findOptions(v, options?.subCategoriesOptions);
|
|
61
|
+
|
|
62
|
+
return subCategory ? <Tooltip title={subCategory}>{subCategory}</Tooltip> : '-';
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
dataIndex: 'country',
|
|
67
|
+
title: t('Country'),
|
|
68
|
+
ellipsis: true,
|
|
69
|
+
show: true,
|
|
70
|
+
render: (v, all) => {
|
|
71
|
+
if (all.empty) {
|
|
72
|
+
return <div className="daf-default-cell" />
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const country = findOptions(v, options?.countries);
|
|
76
|
+
|
|
77
|
+
return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: t("Date"),
|
|
82
|
+
dataIndex: "date",
|
|
83
|
+
key: "date",
|
|
84
|
+
width: 125,
|
|
85
|
+
render: (date, all) => {
|
|
86
|
+
if (all.empty) {
|
|
87
|
+
return <div className="daf-default-cell" />;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
91
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
92
|
+
},
|
|
93
|
+
ellipsis: true,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: t("Sources"),
|
|
97
|
+
dataIndex: "sources",
|
|
98
|
+
key: "sources",
|
|
99
|
+
show: activeTab !== "own",
|
|
100
|
+
render: (val, all) => {
|
|
101
|
+
if (all.empty) {
|
|
102
|
+
return <div className="daf-default-cell" />;
|
|
103
|
+
}
|
|
104
|
+
if (!val || val?.length === 0) {
|
|
105
|
+
return "--";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return <AvatarGroup items={val}></AvatarGroup>;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'actions',
|
|
113
|
+
title: "",
|
|
114
|
+
width: 60,
|
|
115
|
+
render: (_, all) => {
|
|
116
|
+
if (all.empty) {
|
|
117
|
+
return <div className="daf-default-cell" />;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
121
|
+
|
|
122
|
+
return <div style={{ display: "flex", justifyContent: "center" }}>
|
|
123
|
+
<a href={getRedirectLink(link)}>
|
|
124
|
+
<CustomIcon name="Link" size={15} color={theme.baseGray70} />
|
|
125
|
+
</a>
|
|
126
|
+
</div>;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const checkboxConfig = {
|
|
2
|
+
name: 'Name',
|
|
3
|
+
datastakeId: 'ID'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const getFiltersConfig = ({t}) => {
|
|
7
|
+
return {
|
|
8
|
+
country: {
|
|
9
|
+
type: 'select',
|
|
10
|
+
placeholder: t('Country'),
|
|
11
|
+
style: { flex: 1 },
|
|
12
|
+
labelStyle: { flex: 1 },
|
|
13
|
+
getLabel: (option) => option.label,
|
|
14
|
+
getValue: (option) => option.value,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const filtersConfig = {
|
|
20
|
+
name: '',
|
|
21
|
+
datastakeId: '',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getFilterOptions = (options, t) => {
|
|
25
|
+
const { countries } = options || {};
|
|
26
|
+
const _default = {
|
|
27
|
+
country: countries,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _default;
|
|
31
|
+
}
|