Skip to content

Commit

Permalink
refactor(ui): simplify schema range rendering
Browse files Browse the repository at this point in the history
Is difficult to maintain

Refs springwolf#378
  • Loading branch information
aerfus committed Jan 30, 2024
1 parent b53de57 commit c9de230
Showing 1 changed file with 4 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,18 @@
class="range"
*ngIf="schema.minimum !== undefined && schema.maximum === undefined"
>
<span
*ngIf="
schema.exclusiveMinimum;
then exclusiveMinimumSign;
else inclusiveMinimumSign
"
></span>
{{ schema.minimum }}
{{ schema.exclusiveMinimum ? ">" : ">=" }} {{ schema.minimum }}
</span>
<span
class="range"
*ngIf="schema.minimum === undefined && schema.maximum !== undefined"
>
<span
*ngIf="
schema.exclusiveMaximum;
then exclusiveMaximumSign;
else inclusiveMaximumSign
"
></span>
{{ schema.maximum }}
{{ schema.exclusiveMaximum ? "<" : "<=" }} {{ schema.maximum }}
</span>
<span
class="range"
*ngIf="schema.minimum !== undefined && schema.maximum !== undefined"
>{{ schema.exclusiveMinimum ? "(" : "[" }} {{ schema.minimum }} ..
{{ schema.maximum }} {{ schema.exclusiveMaximum ? ")" : "]" }}</span
>
<span
*ngIf="
schema.exclusiveMinimum;
then exclusiveMinimumBrackets;
else inclusiveMinimumBrackets
"
></span>
{{ schema.minimum }} .. {{ schema.maximum }}
<span
*ngIf="
schema.exclusiveMaximum;
then exclusiveMaximumBrackets;
else inclusiveMaximumBrackets
"
></span>
</span>
</div>

<ng-template #exclusiveMinimumBrackets>(</ng-template>
<ng-template #exclusiveMaximumBrackets>)</ng-template>
<ng-template #inclusiveMinimumBrackets>[</ng-template>
<ng-template #inclusiveMaximumBrackets>]</ng-template>

<ng-template #exclusiveMinimumSign>&gt;</ng-template>
<ng-template #exclusiveMaximumSign>&lt;</ng-template>
<ng-template #inclusiveMinimumSign>&gt;=</ng-template>
<ng-template #inclusiveMaximumSign>&lt;=</ng-template>

0 comments on commit c9de230

Please sign in to comment.