visibility changes
This commit is contained in:
parent
d0ad9a8be0
commit
eb770ed65e
|
@ -23,17 +23,15 @@ public class TransformerProperties {
|
|||
|
||||
private final String url;
|
||||
private final String transformerId;
|
||||
private final List<String> codes;
|
||||
private final String issuerUrl;
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final String scope;
|
||||
|
||||
@ConstructorBinding
|
||||
public TransformerSource(String url, String transformerId, List<String> codes, String issuerUrl, String clientId, String clientSecret, String scope) {
|
||||
public TransformerSource(String url, String transformerId, String issuerUrl, String clientId, String clientSecret, String scope) {
|
||||
this.url = url;
|
||||
this.transformerId = transformerId;
|
||||
this.codes = codes;
|
||||
this.issuerUrl = issuerUrl;
|
||||
this.clientId = clientId;
|
||||
this.clientSecret = clientSecret;
|
||||
|
@ -60,10 +58,6 @@ public class TransformerProperties {
|
|||
return scope;
|
||||
}
|
||||
|
||||
public List<String> getCodes() {
|
||||
return codes;
|
||||
}
|
||||
|
||||
public String getTransformerId() {
|
||||
return transformerId;
|
||||
}
|
||||
|
|
|
@ -2,14 +2,12 @@ transformer:
|
|||
sources:
|
||||
- url: http://dev04.local.cite.gr:55330/file/docx
|
||||
transformerId: docx-file-transformer
|
||||
codes: [ docx, pdf ]
|
||||
issuer-url: ${IDP_ISSUER_URI_TOKEN}
|
||||
client-id: ${IDP_APIKEY_CLIENT_ID}
|
||||
client-secret: ${IDP_APIKEY_CLIENT_SECRET}
|
||||
scope: ${IDP_APIKEY_SCOPE}
|
||||
- url: http://dev04.local.cite.gr:55330/file/rdajson
|
||||
transformerId: rda-file-transformer
|
||||
codes: [ json ]
|
||||
issuer-url: ${IDP_ISSUER_URI_TOKEN}
|
||||
client-id: ${IDP_APIKEY_CLIENT_ID}
|
||||
client-secret: ${IDP_APIKEY_CLIENT_SECRET}
|
||||
|
|
|
@ -570,7 +570,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
permissionPerSection => {
|
||||
const canedit = permissionPerSection && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()] && permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.EditDescription);
|
||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !canedit);
|
||||
this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties'));
|
||||
if (this.item.descriptionTemplate?.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties'));
|
||||
|
||||
// this.selectedSystemFields = this.selectedSystemFieldDisabled();
|
||||
this.descriptionEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||
|
@ -795,6 +795,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
|
||||
this.descriptionTemplateService.getSingle(descriptionTemplateId, DescriptionEditorResolver.descriptionTemplateLookupFields()).pipe(takeUntil(this._destroyed)).subscribe(descriptionTemplate => {
|
||||
|
||||
|
||||
this.editorModel.properties = new DescriptionPropertyDefinitionEditorModel(this.editorModel.validationErrorModel).fromModel(null, descriptionTemplate, null);
|
||||
this.formGroup.setControl('properties', this.editorModel.buildProperties());
|
||||
this.item.descriptionTemplate = descriptionTemplate;
|
||||
|
@ -802,6 +803,8 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
const sectionId = this.item.dmpDescriptionTemplate.sectionId;
|
||||
this.item.dmpDescriptionTemplate = this.item.dmp.dmpDescriptionTemplates.find(x => x.sectionId == sectionId && x.descriptionTemplateGroupId == descriptionTemplate.groupId);
|
||||
this.formGroup.get('dmpDescriptionTemplateId').setValue(this.item.dmpDescriptionTemplate.id);
|
||||
if (descriptionTemplate.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties'));
|
||||
|
||||
});
|
||||
// this.formGroup.removeControl('descriptionProfileDefinition');
|
||||
// this.getDefinition(profiledId);
|
||||
|
|
|
@ -13,6 +13,7 @@ export class VisibilityRulesService {
|
|||
private definition: DescriptionTemplateDefinition;
|
||||
private rulesBySources: Map<String, RuleWithTarget[]> ;
|
||||
public isVisibleMap: { [key: string]: boolean } = null;
|
||||
private _isVisibleMap: { [key: string]: boolean } = null;
|
||||
|
||||
constructor(
|
||||
protected formService: FormService
|
||||
|
@ -23,7 +24,7 @@ export class VisibilityRulesService {
|
|||
this.definition = definition;
|
||||
this.form = form;
|
||||
this.rulesBySources = null;
|
||||
this.isVisibleMap = null;
|
||||
this._isVisibleMap = null;
|
||||
this.calculateVisibility();
|
||||
}
|
||||
|
||||
|
@ -52,12 +53,12 @@ export class VisibilityRulesService {
|
|||
|
||||
public reloadVisibility() {
|
||||
this.rulesBySources = null;
|
||||
this.isVisibleMap = null;
|
||||
this._isVisibleMap = null;
|
||||
this.calculateVisibility();
|
||||
}
|
||||
|
||||
private calculateVisibility(){
|
||||
if (this.isVisibleMap != null) return;
|
||||
if (this._isVisibleMap != null) return;
|
||||
if (this.definition == null || this.form == null) return;
|
||||
|
||||
this.initRules();
|
||||
|
@ -66,6 +67,7 @@ export class VisibilityRulesService {
|
|||
this.setDefaultVisibilityForNotCaclucted();
|
||||
this.hideParentIfAllChildrenAreHidden();
|
||||
this.ensureFieldSetVisibility();
|
||||
this.isVisibleMap = this._isVisibleMap;
|
||||
}
|
||||
|
||||
private initRules(){
|
||||
|
@ -176,11 +178,11 @@ export class VisibilityRulesService {
|
|||
}
|
||||
|
||||
private buildTargetVisibility(){
|
||||
this.isVisibleMap = {};
|
||||
this._isVisibleMap = {};
|
||||
const propertyDefinition: DescriptionPropertyDefinitionPersist = this.formService.getValue(this.form.getRawValue()) as DescriptionPropertyDefinitionPersist;
|
||||
this.rulesBySources.forEach((ruleForSource: RuleWithTarget[], ruleForSourceKey: string) => {
|
||||
for (let i = 0; i < ruleForSource.length; i++) {
|
||||
const rule = ruleForSource[i];
|
||||
const propertyDefinition: DescriptionPropertyDefinitionPersist = this.formService.getValue(this.form.value) as DescriptionPropertyDefinitionPersist;
|
||||
if (propertyDefinition.fieldSets != null) {
|
||||
new Map(Object.entries(propertyDefinition.fieldSets)).forEach((propertyDefinitionFieldSet: DescriptionPropertyDefinitionFieldSetPersist, propertyDefinitionFieldSetKey: string) => {
|
||||
if (propertyDefinitionFieldSet.items != null && propertyDefinitionFieldSet.items.length > 0) {
|
||||
|
@ -192,21 +194,22 @@ export class VisibilityRulesService {
|
|||
|
||||
if (new Map(Object.entries(definitionFieldSetItem.fields)).has(rule.target)){ //Rule applies only for current multiple item
|
||||
const fieldKey = this.buildVisibilityKey(rule.target, definitionFieldSetItem.ordinal);
|
||||
const currentState = this.isVisibleMap[fieldKey] ?? false;
|
||||
this.isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
const currentState = this._isVisibleMap[fieldKey] ?? false;
|
||||
this._isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
//console.log(fieldKey + " " + this._isVisibleMap[fieldKey] + " " + field.textListValue);
|
||||
} else if (this.getDescriptionTemplateDefinitionFieldById(this.definition, rule.target).length > 0 || this.getDescriptionTemplateDefinitionFieldSetById(this.definition, rule.target).length > 0) { //Rule applies to different fieldset, so we apply for all multiple items
|
||||
const ordinals: number[] = this.getKeyOrdinals(rule.target, propertyDefinition);
|
||||
for (let k = 0; k < ordinals.length; k++) {
|
||||
const ordinal = ordinals[j];
|
||||
const fieldKey = this.buildVisibilityKey(rule.target, ordinal);
|
||||
const currentState = this.isVisibleMap[fieldKey] ?? false;
|
||||
this.isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
const currentState = this._isVisibleMap[fieldKey] ?? false;
|
||||
this._isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
|
||||
}
|
||||
} else {
|
||||
const fieldKey = this.buildVisibilityKey(rule.target, null); //Ordinal is null if target not on field
|
||||
const currentState = this.isVisibleMap[fieldKey] ?? false;
|
||||
this.isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
const currentState = this._isVisibleMap[fieldKey] ?? false;
|
||||
this._isVisibleMap[fieldKey] = currentState || this.ruleIsTrue(rule, field);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -276,7 +279,7 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < this.definition?.pages.length; i++) {
|
||||
const pageEntity = this.definition?.pages[i];
|
||||
const fieldKey = this.buildVisibilityKey(pageEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
this.expandPageVisibility(pageEntity, currentValue);
|
||||
}
|
||||
}
|
||||
|
@ -286,16 +289,16 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < pageEntity.sections.length; i++) {
|
||||
const sectionEntity = pageEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(sectionEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue != null){
|
||||
if (parentVisibility != null && !parentVisibility) { //Parent is hidden so all childs should be hidden
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
this.expandSectionVisibility(sectionEntity, currentValue);
|
||||
} else {
|
||||
this.expandSectionVisibility(sectionEntity, currentValue);
|
||||
}
|
||||
} else {
|
||||
if (parentVisibility != null) this.isVisibleMap[fieldKey] = parentVisibility;
|
||||
if (parentVisibility != null) this._isVisibleMap[fieldKey] = parentVisibility;
|
||||
this.expandSectionVisibility(sectionEntity, parentVisibility);
|
||||
}
|
||||
}
|
||||
|
@ -305,41 +308,41 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < sectionEntity.sections.length; i++) {
|
||||
const subSectionEntity = sectionEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(subSectionEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue != null){
|
||||
if (parentVisibility != null && !parentVisibility) { //Parent is hidden so all childs should be hidden
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
this.expandSectionVisibility(subSectionEntity, currentValue);
|
||||
} else {
|
||||
this.expandSectionVisibility(subSectionEntity, currentValue);
|
||||
}
|
||||
} else {
|
||||
if (parentVisibility != null) this.isVisibleMap[fieldKey] = parentVisibility;
|
||||
if (parentVisibility != null) this._isVisibleMap[fieldKey] = parentVisibility;
|
||||
this.expandSectionVisibility(subSectionEntity, parentVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sectionEntity.fieldSets != null) {
|
||||
|
||||
const propertyDefinition = this.formService.getValue(this.form.getRawValue()) as DescriptionPropertyDefinitionPersist;
|
||||
for (let i = 0; i < sectionEntity.fieldSets.length; i++) {
|
||||
const fieldSetEntity = sectionEntity.fieldSets[i];
|
||||
|
||||
const propertyDefinition = this.formService.getValue(this.form.value) as DescriptionPropertyDefinitionPersist;
|
||||
if (propertyDefinition.fieldSets != null && new Map(Object.entries(propertyDefinition.fieldSets)).has(fieldSetEntity.id)) {
|
||||
const propertyDefinitionFieldSet = new Map(Object.entries(propertyDefinition.fieldSets)).get(fieldSetEntity.id)
|
||||
if (propertyDefinitionFieldSet.items != null && propertyDefinitionFieldSet.items.length > 0) {
|
||||
for (let j = 0; j < propertyDefinitionFieldSet.items.length; j++) {
|
||||
const definitionFieldSetItem = propertyDefinitionFieldSet.items[j];
|
||||
const fieldKey = this.buildVisibilityKey(fieldSetEntity.id, definitionFieldSetItem.ordinal);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue != null){
|
||||
if (parentVisibility != null && !parentVisibility) { //Parent is hidden so all childs should be hidden
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
this.expandFieldSetVisibility(fieldSetEntity, currentValue, definitionFieldSetItem.ordinal);
|
||||
} else {
|
||||
this.expandFieldSetVisibility(fieldSetEntity, currentValue, definitionFieldSetItem.ordinal);
|
||||
}
|
||||
} else {
|
||||
if (parentVisibility != null) this.isVisibleMap[fieldKey] = parentVisibility;
|
||||
if (parentVisibility != null) this._isVisibleMap[fieldKey] = parentVisibility;
|
||||
this.expandFieldSetVisibility(fieldSetEntity, parentVisibility, definitionFieldSetItem.ordinal);
|
||||
}
|
||||
}
|
||||
|
@ -354,13 +357,13 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < fieldSetEntity.fields.length; i++) {
|
||||
const fieldEntity = fieldSetEntity.fields[i];
|
||||
const fieldKey = this.buildVisibilityKey(fieldEntity.id, ordinal);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue != null){
|
||||
if (parentVisibility != null && !parentVisibility) { //Parent is hidden so all childs should be hidden
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
}
|
||||
} else if (parentVisibility != null){
|
||||
this.isVisibleMap[fieldKey] = parentVisibility;
|
||||
this._isVisibleMap[fieldKey] = parentVisibility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -371,8 +374,8 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < this.definition?.pages.length; i++) {
|
||||
const pageEntity = this.definition?.pages[i];
|
||||
const fieldKey = this.buildVisibilityKey(pageEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null) this.isVisibleMap[fieldKey] = true;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null) this._isVisibleMap[fieldKey] = true;
|
||||
this.setDefaultPageVisibility(pageEntity);
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +385,9 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < pageEntity.sections.length; i++) {
|
||||
const sectionEntity = pageEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(sectionEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null){
|
||||
this.isVisibleMap[fieldKey] = true;
|
||||
this._isVisibleMap[fieldKey] = true;
|
||||
this.setDefaultSectionVisibility(sectionEntity);
|
||||
}
|
||||
}
|
||||
|
@ -395,27 +398,27 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < sectionEntity.sections.length; i++) {
|
||||
const subSectionEntity = sectionEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(subSectionEntity.id, null);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null){
|
||||
this.isVisibleMap[fieldKey] = true;
|
||||
this._isVisibleMap[fieldKey] = true;
|
||||
this.setDefaultSectionVisibility(subSectionEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sectionEntity.fieldSets != null) {
|
||||
const propertyDefinition = this.formService.getValue(this.form.getRawValue()) as DescriptionPropertyDefinitionPersist;
|
||||
for (let i = 0; i < sectionEntity.fieldSets.length; i++) {
|
||||
const fieldSetEntity = sectionEntity.fieldSets[i];
|
||||
|
||||
const propertyDefinition = this.formService.getValue(this.form.value) as DescriptionPropertyDefinitionPersist;
|
||||
if (propertyDefinition.fieldSets != null && new Map(Object.entries(propertyDefinition.fieldSets)).has(fieldSetEntity.id)) {
|
||||
const propertyDefinitionFieldSet = new Map(Object.entries(propertyDefinition.fieldSets)).get(fieldSetEntity.id)
|
||||
if (propertyDefinitionFieldSet.items != null && propertyDefinitionFieldSet.items.length > 0) {
|
||||
for (let j = 0; j < propertyDefinitionFieldSet.items.length; j++) {
|
||||
const definitionFieldSetItem = propertyDefinitionFieldSet.items[j];
|
||||
const fieldKey = this.buildVisibilityKey(fieldSetEntity.id, definitionFieldSetItem.ordinal);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null){
|
||||
this.isVisibleMap[fieldKey] = true;
|
||||
this._isVisibleMap[fieldKey] = true;
|
||||
this.setDefaultFieldSetVisibility(fieldSetEntity, definitionFieldSetItem.ordinal);
|
||||
}
|
||||
}
|
||||
|
@ -430,9 +433,9 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < fieldSetEntity.fields.length; i++) {
|
||||
const fieldEntity = fieldSetEntity.fields[i];
|
||||
const fieldKey = this.buildVisibilityKey(fieldEntity.id, ordinal);
|
||||
const currentValue: boolean | null = this.isVisibleMap[fieldKey] ?? null;
|
||||
const currentValue: boolean | null = this._isVisibleMap[fieldKey] ?? null;
|
||||
if (currentValue == null){
|
||||
this.isVisibleMap[fieldKey] = true;
|
||||
this._isVisibleMap[fieldKey] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -445,8 +448,8 @@ export class VisibilityRulesService {
|
|||
const fieldKey = this.buildVisibilityKey(pageEntity.id, null);
|
||||
const isCurrentHidden = this.isHiddenPageVisibilityIfAllChildrenIsHidden(pageEntity);
|
||||
|
||||
if (isCurrentHidden && (this.isVisibleMap[fieldKey] ?? true)) {
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
if (isCurrentHidden && (this._isVisibleMap[fieldKey] ?? true)) {
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,8 +461,8 @@ export class VisibilityRulesService {
|
|||
const sectionEntity = pageEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(sectionEntity.id, null);
|
||||
const isCurrentHidden = this.isHiddenSectionIfAllChildrenIsHidden(sectionEntity);
|
||||
if (isCurrentHidden && (this.isVisibleMap[fieldKey] ?? true)) {
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
if (isCurrentHidden && (this._isVisibleMap[fieldKey] ?? true)) {
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
}
|
||||
isHidden = isHidden && isCurrentHidden;
|
||||
}
|
||||
|
@ -473,16 +476,16 @@ export class VisibilityRulesService {
|
|||
const subSectionEntity = sectionEntity.sections[i];
|
||||
const fieldKey = this.buildVisibilityKey(subSectionEntity.id, null);
|
||||
const isCurrentHidden = this.isHiddenSectionIfAllChildrenIsHidden(subSectionEntity);
|
||||
if (isCurrentHidden && (this.isVisibleMap[fieldKey] ?? true)) {
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
if (isCurrentHidden && (this._isVisibleMap[fieldKey] ?? true)) {
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
}
|
||||
isHidden = isHidden && isCurrentHidden;
|
||||
}
|
||||
}
|
||||
if (sectionEntity.fieldSets != null) {
|
||||
const propertyDefinition = this.formService.getValue(this.form.getRawValue()) as DescriptionPropertyDefinitionPersist;
|
||||
for (let i = 0; i < sectionEntity.fieldSets.length; i++) {
|
||||
const fieldSetEntity = sectionEntity.fieldSets[i];
|
||||
const propertyDefinition = this.formService.getValue(this.form.value) as DescriptionPropertyDefinitionPersist;
|
||||
if (propertyDefinition.fieldSets != null && new Map(Object.entries(propertyDefinition.fieldSets)).has(fieldSetEntity.id)) {
|
||||
const propertyDefinitionFieldSet = new Map(Object.entries(propertyDefinition.fieldSets)).get(fieldSetEntity.id)
|
||||
if (propertyDefinitionFieldSet.items != null && propertyDefinitionFieldSet.items.length > 0) {
|
||||
|
@ -490,8 +493,8 @@ export class VisibilityRulesService {
|
|||
const definitionFieldSetItem = propertyDefinitionFieldSet.items[j];
|
||||
const fieldKey = this.buildVisibilityKey(fieldSetEntity.id, definitionFieldSetItem.ordinal);
|
||||
const isCurrentHidden = this.isHiddenFieldSetIfAllChildrenIsHidden(fieldSetEntity, definitionFieldSetItem.ordinal);
|
||||
if (isCurrentHidden && (this.isVisibleMap[fieldKey] ?? true)) {
|
||||
this.isVisibleMap[fieldKey] = false;
|
||||
if (isCurrentHidden && (this._isVisibleMap[fieldKey] ?? true)) {
|
||||
this._isVisibleMap[fieldKey] = false;
|
||||
}
|
||||
isHidden = isHidden && isCurrentHidden;
|
||||
}
|
||||
|
@ -508,7 +511,7 @@ export class VisibilityRulesService {
|
|||
for (let i = 0; i < fieldSetEntity.fields.length; i++) {
|
||||
const fieldEntity = fieldSetEntity.fields[i];
|
||||
const fieldKey = this.buildVisibilityKey(fieldEntity.id, ordinal);
|
||||
const currentValue: boolean | null = (this.isVisibleMap[fieldKey] ?? true);
|
||||
const currentValue: boolean | null = (this._isVisibleMap[fieldKey] ?? true);
|
||||
isHidden = isHidden && !currentValue;
|
||||
}
|
||||
return isHidden;
|
||||
|
@ -540,23 +543,23 @@ export class VisibilityRulesService {
|
|||
}
|
||||
}
|
||||
if (sectionEntity.fieldSets != null) {
|
||||
const propertyDefinition = this.formService.getValue(this.form.getRawValue()) as DescriptionPropertyDefinitionPersist;
|
||||
for (let i = 0; i < sectionEntity.fieldSets.length; i++) {
|
||||
const fieldSetEntity = sectionEntity.fieldSets[i];
|
||||
let isHidden = true;
|
||||
const propertyDefinition = this.formService.getValue(this.form.value) as DescriptionPropertyDefinitionPersist;
|
||||
if (propertyDefinition.fieldSets != null && new Map(Object.entries(propertyDefinition.fieldSets)).has(fieldSetEntity.id)) {
|
||||
const propertyDefinitionFieldSet = new Map(Object.entries(propertyDefinition.fieldSets)).get(fieldSetEntity.id)
|
||||
if (propertyDefinitionFieldSet.items != null && propertyDefinitionFieldSet.items.length > 0) {
|
||||
for (let j = 0; j < propertyDefinitionFieldSet.items.length; j++) {
|
||||
const definitionFieldSetItem = propertyDefinitionFieldSet.items[j];
|
||||
const fieldKey = this.buildVisibilityKey(fieldSetEntity.id, definitionFieldSetItem.ordinal);
|
||||
const isCurrentHidden = !this.isVisibleMap[fieldKey] ?? false;
|
||||
const isCurrentHidden = !this._isVisibleMap[fieldKey] ?? false;
|
||||
isHidden = isHidden && isCurrentHidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
const globalFieldSetKey = this.buildVisibilityKey(fieldSetEntity.id, null);
|
||||
this.isVisibleMap[globalFieldSetKey] = !isHidden;
|
||||
this._isVisibleMap[globalFieldSetKey] = !isHidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue