Merge pull request #2620 from atmire/w2p-108045_repeatable-date-fields-label-fix_contribute-main

Fix for repeatable date field labels
This commit is contained in:
Tim Donohue
2023-11-10 16:38:13 -06:00
committed by GitHub
5 changed files with 6 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
metadataFields: [],
hasSelectableMetadata: false
}),
new DynamicDsDatePickerModel({ id: 'datepicker' }),
new DynamicDsDatePickerModel({ id: 'datepicker', repeatable: false }),
new DynamicLookupModel({
id: 'lookup',
metadataFields: [],

View File

@@ -1,6 +1,6 @@
<div>
<fieldset class="d-flex">
<legend [id]="'legend_' + model.id" [ngClass]="[getClass('element', 'label'), getClass('grid', 'label')]">
<legend *ngIf="!model.repeatable" [id]="'legend_' + model.id" [ngClass]="[getClass('element', 'label'), getClass('grid', 'label')]">
{{model.placeholder}} <span *ngIf="model.required">*</span>
</legend>
<ds-number-picker

View File

@@ -29,6 +29,7 @@ export const DATE_TEST_MODEL_CONFIG = {
placeholder: 'Date',
readOnly: false,
required: true,
repeatable: false,
toggleIcon: 'fas fa-calendar'
};

View File

@@ -15,6 +15,7 @@ export const DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER = 'DATE';
export interface DynamicDsDateControlModelConfig extends DynamicDatePickerModelConfig {
legend?: string;
typeBindRelations?: DynamicFormControlRelation[];
repeatable: boolean;
}
/**
@@ -37,7 +38,7 @@ export class DynamicDsDatePickerModel extends DynamicDateControlModel {
this.metadataValue = (config as any).metadataValue;
this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : [];
this.hiddenUpdates = new BehaviorSubject<boolean>(this.hidden);
this.repeatable = config.repeatable;
// This was a subscription, then an async setTimeout, but it seems unnecessary
const parentModel = this.getRootParent(this);
if (parentModel && isNotUndefined(parentModel.hidden)) {

View File

@@ -290,7 +290,7 @@ describe('FormBuilderService test suite', () => {
hasSelectableMetadata: true
}),
new DynamicDsDatePickerModel({ id: 'testDate' }),
new DynamicDsDatePickerModel({ id: 'testDate', repeatable: false}),
new DynamicLookupModel({
id: 'testLookup',