zek 19.0.16 → 19.0.20
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/fesm2022/zek.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, InjectionToken, Inject, Directive, EventEmitter, Input, Output, ViewChild, HostListener, Pipe, Component, forwardRef, NgModule, ViewEncapsulation, ChangeDetectionStrategy
|
|
2
|
+
import { Injectable, inject, InjectionToken, Inject, Directive, EventEmitter, Input, Output, ViewChild, HostListener, Pipe, Component, forwardRef, NgModule, Optional, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import { Router, NavigationStart, ActivatedRoute, RouterModule } from '@angular/router';
|
|
5
5
|
import { Subject, of, tap, catchError, firstValueFrom, interval, BehaviorSubject, timer } from 'rxjs';
|
|
@@ -20,6 +20,130 @@ var PrintType;
|
|
|
20
20
|
PrintType[PrintType["Pdf"] = 2] = "Pdf";
|
|
21
21
|
})(PrintType || (PrintType = {}));
|
|
22
22
|
|
|
23
|
+
class ObjectHelper {
|
|
24
|
+
static isDefined(value) {
|
|
25
|
+
return typeof value !== 'undefined' && value !== null;
|
|
26
|
+
}
|
|
27
|
+
static isObject(value) {
|
|
28
|
+
return this.isDefined(value) && typeof value === 'object';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if the object is a string or array before evaluating the length attribute.
|
|
32
|
+
* This avoids falsely rejecting objects that contain a custom length attribute.
|
|
33
|
+
* For example, the object {id: 1, length: 0, width: 0} should not be returned as empty.
|
|
34
|
+
*/
|
|
35
|
+
static isEmptyValue(value) {
|
|
36
|
+
return !this.isDefined(value) || ((typeof value === 'string' || Array.isArray(value)) && value.length === 0);
|
|
37
|
+
}
|
|
38
|
+
static isEmpty(obj) {
|
|
39
|
+
if (!this.isDefined(obj))
|
|
40
|
+
return true;
|
|
41
|
+
// if (typeof obj === 'undefined' || obj === null)
|
|
42
|
+
// return true;
|
|
43
|
+
for (const prop in obj) {
|
|
44
|
+
const v = obj[prop];
|
|
45
|
+
if (!this.isEmptyValue(v))
|
|
46
|
+
return false;
|
|
47
|
+
// if (typeof (obj[prop]) !== undefined && obj[prop] !== null && obj[prop] !== '') {
|
|
48
|
+
// return false;
|
|
49
|
+
// }
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated The method should not be used. please use deleteNullFields
|
|
55
|
+
*/
|
|
56
|
+
static deleteNullKeys(val) {
|
|
57
|
+
this.deleteNullFields(val);
|
|
58
|
+
}
|
|
59
|
+
static deleteNullFields(val) {
|
|
60
|
+
if (!val)
|
|
61
|
+
return;
|
|
62
|
+
for (let key in val) {
|
|
63
|
+
let tmp = val[key];
|
|
64
|
+
if (tmp === undefined || tmp === null) {
|
|
65
|
+
delete val[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return val;
|
|
69
|
+
}
|
|
70
|
+
static assignFields(target, source) {
|
|
71
|
+
let t = target;
|
|
72
|
+
let s = source;
|
|
73
|
+
for (const key of Object.keys(target)) {
|
|
74
|
+
let v = s[key];
|
|
75
|
+
if (typeof v !== 'undefined') {
|
|
76
|
+
t[key] = v;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return target;
|
|
80
|
+
}
|
|
81
|
+
static deepCopy(value) {
|
|
82
|
+
// 1. Guard clause: if value is null or not an object, return it.
|
|
83
|
+
// (This handles primitives and breaks recursion)
|
|
84
|
+
if (!this.isObject(value))
|
|
85
|
+
return value;
|
|
86
|
+
// 2. Handle Arrays
|
|
87
|
+
if (Array.isArray(value)) {
|
|
88
|
+
return value.map(x => this.deepCopy(x));
|
|
89
|
+
}
|
|
90
|
+
// 3. Handle Objects
|
|
91
|
+
const output = {};
|
|
92
|
+
for (const key of Object.keys(value)) {
|
|
93
|
+
const v = value[key];
|
|
94
|
+
if (this.isObject(v)) {
|
|
95
|
+
output[key] = this.deepCopy(v);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
Object.assign(output, { [key]: v });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return output;
|
|
102
|
+
}
|
|
103
|
+
static deepEquals(a, b) {
|
|
104
|
+
// 1. Strict equality for primitives
|
|
105
|
+
if (a === b)
|
|
106
|
+
return true;
|
|
107
|
+
// 2. If one is null/undefined or types differ → not equal
|
|
108
|
+
if (a == null || b == null || typeof a !== typeof b)
|
|
109
|
+
return false;
|
|
110
|
+
// 3. Date comparison
|
|
111
|
+
if (a instanceof Date && b instanceof Date) {
|
|
112
|
+
return a.getTime() === b.getTime();
|
|
113
|
+
}
|
|
114
|
+
// 4. Arrays
|
|
115
|
+
if (Array.isArray(a)) {
|
|
116
|
+
if (!Array.isArray(b))
|
|
117
|
+
return false;
|
|
118
|
+
if (a.length !== b.length)
|
|
119
|
+
return false;
|
|
120
|
+
for (let i = 0; i < a.length; i++) {
|
|
121
|
+
if (!this.deepEquals(a[i], b[i]))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
// 5. Objects
|
|
127
|
+
if (this.isObject(a)) {
|
|
128
|
+
if (!this.isObject(b))
|
|
129
|
+
return false;
|
|
130
|
+
const keysA = Object.keys(a);
|
|
131
|
+
const keysB = Object.keys(b);
|
|
132
|
+
if (keysA.length !== keysB.length)
|
|
133
|
+
return false;
|
|
134
|
+
for (const key of keysA) {
|
|
135
|
+
if (!keysB.includes(key))
|
|
136
|
+
return false;
|
|
137
|
+
if (!this.deepEquals(a[key], b[key]))
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
// 6. Fallback
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
23
147
|
// import { KeyPair } from "../models/key-pair.model";
|
|
24
148
|
// import { Tree } from "../models/tree.model";
|
|
25
149
|
class ArrayHelper {
|
|
@@ -114,11 +238,37 @@ class ArrayHelper {
|
|
|
114
238
|
}
|
|
115
239
|
return result;
|
|
116
240
|
}
|
|
117
|
-
static
|
|
241
|
+
static filterByKeyString(filterValue, key, array) {
|
|
118
242
|
if (typeof filterValue === 'undefined' || filterValue == null || (typeof key === 'string' && key.length === 0))
|
|
119
243
|
return array;
|
|
120
244
|
return array.filter(x => x !== undefined && x !== null && x[key] === filterValue);
|
|
121
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Filters an array based on whether the value derived by the keySelector
|
|
248
|
+
* equals the filterValue.
|
|
249
|
+
* @param filterValue The value to match.
|
|
250
|
+
* @param keySelector A function that takes an item of type T and returns the key value of type K.
|
|
251
|
+
* @param array The array of items to filter.
|
|
252
|
+
* @returns A new array containing only the items that match the filter criteria.
|
|
253
|
+
*/
|
|
254
|
+
static filterByKey(filterValue, keySelector, array) {
|
|
255
|
+
// 1. Handle edge cases: if filterValue is undefined or null, or the array is null/empty,
|
|
256
|
+
// return the array or an empty array, respectively.
|
|
257
|
+
if (typeof filterValue === 'undefined' || filterValue === null || !array) {
|
|
258
|
+
return array || [];
|
|
259
|
+
}
|
|
260
|
+
// 2. Filter the array using the keySelector for comparison
|
|
261
|
+
return array.filter((item) => {
|
|
262
|
+
// Ensure the item itself is not undefined or null before trying to get its key
|
|
263
|
+
if (!ObjectHelper.isDefined(item)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
// Get the specific key value for the current item
|
|
267
|
+
const itemKey = keySelector(item);
|
|
268
|
+
// Return true if the item's key value strictly equals the filterValue
|
|
269
|
+
return itemKey === filterValue;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
122
272
|
static flatten(array, indent = 0) {
|
|
123
273
|
let result = [];
|
|
124
274
|
if (!Array.isArray(array)) {
|
|
@@ -996,130 +1146,6 @@ class FileHelper {
|
|
|
996
1146
|
}
|
|
997
1147
|
}
|
|
998
1148
|
|
|
999
|
-
class ObjectHelper {
|
|
1000
|
-
static isDefined(value) {
|
|
1001
|
-
return typeof value !== 'undefined' && value !== null;
|
|
1002
|
-
}
|
|
1003
|
-
static isObject(value) {
|
|
1004
|
-
return this.isDefined(value) && typeof value === 'object';
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Check if the object is a string or array before evaluating the length attribute.
|
|
1008
|
-
* This avoids falsely rejecting objects that contain a custom length attribute.
|
|
1009
|
-
* For example, the object {id: 1, length: 0, width: 0} should not be returned as empty.
|
|
1010
|
-
*/
|
|
1011
|
-
static isEmptyValue(value) {
|
|
1012
|
-
return !this.isDefined(value) || ((typeof value === 'string' || Array.isArray(value)) && value.length === 0);
|
|
1013
|
-
}
|
|
1014
|
-
static isEmpty(obj) {
|
|
1015
|
-
if (!this.isDefined(obj))
|
|
1016
|
-
return true;
|
|
1017
|
-
// if (typeof obj === 'undefined' || obj === null)
|
|
1018
|
-
// return true;
|
|
1019
|
-
for (const prop in obj) {
|
|
1020
|
-
const v = obj[prop];
|
|
1021
|
-
if (!this.isEmptyValue(v))
|
|
1022
|
-
return false;
|
|
1023
|
-
// if (typeof (obj[prop]) !== undefined && obj[prop] !== null && obj[prop] !== '') {
|
|
1024
|
-
// return false;
|
|
1025
|
-
// }
|
|
1026
|
-
}
|
|
1027
|
-
return true;
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* @deprecated The method should not be used. please use deleteNullFields
|
|
1031
|
-
*/
|
|
1032
|
-
static deleteNullKeys(val) {
|
|
1033
|
-
this.deleteNullFields(val);
|
|
1034
|
-
}
|
|
1035
|
-
static deleteNullFields(val) {
|
|
1036
|
-
if (!val)
|
|
1037
|
-
return;
|
|
1038
|
-
for (let key in val) {
|
|
1039
|
-
let tmp = val[key];
|
|
1040
|
-
if (tmp === undefined || tmp === null) {
|
|
1041
|
-
delete val[key];
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
return val;
|
|
1045
|
-
}
|
|
1046
|
-
static assignFields(target, source) {
|
|
1047
|
-
let t = target;
|
|
1048
|
-
let s = source;
|
|
1049
|
-
for (const key of Object.keys(target)) {
|
|
1050
|
-
let v = s[key];
|
|
1051
|
-
if (typeof v !== 'undefined') {
|
|
1052
|
-
t[key] = v;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
return target;
|
|
1056
|
-
}
|
|
1057
|
-
static deepCopy(value) {
|
|
1058
|
-
// 1. Guard clause: if value is null or not an object, return it.
|
|
1059
|
-
// (This handles primitives and breaks recursion)
|
|
1060
|
-
if (!this.isObject(value))
|
|
1061
|
-
return value;
|
|
1062
|
-
// 2. Handle Arrays
|
|
1063
|
-
if (Array.isArray(value)) {
|
|
1064
|
-
return value.map(x => this.deepCopy(x));
|
|
1065
|
-
}
|
|
1066
|
-
// 3. Handle Objects
|
|
1067
|
-
const output = {};
|
|
1068
|
-
for (const key of Object.keys(value)) {
|
|
1069
|
-
const v = value[key];
|
|
1070
|
-
if (this.isObject(v)) {
|
|
1071
|
-
output[key] = this.deepCopy(v);
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
Object.assign(output, { [key]: v });
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
return output;
|
|
1078
|
-
}
|
|
1079
|
-
static deepEquals(a, b) {
|
|
1080
|
-
// 1. Strict equality for primitives
|
|
1081
|
-
if (a === b)
|
|
1082
|
-
return true;
|
|
1083
|
-
// 2. If one is null/undefined or types differ → not equal
|
|
1084
|
-
if (a == null || b == null || typeof a !== typeof b)
|
|
1085
|
-
return false;
|
|
1086
|
-
// 3. Date comparison
|
|
1087
|
-
if (a instanceof Date && b instanceof Date) {
|
|
1088
|
-
return a.getTime() === b.getTime();
|
|
1089
|
-
}
|
|
1090
|
-
// 4. Arrays
|
|
1091
|
-
if (Array.isArray(a)) {
|
|
1092
|
-
if (!Array.isArray(b))
|
|
1093
|
-
return false;
|
|
1094
|
-
if (a.length !== b.length)
|
|
1095
|
-
return false;
|
|
1096
|
-
for (let i = 0; i < a.length; i++) {
|
|
1097
|
-
if (!this.deepEquals(a[i], b[i]))
|
|
1098
|
-
return false;
|
|
1099
|
-
}
|
|
1100
|
-
return true;
|
|
1101
|
-
}
|
|
1102
|
-
// 5. Objects
|
|
1103
|
-
if (this.isObject(a)) {
|
|
1104
|
-
if (!this.isObject(b))
|
|
1105
|
-
return false;
|
|
1106
|
-
const keysA = Object.keys(a);
|
|
1107
|
-
const keysB = Object.keys(b);
|
|
1108
|
-
if (keysA.length !== keysB.length)
|
|
1109
|
-
return false;
|
|
1110
|
-
for (const key of keysA) {
|
|
1111
|
-
if (!keysB.includes(key))
|
|
1112
|
-
return false;
|
|
1113
|
-
if (!this.deepEquals(a[key], b[key]))
|
|
1114
|
-
return false;
|
|
1115
|
-
}
|
|
1116
|
-
return true;
|
|
1117
|
-
}
|
|
1118
|
-
// 6. Fallback
|
|
1119
|
-
return false;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
1149
|
class FilterHelper {
|
|
1124
1150
|
static isEmpty(obj) {
|
|
1125
1151
|
if (typeof obj === 'undefined' || obj === null)
|
|
@@ -2647,8 +2673,9 @@ class EditFormComponent extends BaseComponent {
|
|
|
2647
2673
|
this.model = await this.getModel();
|
|
2648
2674
|
}
|
|
2649
2675
|
else {
|
|
2650
|
-
this.initCreate();
|
|
2676
|
+
await this.initCreate();
|
|
2651
2677
|
}
|
|
2678
|
+
this.onBindModelCompleted();
|
|
2652
2679
|
}
|
|
2653
2680
|
initCreate() {
|
|
2654
2681
|
this.model = {};
|
|
@@ -3052,6 +3079,7 @@ class ListBaseComponent extends BaseComponent {
|
|
|
3052
3079
|
const tmp = StorageHelper.get('filter');
|
|
3053
3080
|
if (tmp && tmp.url && tmp.url === this.url && tmp.filter) {
|
|
3054
3081
|
this.filter = Object.assign({}, tmp.filter);
|
|
3082
|
+
//this.filter = { ...tmp.filter };
|
|
3055
3083
|
//we dont need this.assignFilter(); because after initStoredFilter(); will be assigned.
|
|
3056
3084
|
}
|
|
3057
3085
|
else {
|
|
@@ -4269,7 +4297,7 @@ class DateValueAccessor {
|
|
|
4269
4297
|
}
|
|
4270
4298
|
}
|
|
4271
4299
|
isReadOnly() {
|
|
4272
|
-
return this.el.nativeElement.disabled || this.el.nativeElement.readOnly;
|
|
4300
|
+
return this.el.nativeElement.disabled || this.el.nativeElement.readonly || this.el.nativeElement.readOnly;
|
|
4273
4301
|
}
|
|
4274
4302
|
//write from model to el.nativeElement
|
|
4275
4303
|
writeValue(value) {
|
|
@@ -4696,6 +4724,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
4696
4724
|
class ZekFileInput extends CoreUiComponent {
|
|
4697
4725
|
// @Input() model!: string[] | null;
|
|
4698
4726
|
onUpload = new EventEmitter();
|
|
4727
|
+
fileInput;
|
|
4699
4728
|
fileService = inject(FileService);
|
|
4700
4729
|
_uniqueId = `zek-file-input-${this.uniqueId}`;
|
|
4701
4730
|
/** The unique ID for the tag. */
|
|
@@ -4720,7 +4749,6 @@ class ZekFileInput extends CoreUiComponent {
|
|
|
4720
4749
|
set multiple(v) {
|
|
4721
4750
|
this._multiple = Convert.toBooleanProperty(v);
|
|
4722
4751
|
}
|
|
4723
|
-
// files: File[] | null = null;
|
|
4724
4752
|
clickInput() {
|
|
4725
4753
|
const el = document.getElementById(this.inputId);
|
|
4726
4754
|
if (el) {
|
|
@@ -4743,9 +4771,11 @@ class ZekFileInput extends CoreUiComponent {
|
|
|
4743
4771
|
this.onUpload.emit(data.value);
|
|
4744
4772
|
}
|
|
4745
4773
|
});
|
|
4774
|
+
if (this.fileInput)
|
|
4775
|
+
this.fileInput.nativeElement.value = '';
|
|
4746
4776
|
}
|
|
4747
4777
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekFileInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4748
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekFileInput, isStandalone: true, selector: "zek-file-input", inputs: { id: "id", accept: "accept", multiple: "multiple" }, outputs: { onUpload: "onUpload" }, host: { properties: { "attr.id": "id" } }, providers: [FileService], usesInheritance: true, ngImport: i0, template: "<input type=\"file\" class=\"form-control\"\r\n name=\"{{inputId}}\"\r\n id=\"{{inputId}}\"\r\n [multiple]=\"multiple\" [accept]=\"accept\" [required]=\"required\" [disabled]=\"readonly\"\r\n #fileInput\r\n (change)=\"onFileInputChange($event)\" />", styles: [":host input[type=file]{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }] });
|
|
4778
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekFileInput, isStandalone: true, selector: "zek-file-input", inputs: { id: "id", accept: "accept", multiple: "multiple" }, outputs: { onUpload: "onUpload" }, host: { properties: { "attr.id": "id" } }, providers: [FileService], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<input type=\"file\" class=\"form-control\"\r\n name=\"{{inputId}}\"\r\n id=\"{{inputId}}\"\r\n [multiple]=\"multiple\" [accept]=\"accept\" [required]=\"required\" [disabled]=\"readonly\"\r\n #fileInput\r\n (change)=\"onFileInputChange($event)\" />", styles: [":host input[type=file]{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }] });
|
|
4749
4779
|
}
|
|
4750
4780
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekFileInput, decorators: [{
|
|
4751
4781
|
type: Component,
|
|
@@ -4754,6 +4784,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
4754
4784
|
}, template: "<input type=\"file\" class=\"form-control\"\r\n name=\"{{inputId}}\"\r\n id=\"{{inputId}}\"\r\n [multiple]=\"multiple\" [accept]=\"accept\" [required]=\"required\" [disabled]=\"readonly\"\r\n #fileInput\r\n (change)=\"onFileInputChange($event)\" />", styles: [":host input[type=file]{display:none}\n"] }]
|
|
4755
4785
|
}], propDecorators: { onUpload: [{
|
|
4756
4786
|
type: Output
|
|
4787
|
+
}], fileInput: [{
|
|
4788
|
+
type: ViewChild,
|
|
4789
|
+
args: ['fileInput']
|
|
4757
4790
|
}], id: [{
|
|
4758
4791
|
type: Input
|
|
4759
4792
|
}], accept: [{
|
|
@@ -6016,22 +6049,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
6016
6049
|
}] } });
|
|
6017
6050
|
|
|
6018
6051
|
class ZekFieldValidator {
|
|
6052
|
+
parentForm;
|
|
6053
|
+
parentFormGroup;
|
|
6019
6054
|
field;
|
|
6055
|
+
_log = false;
|
|
6056
|
+
get log() {
|
|
6057
|
+
return this._log;
|
|
6058
|
+
}
|
|
6059
|
+
set log(value) {
|
|
6060
|
+
const v = Convert.toBooleanProperty(value);
|
|
6061
|
+
if (this._log !== v) {
|
|
6062
|
+
this._log = v;
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
constructor(parentForm, parentFormGroup) {
|
|
6066
|
+
this.parentForm = parentForm;
|
|
6067
|
+
this.parentFormGroup = parentFormGroup;
|
|
6068
|
+
}
|
|
6020
6069
|
get hasErrors() {
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6070
|
+
if (!this.field)
|
|
6071
|
+
return false;
|
|
6072
|
+
const errors = this.field.errors;
|
|
6073
|
+
const invalid = this.field.invalid;
|
|
6074
|
+
// Check for specific error object existence
|
|
6075
|
+
if (!invalid || !errors)
|
|
6076
|
+
return false;
|
|
6077
|
+
// 1. Check if field is touched or dirty
|
|
6078
|
+
const isInteract = this.field.dirty || this.field.touched;
|
|
6079
|
+
// 2. Check if parent form is submitted (Works for both Reactive and Template)
|
|
6080
|
+
const isSubmitted = (this.parentForm && this.parentForm.submitted) ||
|
|
6081
|
+
(this.parentFormGroup && this.parentFormGroup.submitted) ||
|
|
6082
|
+
(this.field.formDirective && this.field.formDirective.submitted);
|
|
6083
|
+
return isInteract || isSubmitted;
|
|
6025
6084
|
}
|
|
6026
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekFieldValidator, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6027
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekFieldValidator, isStandalone: true, selector: "zek-field-validator, [zek-field-validator]", inputs: { field: "field" }, host: { properties: { "class.invalid-tooltip": "hasErrors" } }, ngImport: i0, template: "<ng-container *ngIf=\"hasErrors\">\r\n <ng-container *
|
|
6085
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekFieldValidator, deps: [{ token: i2$1.NgForm, optional: true }, { token: i2$1.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
6086
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekFieldValidator, isStandalone: true, selector: "zek-field-validator, [zek-field-validator]", inputs: { field: "field", log: "log" }, host: { properties: { "class.invalid-tooltip": "hasErrors" } }, ngImport: i0, template: "<ng-container *ngIf=\"hasErrors\" [ngSwitch]=\"true\">\r\n\r\n <ng-container *ngSwitchCase=\"field.errors.required\">\r\n {{ 'Validation.Required' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.minlength\">\r\n {{ 'Validation.MinLengthFormat' | translate:{ value: field.errors.minlength.requiredLength } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.maxlength\">\r\n {{ 'Validation.MaxLengthFormat' | translate:{ value: field.errors.maxlength.requiredLength } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.min\">\r\n {{ 'Validation.Min' | translate:{ value: field.errors.min.min } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.max\">\r\n {{ 'Validation.Max' | translate:{ value: field.errors.max.max } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.email\">\r\n {{ 'Validation.Pattern' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.pattern\">\r\n {{ 'Validation.Pattern' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.mismatch\">\r\n {{ 'Validation.Mismatch' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.server\">\r\n {{ field.errors.server }}\r\n </ng-container>\r\n\r\n</ng-container>\r\n\r\n<div *ngIf=\"log\" class=\"bg-dark text-light p-2 mt-2 rounded small\">\r\n <strong>Debug:</strong>\r\n <pre class=\"text-light m-0\">{{ field?.errors | json }}</pre>\r\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "pipe", type: i1$2.JsonPipe, name: "json" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
6028
6087
|
}
|
|
6029
6088
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekFieldValidator, decorators: [{
|
|
6030
6089
|
type: Component,
|
|
6031
6090
|
args: [{ standalone: true, selector: 'zek-field-validator, [zek-field-validator]', host: {
|
|
6032
6091
|
'[class.invalid-tooltip]': 'hasErrors'
|
|
6033
|
-
}, imports: [CommonModule, TranslateModule], template: "<ng-container *ngIf=\"hasErrors\">\r\n <ng-container *
|
|
6034
|
-
}],
|
|
6092
|
+
}, imports: [CommonModule, TranslateModule], template: "<ng-container *ngIf=\"hasErrors\" [ngSwitch]=\"true\">\r\n\r\n <ng-container *ngSwitchCase=\"field.errors.required\">\r\n {{ 'Validation.Required' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.minlength\">\r\n {{ 'Validation.MinLengthFormat' | translate:{ value: field.errors.minlength.requiredLength } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.maxlength\">\r\n {{ 'Validation.MaxLengthFormat' | translate:{ value: field.errors.maxlength.requiredLength } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.min\">\r\n {{ 'Validation.Min' | translate:{ value: field.errors.min.min } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.max\">\r\n {{ 'Validation.Max' | translate:{ value: field.errors.max.max } }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.email\">\r\n {{ 'Validation.Pattern' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.pattern\">\r\n {{ 'Validation.Pattern' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.mismatch\">\r\n {{ 'Validation.Mismatch' | translate }}\r\n </ng-container>\r\n\r\n <ng-container *ngSwitchCase=\"!!field.errors.server\">\r\n {{ field.errors.server }}\r\n </ng-container>\r\n\r\n</ng-container>\r\n\r\n<div *ngIf=\"log\" class=\"bg-dark text-light p-2 mt-2 rounded small\">\r\n <strong>Debug:</strong>\r\n <pre class=\"text-light m-0\">{{ field?.errors | json }}</pre>\r\n</div>" }]
|
|
6093
|
+
}], ctorParameters: () => [{ type: i2$1.NgForm, decorators: [{
|
|
6094
|
+
type: Optional
|
|
6095
|
+
}] }, { type: i2$1.FormGroupDirective, decorators: [{
|
|
6096
|
+
type: Optional
|
|
6097
|
+
}] }], propDecorators: { field: [{
|
|
6098
|
+
type: Input
|
|
6099
|
+
}], log: [{
|
|
6035
6100
|
type: Input
|
|
6036
6101
|
}] } });
|
|
6037
6102
|
|
|
@@ -6056,7 +6121,7 @@ class ZekPassword {
|
|
|
6056
6121
|
this._type = this._type === 'password' ? 'text' : 'password';
|
|
6057
6122
|
}
|
|
6058
6123
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekPassword, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6059
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekPassword, isStandalone: true, selector: "zek-password", inputs: { name: "name", required: "required", minlength: "minlength", maxlength: "maxlength", model: "model" }, outputs: { onChange: "modelChange" }, ngImport: i0, template: "<div class=\"input-group has-validation\">\r\n <input type=\"{{type}}\" class=\"form-control\" name=\"{{name}}\" id=\"{{name}}\" [attr.aria-describedby]=\"name+'-show'\"\r\n [required]=\"required\" [minlength]=\"minlength\" [maxlength]=\"maxlength\"\r\n [ngModel]=\"model\" (ngModelChange)=\"onChange.emit($event)\"\r\n #password=\"ngModel\"\r\n >\r\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"{{name}}-show\" (click)=\"showHide()\"><i class=\"fa-solid fa-eye\"></i></button>\r\n <div zek-field-validator [field]=\"password\"></div>\r\n</div>", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZekFieldValidator, selector: "zek-field-validator, [zek-field-validator]", inputs: ["field"] }] });
|
|
6124
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekPassword, isStandalone: true, selector: "zek-password", inputs: { name: "name", required: "required", minlength: "minlength", maxlength: "maxlength", model: "model" }, outputs: { onChange: "modelChange" }, ngImport: i0, template: "<div class=\"input-group has-validation\">\r\n <input type=\"{{type}}\" class=\"form-control\" name=\"{{name}}\" id=\"{{name}}\" [attr.aria-describedby]=\"name+'-show'\"\r\n [required]=\"required\" [minlength]=\"minlength\" [maxlength]=\"maxlength\"\r\n [ngModel]=\"model\" (ngModelChange)=\"onChange.emit($event)\"\r\n #password=\"ngModel\"\r\n >\r\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"{{name}}-show\" (click)=\"showHide()\"><i class=\"fa-solid fa-eye\"></i></button>\r\n <div zek-field-validator [field]=\"password\"></div>\r\n</div>", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZekFieldValidator, selector: "zek-field-validator, [zek-field-validator]", inputs: ["field", "log"] }] });
|
|
6060
6125
|
}
|
|
6061
6126
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekPassword, decorators: [{
|
|
6062
6127
|
type: Component,
|
|
@@ -6590,7 +6655,7 @@ class ZekSelectMultiple extends CoreUiComponent {
|
|
|
6590
6655
|
let notUnique = [];
|
|
6591
6656
|
if (this.valueField) {
|
|
6592
6657
|
for (const currentValue of value) {
|
|
6593
|
-
const items = ArrayHelper.
|
|
6658
|
+
const items = ArrayHelper.filterByKeyString(currentValue, this.valueField, this._data);
|
|
6594
6659
|
notUnique = notUnique.concat(items);
|
|
6595
6660
|
}
|
|
6596
6661
|
}
|
|
@@ -6606,7 +6671,7 @@ class ZekSelectMultiple extends CoreUiComponent {
|
|
|
6606
6671
|
else {
|
|
6607
6672
|
if (Array.isArray(this._data)) {
|
|
6608
6673
|
if (this.valueField) {
|
|
6609
|
-
this._selected = ArrayHelper.
|
|
6674
|
+
this._selected = ArrayHelper.filterByKeyString(value, this.valueField, this._data);
|
|
6610
6675
|
}
|
|
6611
6676
|
else {
|
|
6612
6677
|
this._selected = this._data.filter(x => x === value);
|