Skip to content

Commit

Permalink
NaturalSelectEnum does not capitalize enum name #10356
Browse files Browse the repository at this point in the history
While most enum names start with a capital, and should do so, there are
cases where we require to start with a lowercase, such as SI unit `kg`
  • Loading branch information
PowerKiKi committed Jun 11, 2024
1 parent c76387c commit 7e9c15b
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 64 deletions.
2 changes: 1 addition & 1 deletion client/app/admin/accounts/accounts/accounts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<ng-container matColumnDef="type">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Type</th>
<td *matCellDef="let element" mat-cell>
{{ element.item.type | enum: 'AccountType' | async | capitalize }}
{{ element.item.type | enum: 'AccountType' | async }}
</td>
</ng-container>

Expand Down
2 changes: 0 additions & 2 deletions client/app/admin/accounts/accounts/accounts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
NaturalTableButtonComponent,
NaturalAvatarComponent,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
} from '@ecodev/natural';
Expand Down Expand Up @@ -61,7 +60,6 @@ type AccountingExportDialogResult = {
MatProgressSpinnerModule,
MatPaginatorModule,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
IbanPipe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
NaturalFileComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down Expand Up @@ -55,7 +54,6 @@ import {CommonModule} from '@angular/common';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down
2 changes: 1 addition & 1 deletion client/app/admin/bookings/bookings/bookings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<ng-container matColumnDef="status">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Statut</th>
<td *matCellDef="let element" mat-cell>
{{ element.status | enum: 'BookingStatus' | async | capitalize }}
{{ element.status | enum: 'BookingStatus' | async }}
</td>
<td *matFooterCellDef mat-footer-cell></td>
</ng-container>
Expand Down
2 changes: 0 additions & 2 deletions client/app/admin/bookings/bookings/bookings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
NaturalFileComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down Expand Up @@ -52,7 +51,6 @@ import {CommonModule} from '@angular/common';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
<ng-container matColumnDef="status">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Status</th>
<td *matCellDef="let element" mat-cell>
{{ element.status | enum: 'ExpenseClaimStatus' | async | capitalize }}
{{ element.status | enum: 'ExpenseClaimStatus' | async }}
</td>
</ng-container>

<ng-container matColumnDef="type">
<th *matHeaderCellDef mat-header-cell mat-sort-header natural-4em-column>Type</th>
<td *matCellDef="let element" mat-cell>
{{ element.type | enum: 'ExpenseClaimType' | async | capitalize }}
{{ element.type | enum: 'ExpenseClaimType' | async }}
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
NaturalAvatarComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
} from '@ecodev/natural';
Expand Down Expand Up @@ -48,7 +47,6 @@ import {CommonModule} from '@angular/common';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
],
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/users/users/users.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<ng-container matColumnDef="role">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Rôle</th>
<td *matCellDef="let element" mat-cell>
{{ element.role | enum: 'UserRole' | async | capitalize }}
{{ element.role | enum: 'UserRole' | async }}
</td>
</ng-container>

Expand All @@ -80,7 +80,7 @@
[matTooltipDisabled]="isActive(element) || isActivable(element)"
>
@if (isActive(element)) {
<span>{{ element.status | enum: 'UserStatus' | async | capitalize }}</span>
<span>{{ element.status | enum: 'UserStatus' | async }}</span>
}
@if (!isActive(element)) {
<button
Expand All @@ -90,7 +90,7 @@
[style.width.px]="150"
(click)="activate(element)"
>
Activer ({{ element.status | enum: 'UserStatus' | async | capitalize }})
Activer ({{ element.status | enum: 'UserStatus' | async }})
</button>
}
</td>
Expand Down
2 changes: 0 additions & 2 deletions client/app/admin/users/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
NaturalAvatarComponent,
NaturalTableButtonComponent,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
} from '@ecodev/natural';
Expand Down Expand Up @@ -52,7 +51,6 @@ import {CommonModule} from '@angular/common';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ <h2 class="nat-expand mat-headline-5 nat-no-margin nat-no-collapse">
<ng-container matColumnDef="status">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Status</th>
<td *matCellDef="let expenseClaim" mat-cell>
{{ expenseClaim.status | enum: 'ExpenseClaimStatus' | async | capitalize }}
{{ expenseClaim.status | enum: 'ExpenseClaimStatus' | async }}
</td>
</ng-container>

<ng-container matColumnDef="type">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Type</th>
<td *matCellDef="let expenseClaim" mat-cell>
{{ expenseClaim.type | enum: 'ExpenseClaimType' | async | capitalize }}
{{ expenseClaim.type | enum: 'ExpenseClaimType' | async }}
</td>
</ng-container>

Expand Down
9 changes: 1 addition & 8 deletions client/app/profile/components/finances/finances.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import {UserService} from '../../../admin/users/services/user.service';
import {ExpenseClaimService} from '../../../admin/expenseClaim/services/expenseClaim.service';
import {MatDialog} from '@angular/material/dialog';
import {CreateRefundComponent} from '../create-refund/create-refund.component';
import {
ifValid,
NaturalAbstractList,
NaturalIconDirective,
NaturalCapitalizePipe,
NaturalEnumPipe,
} from '@ecodev/natural';
import {ifValid, NaturalAbstractList, NaturalIconDirective, NaturalEnumPipe} from '@ecodev/natural';
import {TransactionLineService} from '../../../admin/transactions/services/transactionLine.service';
import {finalize} from 'rxjs/operators';
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
Expand Down Expand Up @@ -50,7 +44,6 @@ import {CommonModule} from '@angular/common';
MoneyComponent,
MatProgressSpinnerModule,
MatPaginatorModule,
NaturalCapitalizePipe,
NaturalEnumPipe,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="nat-vertical nat-gap-10">
<div class="mat-headline-4">{{ viewer.name }}</div>
<div class="mat-body-1">
{{ viewer.status | enum: 'UserStatus' | async | capitalize }}
{{ viewer.status | enum: 'UserStatus' | async }}
</div>
<div class="nat-horizontal nat-wrap nat-gap-15 mat-body-2">
@for (license of licenses; track license) {
Expand Down
2 changes: 0 additions & 2 deletions client/app/profile/components/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
NaturalIconDirective,
NaturalSidenavContentComponent,
NaturalAvatarComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
} from '@ecodev/natural';
import {UserService} from '../../../admin/users/services/user.service';
Expand Down Expand Up @@ -52,7 +51,6 @@ import {MatButtonModule} from '@angular/material/button';
MoneyComponent,
MatDividerModule,
RouterOutlet,
NaturalCapitalizePipe,
NaturalEnumPipe,
],
})
Expand Down
2 changes: 0 additions & 2 deletions client/app/safety/safety.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
NaturalFileComponent,
NaturalIconDirective,
NaturalFixedButtonComponent,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down Expand Up @@ -51,7 +50,6 @@ import {CommonModule} from '@angular/common';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
NaturalCapitalizePipe,
NaturalEnumPipe,
NaturalSwissDatePipe,
NaturalEllipsisPipe,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@angular/router": "^17.3.4",
"@apollo/client": "~3.9.5",
"@ecodev/fab-speed-dial": "^16.0.6",
"@ecodev/natural": "^58.0.6",
"@ecodev/natural-editor": "^58.0.6",
"@ecodev/natural": "^58.0.7",
"@ecodev/natural-editor": "^58.0.7",
"@ecodev/natural-layout": "^2.0.2",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript-apollo-angular": "^4.0.0",
Expand Down
12 changes: 6 additions & 6 deletions server/Application/Api/Enum/AccountTypeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class AccountTypeType extends EnumType
public function __construct()
{
$config = [
\Application\DBAL\Types\AccountTypeType::ASSET => 'actif',
\Application\DBAL\Types\AccountTypeType::LIABILITY => 'passif',
\Application\DBAL\Types\AccountTypeType::REVENUE => 'produit',
\Application\DBAL\Types\AccountTypeType::EXPENSE => 'charge',
\Application\DBAL\Types\AccountTypeType::EQUITY => 'résultat',
\Application\DBAL\Types\AccountTypeType::GROUP => 'groupe',
\Application\DBAL\Types\AccountTypeType::ASSET => 'Actif',
\Application\DBAL\Types\AccountTypeType::LIABILITY => 'Passif',
\Application\DBAL\Types\AccountTypeType::REVENUE => 'Produit',
\Application\DBAL\Types\AccountTypeType::EXPENSE => 'Charge',
\Application\DBAL\Types\AccountTypeType::EQUITY => 'Résultat',
\Application\DBAL\Types\AccountTypeType::GROUP => 'Groupe',
];

parent::__construct($config);
Expand Down
8 changes: 4 additions & 4 deletions server/Application/Api/Enum/ExpenseClaimStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class ExpenseClaimStatusType extends EnumType
public function __construct()
{
$config = [
\Application\DBAL\Types\ExpenseClaimStatusType::NEW => 'à traiter',
\Application\DBAL\Types\ExpenseClaimStatusType::PROCESSING => 'en traitement',
\Application\DBAL\Types\ExpenseClaimStatusType::PROCESSED => 'traîté',
\Application\DBAL\Types\ExpenseClaimStatusType::REJECTED => 'refusé',
\Application\DBAL\Types\ExpenseClaimStatusType::NEW => 'À traiter',
\Application\DBAL\Types\ExpenseClaimStatusType::PROCESSING => 'En traitement',
\Application\DBAL\Types\ExpenseClaimStatusType::PROCESSED => 'Traîté',
\Application\DBAL\Types\ExpenseClaimStatusType::REJECTED => 'Refusé',
];

parent::__construct($config);
Expand Down
12 changes: 6 additions & 6 deletions server/Application/Api/Enum/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class RelationshipType extends EnumType
public function __construct()
{
$config = [
\Application\DBAL\Types\RelationshipType::HOUSEHOLDER => 'chef(e) de famille',
\Application\DBAL\Types\RelationshipType::PARTNER => 'conjoint',
\Application\DBAL\Types\RelationshipType::CHILD => 'enfant',
\Application\DBAL\Types\RelationshipType::PARENT => 'parent',
\Application\DBAL\Types\RelationshipType::SISTER => 'soeur',
\Application\DBAL\Types\RelationshipType::BROTHER => 'frère',
\Application\DBAL\Types\RelationshipType::HOUSEHOLDER => 'Chef(e) de famille',
\Application\DBAL\Types\RelationshipType::PARTNER => 'Conjoint',
\Application\DBAL\Types\RelationshipType::CHILD => 'Enfant',
\Application\DBAL\Types\RelationshipType::PARENT => 'Parent',
\Application\DBAL\Types\RelationshipType::SISTER => 'Soeur',
\Application\DBAL\Types\RelationshipType::BROTHER => 'Frère',
];

parent::__construct($config);
Expand Down
6 changes: 3 additions & 3 deletions server/Application/Api/Enum/SexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public function __construct()
'values' => [
'not_known' => [
'value' => 0,
'description' => 'inconnu',
'description' => 'Inconnu',
],
'male' => [
'value' => 1,
'description' => 'masculin',
'description' => 'Masculin',
],
'female' => [
'value' => 2,
'description' => 'féminin',
'description' => 'Féminin',
],
],
];
Expand Down
47 changes: 36 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1554,10 +1554,10 @@
dependencies:
tslib "^2.6"

"@ecodev/natural-editor@^58.0.6":
version "58.0.6"
resolved "https://registry.yarnpkg.com/@ecodev/natural-editor/-/natural-editor-58.0.6.tgz#64a2414fcc75b896241e80b6f99235018b0b7e9f"
integrity sha512-tsYgKP2GzPoXg5Zlo6Ti+A6GUQWaiS1wpHtil8kdW2Qg6hsOqfHGrbWhF8Pvae/k46OXymx30uo68DLlmTLd/g==
"@ecodev/natural-editor@^58.0.7":
version "58.0.7"
resolved "https://registry.yarnpkg.com/@ecodev/natural-editor/-/natural-editor-58.0.7.tgz#e8cdeb81c7a4f51c906f856ca6bd9ecd9bf791d5"
integrity sha512-BP75IFKrQRJingbAV8t6RJ74/ZQstUs8e2QLbgvZg4o27RBJcWlRLBXkgHurz+DL0gCaRC60Y6IFy1dXSS/DYQ==
dependencies:
prosemirror-commands "^1.5.2"
prosemirror-dropcursor "^1.8.1"
Expand All @@ -1579,10 +1579,10 @@
resolved "https://registry.yarnpkg.com/@ecodev/natural-layout/-/natural-layout-2.0.2.tgz#e2c64c2ddb3c60793a39236b52624fde323e610a"
integrity sha512-BV75kFQmpfuSBNQ1jyKu+IdGkFTMESjPrtKrEyc3MqcmVhV5IiYU0LXTaghLZozuZgCT9HfMOnEsh05aS2j9uQ==

"@ecodev/natural@^58.0.6":
version "58.0.6"
resolved "https://registry.yarnpkg.com/@ecodev/natural/-/natural-58.0.6.tgz#64d1d0bd2c6985c7b272ac3401b8a12439a27233"
integrity sha512-Y3KfQWnNZNq/7w28M15gxSItVm2hNCVMMDIOnXeQkpRfk4/iSdwJ/MekndAf0R6XzUL9IMWdVf4xMvpLArst1g==
"@ecodev/natural@^58.0.7":
version "58.0.7"
resolved "https://registry.yarnpkg.com/@ecodev/natural/-/natural-58.0.7.tgz#912f8e869ee1d43fd5a5cb7793a14cb831dee817"
integrity sha512-+Rqboy6uL7FgB1BdeqOfETG6oOri2YbL70cmaetgPR7O3NEx5JYDtaTL7Nz4ItFRq2UMjSt3zw3RglgZMJZf7Q==
dependencies:
crypto-es "^2.0.3"
extract-files "^13.0.0"
Expand Down Expand Up @@ -9506,7 +9506,16 @@ string-env-interpolation@^1.0.1:
resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152"
integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -9538,7 +9547,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -10238,7 +10254,7 @@ wildcard@^2.0.0:
resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67"
integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -10256,6 +10272,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 7e9c15b

Please sign in to comment.