datastake-daf 0.6.750 → 0.6.752
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 +118 -111
- package/dist/pages/index.js +307 -222
- package/dist/utils/index.js +24 -0
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/index.jsx +26 -11
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -2
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +1 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +6 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/helper.js +3 -3
- package/src/@daf/pages/Locations/MineSite/index.jsx +1 -1
- package/src/@daf/pages/Summary/Minesite/components/MineDetailsSection/index.js +51 -0
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/config.js +31 -37
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/index.js +4 -16
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +6 -6
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +13 -16
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -3
- package/src/@daf/pages/Summary/Minesite/index.jsx +15 -19
- package/src/@daf/pages/Summary/Operator/components/Governance/config.js +4 -4
- package/src/@daf/pages/Summary/Operator/components/Governance/helper.js +8 -11
- package/src/@daf/pages/Summary/Operator/components/Governance/index.js +9 -3
- package/src/@daf/pages/Summary/Operator/index.jsx +6 -4
- package/src/@daf/pages/Summary/components/InformationAvailability/components/Contributions/index.js +16 -5
- package/src/@daf/pages/Summary/components/InformationAvailability/components/InformationCompleteness/index.js +2 -3
- package/src/@daf/pages/Summary/components/InformationAvailability/index.js +7 -4
- package/src/@daf/pages/Summary/hook.js +3 -3
- package/src/constants/locales/en/translation.js +8 -0
- package/src/constants/locales/fr/translation.js +8 -0
- package/src/constants/locales/sp/translation.js +8 -0
package/dist/components/index.js
CHANGED
|
@@ -8143,7 +8143,7 @@ const {
|
|
|
8143
8143
|
Paragraph: Paragraph$1
|
|
8144
8144
|
} = antd.Typography;
|
|
8145
8145
|
const checkHasActiveFilterValues = filtersConfig => {
|
|
8146
|
-
if (!filtersConfig
|
|
8146
|
+
if (!(filtersConfig !== null && filtersConfig !== void 0 && filtersConfig.filtersConfig) || !(filtersConfig !== null && filtersConfig !== void 0 && filtersConfig.selectedFilters)) return false;
|
|
8147
8147
|
const filterConfigKeys = Object.keys(filtersConfig.filtersConfig);
|
|
8148
8148
|
const selectedFilters = filtersConfig.selectedFilters;
|
|
8149
8149
|
return filterConfigKeys.some(key => {
|
|
@@ -8151,27 +8151,28 @@ const checkHasActiveFilterValues = filtersConfig => {
|
|
|
8151
8151
|
return value !== undefined && value !== null && value !== "";
|
|
8152
8152
|
});
|
|
8153
8153
|
};
|
|
8154
|
-
const useHeader =
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8154
|
+
const useHeader = _ref => {
|
|
8155
|
+
let {
|
|
8156
|
+
title = "",
|
|
8157
|
+
tooltip = "",
|
|
8158
|
+
supportText = "",
|
|
8159
|
+
tags = [],
|
|
8160
|
+
actionButtons: _actionButtons = [],
|
|
8161
|
+
titleTooltip,
|
|
8162
|
+
className,
|
|
8163
|
+
addedHeader = null,
|
|
8164
|
+
addedHeaderFirst,
|
|
8165
|
+
extraButtons: _extraButtons = [],
|
|
8166
|
+
onDownload,
|
|
8167
|
+
downloadDisabled,
|
|
8168
|
+
goBackTo,
|
|
8169
|
+
loading,
|
|
8170
|
+
renderExtraComponents,
|
|
8171
|
+
app = "",
|
|
8172
|
+
isViewMode = false,
|
|
8173
|
+
filtersConfig = {}
|
|
8174
|
+
} = _ref;
|
|
8175
|
+
const hasActiveFilterValues = React.useMemo(() => checkHasActiveFilterValues(filtersConfig), [filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.filtersConfig, filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.selectedFilters]);
|
|
8175
8176
|
const [showFilters, setShowFilters] = React.useState(() => checkHasActiveFilterValues(filtersConfig));
|
|
8176
8177
|
const hasFilters = filtersConfig && Object.keys(filtersConfig).length > 0;
|
|
8177
8178
|
React.useEffect(() => {
|
|
@@ -8213,9 +8214,9 @@ const useHeader = ({
|
|
|
8213
8214
|
const buttonCont = React.useRef();
|
|
8214
8215
|
const [mainContWidth, setMainContWidth] = React.useState(600);
|
|
8215
8216
|
const [buttonContWidth, setButtonContWidth] = React.useState(0);
|
|
8216
|
-
const hasSupportText = !!supportText
|
|
8217
|
-
const hasTags = !!tags
|
|
8218
|
-
const hasButtons = React.useMemo(() => !!(actionButtons
|
|
8217
|
+
const hasSupportText = !!(supportText !== null && supportText !== void 0 && supportText.length);
|
|
8218
|
+
const hasTags = !!(tags !== null && tags !== void 0 && tags.length);
|
|
8219
|
+
const hasButtons = React.useMemo(() => !!(actionButtons !== null && actionButtons !== void 0 && actionButtons.length || extraButtons !== null && extraButtons !== void 0 && extraButtons.length), [actionButtons, extraButtons]);
|
|
8219
8220
|
React.useEffect(() => {
|
|
8220
8221
|
const mainContObserver = new ResizeObserver(entries => {
|
|
8221
8222
|
const _mainEntry = entries[0];
|
|
@@ -8375,20 +8376,22 @@ const useHeader = ({
|
|
|
8375
8376
|
const {
|
|
8376
8377
|
useToken: useToken$m
|
|
8377
8378
|
} = antd.theme;
|
|
8378
|
-
function BreadCrumbs({
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8379
|
+
function BreadCrumbs(_ref) {
|
|
8380
|
+
let {
|
|
8381
|
+
breadcrumbs = [],
|
|
8382
|
+
mainContWidth = 0
|
|
8383
|
+
} = _ref;
|
|
8382
8384
|
const [splitIndex, setSplitIndex] = React.useState(0);
|
|
8383
8385
|
const {
|
|
8384
8386
|
token
|
|
8385
8387
|
} = useToken$m();
|
|
8386
|
-
const _renderBreadcrumb = (b, i, isLast
|
|
8388
|
+
const _renderBreadcrumb = function (b, i, isLast) {
|
|
8389
|
+
let noOnClickLast = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8387
8390
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8388
8391
|
className: "flex breadcrumb-item",
|
|
8389
|
-
onClick: noOnClickLast && isLast ? undefined : b
|
|
8392
|
+
onClick: noOnClickLast && isLast ? undefined : b === null || b === void 0 ? void 0 : b.onClick,
|
|
8390
8393
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8391
|
-
children: b
|
|
8394
|
+
children: b === null || b === void 0 ? void 0 : b.label
|
|
8392
8395
|
}), !isLast && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8393
8396
|
className: "flex flex-column justify-content-center",
|
|
8394
8397
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
@@ -8398,7 +8401,7 @@ function BreadCrumbs({
|
|
|
8398
8401
|
color: token.baseGray50
|
|
8399
8402
|
})
|
|
8400
8403
|
})]
|
|
8401
|
-
},
|
|
8404
|
+
}, "breadcrumb-item-".concat(i));
|
|
8402
8405
|
};
|
|
8403
8406
|
React.useEffect(() => {
|
|
8404
8407
|
const _placeholderCont = document.getElementById("header-breadcrumbs");
|
|
@@ -8441,7 +8444,7 @@ function BreadCrumbs({
|
|
|
8441
8444
|
placement: "bottomRight",
|
|
8442
8445
|
menu: {
|
|
8443
8446
|
items: groupedBreadCrumbs[2].map((it, i) => ({
|
|
8444
|
-
key:
|
|
8447
|
+
key: "items-".concat(i),
|
|
8445
8448
|
label: it.label,
|
|
8446
8449
|
onClick: it.onClick
|
|
8447
8450
|
}))
|
|
@@ -10067,42 +10070,37 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10067
10070
|
}
|
|
10068
10071
|
};
|
|
10069
10072
|
|
|
10070
|
-
const handleDataLinkWithTableKeys =
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
} = _ref;
|
|
10086
|
-
if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
|
|
10073
|
+
const handleDataLinkWithTableKeys = ({
|
|
10074
|
+
inputConfig,
|
|
10075
|
+
inputKey,
|
|
10076
|
+
value,
|
|
10077
|
+
level,
|
|
10078
|
+
t,
|
|
10079
|
+
rootForm,
|
|
10080
|
+
allData,
|
|
10081
|
+
user,
|
|
10082
|
+
getApiBaseUrl = () => {},
|
|
10083
|
+
getAppHeader = () => {},
|
|
10084
|
+
app,
|
|
10085
|
+
TreeNodeComponent
|
|
10086
|
+
}) => {
|
|
10087
|
+
if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
|
|
10087
10088
|
return null;
|
|
10088
10089
|
}
|
|
10089
10090
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
10090
|
-
const isAjaxModal = React.useMemo(() =>
|
|
10091
|
-
var _inputConfig$meta2;
|
|
10092
|
-
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
10093
|
-
}, [inputConfig]);
|
|
10091
|
+
const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
|
|
10094
10092
|
const ajaxModalValues = useAjaxModal$2({
|
|
10095
10093
|
name: inputKey,
|
|
10096
10094
|
user,
|
|
10097
|
-
namespace: inputConfig
|
|
10098
|
-
skipFetch: inputConfig
|
|
10095
|
+
namespace: inputConfig?.meta?.namespace,
|
|
10096
|
+
skipFetch: inputConfig?.meta?.skipFetch,
|
|
10099
10097
|
isAjaxModal,
|
|
10100
|
-
formScope: inputConfig
|
|
10098
|
+
formScope: inputConfig?.meta?.formScope,
|
|
10101
10099
|
APP: app,
|
|
10102
10100
|
apiBaseUrl: getApiBaseUrl(),
|
|
10103
10101
|
_getAppHeader: getAppHeader
|
|
10104
10102
|
});
|
|
10105
|
-
const dataLinkForm = ajaxModalValues
|
|
10103
|
+
const dataLinkForm = ajaxModalValues?.form;
|
|
10106
10104
|
const createInputsAndValues = item => {
|
|
10107
10105
|
const inputs = {};
|
|
10108
10106
|
const values = {};
|
|
@@ -10115,20 +10113,19 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10115
10113
|
};
|
|
10116
10114
|
const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
|
|
10117
10115
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10118
|
-
const itemValue = itemToCheck
|
|
10116
|
+
const itemValue = itemToCheck?.[fieldKey];
|
|
10119
10117
|
return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
|
|
10120
10118
|
}
|
|
10121
10119
|
return false;
|
|
10122
10120
|
};
|
|
10123
10121
|
const processedTableKeys = processConditionalTableKeys(tableKeys, item);
|
|
10124
10122
|
processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
|
|
10125
|
-
|
|
10126
|
-
const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
|
|
10123
|
+
const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
|
|
10127
10124
|
if (formInputConfig) {
|
|
10128
|
-
|
|
10129
|
-
|
|
10125
|
+
inputs[tableKey] = {
|
|
10126
|
+
...formInputConfig,
|
|
10130
10127
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
10131
|
-
}
|
|
10128
|
+
};
|
|
10132
10129
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10133
10130
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10134
10131
|
let resolvedLabel = null;
|
|
@@ -10136,7 +10133,7 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10136
10133
|
const parts = labelKey.split(' is ');
|
|
10137
10134
|
if (parts.length === 2) {
|
|
10138
10135
|
const [conditionKey, conditionValue] = parts;
|
|
10139
|
-
if (
|
|
10136
|
+
if (item?.[conditionKey] === conditionValue) {
|
|
10140
10137
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10141
10138
|
break;
|
|
10142
10139
|
}
|
|
@@ -10144,17 +10141,16 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10144
10141
|
}
|
|
10145
10142
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
10146
10143
|
}
|
|
10147
|
-
values[tableKey] =
|
|
10144
|
+
values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item[formInputConfig?.meta?.onNewSetValueKey] || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[tableKey];
|
|
10148
10145
|
} else {
|
|
10149
|
-
var _item$linking2;
|
|
10150
10146
|
inputs[tableKey] = {
|
|
10151
10147
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
10152
|
-
type: inputConfig
|
|
10148
|
+
type: inputConfig?.type
|
|
10153
10149
|
};
|
|
10154
|
-
values[tableKey] =
|
|
10150
|
+
values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
|
|
10155
10151
|
}
|
|
10156
10152
|
});
|
|
10157
|
-
if (dataLinkForm
|
|
10153
|
+
if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
|
|
10158
10154
|
Object.keys(dataLinkForm.identification).filter(fieldKey => {
|
|
10159
10155
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10160
10156
|
return !isUploadFieldEmpty(fieldKey, item);
|
|
@@ -10164,11 +10160,11 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10164
10160
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10165
10161
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10166
10162
|
}).forEach(fieldKey => {
|
|
10167
|
-
var _item$linking3, _formInputConfig$tabl2;
|
|
10168
10163
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10169
|
-
inputs[fieldKey] =
|
|
10164
|
+
inputs[fieldKey] = {
|
|
10165
|
+
...formInputConfig,
|
|
10170
10166
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10171
|
-
}
|
|
10167
|
+
};
|
|
10172
10168
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10173
10169
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10174
10170
|
let resolvedLabel = null;
|
|
@@ -10176,7 +10172,7 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10176
10172
|
const parts = labelKey.split(' is ');
|
|
10177
10173
|
if (parts.length === 2) {
|
|
10178
10174
|
const [conditionKey, conditionValue] = parts;
|
|
10179
|
-
if (
|
|
10175
|
+
if (item?.[conditionKey] === conditionValue) {
|
|
10180
10176
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10181
10177
|
break;
|
|
10182
10178
|
}
|
|
@@ -10184,7 +10180,7 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10184
10180
|
}
|
|
10185
10181
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10186
10182
|
}
|
|
10187
|
-
values[fieldKey] =
|
|
10183
|
+
values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[fieldKey];
|
|
10188
10184
|
});
|
|
10189
10185
|
}
|
|
10190
10186
|
return {
|
|
@@ -10194,7 +10190,7 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10194
10190
|
};
|
|
10195
10191
|
if (Array.isArray(value)) {
|
|
10196
10192
|
return value.map((item, itemIndex) => {
|
|
10197
|
-
const datastakeIdValue = item
|
|
10193
|
+
const datastakeIdValue = item?.datastakeId;
|
|
10198
10194
|
const {
|
|
10199
10195
|
inputs,
|
|
10200
10196
|
values
|
|
@@ -10203,9 +10199,9 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10203
10199
|
return null;
|
|
10204
10200
|
}
|
|
10205
10201
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10206
|
-
nodeKey: datastakeIdValue || t(
|
|
10202
|
+
nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10207
10203
|
config: {
|
|
10208
|
-
label: datastakeIdValue || t(
|
|
10204
|
+
label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10209
10205
|
type: 'custom-datalink',
|
|
10210
10206
|
inputs: inputs
|
|
10211
10207
|
},
|
|
@@ -10219,10 +10215,10 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10219
10215
|
getApiBaseUrl: getApiBaseUrl,
|
|
10220
10216
|
getAppHeader: getAppHeader,
|
|
10221
10217
|
app: app
|
|
10222
|
-
},
|
|
10218
|
+
}, `${inputKey}-${itemIndex}`);
|
|
10223
10219
|
});
|
|
10224
10220
|
} else {
|
|
10225
|
-
const datastakeIdValue = value
|
|
10221
|
+
const datastakeIdValue = value?.datastakeId;
|
|
10226
10222
|
const {
|
|
10227
10223
|
inputs,
|
|
10228
10224
|
values
|
|
@@ -10247,25 +10243,24 @@ const handleDataLinkWithTableKeys = _ref => {
|
|
|
10247
10243
|
getApiBaseUrl: getApiBaseUrl,
|
|
10248
10244
|
getAppHeader: getAppHeader,
|
|
10249
10245
|
app: app
|
|
10250
|
-
},
|
|
10246
|
+
}, `${inputKey}-single`);
|
|
10251
10247
|
}
|
|
10252
10248
|
};
|
|
10253
10249
|
|
|
10254
|
-
const handleGroupChildren =
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
if (!(config !== null && config !== void 0 && config.inputs)) {
|
|
10250
|
+
const handleGroupChildren = ({
|
|
10251
|
+
config,
|
|
10252
|
+
value,
|
|
10253
|
+
allData,
|
|
10254
|
+
level,
|
|
10255
|
+
t,
|
|
10256
|
+
rootForm,
|
|
10257
|
+
user,
|
|
10258
|
+
getApiBaseUrl = () => {},
|
|
10259
|
+
getAppHeader = () => {},
|
|
10260
|
+
app,
|
|
10261
|
+
TreeNodeComponent
|
|
10262
|
+
}) => {
|
|
10263
|
+
if (!config?.inputs) {
|
|
10269
10264
|
return null;
|
|
10270
10265
|
}
|
|
10271
10266
|
const inputKeys = Object.keys(config.inputs);
|
|
@@ -10278,7 +10273,7 @@ const handleGroupChildren = _ref => {
|
|
|
10278
10273
|
if (value && typeof value === 'object' && value[inputKey]) {
|
|
10279
10274
|
inputValue = value[inputKey];
|
|
10280
10275
|
} else {
|
|
10281
|
-
inputValue = allData
|
|
10276
|
+
inputValue = allData?.[inputKey];
|
|
10282
10277
|
}
|
|
10283
10278
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10284
10279
|
nodeKey: inputKey,
|
|
@@ -39907,20 +39902,27 @@ function DynamicForm(_ref) {
|
|
|
39907
39902
|
}
|
|
39908
39903
|
}, [data]);
|
|
39909
39904
|
|
|
39910
|
-
// Initialize default values for hidden fields
|
|
39905
|
+
// Initialize default values for hidden and disabled fields
|
|
39911
39906
|
React.useEffect(() => {
|
|
39912
39907
|
if (Object.keys(form).length > 0) {
|
|
39913
39908
|
const updatedValues = _objectSpread2({}, values);
|
|
39914
39909
|
let hasChanges = false;
|
|
39910
|
+
const isEditMode = data && (data.id || data._id);
|
|
39915
39911
|
|
|
39916
|
-
// Process all form fields to set default values for hidden fields
|
|
39912
|
+
// Process all form fields to set default values for hidden and disabled fields
|
|
39917
39913
|
Object.keys(form).forEach(formKey => {
|
|
39918
39914
|
Object.keys(form[formKey]).forEach(fieldKey => {
|
|
39919
|
-
var _field$meta, _field$meta2;
|
|
39915
|
+
var _field$meta, _field$meta2, _field$meta3, _field$meta4, _field$meta5, _field$meta6;
|
|
39920
39916
|
const field = form[formKey][fieldKey];
|
|
39921
|
-
|
|
39922
|
-
|
|
39923
|
-
|
|
39917
|
+
const fieldId = field.dataId || fieldKey;
|
|
39918
|
+
|
|
39919
|
+
// Check if field is disabled
|
|
39920
|
+
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;
|
|
39921
|
+
|
|
39922
|
+
// Set default value for hidden fields or disabled fields with default values
|
|
39923
|
+
if ((field === null || field === void 0 || (_field$meta6 = field.meta) === null || _field$meta6 === void 0 ? void 0 : _field$meta6.defaultValue) !== undefined && !propHasValue(updatedValues[fieldId])) {
|
|
39924
|
+
var _field$meta7;
|
|
39925
|
+
if ((field === null || field === void 0 || (_field$meta7 = field.meta) === null || _field$meta7 === void 0 ? void 0 : _field$meta7.hidden) === true || isDisabled) {
|
|
39924
39926
|
updatedValues[fieldId] = field.meta.defaultValue;
|
|
39925
39927
|
hasChanges = true;
|
|
39926
39928
|
}
|
|
@@ -39933,7 +39935,7 @@ function DynamicForm(_ref) {
|
|
|
39933
39935
|
MainForm.setFieldsValue(updatedValues);
|
|
39934
39936
|
}
|
|
39935
39937
|
}
|
|
39936
|
-
}, [form]);
|
|
39938
|
+
}, [form, data, isModal]);
|
|
39937
39939
|
const setSelectedForm = id => {
|
|
39938
39940
|
setForms(Forms.map(form => {
|
|
39939
39941
|
id === form.id ? form.selected = true : form.selected = false;
|
|
@@ -39970,7 +39972,7 @@ function DynamicForm(_ref) {
|
|
|
39970
39972
|
}).every(key => key);
|
|
39971
39973
|
};
|
|
39972
39974
|
const getData = (name, input, value, commentValue, path, disabledPath) => {
|
|
39973
|
-
var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$
|
|
39975
|
+
var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$meta9, _input$meta10, _input$meta11, _input$meta12;
|
|
39974
39976
|
const props = {
|
|
39975
39977
|
// placeholder: input.labelHint ? input.labelHint : getInputLabel(input, values, true),
|
|
39976
39978
|
placeholder: input.labelHint,
|
|
@@ -40007,11 +40009,16 @@ function DynamicForm(_ref) {
|
|
|
40007
40009
|
}
|
|
40008
40010
|
value = fileList;
|
|
40009
40011
|
}
|
|
40010
|
-
// Handle default values for hidden fields
|
|
40011
|
-
if ((input === null || input === void 0 || (_input$meta7 = input.meta) === null || _input$meta7 === void 0 ? void 0 : _input$meta7.
|
|
40012
|
-
|
|
40013
|
-
|
|
40014
|
-
|
|
40012
|
+
// Handle default values for hidden fields and disabled fields
|
|
40013
|
+
if ((input === null || input === void 0 || (_input$meta7 = input.meta) === null || _input$meta7 === void 0 ? void 0 : _input$meta7.defaultValue) !== undefined && !propHasValue(value)) {
|
|
40014
|
+
var _input$meta8;
|
|
40015
|
+
const isFieldHidden = (input === null || input === void 0 || (_input$meta8 = input.meta) === null || _input$meta8 === void 0 ? void 0 : _input$meta8.hidden) === true;
|
|
40016
|
+
const isFieldDisabled = props.disabled || isDisabled;
|
|
40017
|
+
if (isFieldHidden || isFieldDisabled) {
|
|
40018
|
+
value = input.meta.defaultValue;
|
|
40019
|
+
if (typeof path === 'string') {
|
|
40020
|
+
dot__default["default"].str(path, value, values);
|
|
40021
|
+
}
|
|
40015
40022
|
}
|
|
40016
40023
|
}
|
|
40017
40024
|
const config = {
|