mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-3782] qualdrop move restored
This commit is contained in:
@@ -65,7 +65,7 @@ export class SectionFormOperationsService {
|
||||
this.dispatchOperationsFromChangeEvent(pathCombiner, event, previousValue, hasStoredValue);
|
||||
break;
|
||||
case 'move':
|
||||
this.dispatchOperationsFromMoveEvent(pathCombiner, event);
|
||||
this.dispatchOperationsFromMoveEvent(pathCombiner, event, previousValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -469,9 +469,28 @@ export class SectionFormOperationsService {
|
||||
previousValue.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle form move operations
|
||||
*
|
||||
* @param pathCombiner
|
||||
* the [[JsonPatchOperationPathCombiner]] object for the specified operation
|
||||
* @param event
|
||||
* the [[DynamicFormControlEvent]] for the specified operation
|
||||
* @param previousValue
|
||||
* the [[FormFieldPreviousValueObject]] for the specified operation
|
||||
*/
|
||||
private dispatchOperationsFromMoveEvent(pathCombiner: JsonPatchOperationPathCombiner,
|
||||
event: DynamicFormControlEvent) {
|
||||
event: DynamicFormControlEvent,
|
||||
previousValue: FormFieldPreviousValueObject) {
|
||||
|
||||
const customEvent = event.$event;
|
||||
|
||||
if (this.formBuilder.isQualdropGroup(customEvent.model.parent as DynamicFormControlModel)
|
||||
|| this.formBuilder.isQualdropGroup(customEvent.model as DynamicFormControlModel)) {
|
||||
// It's a qualdrup model
|
||||
this.dispatchOperationsFromMap(this.getQualdropValueMap(customEvent), pathCombiner, customEvent, previousValue);
|
||||
return;
|
||||
}
|
||||
const path = this.getFieldPathFromEvent(customEvent);
|
||||
const segmentedPath = this.getFieldPathSegmentedFromChangeEvent(customEvent);
|
||||
const moveTo = pathCombiner.getPath(path);
|
||||
|
@@ -19,7 +19,7 @@ import { FormComponent } from '../../../shared/form/form.component';
|
||||
import { FormService } from '../../../shared/form/form.service';
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { SubmissionFormsConfigService } from '../../../core/config/submission-forms-config.service';
|
||||
import { hasNoValue, hasValue, isNotEmpty, isUndefined } from '../../../shared/empty.util';
|
||||
import { hasValue, isNotEmpty, isUndefined } from '../../../shared/empty.util';
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
||||
import { SubmissionSectionError, SubmissionSectionObject } from '../../objects/submission-objects.reducer';
|
||||
@@ -454,11 +454,11 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
||||
* The customEvent is stored inside event.$event
|
||||
* @param $event
|
||||
*/
|
||||
onCustomEvent(event: any) {
|
||||
onCustomEvent(event: DynamicFormControlEvent) {
|
||||
this.formOperationsService.dispatchOperationsFromEvent(
|
||||
this.pathCombiner,
|
||||
event,
|
||||
null,
|
||||
this.previousValue,
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user