datastake-daf 0.6.486 → 0.6.488
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 +49 -5
- package/dist/services/index.js +6338 -0
- package/dist/utils/index.js +297 -0
- package/package.json +1 -1
- package/rollup.config.js +20 -0
- package/src/@daf/core/components/DynamicForm/helper.js +7 -0
- package/src/@daf/core/components/DynamicForm/index.jsx +36 -0
- package/src/@daf/services/BaseHTTPService.js +229 -0
- package/src/@daf/services/ErrorHandler.js +43 -0
- package/src/helpers/StringHelper.js +12 -1
- package/src/helpers/errorHandling.js +97 -0
- package/src/helpers/urlHelpers.js +36 -0
- package/src/services.js +2 -0
- package/src/utils.js +9 -2
package/dist/components/index.js
CHANGED
|
@@ -42988,6 +42988,15 @@ const checkCondition = (condition, repeatValues, formsValue) => {
|
|
|
42988
42988
|
};
|
|
42989
42989
|
function showHideInput(input, formsValue, repeatIndex, repeatValues, setValues, ref) {
|
|
42990
42990
|
if (input?.meta?.hidden === true) {
|
|
42991
|
+
// Set default value for hidden fields
|
|
42992
|
+
if (input?.meta?.defaultValue !== undefined && !propHasValue(formsValue[ref])) {
|
|
42993
|
+
formsValue[ref] = input.meta.defaultValue;
|
|
42994
|
+
if (setValues && typeof setValues === 'function') {
|
|
42995
|
+
setValues({
|
|
42996
|
+
...formsValue
|
|
42997
|
+
});
|
|
42998
|
+
}
|
|
42999
|
+
}
|
|
42991
43000
|
return false;
|
|
42992
43001
|
}
|
|
42993
43002
|
if (input.showIf) {
|
|
@@ -45474,6 +45483,34 @@ function DynamicForm(_ref) {
|
|
|
45474
45483
|
// MainForm.resetFields();
|
|
45475
45484
|
}
|
|
45476
45485
|
}, [data]);
|
|
45486
|
+
|
|
45487
|
+
// Initialize default values for hidden fields
|
|
45488
|
+
React.useEffect(() => {
|
|
45489
|
+
if (Object.keys(form).length > 0) {
|
|
45490
|
+
const updatedValues = _objectSpread2({}, values);
|
|
45491
|
+
let hasChanges = false;
|
|
45492
|
+
|
|
45493
|
+
// Process all form fields to set default values for hidden fields
|
|
45494
|
+
Object.keys(form).forEach(formKey => {
|
|
45495
|
+
Object.keys(form[formKey]).forEach(fieldKey => {
|
|
45496
|
+
var _field$meta, _field$meta2;
|
|
45497
|
+
const field = form[formKey][fieldKey];
|
|
45498
|
+
if ((field === null || field === void 0 || (_field$meta = field.meta) === null || _field$meta === void 0 ? void 0 : _field$meta.hidden) === true && (field === null || field === void 0 || (_field$meta2 = field.meta) === null || _field$meta2 === void 0 ? void 0 : _field$meta2.defaultValue) !== undefined) {
|
|
45499
|
+
const fieldId = field.dataId || fieldKey;
|
|
45500
|
+
if (!propHasValue(updatedValues[fieldId])) {
|
|
45501
|
+
updatedValues[fieldId] = field.meta.defaultValue;
|
|
45502
|
+
hasChanges = true;
|
|
45503
|
+
}
|
|
45504
|
+
}
|
|
45505
|
+
});
|
|
45506
|
+
});
|
|
45507
|
+
if (hasChanges) {
|
|
45508
|
+
setValues(updatedValues);
|
|
45509
|
+
// Also set the values in the Ant Design form
|
|
45510
|
+
MainForm.setFieldsValue(updatedValues);
|
|
45511
|
+
}
|
|
45512
|
+
}
|
|
45513
|
+
}, [form]);
|
|
45477
45514
|
const setSelectedForm = id => {
|
|
45478
45515
|
setForms(Forms.map(form => {
|
|
45479
45516
|
id === form.id ? form.selected = true : form.selected = false;
|
|
@@ -45510,7 +45547,7 @@ function DynamicForm(_ref) {
|
|
|
45510
45547
|
}).every(key => key);
|
|
45511
45548
|
};
|
|
45512
45549
|
const getData = (name, input, value, commentValue, path, disabledPath) => {
|
|
45513
|
-
var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$meta8, _input$meta9, _input$meta10;
|
|
45550
|
+
var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$meta8, _input$meta9, _input$meta10, _input$meta11, _input$meta12;
|
|
45514
45551
|
const props = {
|
|
45515
45552
|
// placeholder: input.labelHint ? input.labelHint : getInputLabel(input, values, true),
|
|
45516
45553
|
placeholder: input.labelHint,
|
|
@@ -45547,9 +45584,16 @@ function DynamicForm(_ref) {
|
|
|
45547
45584
|
}
|
|
45548
45585
|
value = fileList;
|
|
45549
45586
|
}
|
|
45587
|
+
// Handle default values for hidden fields
|
|
45588
|
+
if ((input === null || input === void 0 || (_input$meta7 = input.meta) === null || _input$meta7 === void 0 ? void 0 : _input$meta7.hidden) === true && (input === null || input === void 0 || (_input$meta8 = input.meta) === null || _input$meta8 === void 0 ? void 0 : _input$meta8.defaultValue) !== undefined && !propHasValue(value)) {
|
|
45589
|
+
value = input.meta.defaultValue;
|
|
45590
|
+
if (typeof path === 'string') {
|
|
45591
|
+
dot__default["default"].str(path, value, values);
|
|
45592
|
+
}
|
|
45593
|
+
}
|
|
45550
45594
|
const config = {
|
|
45551
45595
|
name,
|
|
45552
|
-
call: input.call ? input.call : input === null || input === void 0 || (_input$
|
|
45596
|
+
call: input.call ? input.call : input === null || input === void 0 || (_input$meta9 = input.meta) === null || _input$meta9 === void 0 ? void 0 : _input$meta9.call,
|
|
45553
45597
|
automaticallyLink: input.automaticallyLink,
|
|
45554
45598
|
props,
|
|
45555
45599
|
formsValue: values,
|
|
@@ -45561,8 +45605,8 @@ function DynamicForm(_ref) {
|
|
|
45561
45605
|
updateOptions: input.updateOptions || false,
|
|
45562
45606
|
options: input.options,
|
|
45563
45607
|
optionGroup: input.optionGroup,
|
|
45564
|
-
optionsFilter: input === null || input === void 0 || (_input$
|
|
45565
|
-
filterCond: input === null || input === void 0 || (_input$
|
|
45608
|
+
optionsFilter: input === null || input === void 0 || (_input$meta10 = input.meta) === null || _input$meta10 === void 0 ? void 0 : _input$meta10.optionsFilter,
|
|
45609
|
+
filterCond: input === null || input === void 0 || (_input$meta11 = input.meta) === null || _input$meta11 === void 0 ? void 0 : _input$meta11.filterCond,
|
|
45566
45610
|
disableOtherFields: input.disableOtherFields,
|
|
45567
45611
|
updateOtherFields: input.updateOtherFields,
|
|
45568
45612
|
repeatLabel: input.repeatLabel,
|
|
@@ -45572,7 +45616,7 @@ function DynamicForm(_ref) {
|
|
|
45572
45616
|
restricted: input.restricted || false,
|
|
45573
45617
|
totalMax: input.totalMax,
|
|
45574
45618
|
country: input.country || undefined,
|
|
45575
|
-
address: (input === null || input === void 0 || (_input$
|
|
45619
|
+
address: (input === null || input === void 0 || (_input$meta12 = input.meta) === null || _input$meta12 === void 0 ? void 0 : _input$meta12.address) || undefined,
|
|
45576
45620
|
stakeholderId: input.stakeholderId,
|
|
45577
45621
|
preSelected,
|
|
45578
45622
|
addressData,
|