* task #38754, bug #11135, only auto append child when user toggle type manually.

This commit is contained in:
Hao Sun
2021-06-17 13:33:56 +08:00
parent 4bc2653e59
commit b4d60b8edc
+11 -19
View File
@@ -220,25 +220,6 @@ function initSteps(selector)
updateStepType($step, type);
});
/* Auto insert step to group without any steps */
if(!skipAutoAddStep)
{
var needRefresh = false;
getStepsElements().each(function(idx)
{
var $step = $(this).attr('data-index', idx + 1);
if($step.attr('data-type') !== 'group') return;
var $nextStep = $step.next('.step:not(.drag-shadow)');
if(!$nextStep.length || $nextStep.attr('data-type') !== 'item')
{
insertStepRow($step, 1, 'item', true);
needRefresh = true;
}
});
if(needRefresh) refreshSteps(true);
}
};
var initSortable = function()
{
@@ -301,6 +282,17 @@ function initSteps(selector)
suggestType = suggestChild ? 'item' : 'step';
}
$step.find('.step-type').val(suggestType);
/* Auto insert step to group without any steps */
if(suggestType === 'group')
{
var $nextStep = $step.next('.step:not(.drag-shadow)');
if(!$nextStep.length || $nextStep.find('.step-type').val() !== 'item')
{
insertStepRow($step, 1, 'item', true);
}
}
refreshSteps();
}).on('change', '.form-control', function()
{