Skip to content

Commit

Permalink
Merge pull request #1833 from ProgrammeVitam/12687-md-date-small-display
Browse files Browse the repository at this point in the history
Story #12687: MD display small for datetime only
  • Loading branch information
laedanrex authored May 2, 2024
2 parents 027b6f0 + bb6af01 commit 3a7b9d7
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,25 @@ export class SchemaElementToDisplayRuleService {
}
}

private getLayoutSize(schemaElement: SchemaElement): LayoutSize {
if (schemaElement.DataType === 'DATETIME') {
return 'small';
}
return { SHORT: 'small', MEDIUM: 'medium', LARGE: 'large' }[schemaElement.StringSize || 'MEDIUM'] as LayoutSize;
}

public mapSchemaElementToDisplayRule(schemaElement: SchemaElement): DisplayRule {
const component: ComponentName = this.mapSchemaElementToComponent(schemaElement);
const baseDisplayRule = this.schemaElementComponentTypeToDisplayRule[component];
const size = { SHORT: 'small', MEDIUM: 'medium', LARGE: 'large' }[schemaElement.StringSize || 'SHORT'] as LayoutSize;
const layoutSize = this.getLayoutSize(schemaElement);
return {
...baseDisplayRule,
Path: schemaElement.Path,
ui: {
...baseDisplayRule.ui,
layout: {
size,
columns: size === 'small' ? 1 : 2,
size: layoutSize,
columns: layoutSize === 'small' ? 1 : 2,
},
Path: schemaElement.ApiPath,
label: schemaElement.ShortName,
Expand Down

0 comments on commit 3a7b9d7

Please sign in to comment.