@mcurros2/microm 1.1.446-0 → 1.1.447-0

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/index.js CHANGED
@@ -7376,13 +7376,16 @@ $parcel$export(module.exports, "useHierarchyKeys", function () { return $7f5304f
7376
7376
 
7377
7377
  parcelRequire("2eyXi");
7378
7378
  var $2cfmO = parcelRequire("2cfmO");
7379
- const $7f5304fd68d04ed6$var$generateParentKeysArray = (hierarchy, mappedHierarchy, values, changedIndex)=>{
7379
+ const $7f5304fd68d04ed6$var$resolveHierarchyValues = (formAPI, hierarchy)=>{
7380
+ return hierarchy.map((name)=>Object.prototype.hasOwnProperty.call(formAPI.form.values, name) ? formAPI.form.values[name] : formAPI.entity.def.columns[name]?.value ?? '');
7381
+ };
7382
+ const $7f5304fd68d04ed6$var$generateParentKeysArray = (hierarchy, mappedHierarchy, hierarchyValues, changedIndex)=>{
7380
7383
  return hierarchy.map((_, index)=>{
7381
7384
  const parentKeys = {};
7382
7385
  for(let i = 0; i <= index; i++){
7383
7386
  const formValueName = hierarchy[i];
7384
7387
  const mappedName = mappedHierarchy?.[i] || formValueName;
7385
- parentKeys[mappedName] = changedIndex !== undefined && i > changedIndex ? '' : values[formValueName];
7388
+ parentKeys[mappedName] = changedIndex !== undefined && i > changedIndex ? '' : hierarchyValues[i];
7386
7389
  }
7387
7390
  return parentKeys;
7388
7391
  });
@@ -7397,9 +7400,10 @@ const $7f5304fd68d04ed6$var$areStringArraysEqual = (left, right)=>{
7397
7400
  };
7398
7401
  function $7f5304fd68d04ed6$export$1dc6a021c60990b5(props) {
7399
7402
  const { formAPI: formAPI, hierarchy: hierarchy, mappedHierarchy: mappedHierarchy } = props;
7403
+ const currentHierarchyValues = $7f5304fd68d04ed6$var$resolveHierarchyValues(formAPI, hierarchy);
7400
7404
  const [hierarchyState, setHierarchyState] = (0, $b4te3$react.useState)(()=>({
7401
- parentKeysArray: $7f5304fd68d04ed6$var$generateParentKeysArray(hierarchy, mappedHierarchy, formAPI.form.values),
7402
- hierarchyValues: hierarchy.map((name)=>formAPI.form.values[name]),
7405
+ parentKeysArray: $7f5304fd68d04ed6$var$generateParentKeysArray(hierarchy, mappedHierarchy, currentHierarchyValues),
7406
+ hierarchyValues: currentHierarchyValues,
7403
7407
  hierarchy: [
7404
7408
  ...hierarchy
7405
7409
  ],
@@ -7408,7 +7412,6 @@ function $7f5304fd68d04ed6$export$1dc6a021c60990b5(props) {
7408
7412
  ] : undefined,
7409
7413
  changeRevision: 0
7410
7414
  }));
7411
- const currentHierarchyValues = hierarchy.map((name)=>formAPI.form.values[name]);
7412
7415
  const isGetLoading = formAPI.status.operationType === 'get' && formAPI.status.loading === true;
7413
7416
  const isExistingRecordMode = formAPI.formMode === 'edit' || formAPI.formMode === 'view';
7414
7417
  const isNewCompletedGet = isExistingRecordMode && formAPI.status.operationType === 'get' && formAPI.status.loading === false && hierarchyState.processedGetStatus !== formAPI.status;
@@ -7422,7 +7425,7 @@ function $7f5304fd68d04ed6$export$1dc6a021c60990b5(props) {
7422
7425
  let resolvedHierarchyState = hierarchyState;
7423
7426
  if (!isGetLoading) {
7424
7427
  const changedIndex = isNewCompletedGet || hierarchyConfigurationChanged ? undefined : detectedChangedIndex === -1 ? hierarchyState.changedIndex : detectedChangedIndex;
7425
- const newParentKeysArray = $7f5304fd68d04ed6$var$generateParentKeysArray(hierarchy, mappedHierarchy, formAPI.form.values, changedIndex);
7428
+ const newParentKeysArray = $7f5304fd68d04ed6$var$generateParentKeysArray(hierarchy, mappedHierarchy, currentHierarchyValues, changedIndex);
7426
7429
  const parentKeysChanged = !$7f5304fd68d04ed6$var$areParentKeysArraysEqual(hierarchyState.parentKeysArray, newParentKeysArray);
7427
7430
  const hierarchyChanged = isNewCompletedGet || hierarchyConfigurationChanged || detectedChangedIndex !== -1;
7428
7431
  if (parentKeysChanged || hierarchyChanged) {