datastake-daf 0.6.811 → 0.6.812
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +35 -57
- package/dist/pages/index.js +26 -4
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/FaunaWidget/index.jsx +1 -2
- package/src/@daf/pages/Summary/Activities/Monitoring/components/BiodiversityAndHabitat/index.jsx +2 -2
- package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +24 -0
package/dist/components/index.js
CHANGED
|
@@ -19415,8 +19415,6 @@ function FaunaWidget(_ref) {
|
|
|
19415
19415
|
$itemWidth: itemWidth,
|
|
19416
19416
|
$itemHeight: itemHeight,
|
|
19417
19417
|
children: faunaConfig.map(item => {
|
|
19418
|
-
// Use colored SVG if the item's key exists in faunaPresent array
|
|
19419
|
-
// Otherwise use default SVG
|
|
19420
19418
|
const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(item.key);
|
|
19421
19419
|
const shouldUseColored = isPresent;
|
|
19422
19420
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
@@ -20026,8 +20024,7 @@ function _checkValue(wantedValue, match, fieldValue) {
|
|
|
20026
20024
|
}
|
|
20027
20025
|
return false;
|
|
20028
20026
|
}
|
|
20029
|
-
function getInputProp$1(prop) {
|
|
20030
|
-
let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20027
|
+
function getInputProp$1(prop, formsValue = {}) {
|
|
20031
20028
|
if (prop && typeof prop === 'object') {
|
|
20032
20029
|
const validations = Object.keys(prop);
|
|
20033
20030
|
const key = validations.find(v => {
|
|
@@ -20041,9 +20038,7 @@ function getInputProp$1(prop) {
|
|
|
20041
20038
|
return prop;
|
|
20042
20039
|
}
|
|
20043
20040
|
}
|
|
20044
|
-
function getInputLabel$2(input) {
|
|
20045
|
-
let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20046
|
-
let asText = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
20041
|
+
function getInputLabel$2(input, formsValue = {}, asText = false) {
|
|
20047
20042
|
const label = getInputProp$1(input.label, formsValue);
|
|
20048
20043
|
return input.description && typeof input.description === 'string' && !asText ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
20049
20044
|
children: [ReactHtmlParser__default["default"](label), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
@@ -20250,22 +20245,14 @@ const sgbEvaluationIcons = getSgbEvaluationIcons(22, 22);
|
|
|
20250
20245
|
const types = {
|
|
20251
20246
|
MODAL: 'modal'
|
|
20252
20247
|
};
|
|
20253
|
-
const isGroupInput =
|
|
20254
|
-
var _group$meta;
|
|
20255
|
-
let repeatable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20256
|
-
let data = arguments.length > 2 ? arguments[2] : undefined;
|
|
20248
|
+
const isGroupInput = (group, repeatable = false, data) => {
|
|
20257
20249
|
let resp = group.inputs && Object.keys(group.inputs).length && group.repeatable === repeatable && group.type !== 'groupInputs' && group.type !== 'group' && group.type !== 'dataLinkGroup' && group.display !== 'group' && !group.viewGroup && !group.component;
|
|
20258
|
-
if (group.showIf || group
|
|
20250
|
+
if (group.showIf || group?.meta?.excludeFromView) {
|
|
20259
20251
|
resp = resp && showHideInput$3(group, data);
|
|
20260
20252
|
}
|
|
20261
20253
|
return resp;
|
|
20262
20254
|
};
|
|
20263
|
-
const repeatObjects =
|
|
20264
|
-
let fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
|
20265
|
-
let filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20266
|
-
let sort = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
20267
|
-
return filter ? Object.keys(obj).filter(key => filter(obj[key])).map(fn) : sort ? Object.keys(obj).sort(sort).map(fn) : Object.keys(obj).map(fn);
|
|
20268
|
-
};
|
|
20255
|
+
const repeatObjects = (obj, fn = () => {}, filter = null, sort = null) => filter ? Object.keys(obj).filter(key => filter(obj[key])).map(fn) : sort ? Object.keys(obj).sort(sort).map(fn) : Object.keys(obj).map(fn);
|
|
20269
20256
|
const conditions = new RegExp(/( is | and | not | notEmpty | includes )/gm);
|
|
20270
20257
|
const getLastRow = (arr, cols) => {
|
|
20271
20258
|
let currentInd = -1;
|
|
@@ -20331,32 +20318,28 @@ const checkCondition$3 = (condition, formsValue, repeatValues, input) => {
|
|
|
20331
20318
|
}
|
|
20332
20319
|
};
|
|
20333
20320
|
const showHideInput$3 = (input, formsValue, repeatValues) => {
|
|
20334
|
-
|
|
20335
|
-
if (input.showIf && !(input !== null && input !== void 0 && (_input$meta = input.meta) !== null && _input$meta !== void 0 && _input$meta.excludeFromView) && !['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
|
|
20321
|
+
if (input.showIf && !input?.meta?.excludeFromView && !['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
|
|
20336
20322
|
const isOrCond = input.showIf.indexOf('OR') >= 0;
|
|
20337
20323
|
const allParts = input.showIf.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
|
|
20338
20324
|
const parts = allParts.map(condition => checkCondition$3(condition, formsValue, repeatValues, input));
|
|
20339
20325
|
return parts.length > 0 && (isOrCond && parts.filter(p => p).length >= 1 || parts.filter(p => !p).length === 0);
|
|
20340
20326
|
}
|
|
20341
|
-
if (typeof
|
|
20342
|
-
|
|
20343
|
-
const
|
|
20344
|
-
const allParts = input === null || input === void 0 || (_input$meta4 = input.meta) === null || _input$meta4 === void 0 ? void 0 : _input$meta4.excludeFromView.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
|
|
20327
|
+
if (typeof input?.meta?.excludeFromView === 'string') {
|
|
20328
|
+
const isOrCond = input?.meta?.excludeFromView.indexOf('OR') >= 0;
|
|
20329
|
+
const allParts = input?.meta?.excludeFromView.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
|
|
20345
20330
|
const parts = allParts.map(condition => checkCondition$3(condition, formsValue, repeatValues, input));
|
|
20346
20331
|
const excludeFromView = parts.length > 0 && (isOrCond && parts.filter(p => p).length >= 1 || parts.filter(p => !p).length === 0);
|
|
20347
20332
|
return !excludeFromView;
|
|
20348
20333
|
}
|
|
20349
|
-
if (typeof
|
|
20350
|
-
|
|
20351
|
-
return !(input !== null && input !== void 0 && (_input$meta6 = input.meta) !== null && _input$meta6 !== void 0 && _input$meta6.excludeFromView);
|
|
20334
|
+
if (typeof input?.meta?.excludeFromView === 'boolean') {
|
|
20335
|
+
return !input?.meta?.excludeFromView;
|
|
20352
20336
|
}
|
|
20353
|
-
if (input
|
|
20337
|
+
if (input?.meta?.excludeFromView || ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
|
|
20354
20338
|
return false;
|
|
20355
20339
|
}
|
|
20356
20340
|
return true;
|
|
20357
20341
|
};
|
|
20358
|
-
const groupSubsections =
|
|
20359
|
-
let onlyConf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20342
|
+
const groupSubsections = (form, onlyConf = false) => {
|
|
20360
20343
|
return Object.keys(form).reduce((f, fKey) => {
|
|
20361
20344
|
if (form[fKey].subSection) {
|
|
20362
20345
|
let subName = form[fKey].subSection;
|
|
@@ -20393,27 +20376,25 @@ const groupSubsections = function (form) {
|
|
|
20393
20376
|
return f;
|
|
20394
20377
|
}, {});
|
|
20395
20378
|
};
|
|
20396
|
-
const renderPlaceholder =
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20405
|
-
} = _ref;
|
|
20406
|
-
if ((((data === null || data === void 0 || (_data$meta = data.meta) === null || _data$meta === void 0 ? void 0 : _data$meta.inputs) || {})[name] || {}).notApplicable) {
|
|
20379
|
+
const renderPlaceholder = ({
|
|
20380
|
+
data,
|
|
20381
|
+
config,
|
|
20382
|
+
name,
|
|
20383
|
+
withPlaceholder = true,
|
|
20384
|
+
parent,
|
|
20385
|
+
t
|
|
20386
|
+
}) => {
|
|
20387
|
+
if (((data?.meta?.inputs || {})[name] || {}).notApplicable) {
|
|
20407
20388
|
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
20408
20389
|
className: "text-muted",
|
|
20409
20390
|
children: t('Not applicable')
|
|
20410
|
-
},
|
|
20391
|
+
}, `${parent}-${name}`);
|
|
20411
20392
|
}
|
|
20412
|
-
if (((
|
|
20393
|
+
if (((data?.meta?.inputs || {})[name] || {}).notAvailable) {
|
|
20413
20394
|
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
20414
20395
|
className: "text-muted",
|
|
20415
20396
|
children: t('No available information')
|
|
20416
|
-
},
|
|
20397
|
+
}, `${parent}-${name}`);
|
|
20417
20398
|
}
|
|
20418
20399
|
if (!withPlaceholder) {
|
|
20419
20400
|
return '';
|
|
@@ -20421,9 +20402,9 @@ const renderPlaceholder = _ref => {
|
|
|
20421
20402
|
return config.noValue ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
20422
20403
|
className: "text-muted",
|
|
20423
20404
|
children: config.noValue
|
|
20424
|
-
},
|
|
20405
|
+
}, `${parent}-${name}`) : /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
20425
20406
|
className: "text-muted flex",
|
|
20426
|
-
children: [t('Not answered'), config
|
|
20407
|
+
children: [t('Not answered'), config?.meta?.mandatory ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20427
20408
|
className: "ml-1",
|
|
20428
20409
|
style: {
|
|
20429
20410
|
marginTop: -1
|
|
@@ -20435,10 +20416,9 @@ const renderPlaceholder = _ref => {
|
|
|
20435
20416
|
color: "#FFC069"
|
|
20436
20417
|
})
|
|
20437
20418
|
}) : null]
|
|
20438
|
-
},
|
|
20419
|
+
}, `${parent}-${name}`);
|
|
20439
20420
|
};
|
|
20440
|
-
function getSelectOptions$2(option) {
|
|
20441
|
-
let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20421
|
+
function getSelectOptions$2(option, formsValue = {}) {
|
|
20442
20422
|
if (typeof option.label === 'object') {
|
|
20443
20423
|
const validations = Object.keys(option.label);
|
|
20444
20424
|
const key = validations.find(v => {
|
|
@@ -20467,15 +20447,13 @@ function numberWithCommas$1(x) {
|
|
|
20467
20447
|
}
|
|
20468
20448
|
const noLabelInputTypes = ['ajaxSubGroup', 'subGroup', 'group', 'groupExpandable'];
|
|
20469
20449
|
const excludedKeys$1 = ['id', 'label', 'position', 'subTitle'];
|
|
20470
|
-
const renderDate =
|
|
20471
|
-
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
input
|
|
20476
|
-
} = _ref2;
|
|
20450
|
+
const renderDate = ({
|
|
20451
|
+
item,
|
|
20452
|
+
inputName,
|
|
20453
|
+
input
|
|
20454
|
+
}) => {
|
|
20477
20455
|
const date = moment__default["default"].parseZone(item[inputName] ? item[inputName].toString() : null);
|
|
20478
|
-
if (input
|
|
20456
|
+
if (input?.meta?.checkExpiry) {
|
|
20479
20457
|
const expired = date.isBefore(moment__default["default"]());
|
|
20480
20458
|
if (expired) {
|
|
20481
20459
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
package/dist/pages/index.js
CHANGED
|
@@ -49119,8 +49119,6 @@ function FaunaWidget({
|
|
|
49119
49119
|
$itemWidth: itemWidth,
|
|
49120
49120
|
$itemHeight: itemHeight,
|
|
49121
49121
|
children: faunaConfig.map(item => {
|
|
49122
|
-
// Use colored SVG if the item's key exists in faunaPresent array
|
|
49123
|
-
// Otherwise use default SVG
|
|
49124
49122
|
const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(item.key);
|
|
49125
49123
|
const shouldUseColored = isPresent;
|
|
49126
49124
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
@@ -58733,6 +58731,30 @@ const getMapDataFromActivity = (activityData, t) => {
|
|
|
58733
58731
|
});
|
|
58734
58732
|
}
|
|
58735
58733
|
|
|
58734
|
+
// Entry 4: Generic locationCheck marker (independent - show if it exists)
|
|
58735
|
+
const locationCheckLat = activityData?.locationCheck?.latitude;
|
|
58736
|
+
const locationCheckLng = activityData?.locationCheck?.longitude;
|
|
58737
|
+
if (isValidCoordinate(locationCheckLat) && isValidCoordinate(locationCheckLng)) {
|
|
58738
|
+
mapData.push({
|
|
58739
|
+
_id: {},
|
|
58740
|
+
id: `${activityData?.id || activityData?.datastakeId || 'locationcheck'}-locationcheck`,
|
|
58741
|
+
// Include area if it exists, so marker can show on top of polygon
|
|
58742
|
+
area: area && area.length >= 3 ? area : null,
|
|
58743
|
+
color: baseColor,
|
|
58744
|
+
gps: {
|
|
58745
|
+
latitude: typeof locationCheckLat === 'number' ? locationCheckLat : parseFloat(locationCheckLat),
|
|
58746
|
+
longitude: typeof locationCheckLng === 'number' ? locationCheckLng : parseFloat(locationCheckLng)
|
|
58747
|
+
},
|
|
58748
|
+
name: t("Location Check"),
|
|
58749
|
+
plotName: locationName,
|
|
58750
|
+
territoryTitle: t("Associated Plot"),
|
|
58751
|
+
datastakeId: `${datastakeId}-locationcheck`,
|
|
58752
|
+
markerColor: "#016C6E",
|
|
58753
|
+
sources: null,
|
|
58754
|
+
link: null
|
|
58755
|
+
});
|
|
58756
|
+
}
|
|
58757
|
+
|
|
58736
58758
|
// Return mapData even if empty - let the map component handle empty arrays
|
|
58737
58759
|
return mapData;
|
|
58738
58760
|
};
|
|
@@ -59188,8 +59210,8 @@ const BiodiversityAndHabitat = ({
|
|
|
59188
59210
|
title: t("Observed Fauna"),
|
|
59189
59211
|
faunaPresent: faunaPresent,
|
|
59190
59212
|
columnsPerRow: 5,
|
|
59191
|
-
itemWidth:
|
|
59192
|
-
itemHeight:
|
|
59213
|
+
itemWidth: 130,
|
|
59214
|
+
itemHeight: 130,
|
|
59193
59215
|
loading: loading,
|
|
59194
59216
|
t: t
|
|
59195
59217
|
})
|
package/package.json
CHANGED
|
@@ -29,8 +29,7 @@ export default function FaunaWidget({
|
|
|
29
29
|
$itemHeight={itemHeight}
|
|
30
30
|
>
|
|
31
31
|
{faunaConfig.map((item) => {
|
|
32
|
-
|
|
33
|
-
// Otherwise use default SVG
|
|
32
|
+
|
|
34
33
|
const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(item.key);
|
|
35
34
|
const shouldUseColored = isPresent;
|
|
36
35
|
|
|
@@ -237,6 +237,30 @@ export const getMapDataFromActivity = (activityData, t) => {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
// Entry 4: Generic locationCheck marker (independent - show if it exists)
|
|
241
|
+
const locationCheckLat = activityData?.locationCheck?.latitude;
|
|
242
|
+
const locationCheckLng = activityData?.locationCheck?.longitude;
|
|
243
|
+
if (isValidCoordinate(locationCheckLat) && isValidCoordinate(locationCheckLng)) {
|
|
244
|
+
mapData.push({
|
|
245
|
+
_id: {},
|
|
246
|
+
id: `${activityData?.id || activityData?.datastakeId || 'locationcheck'}-locationcheck`,
|
|
247
|
+
// Include area if it exists, so marker can show on top of polygon
|
|
248
|
+
area: area && area.length >= 3 ? area : null,
|
|
249
|
+
color: baseColor,
|
|
250
|
+
gps: {
|
|
251
|
+
latitude: typeof locationCheckLat === 'number' ? locationCheckLat : parseFloat(locationCheckLat),
|
|
252
|
+
longitude: typeof locationCheckLng === 'number' ? locationCheckLng : parseFloat(locationCheckLng),
|
|
253
|
+
},
|
|
254
|
+
name: t("Location Check"),
|
|
255
|
+
plotName: locationName,
|
|
256
|
+
territoryTitle: t("Associated Plot"),
|
|
257
|
+
datastakeId: `${datastakeId}-locationcheck`,
|
|
258
|
+
markerColor: "#016C6E",
|
|
259
|
+
sources: null,
|
|
260
|
+
link: null,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
// Return mapData even if empty - let the map component handle empty arrays
|
|
241
265
|
return mapData;
|
|
242
266
|
};
|