tin-spa 2.13.13 → 2.13.15
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/esm2020/lib/classes/Classes.mjs +1 -1
- package/esm2020/lib/classes/TinCore.mjs +1 -2
- package/esm2020/lib/components/date/date.component.mjs +3 -6
- package/esm2020/lib/components/form/form.component.mjs +4 -1
- package/esm2020/lib/components/table/detailsDialog.component.mjs +4 -2
- package/esm2020/lib/components/table-internal/detailsDialog-internal.component.mjs +4 -2
- package/esm2020/lib/components/table-lite/detailsDialog-lite.component.mjs +4 -2
- package/esm2020/lib/components/text/text.component.mjs +1 -5
- package/esm2020/lib/pages/users/users.component.mjs +29 -3
- package/esm2020/lib/services/datalib.service.mjs +1 -2
- package/fesm2015/tin-spa.mjs +46 -15
- package/fesm2015/tin-spa.mjs.map +1 -1
- package/fesm2020/tin-spa.mjs +42 -16
- package/fesm2020/tin-spa.mjs.map +1 -1
- package/lib/classes/Classes.d.ts +1 -0
- package/package.json +1 -1
package/fesm2020/tin-spa.mjs
CHANGED
|
@@ -551,7 +551,6 @@ class Core {
|
|
|
551
551
|
return `Please select ${name}`;
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
// Changed: Added regex validation for text fields - only validate if field has content
|
|
555
554
|
if (field.type == 'text' && field.regex && d && d.toString().trim() !== '') {
|
|
556
555
|
const regexPattern = new RegExp(field.regex.pattern);
|
|
557
556
|
if (!regexPattern.test(d)) {
|
|
@@ -2130,7 +2129,6 @@ class DataServiceLib {
|
|
|
2130
2129
|
ClearCache() {
|
|
2131
2130
|
this.listCache = {};
|
|
2132
2131
|
this.cacheTimestamps = {};
|
|
2133
|
-
// Added: Clear ongoing requests as well
|
|
2134
2132
|
Object.keys(this.ongoingRequests).forEach(key => {
|
|
2135
2133
|
delete this.ongoingRequests[key];
|
|
2136
2134
|
});
|
|
@@ -2529,7 +2527,6 @@ class TextComponent {
|
|
|
2529
2527
|
this.max = 9000000000000000; //Math.max
|
|
2530
2528
|
this.isHovered = false;
|
|
2531
2529
|
//validation
|
|
2532
|
-
// Changed: Updated FormControl validators to use proper validation setup
|
|
2533
2530
|
this.myControl = new FormControl('', this.getValidators());
|
|
2534
2531
|
this.control = new FormControl(this.value, this.getValidators());
|
|
2535
2532
|
}
|
|
@@ -2581,7 +2578,6 @@ class TextComponent {
|
|
|
2581
2578
|
control.updateValueAndValidity();
|
|
2582
2579
|
}
|
|
2583
2580
|
if (!this.required && !this.readonly) {
|
|
2584
|
-
// Changed: Updated to use regex.pattern instead of regex string
|
|
2585
2581
|
const regexPattern = this.regex ? this.regex.pattern : '';
|
|
2586
2582
|
control.setValidators([Validators.minLength(this.min), Validators.maxLength(this.max), Validators.pattern(regexPattern)]);
|
|
2587
2583
|
this.control.updateValueAndValidity();
|
|
@@ -2617,7 +2613,6 @@ class TextComponent {
|
|
|
2617
2613
|
}
|
|
2618
2614
|
leaved() {
|
|
2619
2615
|
this.leave.emit();
|
|
2620
|
-
// Changed: Updated to use new regex object structure for validation on blur
|
|
2621
2616
|
if (this.regex && this.value) {
|
|
2622
2617
|
const regexPattern = new RegExp(this.regex.pattern);
|
|
2623
2618
|
if (!regexPattern.test(this.value)) {
|
|
@@ -2676,7 +2671,6 @@ class TextComponent {
|
|
|
2676
2671
|
if (control.hasError('maxlength')) {
|
|
2677
2672
|
return `Maximum length is ${this.max}`;
|
|
2678
2673
|
}
|
|
2679
|
-
// Changed: Updated to use custom regex message when pattern validation fails
|
|
2680
2674
|
if (control.hasError('pattern')) {
|
|
2681
2675
|
return this.regex?.message || 'Invalid Input';
|
|
2682
2676
|
}
|
|
@@ -2809,11 +2803,11 @@ class DateComponent {
|
|
|
2809
2803
|
this.max = "9999-01-01";
|
|
2810
2804
|
this.readonly = false;
|
|
2811
2805
|
this.hint = "";
|
|
2812
|
-
this.value = Core.nowDate(true);
|
|
2806
|
+
this.value = Core.nowDate(true);
|
|
2813
2807
|
this.display = "";
|
|
2814
2808
|
this.placeholder = "";
|
|
2815
2809
|
this.width = "100%";
|
|
2816
|
-
this.valueChange = new EventEmitter();
|
|
2810
|
+
this.valueChange = new EventEmitter();
|
|
2817
2811
|
this.infoClick = new EventEmitter();
|
|
2818
2812
|
}
|
|
2819
2813
|
onInfoClick(event) {
|
|
@@ -2828,14 +2822,12 @@ class DateComponent {
|
|
|
2828
2822
|
this.updateControlState();
|
|
2829
2823
|
}
|
|
2830
2824
|
if (changes['value']) {
|
|
2831
|
-
// Changed: Set null if value is null/undefined/empty, otherwise create Date object
|
|
2832
2825
|
this.control?.setValue(this.value ? new Date(this.value) : null);
|
|
2833
2826
|
}
|
|
2834
2827
|
}
|
|
2835
2828
|
initializeDateControls() {
|
|
2836
2829
|
this.minDate = new FormControl(new Date(this.min));
|
|
2837
2830
|
this.maxDate = new FormControl(new Date(this.max));
|
|
2838
|
-
// Changed: Initialize with null if value is null/undefined/empty, otherwise create Date object
|
|
2839
2831
|
const initialValue = this.value ? new Date(this.value) : null;
|
|
2840
2832
|
this.control = new FormControl({ value: initialValue, disabled: this.readonly });
|
|
2841
2833
|
this.updateControlState();
|
|
@@ -2850,7 +2842,6 @@ class DateComponent {
|
|
|
2850
2842
|
}
|
|
2851
2843
|
}
|
|
2852
2844
|
onChangeEvent() {
|
|
2853
|
-
// Changed: Emit null when control value is null, otherwise format the date
|
|
2854
2845
|
const controlValue = this.control.value;
|
|
2855
2846
|
const formattedDate = controlValue ? Core.getFormatedDate2(controlValue, true) : null;
|
|
2856
2847
|
this.valueChange.emit(formattedDate);
|
|
@@ -4947,6 +4938,9 @@ class FormComponent {
|
|
|
4947
4938
|
}
|
|
4948
4939
|
selectChanged(field) {
|
|
4949
4940
|
this.inputChanged(field, this.data[field.name]);
|
|
4941
|
+
if (field.onSelectChange) {
|
|
4942
|
+
field.onSelectChange(this.data[field.name], this.data);
|
|
4943
|
+
}
|
|
4950
4944
|
}
|
|
4951
4945
|
inputChanged(field, value) {
|
|
4952
4946
|
this.inputChange.emit({ field: field, value: value });
|
|
@@ -5398,7 +5392,9 @@ class DetailsDialogLite {
|
|
|
5398
5392
|
}
|
|
5399
5393
|
processButtonAction(button) {
|
|
5400
5394
|
if (!button.action) {
|
|
5401
|
-
|
|
5395
|
+
if (!button.keepOpen) {
|
|
5396
|
+
this.dialogRef.close({ message: 'emit', data: this.details });
|
|
5397
|
+
}
|
|
5402
5398
|
return;
|
|
5403
5399
|
}
|
|
5404
5400
|
if (button.skipValidation || this.validateForm()) {
|
|
@@ -7004,7 +7000,9 @@ class DetailsDialogInternal {
|
|
|
7004
7000
|
}
|
|
7005
7001
|
processButtonAction(button) {
|
|
7006
7002
|
if (!button.action) {
|
|
7007
|
-
|
|
7003
|
+
if (!button.keepOpen) {
|
|
7004
|
+
this.dialogRef.close({ message: 'emit', data: this.details });
|
|
7005
|
+
}
|
|
7008
7006
|
return;
|
|
7009
7007
|
}
|
|
7010
7008
|
if (button.skipValidation || this.validateForm()) {
|
|
@@ -8092,7 +8090,9 @@ class DetailsDialog {
|
|
|
8092
8090
|
}
|
|
8093
8091
|
processButtonAction(button) {
|
|
8094
8092
|
if (!button.action) {
|
|
8095
|
-
|
|
8093
|
+
if (!button.keepOpen) {
|
|
8094
|
+
this.dialogRef.close({ message: 'emit', data: this.details });
|
|
8095
|
+
}
|
|
8096
8096
|
return;
|
|
8097
8097
|
}
|
|
8098
8098
|
if (button.skipValidation || this.validateForm()) {
|
|
@@ -11130,9 +11130,34 @@ class UsersComponent {
|
|
|
11130
11130
|
};
|
|
11131
11131
|
this.createDialog = {
|
|
11132
11132
|
formConfig: {
|
|
11133
|
-
...this.userBaseFormConfig,
|
|
11134
11133
|
title: 'User',
|
|
11135
|
-
|
|
11134
|
+
fields: [
|
|
11135
|
+
{ name: 'userName', type: 'text', alias: 'Username', required: true, span: true },
|
|
11136
|
+
{
|
|
11137
|
+
name: 'authType', type: 'select', alias: 'Authentication Type', span: true, required: true, defaultFirstValue: true,
|
|
11138
|
+
onSelectChange: (value, data) => {
|
|
11139
|
+
if (value === 'AD' && data.userName?.trim()) {
|
|
11140
|
+
this.dataService.CallApi({ url: `user/ad/${data.userName}` }).subscribe((response) => {
|
|
11141
|
+
if (response.success && response.data) {
|
|
11142
|
+
data.firstName = response.data.firstName || '';
|
|
11143
|
+
data.lastName = response.data.surname || '';
|
|
11144
|
+
data.email = response.data.emailAddress || '';
|
|
11145
|
+
this.messageService.toast('AD user found');
|
|
11146
|
+
}
|
|
11147
|
+
else {
|
|
11148
|
+
this.messageService.toast(response.message || 'AD user not found');
|
|
11149
|
+
}
|
|
11150
|
+
});
|
|
11151
|
+
}
|
|
11152
|
+
}
|
|
11153
|
+
},
|
|
11154
|
+
{ name: 'firstName', type: 'text', required: true, readonlyCondition: x => x.authType !== 'local' },
|
|
11155
|
+
{ name: 'lastName', type: 'text', required: true, readonlyCondition: x => x.authType !== 'local' },
|
|
11156
|
+
{ name: 'password', type: 'password', required: true, hiddenCondition: x => x.authType !== 'local', span: true },
|
|
11157
|
+
{ name: 'confirmPassword', type: 'password', required: true, hiddenCondition: x => x.authType !== 'local', span: true },
|
|
11158
|
+
{ name: 'email', type: 'text', required: false, span: true },
|
|
11159
|
+
{ name: 'roleID', type: 'select', alias: 'Role', required: true, span: true, defaultFirstValue: true },
|
|
11160
|
+
]
|
|
11136
11161
|
},
|
|
11137
11162
|
mode: 'create',
|
|
11138
11163
|
buttons: [
|
|
@@ -11217,6 +11242,7 @@ class UsersComponent {
|
|
|
11217
11242
|
console.log(apiResponse.data);
|
|
11218
11243
|
this.userBaseFormConfig.fields.find(x => x.name == 'roleID').options = apiResponse.data.roles;
|
|
11219
11244
|
this.userBaseFormConfig.fields.find(x => x.name == 'authType').options = apiResponse.data.authTypes;
|
|
11245
|
+
this.createDialog.formConfig.fields.find(x => x.name == 'roleID').options = apiResponse.data.roles;
|
|
11220
11246
|
this.createDialog.formConfig.fields.find(x => x.name == 'authType').options = apiResponse.data.authTypes.filter(x => x.value == 'local' || x.value == 'AD');
|
|
11221
11247
|
});
|
|
11222
11248
|
}
|