datastake-daf 0.6.753 → 0.6.755
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 +103 -97
- package/dist/pages/index.js +849 -282
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/index.jsx +46 -31
- package/src/@daf/core/components/Screens/Users/columns.js +216 -0
- package/src/@daf/core/components/Screens/Users/config.js +174 -0
- package/src/@daf/core/components/Screens/Users/create.jsx +63 -0
- package/src/@daf/core/components/Screens/Users/index.jsx +173 -0
- package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +4 -4
- package/src/@daf/pages/Summary/Activities/Restoration/helper.js +0 -89
- package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +55 -34
- package/src/pages.js +1 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/components/index.js
CHANGED
|
@@ -9436,29 +9436,24 @@ const processConditionalTableKeys = (tableKeys, item) => {
|
|
|
9436
9436
|
});
|
|
9437
9437
|
return processedKeys;
|
|
9438
9438
|
};
|
|
9439
|
-
const renderFieldData =
|
|
9440
|
-
let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
|
|
9441
|
-
let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
|
|
9442
|
-
let app = arguments.length > 6 ? arguments[6] : undefined;
|
|
9443
|
-
let allValues = arguments.length > 7 ? arguments[7] : undefined;
|
|
9444
|
-
let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
|
|
9439
|
+
const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
|
|
9445
9440
|
switch (type) {
|
|
9446
9441
|
case 'year':
|
|
9447
9442
|
return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
|
|
9448
9443
|
case 'date':
|
|
9449
9444
|
{
|
|
9450
|
-
const language = user
|
|
9445
|
+
const language = user?.language && user?.language === 'sp' ? 'es' : user?.language;
|
|
9451
9446
|
return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
|
|
9452
9447
|
}
|
|
9453
9448
|
case 'select':
|
|
9454
9449
|
{
|
|
9455
|
-
const options =
|
|
9450
|
+
const options = config?.options || [];
|
|
9456
9451
|
const option = findOptions(value, options);
|
|
9457
9452
|
return option;
|
|
9458
9453
|
}
|
|
9459
9454
|
case 'multiselect':
|
|
9460
9455
|
{
|
|
9461
|
-
const options =
|
|
9456
|
+
const options = config?.options || [];
|
|
9462
9457
|
const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
|
|
9463
9458
|
const option = findOptions(_val, options);
|
|
9464
9459
|
return option.join(', ');
|
|
@@ -9473,7 +9468,7 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9473
9468
|
formValues: formValues
|
|
9474
9469
|
});
|
|
9475
9470
|
case 'percentage':
|
|
9476
|
-
return value === '-' || value === null || value === undefined ? '-' :
|
|
9471
|
+
return value === '-' || value === null || value === undefined ? '-' : `${value} %`;
|
|
9477
9472
|
case 'geolocation':
|
|
9478
9473
|
{
|
|
9479
9474
|
const val = JSON.parse(value) || {};
|
|
@@ -9487,7 +9482,7 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9487
9482
|
case 'upload':
|
|
9488
9483
|
case 'videoUpload':
|
|
9489
9484
|
{
|
|
9490
|
-
const documentName = allValues
|
|
9485
|
+
const documentName = allValues?.map(item => item?.name).join(', ');
|
|
9491
9486
|
return documentName;
|
|
9492
9487
|
}
|
|
9493
9488
|
default:
|
|
@@ -9495,27 +9490,25 @@ const renderFieldData = function (type, value, user, config) {
|
|
|
9495
9490
|
}
|
|
9496
9491
|
};
|
|
9497
9492
|
|
|
9498
|
-
const renderValue =
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
if (!(config !== null && config !== void 0 && config.inputs)) return null;
|
|
9493
|
+
const renderValue = ({
|
|
9494
|
+
value,
|
|
9495
|
+
hasChildren,
|
|
9496
|
+
config,
|
|
9497
|
+
user,
|
|
9498
|
+
getApiBaseUrl = () => {},
|
|
9499
|
+
getAppHeader = () => {},
|
|
9500
|
+
app,
|
|
9501
|
+
allData = {}
|
|
9502
|
+
}) => {
|
|
9503
|
+
if (config?.type === 'groupInputs') {
|
|
9504
|
+
if (!config?.inputs) return null;
|
|
9511
9505
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
9512
|
-
|
|
9513
|
-
const
|
|
9514
|
-
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9506
|
+
const positionA = config.inputs[a]?.position || 0;
|
|
9507
|
+
const positionB = config.inputs[b]?.position || 0;
|
|
9515
9508
|
return positionA - positionB;
|
|
9516
9509
|
});
|
|
9517
9510
|
const values = inputKeys.map(inputKey => {
|
|
9518
|
-
let inputValue = value
|
|
9511
|
+
let inputValue = value?.[inputKey];
|
|
9519
9512
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
9520
9513
|
return '';
|
|
9521
9514
|
} else if (typeof inputValue === 'object' && inputValue !== null) {
|
|
@@ -9556,8 +9549,8 @@ const renderValue = _ref => {
|
|
|
9556
9549
|
} else {
|
|
9557
9550
|
displayValue = String(value);
|
|
9558
9551
|
}
|
|
9559
|
-
const fieldType =
|
|
9560
|
-
let cssClass =
|
|
9552
|
+
const fieldType = config?.type || 'text';
|
|
9553
|
+
let cssClass = `tree-value ${fieldType}-type`;
|
|
9561
9554
|
if (displayValue === '-') {
|
|
9562
9555
|
cssClass += ' empty';
|
|
9563
9556
|
}
|
|
@@ -9567,21 +9560,19 @@ const renderValue = _ref => {
|
|
|
9567
9560
|
children: displayValue
|
|
9568
9561
|
});
|
|
9569
9562
|
};
|
|
9570
|
-
const determineHasChildren =
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
} = _ref2;
|
|
9576
|
-
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9563
|
+
const determineHasChildren = ({
|
|
9564
|
+
config,
|
|
9565
|
+
level
|
|
9566
|
+
}) => {
|
|
9567
|
+
if (config?.type === 'groupInputs') {
|
|
9577
9568
|
return false;
|
|
9578
9569
|
}
|
|
9579
|
-
if (
|
|
9570
|
+
if (config?.type === 'header' && config?.inputs && Object.keys(config.inputs).length > 0) {
|
|
9580
9571
|
return true;
|
|
9581
9572
|
}
|
|
9582
|
-
return
|
|
9573
|
+
return config?.inputs || config?.type === 'group' || config?.type === 'dataLinkGroup' || config?.type === 'section' || config?.type === 'ajaxSubGroup' ||
|
|
9583
9574
|
// Add this line
|
|
9584
|
-
|
|
9575
|
+
config?.type === 'dataLink' && config?.meta?.tableKeys || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
|
|
9585
9576
|
};
|
|
9586
9577
|
|
|
9587
9578
|
const sortByPosition = (items, getConfig) => {
|
|
@@ -10247,20 +10238,21 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10247
10238
|
}
|
|
10248
10239
|
};
|
|
10249
10240
|
|
|
10250
|
-
const handleGroupChildren =
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10241
|
+
const handleGroupChildren = _ref => {
|
|
10242
|
+
let {
|
|
10243
|
+
config,
|
|
10244
|
+
value,
|
|
10245
|
+
allData,
|
|
10246
|
+
level,
|
|
10247
|
+
t,
|
|
10248
|
+
rootForm,
|
|
10249
|
+
user,
|
|
10250
|
+
getApiBaseUrl = () => {},
|
|
10251
|
+
getAppHeader = () => {},
|
|
10252
|
+
app,
|
|
10253
|
+
TreeNodeComponent
|
|
10254
|
+
} = _ref;
|
|
10255
|
+
if (!(config !== null && config !== void 0 && config.inputs)) {
|
|
10264
10256
|
return null;
|
|
10265
10257
|
}
|
|
10266
10258
|
const inputKeys = Object.keys(config.inputs);
|
|
@@ -10273,7 +10265,7 @@ const handleGroupChildren = ({
|
|
|
10273
10265
|
if (value && typeof value === 'object' && value[inputKey]) {
|
|
10274
10266
|
inputValue = value[inputKey];
|
|
10275
10267
|
} else {
|
|
10276
|
-
inputValue = allData
|
|
10268
|
+
inputValue = allData === null || allData === void 0 ? void 0 : allData[inputKey];
|
|
10277
10269
|
}
|
|
10278
10270
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10279
10271
|
nodeKey: inputKey,
|
|
@@ -10292,20 +10284,22 @@ const handleGroupChildren = ({
|
|
|
10292
10284
|
});
|
|
10293
10285
|
};
|
|
10294
10286
|
|
|
10295
|
-
const GroupInputsHandler =
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10287
|
+
const GroupInputsHandler = _ref => {
|
|
10288
|
+
let {
|
|
10289
|
+
config,
|
|
10290
|
+
allData,
|
|
10291
|
+
value
|
|
10292
|
+
} = _ref;
|
|
10300
10293
|
const renderGroupInputsValue = () => {
|
|
10301
|
-
if (!config
|
|
10294
|
+
if (!(config !== null && config !== void 0 && config.inputs)) return '';
|
|
10302
10295
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
10303
|
-
|
|
10304
|
-
const
|
|
10296
|
+
var _config$inputs$a, _config$inputs$b;
|
|
10297
|
+
const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
|
|
10298
|
+
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
10305
10299
|
return positionA - positionB;
|
|
10306
10300
|
});
|
|
10307
10301
|
const values = inputKeys.map(inputKey => {
|
|
10308
|
-
let inputValue = allData
|
|
10302
|
+
let inputValue = (allData === null || allData === void 0 ? void 0 : allData[inputKey]) || (value === null || value === void 0 ? void 0 : value[inputKey]);
|
|
10309
10303
|
const inputConfig = config.inputs[inputKey];
|
|
10310
10304
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
10311
10305
|
return '';
|
|
@@ -10318,7 +10312,7 @@ const GroupInputsHandler = ({
|
|
|
10318
10312
|
return JSON.stringify(inputValue);
|
|
10319
10313
|
}
|
|
10320
10314
|
} else {
|
|
10321
|
-
if (inputConfig
|
|
10315
|
+
if (inputConfig !== null && inputConfig !== void 0 && inputConfig.options) {
|
|
10322
10316
|
const option = findOptions(inputValue, inputConfig.options);
|
|
10323
10317
|
return option || String(inputValue);
|
|
10324
10318
|
}
|
|
@@ -10423,12 +10417,11 @@ const AjaxSubGroup$2 = ({
|
|
|
10423
10417
|
};
|
|
10424
10418
|
|
|
10425
10419
|
const handleAjaxSubGroupChildren = props => {
|
|
10426
|
-
|
|
10420
|
+
var _props$config;
|
|
10421
|
+
if (((_props$config = props.config) === null || _props$config === void 0 ? void 0 : _props$config.type) !== 'ajaxSubGroup' || !Array.isArray(props.value)) {
|
|
10427
10422
|
return null;
|
|
10428
10423
|
}
|
|
10429
|
-
return [/*#__PURE__*/jsxRuntime.jsx(AjaxSubGroup$2, {
|
|
10430
|
-
...props
|
|
10431
|
-
}, "ajax-subgroup")];
|
|
10424
|
+
return [/*#__PURE__*/jsxRuntime.jsx(AjaxSubGroup$2, _objectSpread2({}, props), "ajax-subgroup")];
|
|
10432
10425
|
};
|
|
10433
10426
|
|
|
10434
10427
|
const TreeNode = _ref => {
|
|
@@ -39899,43 +39892,56 @@ function DynamicForm(_ref) {
|
|
|
39899
39892
|
// setOriginalData({});
|
|
39900
39893
|
// setValues({});
|
|
39901
39894
|
// MainForm.resetFields();
|
|
39895
|
+
} else if (isCreate) {
|
|
39896
|
+
// Reset form when data is empty in create mode (e.g., when switching contexts)
|
|
39897
|
+
setOriginalData({});
|
|
39898
|
+
setValues({});
|
|
39899
|
+
MainForm.resetFields();
|
|
39902
39900
|
}
|
|
39903
|
-
}, [data]);
|
|
39901
|
+
}, [data, isCreate]);
|
|
39904
39902
|
|
|
39905
39903
|
// Initialize default values for hidden and disabled fields
|
|
39906
39904
|
React.useEffect(() => {
|
|
39907
39905
|
if (Object.keys(form).length > 0) {
|
|
39908
|
-
|
|
39909
|
-
|
|
39910
|
-
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39914
|
-
|
|
39915
|
-
|
|
39916
|
-
|
|
39917
|
-
|
|
39918
|
-
|
|
39919
|
-
|
|
39920
|
-
|
|
39921
|
-
|
|
39922
|
-
|
|
39923
|
-
|
|
39924
|
-
|
|
39925
|
-
|
|
39926
|
-
|
|
39927
|
-
|
|
39906
|
+
setValues(prevValues => {
|
|
39907
|
+
// Use data prop as base, or current values if data is empty
|
|
39908
|
+
const baseValues = Object.keys(data).length > 0 ? data : prevValues;
|
|
39909
|
+
const updatedValues = _objectSpread2({}, baseValues);
|
|
39910
|
+
let hasChanges = false;
|
|
39911
|
+
const isEditMode = data && (data.id || data._id);
|
|
39912
|
+
|
|
39913
|
+
// Process all form fields to set default values for hidden and disabled fields
|
|
39914
|
+
Object.keys(form).forEach(formKey => {
|
|
39915
|
+
Object.keys(form[formKey]).forEach(fieldKey => {
|
|
39916
|
+
var _field$meta, _field$meta2, _field$meta3, _field$meta4, _field$meta5, _field$meta6;
|
|
39917
|
+
const field = form[formKey][fieldKey];
|
|
39918
|
+
const fieldId = field.dataId || fieldKey;
|
|
39919
|
+
|
|
39920
|
+
// Check if field is disabled
|
|
39921
|
+
const isDisabled = field !== null && field !== void 0 && (_field$meta = field.meta) !== null && _field$meta !== void 0 && _field$meta.disableEdit && typeof (field === null || field === void 0 || (_field$meta2 = field.meta) === null || _field$meta2 === void 0 ? void 0 : _field$meta2.disableEdit) === 'object' ? isModal ? field.meta.disableEdit.create || field.meta.disableEdit.modal || (field === null || field === void 0 || (_field$meta3 = field.meta) === null || _field$meta3 === void 0 || (_field$meta3 = _field$meta3.disableEdit) === null || _field$meta3 === void 0 ? void 0 : _field$meta3.edit) && isEditMode : field.meta.disableEdit.create || field.meta.disableEdit.drawer || (field === null || field === void 0 || (_field$meta4 = field.meta) === null || _field$meta4 === void 0 || (_field$meta4 = _field$meta4.disableEdit) === null || _field$meta4 === void 0 ? void 0 : _field$meta4.edit) && isEditMode : field === null || field === void 0 || (_field$meta5 = field.meta) === null || _field$meta5 === void 0 ? void 0 : _field$meta5.disableEdit;
|
|
39922
|
+
|
|
39923
|
+
// Set default value for hidden fields or disabled fields with default values
|
|
39924
|
+
if ((field === null || field === void 0 || (_field$meta6 = field.meta) === null || _field$meta6 === void 0 ? void 0 : _field$meta6.defaultValue) !== undefined) {
|
|
39925
|
+
var _field$meta7, _field$meta8;
|
|
39926
|
+
// In create mode, always update disabled/hidden fields with default values when form config changes
|
|
39927
|
+
// This ensures context switching (Operation -> Restoration) updates the field correctly
|
|
39928
|
+
const shouldUpdate = !propHasValue(updatedValues[fieldId]) || isCreate && !isEditMode && ((field === null || field === void 0 || (_field$meta7 = field.meta) === null || _field$meta7 === void 0 ? void 0 : _field$meta7.hidden) === true || isDisabled);
|
|
39929
|
+
if (shouldUpdate && ((field === null || field === void 0 || (_field$meta8 = field.meta) === null || _field$meta8 === void 0 ? void 0 : _field$meta8.hidden) === true || isDisabled)) {
|
|
39930
|
+
updatedValues[fieldId] = field.meta.defaultValue;
|
|
39931
|
+
hasChanges = true;
|
|
39932
|
+
}
|
|
39928
39933
|
}
|
|
39929
|
-
}
|
|
39934
|
+
});
|
|
39930
39935
|
});
|
|
39936
|
+
if (hasChanges) {
|
|
39937
|
+
// Also set the values in the Ant Design form
|
|
39938
|
+
MainForm.setFieldsValue(updatedValues);
|
|
39939
|
+
return updatedValues;
|
|
39940
|
+
}
|
|
39941
|
+
return prevValues;
|
|
39931
39942
|
});
|
|
39932
|
-
if (hasChanges) {
|
|
39933
|
-
setValues(updatedValues);
|
|
39934
|
-
// Also set the values in the Ant Design form
|
|
39935
|
-
MainForm.setFieldsValue(updatedValues);
|
|
39936
|
-
}
|
|
39937
39943
|
}
|
|
39938
|
-
}, [form, data, isModal]);
|
|
39944
|
+
}, [form, data, isModal, isCreate]);
|
|
39939
39945
|
const setSelectedForm = id => {
|
|
39940
39946
|
setForms(Forms.map(form => {
|
|
39941
39947
|
id === form.id ? form.selected = true : form.selected = false;
|