mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
[TLC-1202] Disable fields hidden by type bind, so they are not validated
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
|||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormControlRelation,
|
DynamicFormControlRelation,
|
||||||
DynamicFormRelationService,
|
DynamicFormRelationService,
|
||||||
|
MATCH_DISABLED,
|
||||||
|
MATCH_ENABLED,
|
||||||
MATCH_VISIBLE,
|
MATCH_VISIBLE,
|
||||||
OR_OPERATOR,
|
OR_OPERATOR,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
@@ -217,9 +219,9 @@ export class DsDynamicTypeBindRelationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to construct a typeBindRelations array
|
* Helper function to construct a typeBindRelations array
|
||||||
* @param configuredTypeBindValues
|
* @param configuredTypeBindValues
|
||||||
*/
|
*/
|
||||||
public getTypeBindRelations(configuredTypeBindValues: string[]): DynamicFormControlRelation[] {
|
public getTypeBindRelations(configuredTypeBindValues: string[]): DynamicFormControlRelation[] {
|
||||||
const bindValues = [];
|
const bindValues = [];
|
||||||
configuredTypeBindValues.forEach((value) => {
|
configuredTypeBindValues.forEach((value) => {
|
||||||
@@ -228,11 +230,18 @@ export class DsDynamicTypeBindRelationService {
|
|||||||
value: value,
|
value: value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return [{
|
return [
|
||||||
match: MATCH_VISIBLE,
|
{
|
||||||
operator: OR_OPERATOR,
|
match: MATCH_ENABLED,
|
||||||
when: bindValues,
|
operator: OR_OPERATOR,
|
||||||
}];
|
when: bindValues,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: MATCH_VISIBLE,
|
||||||
|
operator: OR_OPERATOR,
|
||||||
|
when: bindValues,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
DynamicFormControlLayout,
|
DynamicFormControlLayout,
|
||||||
DynamicFormControlRelation,
|
DynamicFormControlRelation,
|
||||||
|
MATCH_DISABLED,
|
||||||
|
MATCH_ENABLED,
|
||||||
MATCH_VISIBLE,
|
MATCH_VISIBLE,
|
||||||
OR_OPERATOR,
|
OR_OPERATOR,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
@@ -381,11 +383,18 @@ export abstract class FieldParser {
|
|||||||
// Example: Field [x] will be VISIBLE if item type = book OR item type = book_part
|
// Example: Field [x] will be VISIBLE if item type = book OR item type = book_part
|
||||||
//
|
//
|
||||||
// The opposing match value will be the dc.type for the workspace item
|
// The opposing match value will be the dc.type for the workspace item
|
||||||
return [{
|
return [
|
||||||
match: MATCH_VISIBLE,
|
{
|
||||||
operator: OR_OPERATOR,
|
match: MATCH_ENABLED,
|
||||||
when: bindValues,
|
operator: OR_OPERATOR,
|
||||||
}];
|
when: bindValues,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: MATCH_VISIBLE,
|
||||||
|
operator: OR_OPERATOR,
|
||||||
|
when: bindValues,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected hasRegex() {
|
protected hasRegex() {
|
||||||
|
Reference in New Issue
Block a user