@flusys/ng-auth 4.0.0-rc → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -3
- package/fesm2022/flusys-ng-auth.mjs +82 -54
- package/fesm2022/flusys-ng-auth.mjs.map +1 -1
- package/package.json +6 -5
- package/types/flusys-ng-auth.d.ts +31 -0
|
@@ -4103,6 +4103,13 @@ class ProfilePageComponent {
|
|
|
4103
4103
|
translate(key, vars) {
|
|
4104
4104
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
4105
4105
|
}
|
|
4106
|
+
/** Translate with fallback: if key returns unchanged, use fallback instead */
|
|
4107
|
+
safeTranslate(key, fallback) {
|
|
4108
|
+
if (!key)
|
|
4109
|
+
return fallback;
|
|
4110
|
+
const translated = this.translate(key);
|
|
4111
|
+
return translated === key ? fallback : translated;
|
|
4112
|
+
}
|
|
4106
4113
|
isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
4107
4114
|
isLoadingPermissions = signal(false, ...(ngDevMode ? [{ debugName: "isLoadingPermissions" }] : []));
|
|
4108
4115
|
isLoadingExtraFields = signal(false, ...(ngDevMode ? [{ debugName: "isLoadingExtraFields" }] : []));
|
|
@@ -4476,7 +4483,7 @@ class ProfilePageComponent {
|
|
|
4476
4483
|
@for (field of editableFields(); track field.key) {
|
|
4477
4484
|
<div class="flex flex-col gap-2">
|
|
4478
4485
|
<label [for]="field.key" class="font-medium text-color">
|
|
4479
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
4486
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
4480
4487
|
</label>
|
|
4481
4488
|
@if (field.component) {
|
|
4482
4489
|
<ng-container *ngComponentOutlet="field.component; injector: getFieldInjector(field)" />
|
|
@@ -4510,7 +4517,7 @@ class ProfilePageComponent {
|
|
|
4510
4517
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
4511
4518
|
@for (field of viewOnlyFields(); track field.key) {
|
|
4512
4519
|
<div class="flex flex-col gap-1">
|
|
4513
|
-
<label class="text-sm text-muted-color">{{ field.label }}</label>
|
|
4520
|
+
<label class="text-sm text-muted-color">{{ safeTranslate(field.labelKey, field.label) }}</label>
|
|
4514
4521
|
<span class="text-color font-medium">
|
|
4515
4522
|
@if (field.type === 'select') {
|
|
4516
4523
|
{{ getSelectLabel(field, getAdminFieldValue(field.key)) }}
|
|
@@ -4531,7 +4538,7 @@ class ProfilePageComponent {
|
|
|
4531
4538
|
<input
|
|
4532
4539
|
pInputText
|
|
4533
4540
|
[id]="field.key"
|
|
4534
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4541
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4535
4542
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4536
4543
|
[disabled]="field.editable === false"
|
|
4537
4544
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
@@ -4542,7 +4549,7 @@ class ProfilePageComponent {
|
|
|
4542
4549
|
pInputText
|
|
4543
4550
|
type="number"
|
|
4544
4551
|
[id]="field.key"
|
|
4545
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4552
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4546
4553
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4547
4554
|
[disabled]="field.editable === false"
|
|
4548
4555
|
(input)="updateExtraField(field.key, $any($event.target).valueAsNumber)"
|
|
@@ -4552,7 +4559,7 @@ class ProfilePageComponent {
|
|
|
4552
4559
|
<textarea
|
|
4553
4560
|
pInputTextarea
|
|
4554
4561
|
[id]="field.key"
|
|
4555
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4562
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4556
4563
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4557
4564
|
[disabled]="field.editable === false"
|
|
4558
4565
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
@@ -4567,9 +4574,9 @@ class ProfilePageComponent {
|
|
|
4567
4574
|
[ngModelOptions]="{standalone: true}"
|
|
4568
4575
|
[disabled]="field.editable === false"
|
|
4569
4576
|
(ngModelChange)="updateExtraField(field.key, $event)">
|
|
4570
|
-
<option value="">{{ field.placeholder ?? ('shared.select' | translate) }}</option>
|
|
4577
|
+
<option value="">{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}</option>
|
|
4571
4578
|
@for (opt of field.options; track opt.value) {
|
|
4572
|
-
<option [value]="opt.value">{{ opt.label }}</option>
|
|
4579
|
+
<option [value]="opt.value">{{ safeTranslate(opt.labelKey, opt.label) }}</option>
|
|
4573
4580
|
}
|
|
4574
4581
|
</select>
|
|
4575
4582
|
}
|
|
@@ -4581,7 +4588,7 @@ class ProfilePageComponent {
|
|
|
4581
4588
|
[checked]="getExtraFieldValue(field.key) ?? false"
|
|
4582
4589
|
[disabled]="field.editable === false"
|
|
4583
4590
|
(change)="updateExtraField(field.key, $any($event.target).checked)" />
|
|
4584
|
-
<span>{{ field.placeholder ?? field.label }}</span>
|
|
4591
|
+
<span>{{ safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label)) }}</span>
|
|
4585
4592
|
</label>
|
|
4586
4593
|
}
|
|
4587
4594
|
@case ('date') {
|
|
@@ -4681,7 +4688,7 @@ class ProfilePageComponent {
|
|
|
4681
4688
|
@if (section.icon) {
|
|
4682
4689
|
<i [class]="section.icon + ' text-primary'"></i>
|
|
4683
4690
|
}
|
|
4684
|
-
<span class="font-semibold text-color">{{ section.title }}</span>
|
|
4691
|
+
<span class="font-semibold text-color">{{ safeTranslate(section.titleKey, section.title) }}</span>
|
|
4685
4692
|
</div>
|
|
4686
4693
|
<div class="section-content">
|
|
4687
4694
|
@if (section.component) {
|
|
@@ -4695,7 +4702,7 @@ class ProfilePageComponent {
|
|
|
4695
4702
|
@if (section.icon) {
|
|
4696
4703
|
<i [class]="section.icon + ' text-primary'"></i>
|
|
4697
4704
|
}
|
|
4698
|
-
<span class="font-semibold text-color">{{ section.title }}</span>
|
|
4705
|
+
<span class="font-semibold text-color">{{ safeTranslate(section.titleKey, section.title) }}</span>
|
|
4699
4706
|
</div>
|
|
4700
4707
|
<div class="section-content">
|
|
4701
4708
|
@if (section.component) {
|
|
@@ -4881,7 +4888,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4881
4888
|
@for (field of editableFields(); track field.key) {
|
|
4882
4889
|
<div class="flex flex-col gap-2">
|
|
4883
4890
|
<label [for]="field.key" class="font-medium text-color">
|
|
4884
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
4891
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
4885
4892
|
</label>
|
|
4886
4893
|
@if (field.component) {
|
|
4887
4894
|
<ng-container *ngComponentOutlet="field.component; injector: getFieldInjector(field)" />
|
|
@@ -4915,7 +4922,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4915
4922
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
4916
4923
|
@for (field of viewOnlyFields(); track field.key) {
|
|
4917
4924
|
<div class="flex flex-col gap-1">
|
|
4918
|
-
<label class="text-sm text-muted-color">{{ field.label }}</label>
|
|
4925
|
+
<label class="text-sm text-muted-color">{{ safeTranslate(field.labelKey, field.label) }}</label>
|
|
4919
4926
|
<span class="text-color font-medium">
|
|
4920
4927
|
@if (field.type === 'select') {
|
|
4921
4928
|
{{ getSelectLabel(field, getAdminFieldValue(field.key)) }}
|
|
@@ -4936,7 +4943,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4936
4943
|
<input
|
|
4937
4944
|
pInputText
|
|
4938
4945
|
[id]="field.key"
|
|
4939
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4946
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4940
4947
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4941
4948
|
[disabled]="field.editable === false"
|
|
4942
4949
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
@@ -4947,7 +4954,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4947
4954
|
pInputText
|
|
4948
4955
|
type="number"
|
|
4949
4956
|
[id]="field.key"
|
|
4950
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4957
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4951
4958
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4952
4959
|
[disabled]="field.editable === false"
|
|
4953
4960
|
(input)="updateExtraField(field.key, $any($event.target).valueAsNumber)"
|
|
@@ -4957,7 +4964,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4957
4964
|
<textarea
|
|
4958
4965
|
pInputTextarea
|
|
4959
4966
|
[id]="field.key"
|
|
4960
|
-
[placeholder]="field.placeholder ?? ''"
|
|
4967
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
4961
4968
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
4962
4969
|
[disabled]="field.editable === false"
|
|
4963
4970
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
@@ -4972,9 +4979,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4972
4979
|
[ngModelOptions]="{standalone: true}"
|
|
4973
4980
|
[disabled]="field.editable === false"
|
|
4974
4981
|
(ngModelChange)="updateExtraField(field.key, $event)">
|
|
4975
|
-
<option value="">{{ field.placeholder ?? ('shared.select' | translate) }}</option>
|
|
4982
|
+
<option value="">{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}</option>
|
|
4976
4983
|
@for (opt of field.options; track opt.value) {
|
|
4977
|
-
<option [value]="opt.value">{{ opt.label }}</option>
|
|
4984
|
+
<option [value]="opt.value">{{ safeTranslate(opt.labelKey, opt.label) }}</option>
|
|
4978
4985
|
}
|
|
4979
4986
|
</select>
|
|
4980
4987
|
}
|
|
@@ -4986,7 +4993,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
4986
4993
|
[checked]="getExtraFieldValue(field.key) ?? false"
|
|
4987
4994
|
[disabled]="field.editable === false"
|
|
4988
4995
|
(change)="updateExtraField(field.key, $any($event.target).checked)" />
|
|
4989
|
-
<span>{{ field.placeholder ?? field.label }}</span>
|
|
4996
|
+
<span>{{ safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label)) }}</span>
|
|
4990
4997
|
</label>
|
|
4991
4998
|
}
|
|
4992
4999
|
@case ('date') {
|
|
@@ -5086,7 +5093,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
5086
5093
|
@if (section.icon) {
|
|
5087
5094
|
<i [class]="section.icon + ' text-primary'"></i>
|
|
5088
5095
|
}
|
|
5089
|
-
<span class="font-semibold text-color">{{ section.title }}</span>
|
|
5096
|
+
<span class="font-semibold text-color">{{ safeTranslate(section.titleKey, section.title) }}</span>
|
|
5090
5097
|
</div>
|
|
5091
5098
|
<div class="section-content">
|
|
5092
5099
|
@if (section.component) {
|
|
@@ -5100,7 +5107,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
5100
5107
|
@if (section.icon) {
|
|
5101
5108
|
<i [class]="section.icon + ' text-primary'"></i>
|
|
5102
5109
|
}
|
|
5103
|
-
<span class="font-semibold text-color">{{ section.title }}</span>
|
|
5110
|
+
<span class="font-semibold text-color">{{ safeTranslate(section.titleKey, section.title) }}</span>
|
|
5104
5111
|
</div>
|
|
5105
5112
|
<div class="section-content">
|
|
5106
5113
|
@if (section.component) {
|
|
@@ -5221,6 +5228,13 @@ class RegisterPageComponent {
|
|
|
5221
5228
|
translate(key, vars) {
|
|
5222
5229
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
5223
5230
|
}
|
|
5231
|
+
/** Translate with fallback: if key returns unchanged, use fallback instead */
|
|
5232
|
+
safeTranslate(key, fallback) {
|
|
5233
|
+
if (!key)
|
|
5234
|
+
return fallback;
|
|
5235
|
+
const translated = this.translate(key);
|
|
5236
|
+
return translated === key ? fallback : translated;
|
|
5237
|
+
}
|
|
5224
5238
|
queryParamMap = toSignal(this.route.queryParamMap);
|
|
5225
5239
|
companySlugInitialized = false;
|
|
5226
5240
|
returnUrl = input('', ...(ngDevMode ? [{ debugName: "returnUrl" }] : []));
|
|
@@ -5576,7 +5590,7 @@ class RegisterPageComponent {
|
|
|
5576
5590
|
@for (field of extraFields(); track field.key) {
|
|
5577
5591
|
<div [class]="field.containerClass ?? ''">
|
|
5578
5592
|
<label [for]="field.key" class="block font-medium mb-2">
|
|
5579
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
5593
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
5580
5594
|
</label>
|
|
5581
5595
|
@if (field.component) {
|
|
5582
5596
|
<ng-container
|
|
@@ -5593,7 +5607,7 @@ class RegisterPageComponent {
|
|
|
5593
5607
|
<input
|
|
5594
5608
|
pInputText
|
|
5595
5609
|
[id]="field.key"
|
|
5596
|
-
[placeholder]="field.placeholder ?? ''"
|
|
5610
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
5597
5611
|
[value]="
|
|
5598
5612
|
extraFieldsModel()[field.key] ??
|
|
5599
5613
|
field.defaultValue ??
|
|
@@ -5613,7 +5627,7 @@ class RegisterPageComponent {
|
|
|
5613
5627
|
pInputText
|
|
5614
5628
|
type="number"
|
|
5615
5629
|
[id]="field.key"
|
|
5616
|
-
[placeholder]="field.placeholder ?? ''"
|
|
5630
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
5617
5631
|
[value]="
|
|
5618
5632
|
extraFieldsModel()[field.key] ??
|
|
5619
5633
|
field.defaultValue ??
|
|
@@ -5632,7 +5646,7 @@ class RegisterPageComponent {
|
|
|
5632
5646
|
<textarea
|
|
5633
5647
|
pInputTextarea
|
|
5634
5648
|
[id]="field.key"
|
|
5635
|
-
[placeholder]="field.placeholder ?? ''"
|
|
5649
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
5636
5650
|
[value]="
|
|
5637
5651
|
extraFieldsModel()[field.key] ??
|
|
5638
5652
|
field.defaultValue ??
|
|
@@ -5665,11 +5679,11 @@ class RegisterPageComponent {
|
|
|
5665
5679
|
"
|
|
5666
5680
|
>
|
|
5667
5681
|
<option value="">
|
|
5668
|
-
{{ field.placeholder ?? ('shared.select' | translate) }}
|
|
5682
|
+
{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}
|
|
5669
5683
|
</option>
|
|
5670
5684
|
@for (opt of field.options; track opt.value) {
|
|
5671
5685
|
<option [value]="opt.value">
|
|
5672
|
-
{{ opt.label }}
|
|
5686
|
+
{{ safeTranslate(opt.labelKey, opt.label) }}
|
|
5673
5687
|
</option>
|
|
5674
5688
|
}
|
|
5675
5689
|
</select>
|
|
@@ -5692,7 +5706,7 @@ class RegisterPageComponent {
|
|
|
5692
5706
|
"
|
|
5693
5707
|
/>
|
|
5694
5708
|
<span>{{
|
|
5695
|
-
field.placeholder ?? field.label
|
|
5709
|
+
safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label))
|
|
5696
5710
|
}}</span>
|
|
5697
5711
|
</label>
|
|
5698
5712
|
}
|
|
@@ -5980,7 +5994,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
5980
5994
|
@for (field of extraFields(); track field.key) {
|
|
5981
5995
|
<div [class]="field.containerClass ?? ''">
|
|
5982
5996
|
<label [for]="field.key" class="block font-medium mb-2">
|
|
5983
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
5997
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
5984
5998
|
</label>
|
|
5985
5999
|
@if (field.component) {
|
|
5986
6000
|
<ng-container
|
|
@@ -5997,7 +6011,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
5997
6011
|
<input
|
|
5998
6012
|
pInputText
|
|
5999
6013
|
[id]="field.key"
|
|
6000
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6014
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6001
6015
|
[value]="
|
|
6002
6016
|
extraFieldsModel()[field.key] ??
|
|
6003
6017
|
field.defaultValue ??
|
|
@@ -6017,7 +6031,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
6017
6031
|
pInputText
|
|
6018
6032
|
type="number"
|
|
6019
6033
|
[id]="field.key"
|
|
6020
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6034
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6021
6035
|
[value]="
|
|
6022
6036
|
extraFieldsModel()[field.key] ??
|
|
6023
6037
|
field.defaultValue ??
|
|
@@ -6036,7 +6050,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
6036
6050
|
<textarea
|
|
6037
6051
|
pInputTextarea
|
|
6038
6052
|
[id]="field.key"
|
|
6039
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6053
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6040
6054
|
[value]="
|
|
6041
6055
|
extraFieldsModel()[field.key] ??
|
|
6042
6056
|
field.defaultValue ??
|
|
@@ -6069,11 +6083,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
6069
6083
|
"
|
|
6070
6084
|
>
|
|
6071
6085
|
<option value="">
|
|
6072
|
-
{{ field.placeholder ?? ('shared.select' | translate) }}
|
|
6086
|
+
{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}
|
|
6073
6087
|
</option>
|
|
6074
6088
|
@for (opt of field.options; track opt.value) {
|
|
6075
6089
|
<option [value]="opt.value">
|
|
6076
|
-
{{ opt.label }}
|
|
6090
|
+
{{ safeTranslate(opt.labelKey, opt.label) }}
|
|
6077
6091
|
</option>
|
|
6078
6092
|
}
|
|
6079
6093
|
</select>
|
|
@@ -6096,7 +6110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
6096
6110
|
"
|
|
6097
6111
|
/>
|
|
6098
6112
|
<span>{{
|
|
6099
|
-
field.placeholder ?? field.label
|
|
6113
|
+
safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label))
|
|
6100
6114
|
}}</span>
|
|
6101
6115
|
</label>
|
|
6102
6116
|
}
|
|
@@ -6604,6 +6618,13 @@ class UserFormComponent {
|
|
|
6604
6618
|
translate(key, vars) {
|
|
6605
6619
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
6606
6620
|
}
|
|
6621
|
+
/** Translate with fallback: if key returns unchanged, use fallback instead */
|
|
6622
|
+
safeTranslate(key, fallback) {
|
|
6623
|
+
if (!key)
|
|
6624
|
+
return fallback;
|
|
6625
|
+
const translated = this.translate(key);
|
|
6626
|
+
return translated === key ? fallback : translated;
|
|
6627
|
+
}
|
|
6607
6628
|
routeParams = toSignal(this.route.paramMap);
|
|
6608
6629
|
userLoadTriggered = false;
|
|
6609
6630
|
/** Loading state */
|
|
@@ -6923,7 +6944,7 @@ class UserFormComponent {
|
|
|
6923
6944
|
@for (field of extraFields(); track field.key) {
|
|
6924
6945
|
<div class="flex flex-col gap-2">
|
|
6925
6946
|
<label [for]="field.key" class="font-medium text-color">
|
|
6926
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
6947
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
6927
6948
|
</label>
|
|
6928
6949
|
@if (field.component) {
|
|
6929
6950
|
<ng-container *ngComponentOutlet="field.component; injector: getFieldInjector(field)" />
|
|
@@ -6935,7 +6956,7 @@ class UserFormComponent {
|
|
|
6935
6956
|
<input
|
|
6936
6957
|
pInputText
|
|
6937
6958
|
[id]="field.key"
|
|
6938
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6959
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6939
6960
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
6940
6961
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
6941
6962
|
class="w-full" />
|
|
@@ -6945,7 +6966,7 @@ class UserFormComponent {
|
|
|
6945
6966
|
pInputText
|
|
6946
6967
|
type="number"
|
|
6947
6968
|
[id]="field.key"
|
|
6948
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6969
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6949
6970
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
6950
6971
|
(input)="updateExtraField(field.key, $any($event.target).valueAsNumber)"
|
|
6951
6972
|
class="w-full" />
|
|
@@ -6954,7 +6975,7 @@ class UserFormComponent {
|
|
|
6954
6975
|
<textarea
|
|
6955
6976
|
pInputTextarea
|
|
6956
6977
|
[id]="field.key"
|
|
6957
|
-
[placeholder]="field.placeholder ?? ''"
|
|
6978
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
6958
6979
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
6959
6980
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
6960
6981
|
class="w-full"
|
|
@@ -6967,9 +6988,9 @@ class UserFormComponent {
|
|
|
6967
6988
|
[ngModel]="getExtraFieldValue(field.key) ?? ''"
|
|
6968
6989
|
[ngModelOptions]="{standalone: true}"
|
|
6969
6990
|
(ngModelChange)="updateExtraField(field.key, $event)">
|
|
6970
|
-
<option value="">{{ field.placeholder ?? ('shared.select' | translate) }}</option>
|
|
6991
|
+
<option value="">{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}</option>
|
|
6971
6992
|
@for (opt of field.options; track opt.value) {
|
|
6972
|
-
<option [value]="opt.value">{{ opt.label }}</option>
|
|
6993
|
+
<option [value]="opt.value">{{ safeTranslate(opt.labelKey, opt.label) }}</option>
|
|
6973
6994
|
}
|
|
6974
6995
|
</select>
|
|
6975
6996
|
}
|
|
@@ -6980,7 +7001,7 @@ class UserFormComponent {
|
|
|
6980
7001
|
[id]="field.key"
|
|
6981
7002
|
[checked]="getExtraFieldValue(field.key) ?? false"
|
|
6982
7003
|
(change)="updateExtraField(field.key, $any($event.target).checked)" />
|
|
6983
|
-
<span>{{ field.placeholder ?? field.label }}</span>
|
|
7004
|
+
<span>{{ safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label)) }}</span>
|
|
6984
7005
|
</label>
|
|
6985
7006
|
}
|
|
6986
7007
|
@case ('date') {
|
|
@@ -7129,7 +7150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7129
7150
|
@for (field of extraFields(); track field.key) {
|
|
7130
7151
|
<div class="flex flex-col gap-2">
|
|
7131
7152
|
<label [for]="field.key" class="font-medium text-color">
|
|
7132
|
-
{{ field.label }}{{ field.required ? ' *' : '' }}
|
|
7153
|
+
{{ safeTranslate(field.labelKey, field.label) }}{{ field.required ? ' *' : '' }}
|
|
7133
7154
|
</label>
|
|
7134
7155
|
@if (field.component) {
|
|
7135
7156
|
<ng-container *ngComponentOutlet="field.component; injector: getFieldInjector(field)" />
|
|
@@ -7141,7 +7162,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7141
7162
|
<input
|
|
7142
7163
|
pInputText
|
|
7143
7164
|
[id]="field.key"
|
|
7144
|
-
[placeholder]="field.placeholder ?? ''"
|
|
7165
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
7145
7166
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
7146
7167
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
7147
7168
|
class="w-full" />
|
|
@@ -7151,7 +7172,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7151
7172
|
pInputText
|
|
7152
7173
|
type="number"
|
|
7153
7174
|
[id]="field.key"
|
|
7154
|
-
[placeholder]="field.placeholder ?? ''"
|
|
7175
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
7155
7176
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
7156
7177
|
(input)="updateExtraField(field.key, $any($event.target).valueAsNumber)"
|
|
7157
7178
|
class="w-full" />
|
|
@@ -7160,7 +7181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7160
7181
|
<textarea
|
|
7161
7182
|
pInputTextarea
|
|
7162
7183
|
[id]="field.key"
|
|
7163
|
-
[placeholder]="field.placeholder ?? ''"
|
|
7184
|
+
[placeholder]="safeTranslate(field.placeholderKey, field.placeholder ?? '')"
|
|
7164
7185
|
[value]="getExtraFieldValue(field.key) ?? ''"
|
|
7165
7186
|
(input)="updateExtraField(field.key, $any($event.target).value)"
|
|
7166
7187
|
class="w-full"
|
|
@@ -7173,9 +7194,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7173
7194
|
[ngModel]="getExtraFieldValue(field.key) ?? ''"
|
|
7174
7195
|
[ngModelOptions]="{standalone: true}"
|
|
7175
7196
|
(ngModelChange)="updateExtraField(field.key, $event)">
|
|
7176
|
-
<option value="">{{ field.placeholder ?? ('shared.select' | translate) }}</option>
|
|
7197
|
+
<option value="">{{ safeTranslate(field.placeholderKey, field.placeholder ?? ('shared.select' | translate)) }}</option>
|
|
7177
7198
|
@for (opt of field.options; track opt.value) {
|
|
7178
|
-
<option [value]="opt.value">{{ opt.label }}</option>
|
|
7199
|
+
<option [value]="opt.value">{{ safeTranslate(opt.labelKey, opt.label) }}</option>
|
|
7179
7200
|
}
|
|
7180
7201
|
</select>
|
|
7181
7202
|
}
|
|
@@ -7186,7 +7207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
7186
7207
|
[id]="field.key"
|
|
7187
7208
|
[checked]="getExtraFieldValue(field.key) ?? false"
|
|
7188
7209
|
(change)="updateExtraField(field.key, $any($event.target).checked)" />
|
|
7189
|
-
<span>{{ field.placeholder ?? field.label }}</span>
|
|
7210
|
+
<span>{{ safeTranslate(field.placeholderKey, field.placeholder ?? safeTranslate(field.labelKey, field.label)) }}</span>
|
|
7190
7211
|
</label>
|
|
7191
7212
|
}
|
|
7192
7213
|
@case ('date') {
|
|
@@ -7823,6 +7844,13 @@ class UserListComponent {
|
|
|
7823
7844
|
translate(key, vars) {
|
|
7824
7845
|
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
7825
7846
|
}
|
|
7847
|
+
/** Translate with fallback: if key returns unchanged, use fallback instead */
|
|
7848
|
+
safeTranslate(key, fallback) {
|
|
7849
|
+
if (!key)
|
|
7850
|
+
return fallback;
|
|
7851
|
+
const translated = this.translate(key);
|
|
7852
|
+
return translated === key ? fallback : translated;
|
|
7853
|
+
}
|
|
7826
7854
|
users = this.userService.data;
|
|
7827
7855
|
isLoading = this.userService.isLoading;
|
|
7828
7856
|
total = this.userService.total;
|
|
@@ -7961,7 +7989,7 @@ class UserListComponent {
|
|
|
7961
7989
|
<th>{{ 'shared.status' | translate }}</th>
|
|
7962
7990
|
@for (col of extraColumns(); track col.key) {
|
|
7963
7991
|
<th [class]="col.styleClass ?? ''" [style.width]="col.width ?? 'auto'">
|
|
7964
|
-
{{ col.header }}
|
|
7992
|
+
{{ safeTranslate(col.headerKey, col.header) }}
|
|
7965
7993
|
</th>
|
|
7966
7994
|
}
|
|
7967
7995
|
<th class="w-[180px]">{{ 'shared.actions' | translate }}</th>
|
|
@@ -8035,7 +8063,7 @@ class UserListComponent {
|
|
|
8035
8063
|
[rounded]="true"
|
|
8036
8064
|
[text]="true"
|
|
8037
8065
|
[severity]="action.severity ?? 'secondary'"
|
|
8038
|
-
[pTooltip]="action.label"
|
|
8066
|
+
[pTooltip]="safeTranslate(action.labelKey, action.label)"
|
|
8039
8067
|
[disabled]="isActionDisabled(action, user)"
|
|
8040
8068
|
(onClick)="onExtraAction(action, user)" />
|
|
8041
8069
|
}
|
|
@@ -8114,7 +8142,7 @@ class UserListComponent {
|
|
|
8114
8142
|
</div>
|
|
8115
8143
|
@for (col of extraColumns(); track col.key) {
|
|
8116
8144
|
<div class="flex flex-col gap-2">
|
|
8117
|
-
<label class="font-medium text-muted-color">{{ col.header }}</label>
|
|
8145
|
+
<label class="font-medium text-muted-color">{{ safeTranslate(col.headerKey, col.header) }}</label>
|
|
8118
8146
|
<span class="text-color">{{ getFieldValue(user, col.field ?? col.key) ?? '-' }}</span>
|
|
8119
8147
|
</div>
|
|
8120
8148
|
}
|
|
@@ -8179,7 +8207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8179
8207
|
<th>{{ 'shared.status' | translate }}</th>
|
|
8180
8208
|
@for (col of extraColumns(); track col.key) {
|
|
8181
8209
|
<th [class]="col.styleClass ?? ''" [style.width]="col.width ?? 'auto'">
|
|
8182
|
-
{{ col.header }}
|
|
8210
|
+
{{ safeTranslate(col.headerKey, col.header) }}
|
|
8183
8211
|
</th>
|
|
8184
8212
|
}
|
|
8185
8213
|
<th class="w-[180px]">{{ 'shared.actions' | translate }}</th>
|
|
@@ -8253,7 +8281,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8253
8281
|
[rounded]="true"
|
|
8254
8282
|
[text]="true"
|
|
8255
8283
|
[severity]="action.severity ?? 'secondary'"
|
|
8256
|
-
[pTooltip]="action.label"
|
|
8284
|
+
[pTooltip]="safeTranslate(action.labelKey, action.label)"
|
|
8257
8285
|
[disabled]="isActionDisabled(action, user)"
|
|
8258
8286
|
(onClick)="onExtraAction(action, user)" />
|
|
8259
8287
|
}
|
|
@@ -8332,7 +8360,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
8332
8360
|
</div>
|
|
8333
8361
|
@for (col of extraColumns(); track col.key) {
|
|
8334
8362
|
<div class="flex flex-col gap-2">
|
|
8335
|
-
<label class="font-medium text-muted-color">{{ col.header }}</label>
|
|
8363
|
+
<label class="font-medium text-muted-color">{{ safeTranslate(col.headerKey, col.header) }}</label>
|
|
8336
8364
|
<span class="text-color">{{ getFieldValue(user, col.field ?? col.key) ?? '-' }}</span>
|
|
8337
8365
|
</div>
|
|
8338
8366
|
}
|