ng-ipa-library 2.0.1 → 3.0.0
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 → esm2022}/lib/core/components/loading/loading.component.mjs +37 -37
- package/{esm2020 → esm2022}/lib/core/interceptors/error.interceptor.mjs +46 -46
- package/{esm2020 → esm2022}/lib/core/interceptors/loading.interceptor.mjs +58 -58
- package/{esm2020 → esm2022}/lib/core/interceptors/myIPAToken.interceptor.mjs +25 -25
- package/{esm2020 → esm2022}/lib/core/interceptors/token.interceptor.mjs +81 -81
- package/{esm2020 → esm2022}/lib/core/services/auth.service.mjs +62 -62
- package/{esm2020 → esm2022}/lib/core/services/error.service.mjs +55 -55
- package/{esm2020 → esm2022}/lib/core/services/loader.service.mjs +24 -24
- package/{esm2020 → esm2022}/lib/core/services/token.service.mjs +22 -22
- package/{esm2020 → esm2022}/lib/generate-form/generate-form.component.mjs +153 -153
- package/{esm2020 → esm2022}/lib/ipa-form/datepicker/datepicker.component.mjs +88 -88
- package/{esm2020 → esm2022}/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.mjs +27 -27
- package/{esm2020 → esm2022}/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.mjs +38 -38
- package/{esm2020 → esm2022}/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.mjs +38 -38
- package/{esm2020 → esm2022}/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.mjs +27 -27
- package/{esm2020 → esm2022}/lib/ipa-form/dropdown-input/dropdown-input.component.mjs +84 -84
- package/{esm2020 → esm2022}/lib/ipa-form/file-upload/file-upload.component.mjs +142 -142
- package/{esm2020 → esm2022}/lib/ipa-form/ipa-form.service.mjs +290 -290
- package/{esm2020 → esm2022}/lib/ipa-form/recaptcha/recaptcha.component.mjs +55 -55
- package/{esm2020 → esm2022}/lib/ipa-form/text-input/text-input.component.mjs +93 -93
- package/{esm2020 → esm2022}/lib/ipa-form/textarea-input/textarea-input.component.mjs +76 -76
- package/{esm2020 → esm2022}/lib/models/apiException.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/apiResponse.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/breadcrumbs.model.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/decodedToken.model.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/exceptionUrl.model.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/generateForm.model.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/pagedResult.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/user.model.mjs +1 -1
- package/{esm2020 → esm2022}/lib/ng-ipa-library.module.mjs +107 -107
- package/{esm2020 → esm2022}/lib/pipes/hijri-date.pipe.mjs +18 -18
- package/{esm2020 → esm2022}/lib/pipes/pipes.module.mjs +16 -16
- package/{esm2020 → esm2022}/lib/services/breadcrumbs.service.mjs +149 -149
- package/{esm2020 → esm2022}/lib/services/common.service.mjs +51 -51
- package/{esm2020 → esm2022}/lib/share-button/share-button.component.mjs +35 -35
- package/{esm2020 → esm2022}/lib/share-button/share-button.module.mjs +50 -50
- package/{esm2020 → esm2022}/ng-ipa-library.mjs +4 -4
- package/{esm2020 → esm2022}/public-api.mjs +41 -41
- package/{fesm2020 → fesm2022}/ng-ipa-library.mjs +1739 -1739
- package/fesm2022/ng-ipa-library.mjs.map +1 -0
- package/index.d.ts +5 -5
- package/lib/core/components/loading/loading.component.d.ts +13 -13
- package/lib/core/interceptors/error.interceptor.d.ts +12 -12
- package/lib/core/interceptors/loading.interceptor.d.ts +14 -14
- package/lib/core/interceptors/myIPAToken.interceptor.d.ts +11 -11
- package/lib/core/interceptors/token.interceptor.d.ts +19 -19
- package/lib/core/services/auth.service.d.ts +18 -18
- package/lib/core/services/error.service.d.ts +19 -19
- package/lib/core/services/loader.service.d.ts +12 -12
- package/lib/core/services/token.service.d.ts +10 -10
- package/lib/generate-form/generate-form.component.d.ts +34 -34
- package/lib/ipa-form/datepicker/datepicker.component.d.ts +37 -37
- package/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.d.ts +7 -7
- package/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.d.ts +11 -11
- package/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.d.ts +11 -11
- package/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.d.ts +7 -7
- package/lib/ipa-form/dropdown-input/dropdown-input.component.d.ts +34 -34
- package/lib/ipa-form/file-upload/file-upload.component.d.ts +40 -40
- package/lib/ipa-form/ipa-form.service.d.ts +51 -51
- package/lib/ipa-form/recaptcha/recaptcha.component.d.ts +22 -22
- package/lib/ipa-form/text-input/text-input.component.d.ts +35 -35
- package/lib/ipa-form/textarea-input/textarea-input.component.d.ts +32 -32
- package/lib/models/apiException.d.ts +5 -5
- package/lib/models/apiResponse.d.ts +5 -5
- package/lib/models/breadcrumbs.model.d.ts +4 -4
- package/lib/models/decodedToken.model.d.ts +6 -6
- package/lib/models/exceptionUrl.model.d.ts +4 -4
- package/lib/models/generateForm.model.d.ts +31 -31
- package/lib/models/pagedResult.d.ts +4 -4
- package/lib/models/user.model.d.ts +7 -7
- package/lib/ng-ipa-library.module.d.ts +25 -25
- package/lib/pipes/hijri-date.pipe.d.ts +7 -7
- package/lib/pipes/pipes.module.d.ts +7 -7
- package/lib/services/breadcrumbs.service.d.ts +18 -18
- package/lib/services/common.service.d.ts +11 -11
- package/lib/share-button/share-button.component.d.ts +11 -11
- package/lib/share-button/share-button.module.d.ts +13 -13
- package/package.json +12 -18
- package/public-api.d.ts +31 -31
- package/fesm2015/ng-ipa-library.mjs +0 -1867
- package/fesm2015/ng-ipa-library.mjs.map +0 -1
- package/fesm2020/ng-ipa-library.mjs.map +0 -1
|
@@ -30,1349 +30,1349 @@ import * as i2$4 from '@angular/common/http';
|
|
|
30
30
|
import { HttpResponse } from '@angular/common/http';
|
|
31
31
|
import { catchError } from 'rxjs/operators';
|
|
32
32
|
|
|
33
|
-
class HijriDatePipe {
|
|
34
|
-
transform(date, format = 'iYYYY-iMM-iDD', lang = 'en') {
|
|
35
|
-
momentHijri.locale(lang);
|
|
36
|
-
return momentHijri(date).format(format);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
42
|
-
type: Pipe,
|
|
43
|
-
args: [{
|
|
44
|
-
name: 'hijriDate',
|
|
45
|
-
}]
|
|
33
|
+
class HijriDatePipe {
|
|
34
|
+
transform(date, format = 'iYYYY-iMM-iDD', lang = 'en') {
|
|
35
|
+
momentHijri.locale(lang);
|
|
36
|
+
return momentHijri(date).format(format);
|
|
37
|
+
}
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: HijriDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
39
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: HijriDatePipe, name: "hijriDate" }); }
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: HijriDatePipe, decorators: [{
|
|
42
|
+
type: Pipe,
|
|
43
|
+
args: [{
|
|
44
|
+
name: 'hijriDate',
|
|
45
|
+
}]
|
|
46
46
|
}] });
|
|
47
47
|
|
|
48
|
-
class PipesModule {
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
54
|
-
type: NgModule,
|
|
55
|
-
args: [{
|
|
56
|
-
declarations: [HijriDatePipe],
|
|
57
|
-
exports: [HijriDatePipe],
|
|
58
|
-
}]
|
|
48
|
+
class PipesModule {
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
50
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: PipesModule, declarations: [HijriDatePipe], exports: [HijriDatePipe] }); }
|
|
51
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PipesModule }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PipesModule, decorators: [{
|
|
54
|
+
type: NgModule,
|
|
55
|
+
args: [{
|
|
56
|
+
declarations: [HijriDatePipe],
|
|
57
|
+
exports: [HijriDatePipe],
|
|
58
|
+
}]
|
|
59
59
|
}] });
|
|
60
60
|
|
|
61
|
-
class IPAFormService {
|
|
62
|
-
constructor(parserFormatter) {
|
|
63
|
-
this.parserFormatter = parserFormatter;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* check link is valid.
|
|
67
|
-
*/
|
|
68
|
-
static linkValidation(control) {
|
|
69
|
-
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?)$/.test(control.value);
|
|
70
|
-
return isValidLink || !control.value ? null : { link: true };
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* check mp4 link is valid.
|
|
74
|
-
*/
|
|
75
|
-
static mp4LinkValidation(control) {
|
|
76
|
-
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?(\/[\w\u0600-\u06FF]+\.mp4))$/.test(control.value);
|
|
77
|
-
return isValidLink || !control.value ? null : { linkMP4: true };
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* check mobile number is valid.
|
|
81
|
-
*/
|
|
82
|
-
static mobileNo(control) {
|
|
83
|
-
const isValidLink = /^05\d{8}$/.test(control.value);
|
|
84
|
-
return isValidLink || !control.value ? null : { mobileNo: true };
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* check email is valid.
|
|
88
|
-
*/
|
|
89
|
-
static email(control) {
|
|
90
|
-
const isValidLink = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test(control.value);
|
|
91
|
-
return isValidLink || !control.value ? null : { Email: true };
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* check national ID or iqama ID is valid.
|
|
95
|
-
*/
|
|
96
|
-
static checkID(control) {
|
|
97
|
-
let isValid = false;
|
|
98
|
-
const value = control.value;
|
|
99
|
-
if (IPAFormService.nationalIdValidate(value) ||
|
|
100
|
-
IPAFormService.iqamaIdValidate(value)) {
|
|
101
|
-
isValid = true;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
isValid = false;
|
|
105
|
-
}
|
|
106
|
-
return isValid || !value ? null : { checkId: true };
|
|
107
|
-
}
|
|
108
|
-
static validHijriDate(control) {
|
|
109
|
-
const date = control.value;
|
|
110
|
-
const isValid = IPAFormService.checkHijriDateValid(date);
|
|
111
|
-
return isValid || !date
|
|
112
|
-
? null
|
|
113
|
-
: {
|
|
114
|
-
ngbDate: {
|
|
115
|
-
invalid: date?.year +
|
|
116
|
-
'-' +
|
|
117
|
-
(date?.month > 10 ? date?.month : '0' + date?.month) +
|
|
118
|
-
'-' +
|
|
119
|
-
(date?.day > 10 ? date?.day : '0' + date?.day),
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
getErrorMessage(control, patternErrorMsg = '', isArabic) {
|
|
124
|
-
for (const propertyName in control?.errors) {
|
|
125
|
-
if (control?.errors.hasOwnProperty(propertyName) &&
|
|
126
|
-
(control.touched || control.dirty)) {
|
|
127
|
-
return this.getValidatorErrorMessage(propertyName, control.errors[propertyName], patternErrorMsg, isArabic);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* convert gregorian date to hijri date (Based on Umm al-Qura calculations).
|
|
134
|
-
* @param date: gregorian date
|
|
135
|
-
* @param format: iDD => day: ١٥, iMM => month: ٠٤, iMMM => month: ربيع ٢,
|
|
136
|
-
* iMMMM => ربيع الثاني, iYY => year: ٤٢, iYYYY => year: ١٤٤٢,
|
|
137
|
-
* dd => ن, ddd => إثنين, dddd => الإثنين
|
|
138
|
-
* @example 'iYYYY/iM/iDهـ الموافق YYYY/M/Dم'
|
|
139
|
-
* '١٤٤٢/٠٤/١٥هـ الموافق ٢٠٢٠/١١/٣٠'
|
|
140
|
-
*/
|
|
141
|
-
convertToHijriDate(date, format = 'iYYYY-iMM-iDD', lang = 'ar-SA') {
|
|
142
|
-
momentHijri.locale(lang);
|
|
143
|
-
return momentHijri(date).format(format);
|
|
144
|
-
}
|
|
145
|
-
convertToGregorianDate(date, format = 'YYYY-MM-DD', lang = 'en') {
|
|
146
|
-
momentHijri.locale(lang);
|
|
147
|
-
const m = momentHijri.iConvert.toGregorian(date.year(), date.month(), date.date());
|
|
148
|
-
return momentHijri(new Date(m.gy, m.gm, m.gd)).format(format);
|
|
149
|
-
}
|
|
150
|
-
getCurrentHijriDate() {
|
|
151
|
-
momentHijri.locale('en');
|
|
152
|
-
return momentHijri().format('iYYYY/iMM/iDD');
|
|
153
|
-
}
|
|
154
|
-
getValidatorErrorMessage(validatorName, validatorValue, patternErrorMsg, isArabic) {
|
|
155
|
-
if (validatorName === 'pattern') {
|
|
156
|
-
validatorValue = this.addPatternMsg(validatorValue, patternErrorMsg);
|
|
157
|
-
}
|
|
158
|
-
const config = {
|
|
159
|
-
required: isArabic ? 'هذا الحقل مطلوب' : 'this field required',
|
|
160
|
-
pattern: `${validatorValue.message}`,
|
|
161
|
-
Email: (isArabic ? 'خطأ في البريد الالكتروني ' : 'Invalid email ') +
|
|
162
|
-
'(example@example.com)',
|
|
163
|
-
maxlength: isArabic
|
|
164
|
-
? `تجاوز عدد الحقل المسموح بها (${validatorValue.requiredLength}) حرف`
|
|
165
|
-
: `this field is more than (${validatorValue.requiredLength}) letter`,
|
|
166
|
-
minlength: isArabic
|
|
167
|
-
? `على الأقل عدد ${validatorValue.requiredLength} حرف`
|
|
168
|
-
: `this field is less than (${validatorValue.requiredLength}) letter`,
|
|
169
|
-
min: isArabic
|
|
170
|
-
? `رقم اكبر من أو يساوي ${validatorValue.min}`
|
|
171
|
-
: `number more than or equal (${validatorValue.min})`,
|
|
172
|
-
max: isArabic
|
|
173
|
-
? `رقم اصغر من أو يساوي ${validatorValue.max}`
|
|
174
|
-
: `number less than or equal (${validatorValue.min})`,
|
|
175
|
-
ngbDate: this.getNgbDatepickerErrorMsg(validatorValue),
|
|
176
|
-
checkId: isArabic
|
|
177
|
-
? 'رقم الهوية أو الاقامة غير صحيح'
|
|
178
|
-
: 'Wrong ID or Iqama number',
|
|
179
|
-
link: (isArabic ? 'الرابط غير صحيح ' : 'Wrong link ') +
|
|
180
|
-
'(http://example.com)',
|
|
181
|
-
linkMP4: (isArabic ? 'رابط MP4 غير صحيح ' : 'Wrong MP4 link ') +
|
|
182
|
-
'(http://example.com/example.mp4)',
|
|
183
|
-
mobileNo: (isArabic ? 'خطأ في رقم الجوال ' : 'Wrong mobile number ') +
|
|
184
|
-
'(05xxxxxxxx)',
|
|
185
|
-
};
|
|
186
|
-
return config[validatorName];
|
|
187
|
-
}
|
|
188
|
-
addPatternMsg(validatorValue, patternErrorMsg) {
|
|
189
|
-
let pattern = {
|
|
190
|
-
...validatorValue,
|
|
191
|
-
message: patternErrorMsg,
|
|
192
|
-
};
|
|
193
|
-
return pattern;
|
|
194
|
-
}
|
|
195
|
-
getNgbDatepickerErrorMsg(validatorValue) {
|
|
196
|
-
let msg = '';
|
|
197
|
-
if (validatorValue.maxDate) {
|
|
198
|
-
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.maxDate.actual)}" اكبر من تاريخ اليوم "${this.parserFormatter.format(validatorValue.maxDate.maxDate)}"`;
|
|
199
|
-
}
|
|
200
|
-
else if (validatorValue.minDate) {
|
|
201
|
-
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.minDate.actual)}" يجب ان يكون اكبر من أو يساوي تاريخ البداية "${this.parserFormatter.format(validatorValue.minDate.minDate)}"`;
|
|
202
|
-
}
|
|
203
|
-
else if (validatorValue.invalid) {
|
|
204
|
-
msg = `التاريخ المدخل غير صحيح ${validatorValue.invalid}.`;
|
|
205
|
-
}
|
|
206
|
-
return msg;
|
|
207
|
-
}
|
|
208
|
-
static checkHijriDateValid(date) {
|
|
209
|
-
return !(momentHijri.iDaysInMonth(date?.year, date?.month - 1) < date?.day ||
|
|
210
|
-
date?.day <= 0 ||
|
|
211
|
-
date?.month <= 0 ||
|
|
212
|
-
date?.month > 12 ||
|
|
213
|
-
date?.year?.toString().length !== 4);
|
|
214
|
-
}
|
|
215
|
-
static convertToEn(value) {
|
|
216
|
-
let newValue = '';
|
|
217
|
-
for (let i = 0; i < value.length; i++) {
|
|
218
|
-
let ch = value.charCodeAt(i);
|
|
219
|
-
if (ch >= 1584 && ch <= 1650) {
|
|
220
|
-
let newChar = ch - 1584;
|
|
221
|
-
newValue = newValue + String.fromCharCode(newChar);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
newValue = newValue + String.fromCharCode(ch);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return newValue;
|
|
228
|
-
}
|
|
229
|
-
static nationalIdValidate(civilId) {
|
|
230
|
-
if (civilId) {
|
|
231
|
-
let strID = this.convertToEn(civilId);
|
|
232
|
-
let digits = '';
|
|
233
|
-
let counter = 0;
|
|
234
|
-
while (counter < 9) {
|
|
235
|
-
if ((counter + 1) % 2 == 0) {
|
|
236
|
-
digits = digits + strID.substring(counter, counter + 1);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
digits =
|
|
240
|
-
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
241
|
-
}
|
|
242
|
-
counter++;
|
|
243
|
-
}
|
|
244
|
-
let intSum = 0;
|
|
245
|
-
let intSumTemp = 0;
|
|
246
|
-
let strSum;
|
|
247
|
-
let intOddSumDigit;
|
|
248
|
-
let CheckDigit;
|
|
249
|
-
counter = 0;
|
|
250
|
-
while (counter < digits.length) {
|
|
251
|
-
intSumTemp = +digits.charAt(counter) * 1;
|
|
252
|
-
intSum += intSumTemp;
|
|
253
|
-
counter++;
|
|
254
|
-
}
|
|
255
|
-
strSum = intSum.toString();
|
|
256
|
-
if (strSum.length == 1) {
|
|
257
|
-
intOddSumDigit = intSum;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
261
|
-
}
|
|
262
|
-
if (intOddSumDigit == 0) {
|
|
263
|
-
CheckDigit = 0;
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
267
|
-
}
|
|
268
|
-
let PublicID = this.convertToEn(civilId);
|
|
269
|
-
if (CheckDigit ==
|
|
270
|
-
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
271
|
-
strID.length == 10 &&
|
|
272
|
-
strID.substring(0, 1) == '1') {
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
static iqamaIdValidate(civilId) {
|
|
284
|
-
if (civilId) {
|
|
285
|
-
let strID = this.convertToEn(civilId);
|
|
286
|
-
let digits = '';
|
|
287
|
-
let counter = 0;
|
|
288
|
-
while (counter < 9) {
|
|
289
|
-
if ((counter + 1) % 2 == 0) {
|
|
290
|
-
digits = digits + strID.substring(counter, counter + 1);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
digits =
|
|
294
|
-
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
295
|
-
}
|
|
296
|
-
counter++;
|
|
297
|
-
}
|
|
298
|
-
let intSum = 0;
|
|
299
|
-
let intSumTemp = 0;
|
|
300
|
-
let strSum;
|
|
301
|
-
let intOddSumDigit;
|
|
302
|
-
let CheckDigit;
|
|
303
|
-
counter = 0;
|
|
304
|
-
while (counter < digits.length) {
|
|
305
|
-
intSumTemp = +digits.charAt(counter) * 1;
|
|
306
|
-
intSum += intSumTemp;
|
|
307
|
-
counter++;
|
|
308
|
-
}
|
|
309
|
-
strSum = intSum.toString();
|
|
310
|
-
if (strSum.length == 1) {
|
|
311
|
-
intOddSumDigit = intSum;
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
315
|
-
}
|
|
316
|
-
if (intOddSumDigit == 0) {
|
|
317
|
-
CheckDigit = 0;
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
321
|
-
}
|
|
322
|
-
let PublicID = this.convertToEn(civilId);
|
|
323
|
-
if (CheckDigit ==
|
|
324
|
-
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
325
|
-
strID.length == 10 &&
|
|
326
|
-
strID.substring(0, 1) == '2') {
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
341
|
-
type: Injectable,
|
|
342
|
-
args: [{
|
|
343
|
-
providedIn: 'root',
|
|
344
|
-
}]
|
|
61
|
+
class IPAFormService {
|
|
62
|
+
constructor(parserFormatter) {
|
|
63
|
+
this.parserFormatter = parserFormatter;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* check link is valid.
|
|
67
|
+
*/
|
|
68
|
+
static linkValidation(control) {
|
|
69
|
+
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?)$/.test(control.value);
|
|
70
|
+
return isValidLink || !control.value ? null : { link: true };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* check mp4 link is valid.
|
|
74
|
+
*/
|
|
75
|
+
static mp4LinkValidation(control) {
|
|
76
|
+
const isValidLink = /^((https?:\/\/)[\w-]+(\.[a-z-]+)+\.?(:\d+)?(\/\S*)?(\/[\w\u0600-\u06FF]+\.mp4))$/.test(control.value);
|
|
77
|
+
return isValidLink || !control.value ? null : { linkMP4: true };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* check mobile number is valid.
|
|
81
|
+
*/
|
|
82
|
+
static mobileNo(control) {
|
|
83
|
+
const isValidLink = /^05\d{8}$/.test(control.value);
|
|
84
|
+
return isValidLink || !control.value ? null : { mobileNo: true };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* check email is valid.
|
|
88
|
+
*/
|
|
89
|
+
static email(control) {
|
|
90
|
+
const isValidLink = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test(control.value);
|
|
91
|
+
return isValidLink || !control.value ? null : { Email: true };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* check national ID or iqama ID is valid.
|
|
95
|
+
*/
|
|
96
|
+
static checkID(control) {
|
|
97
|
+
let isValid = false;
|
|
98
|
+
const value = control.value;
|
|
99
|
+
if (IPAFormService.nationalIdValidate(value) ||
|
|
100
|
+
IPAFormService.iqamaIdValidate(value)) {
|
|
101
|
+
isValid = true;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
isValid = false;
|
|
105
|
+
}
|
|
106
|
+
return isValid || !value ? null : { checkId: true };
|
|
107
|
+
}
|
|
108
|
+
static validHijriDate(control) {
|
|
109
|
+
const date = control.value;
|
|
110
|
+
const isValid = IPAFormService.checkHijriDateValid(date);
|
|
111
|
+
return isValid || !date
|
|
112
|
+
? null
|
|
113
|
+
: {
|
|
114
|
+
ngbDate: {
|
|
115
|
+
invalid: date?.year +
|
|
116
|
+
'-' +
|
|
117
|
+
(date?.month > 10 ? date?.month : '0' + date?.month) +
|
|
118
|
+
'-' +
|
|
119
|
+
(date?.day > 10 ? date?.day : '0' + date?.day),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
getErrorMessage(control, patternErrorMsg = '', isArabic) {
|
|
124
|
+
for (const propertyName in control?.errors) {
|
|
125
|
+
if (control?.errors.hasOwnProperty(propertyName) &&
|
|
126
|
+
(control.touched || control.dirty)) {
|
|
127
|
+
return this.getValidatorErrorMessage(propertyName, control.errors[propertyName], patternErrorMsg, isArabic);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* convert gregorian date to hijri date (Based on Umm al-Qura calculations).
|
|
134
|
+
* @param date: gregorian date
|
|
135
|
+
* @param format: iDD => day: ١٥, iMM => month: ٠٤, iMMM => month: ربيع ٢,
|
|
136
|
+
* iMMMM => ربيع الثاني, iYY => year: ٤٢, iYYYY => year: ١٤٤٢,
|
|
137
|
+
* dd => ن, ddd => إثنين, dddd => الإثنين
|
|
138
|
+
* @example 'iYYYY/iM/iDهـ الموافق YYYY/M/Dم'
|
|
139
|
+
* '١٤٤٢/٠٤/١٥هـ الموافق ٢٠٢٠/١١/٣٠'
|
|
140
|
+
*/
|
|
141
|
+
convertToHijriDate(date, format = 'iYYYY-iMM-iDD', lang = 'ar-SA') {
|
|
142
|
+
momentHijri.locale(lang);
|
|
143
|
+
return momentHijri(date).format(format);
|
|
144
|
+
}
|
|
145
|
+
convertToGregorianDate(date, format = 'YYYY-MM-DD', lang = 'en') {
|
|
146
|
+
momentHijri.locale(lang);
|
|
147
|
+
const m = momentHijri.iConvert.toGregorian(date.year(), date.month(), date.date());
|
|
148
|
+
return momentHijri(new Date(m.gy, m.gm, m.gd)).format(format);
|
|
149
|
+
}
|
|
150
|
+
getCurrentHijriDate() {
|
|
151
|
+
momentHijri.locale('en');
|
|
152
|
+
return momentHijri().format('iYYYY/iMM/iDD');
|
|
153
|
+
}
|
|
154
|
+
getValidatorErrorMessage(validatorName, validatorValue, patternErrorMsg, isArabic) {
|
|
155
|
+
if (validatorName === 'pattern') {
|
|
156
|
+
validatorValue = this.addPatternMsg(validatorValue, patternErrorMsg);
|
|
157
|
+
}
|
|
158
|
+
const config = {
|
|
159
|
+
required: isArabic ? 'هذا الحقل مطلوب' : 'this field required',
|
|
160
|
+
pattern: `${validatorValue.message}`,
|
|
161
|
+
Email: (isArabic ? 'خطأ في البريد الالكتروني ' : 'Invalid email ') +
|
|
162
|
+
'(example@example.com)',
|
|
163
|
+
maxlength: isArabic
|
|
164
|
+
? `تجاوز عدد الحقل المسموح بها (${validatorValue.requiredLength}) حرف`
|
|
165
|
+
: `this field is more than (${validatorValue.requiredLength}) letter`,
|
|
166
|
+
minlength: isArabic
|
|
167
|
+
? `على الأقل عدد ${validatorValue.requiredLength} حرف`
|
|
168
|
+
: `this field is less than (${validatorValue.requiredLength}) letter`,
|
|
169
|
+
min: isArabic
|
|
170
|
+
? `رقم اكبر من أو يساوي ${validatorValue.min}`
|
|
171
|
+
: `number more than or equal (${validatorValue.min})`,
|
|
172
|
+
max: isArabic
|
|
173
|
+
? `رقم اصغر من أو يساوي ${validatorValue.max}`
|
|
174
|
+
: `number less than or equal (${validatorValue.min})`,
|
|
175
|
+
ngbDate: this.getNgbDatepickerErrorMsg(validatorValue),
|
|
176
|
+
checkId: isArabic
|
|
177
|
+
? 'رقم الهوية أو الاقامة غير صحيح'
|
|
178
|
+
: 'Wrong ID or Iqama number',
|
|
179
|
+
link: (isArabic ? 'الرابط غير صحيح ' : 'Wrong link ') +
|
|
180
|
+
'(http://example.com)',
|
|
181
|
+
linkMP4: (isArabic ? 'رابط MP4 غير صحيح ' : 'Wrong MP4 link ') +
|
|
182
|
+
'(http://example.com/example.mp4)',
|
|
183
|
+
mobileNo: (isArabic ? 'خطأ في رقم الجوال ' : 'Wrong mobile number ') +
|
|
184
|
+
'(05xxxxxxxx)',
|
|
185
|
+
};
|
|
186
|
+
return config[validatorName];
|
|
187
|
+
}
|
|
188
|
+
addPatternMsg(validatorValue, patternErrorMsg) {
|
|
189
|
+
let pattern = {
|
|
190
|
+
...validatorValue,
|
|
191
|
+
message: patternErrorMsg,
|
|
192
|
+
};
|
|
193
|
+
return pattern;
|
|
194
|
+
}
|
|
195
|
+
getNgbDatepickerErrorMsg(validatorValue) {
|
|
196
|
+
let msg = '';
|
|
197
|
+
if (validatorValue.maxDate) {
|
|
198
|
+
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.maxDate.actual)}" اكبر من تاريخ اليوم "${this.parserFormatter.format(validatorValue.maxDate.maxDate)}"`;
|
|
199
|
+
}
|
|
200
|
+
else if (validatorValue.minDate) {
|
|
201
|
+
msg = `التاريخ المدخل "${this.parserFormatter.format(validatorValue.minDate.actual)}" يجب ان يكون اكبر من أو يساوي تاريخ البداية "${this.parserFormatter.format(validatorValue.minDate.minDate)}"`;
|
|
202
|
+
}
|
|
203
|
+
else if (validatorValue.invalid) {
|
|
204
|
+
msg = `التاريخ المدخل غير صحيح ${validatorValue.invalid}.`;
|
|
205
|
+
}
|
|
206
|
+
return msg;
|
|
207
|
+
}
|
|
208
|
+
static checkHijriDateValid(date) {
|
|
209
|
+
return !(momentHijri.iDaysInMonth(date?.year, date?.month - 1) < date?.day ||
|
|
210
|
+
date?.day <= 0 ||
|
|
211
|
+
date?.month <= 0 ||
|
|
212
|
+
date?.month > 12 ||
|
|
213
|
+
date?.year?.toString().length !== 4);
|
|
214
|
+
}
|
|
215
|
+
static convertToEn(value) {
|
|
216
|
+
let newValue = '';
|
|
217
|
+
for (let i = 0; i < value.length; i++) {
|
|
218
|
+
let ch = value.charCodeAt(i);
|
|
219
|
+
if (ch >= 1584 && ch <= 1650) {
|
|
220
|
+
let newChar = ch - 1584;
|
|
221
|
+
newValue = newValue + String.fromCharCode(newChar);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
newValue = newValue + String.fromCharCode(ch);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return newValue;
|
|
228
|
+
}
|
|
229
|
+
static nationalIdValidate(civilId) {
|
|
230
|
+
if (civilId) {
|
|
231
|
+
let strID = this.convertToEn(civilId);
|
|
232
|
+
let digits = '';
|
|
233
|
+
let counter = 0;
|
|
234
|
+
while (counter < 9) {
|
|
235
|
+
if ((counter + 1) % 2 == 0) {
|
|
236
|
+
digits = digits + strID.substring(counter, counter + 1);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
digits =
|
|
240
|
+
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
241
|
+
}
|
|
242
|
+
counter++;
|
|
243
|
+
}
|
|
244
|
+
let intSum = 0;
|
|
245
|
+
let intSumTemp = 0;
|
|
246
|
+
let strSum;
|
|
247
|
+
let intOddSumDigit;
|
|
248
|
+
let CheckDigit;
|
|
249
|
+
counter = 0;
|
|
250
|
+
while (counter < digits.length) {
|
|
251
|
+
intSumTemp = +digits.charAt(counter) * 1;
|
|
252
|
+
intSum += intSumTemp;
|
|
253
|
+
counter++;
|
|
254
|
+
}
|
|
255
|
+
strSum = intSum.toString();
|
|
256
|
+
if (strSum.length == 1) {
|
|
257
|
+
intOddSumDigit = intSum;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
261
|
+
}
|
|
262
|
+
if (intOddSumDigit == 0) {
|
|
263
|
+
CheckDigit = 0;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
267
|
+
}
|
|
268
|
+
let PublicID = this.convertToEn(civilId);
|
|
269
|
+
if (CheckDigit ==
|
|
270
|
+
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
271
|
+
strID.length == 10 &&
|
|
272
|
+
strID.substring(0, 1) == '1') {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
static iqamaIdValidate(civilId) {
|
|
284
|
+
if (civilId) {
|
|
285
|
+
let strID = this.convertToEn(civilId);
|
|
286
|
+
let digits = '';
|
|
287
|
+
let counter = 0;
|
|
288
|
+
while (counter < 9) {
|
|
289
|
+
if ((counter + 1) % 2 == 0) {
|
|
290
|
+
digits = digits + strID.substring(counter, counter + 1);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
digits =
|
|
294
|
+
digits + (+strID.substring(counter, counter + 1) * 2).toString();
|
|
295
|
+
}
|
|
296
|
+
counter++;
|
|
297
|
+
}
|
|
298
|
+
let intSum = 0;
|
|
299
|
+
let intSumTemp = 0;
|
|
300
|
+
let strSum;
|
|
301
|
+
let intOddSumDigit;
|
|
302
|
+
let CheckDigit;
|
|
303
|
+
counter = 0;
|
|
304
|
+
while (counter < digits.length) {
|
|
305
|
+
intSumTemp = +digits.charAt(counter) * 1;
|
|
306
|
+
intSum += intSumTemp;
|
|
307
|
+
counter++;
|
|
308
|
+
}
|
|
309
|
+
strSum = intSum.toString();
|
|
310
|
+
if (strSum.length == 1) {
|
|
311
|
+
intOddSumDigit = intSum;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
intOddSumDigit = strSum.substring(strSum.length, strSum.length - 1);
|
|
315
|
+
}
|
|
316
|
+
if (intOddSumDigit == 0) {
|
|
317
|
+
CheckDigit = 0;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
CheckDigit = (10 - +intOddSumDigit).toString();
|
|
321
|
+
}
|
|
322
|
+
let PublicID = this.convertToEn(civilId);
|
|
323
|
+
if (CheckDigit ==
|
|
324
|
+
PublicID.substring(PublicID.length - 1, PublicID.length) &&
|
|
325
|
+
strID.length == 10 &&
|
|
326
|
+
strID.substring(0, 1) == '2') {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IPAFormService, deps: [{ token: i2.NgbDateParserFormatter }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
338
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IPAFormService, providedIn: 'root' }); }
|
|
339
|
+
}
|
|
340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IPAFormService, decorators: [{
|
|
341
|
+
type: Injectable,
|
|
342
|
+
args: [{
|
|
343
|
+
providedIn: 'root',
|
|
344
|
+
}]
|
|
345
345
|
}], ctorParameters: function () { return [{ type: i2.NgbDateParserFormatter }]; } });
|
|
346
346
|
|
|
347
|
-
class TextInputComponent {
|
|
348
|
-
constructor(validationService, controlDir, cd) {
|
|
349
|
-
this.validationService = validationService;
|
|
350
|
-
this.controlDir = controlDir;
|
|
351
|
-
this.cd = cd;
|
|
352
|
-
this.type = 'text';
|
|
353
|
-
this.placeholder = 'please enter text';
|
|
354
|
-
this.label = 'text input';
|
|
355
|
-
this.required = false;
|
|
356
|
-
this.patternErrorMsg = 'invalid pattern';
|
|
357
|
-
this.onlyNumber = false;
|
|
358
|
-
this.pattern = '';
|
|
359
|
-
this.isArabicForm = true;
|
|
360
|
-
this.formControl = new UntypedFormControl('');
|
|
361
|
-
this.controlDir.valueAccessor = this;
|
|
362
|
-
}
|
|
363
|
-
ngAfterContentChecked() {
|
|
364
|
-
this.cd.detectChanges();
|
|
365
|
-
}
|
|
366
|
-
ngOnInit() {
|
|
367
|
-
const control = this.controlDir.control;
|
|
368
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
369
|
-
control?.setValidators(validators);
|
|
370
|
-
control?.updateValueAndValidity();
|
|
371
|
-
this.formControl = control;
|
|
372
|
-
}
|
|
373
|
-
onChange(event) { }
|
|
374
|
-
onTouched() { }
|
|
375
|
-
writeValue(obj) {
|
|
376
|
-
this.input.nativeElement.value = obj || '';
|
|
377
|
-
}
|
|
378
|
-
registerOnChange(fn) {
|
|
379
|
-
this.onChange = fn;
|
|
380
|
-
}
|
|
381
|
-
registerOnTouched(fn) {
|
|
382
|
-
this.onTouched = fn;
|
|
383
|
-
}
|
|
384
|
-
checkIsNumber(event) {
|
|
385
|
-
if (this.onlyNumber) {
|
|
386
|
-
const initialValue = this.formControl.value;
|
|
387
|
-
const newValue = initialValue.replace(/[^0-9]*/g, '');
|
|
388
|
-
this.formControl.patchValue(newValue);
|
|
389
|
-
this.formControl.markAsPristine();
|
|
390
|
-
if (initialValue !== this.formControl.value) {
|
|
391
|
-
event.stopPropagation();
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
get errorMessage() {
|
|
396
|
-
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
397
|
-
return this.errorMsg;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
403
|
-
type: Component,
|
|
404
|
-
args: [{ selector: 'ipa-text-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <input #input id=\"{{id}}\" class=\"form-control {{classes}}\" [type]=\"type\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" (input)=\"checkIsNumber($event)\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>" }]
|
|
405
|
-
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
406
|
-
type: Self
|
|
407
|
-
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { input: [{
|
|
408
|
-
type: ViewChild,
|
|
409
|
-
args: ['input', { static: true }]
|
|
410
|
-
}], id: [{
|
|
411
|
-
type: Input
|
|
412
|
-
}], type: [{
|
|
413
|
-
type: Input
|
|
414
|
-
}], placeholder: [{
|
|
415
|
-
type: Input
|
|
416
|
-
}], label: [{
|
|
417
|
-
type: Input
|
|
418
|
-
}], required: [{
|
|
419
|
-
type: Input
|
|
420
|
-
}], patternErrorMsg: [{
|
|
421
|
-
type: Input
|
|
422
|
-
}], onlyNumber: [{
|
|
423
|
-
type: Input
|
|
424
|
-
}], pattern: [{
|
|
425
|
-
type: Input
|
|
426
|
-
}], classes: [{
|
|
427
|
-
type: Input
|
|
428
|
-
}], containerClasses: [{
|
|
429
|
-
type: Input
|
|
430
|
-
}], isArabicForm: [{
|
|
431
|
-
type: Input
|
|
347
|
+
class TextInputComponent {
|
|
348
|
+
constructor(validationService, controlDir, cd) {
|
|
349
|
+
this.validationService = validationService;
|
|
350
|
+
this.controlDir = controlDir;
|
|
351
|
+
this.cd = cd;
|
|
352
|
+
this.type = 'text';
|
|
353
|
+
this.placeholder = 'please enter text';
|
|
354
|
+
this.label = 'text input';
|
|
355
|
+
this.required = false;
|
|
356
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
357
|
+
this.onlyNumber = false;
|
|
358
|
+
this.pattern = '';
|
|
359
|
+
this.isArabicForm = true;
|
|
360
|
+
this.formControl = new UntypedFormControl('');
|
|
361
|
+
this.controlDir.valueAccessor = this;
|
|
362
|
+
}
|
|
363
|
+
ngAfterContentChecked() {
|
|
364
|
+
this.cd.detectChanges();
|
|
365
|
+
}
|
|
366
|
+
ngOnInit() {
|
|
367
|
+
const control = this.controlDir.control;
|
|
368
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
369
|
+
control?.setValidators(validators);
|
|
370
|
+
control?.updateValueAndValidity();
|
|
371
|
+
this.formControl = control;
|
|
372
|
+
}
|
|
373
|
+
onChange(event) { }
|
|
374
|
+
onTouched() { }
|
|
375
|
+
writeValue(obj) {
|
|
376
|
+
this.input.nativeElement.value = obj || '';
|
|
377
|
+
}
|
|
378
|
+
registerOnChange(fn) {
|
|
379
|
+
this.onChange = fn;
|
|
380
|
+
}
|
|
381
|
+
registerOnTouched(fn) {
|
|
382
|
+
this.onTouched = fn;
|
|
383
|
+
}
|
|
384
|
+
checkIsNumber(event) {
|
|
385
|
+
if (this.onlyNumber) {
|
|
386
|
+
const initialValue = this.formControl.value;
|
|
387
|
+
const newValue = initialValue.replace(/[^0-9]*/g, '');
|
|
388
|
+
this.formControl.patchValue(newValue);
|
|
389
|
+
this.formControl.markAsPristine();
|
|
390
|
+
if (initialValue !== this.formControl.value) {
|
|
391
|
+
event.stopPropagation();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
get errorMessage() {
|
|
396
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
397
|
+
return this.errorMsg;
|
|
398
|
+
}
|
|
399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TextInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: TextInputComponent, selector: "ipa-text-input", inputs: { id: "id", type: "type", placeholder: "placeholder", label: "label", required: "required", patternErrorMsg: "patternErrorMsg", onlyNumber: "onlyNumber", pattern: "pattern", classes: "classes", containerClasses: "containerClasses", isArabicForm: "isArabicForm" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\">\r\n <input #input id=\"{{id}}\" class=\"form-control {{classes}}\" [type]=\"type\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" (input)=\"checkIsNumber($event)\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
401
|
+
}
|
|
402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
403
|
+
type: Component,
|
|
404
|
+
args: [{ selector: 'ipa-text-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <input #input id=\"{{id}}\" class=\"form-control {{classes}}\" [type]=\"type\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" (input)=\"checkIsNumber($event)\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>" }]
|
|
405
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
406
|
+
type: Self
|
|
407
|
+
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { input: [{
|
|
408
|
+
type: ViewChild,
|
|
409
|
+
args: ['input', { static: true }]
|
|
410
|
+
}], id: [{
|
|
411
|
+
type: Input
|
|
412
|
+
}], type: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}], placeholder: [{
|
|
415
|
+
type: Input
|
|
416
|
+
}], label: [{
|
|
417
|
+
type: Input
|
|
418
|
+
}], required: [{
|
|
419
|
+
type: Input
|
|
420
|
+
}], patternErrorMsg: [{
|
|
421
|
+
type: Input
|
|
422
|
+
}], onlyNumber: [{
|
|
423
|
+
type: Input
|
|
424
|
+
}], pattern: [{
|
|
425
|
+
type: Input
|
|
426
|
+
}], classes: [{
|
|
427
|
+
type: Input
|
|
428
|
+
}], containerClasses: [{
|
|
429
|
+
type: Input
|
|
430
|
+
}], isArabicForm: [{
|
|
431
|
+
type: Input
|
|
432
432
|
}] } });
|
|
433
433
|
|
|
434
|
-
class TextareaInputComponent {
|
|
435
|
-
constructor(validationService, controlDir, cd) {
|
|
436
|
-
this.validationService = validationService;
|
|
437
|
-
this.controlDir = controlDir;
|
|
438
|
-
this.cd = cd;
|
|
439
|
-
this.input = new ElementRef(null);
|
|
440
|
-
this.placeholder = 'please enter text';
|
|
441
|
-
this.label = 'textarea input';
|
|
442
|
-
this.required = false;
|
|
443
|
-
this.patternErrorMsg = 'invalid pattern';
|
|
444
|
-
this.isArabicForm = true;
|
|
445
|
-
this.formControl = new UntypedFormControl('');
|
|
446
|
-
this.controlDir.valueAccessor = this;
|
|
447
|
-
}
|
|
448
|
-
ngAfterContentChecked() {
|
|
449
|
-
this.cd.detectChanges();
|
|
450
|
-
}
|
|
451
|
-
ngOnInit() {
|
|
452
|
-
const control = this.controlDir.control;
|
|
453
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
454
|
-
control?.setValidators(validators);
|
|
455
|
-
control?.updateValueAndValidity();
|
|
456
|
-
this.formControl = control;
|
|
457
|
-
}
|
|
458
|
-
onChange(event) { }
|
|
459
|
-
onTouched() { }
|
|
460
|
-
writeValue(obj) {
|
|
461
|
-
this.input.nativeElement.value = obj || '';
|
|
462
|
-
}
|
|
463
|
-
registerOnChange(fn) {
|
|
464
|
-
this.onChange = fn;
|
|
465
|
-
}
|
|
466
|
-
registerOnTouched(fn) {
|
|
467
|
-
this.onTouched = fn;
|
|
468
|
-
}
|
|
469
|
-
get errorMessage() {
|
|
470
|
-
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
471
|
-
return this.errorMsg;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
477
|
-
type: Component,
|
|
478
|
-
args: [{ selector: 'ipa-textarea-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <textarea #input id=\"{{id}}\" class=\"form-control {{classes}}\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" style=\"height: 135px;\"\r\n [ngClass]=\"{\r\n 'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,\r\n 'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </textarea>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [".form-floating label{min-width:100%}.form-floating label:before{content:\"\";position:absolute;top:.9em;z-index:-1;width:110%;height:2em;background-color:#fff;box-shadow:0 -1px #fff}.form-floating>.form-control:focus~label,.form-floating>.form-control:not(:placeholder-shown)~label,.form-floating>.form-select~label{opacity:.95;color:gray}@media (max-width: 1699px){.form-floating label:before{width:107%!important}}@media (max-width: 770px){.form-floating label:before{width:97%!important}}\n"] }]
|
|
479
|
-
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
480
|
-
type: Self
|
|
481
|
-
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { input: [{
|
|
482
|
-
type: ViewChild,
|
|
483
|
-
args: ['input', { static: true }]
|
|
484
|
-
}], id: [{
|
|
485
|
-
type: Input
|
|
486
|
-
}], placeholder: [{
|
|
487
|
-
type: Input
|
|
488
|
-
}], label: [{
|
|
489
|
-
type: Input
|
|
490
|
-
}], required: [{
|
|
491
|
-
type: Input
|
|
492
|
-
}], patternErrorMsg: [{
|
|
493
|
-
type: Input
|
|
494
|
-
}], pattern: [{
|
|
495
|
-
type: Input
|
|
496
|
-
}], classes: [{
|
|
497
|
-
type: Input
|
|
498
|
-
}], containerClasses: [{
|
|
499
|
-
type: Input
|
|
500
|
-
}], isArabicForm: [{
|
|
501
|
-
type: Input
|
|
434
|
+
class TextareaInputComponent {
|
|
435
|
+
constructor(validationService, controlDir, cd) {
|
|
436
|
+
this.validationService = validationService;
|
|
437
|
+
this.controlDir = controlDir;
|
|
438
|
+
this.cd = cd;
|
|
439
|
+
this.input = new ElementRef(null);
|
|
440
|
+
this.placeholder = 'please enter text';
|
|
441
|
+
this.label = 'textarea input';
|
|
442
|
+
this.required = false;
|
|
443
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
444
|
+
this.isArabicForm = true;
|
|
445
|
+
this.formControl = new UntypedFormControl('');
|
|
446
|
+
this.controlDir.valueAccessor = this;
|
|
447
|
+
}
|
|
448
|
+
ngAfterContentChecked() {
|
|
449
|
+
this.cd.detectChanges();
|
|
450
|
+
}
|
|
451
|
+
ngOnInit() {
|
|
452
|
+
const control = this.controlDir.control;
|
|
453
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
454
|
+
control?.setValidators(validators);
|
|
455
|
+
control?.updateValueAndValidity();
|
|
456
|
+
this.formControl = control;
|
|
457
|
+
}
|
|
458
|
+
onChange(event) { }
|
|
459
|
+
onTouched() { }
|
|
460
|
+
writeValue(obj) {
|
|
461
|
+
this.input.nativeElement.value = obj || '';
|
|
462
|
+
}
|
|
463
|
+
registerOnChange(fn) {
|
|
464
|
+
this.onChange = fn;
|
|
465
|
+
}
|
|
466
|
+
registerOnTouched(fn) {
|
|
467
|
+
this.onTouched = fn;
|
|
468
|
+
}
|
|
469
|
+
get errorMessage() {
|
|
470
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
471
|
+
return this.errorMsg;
|
|
472
|
+
}
|
|
473
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TextareaInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
474
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: TextareaInputComponent, selector: "ipa-textarea-input", inputs: { id: "id", placeholder: "placeholder", label: "label", required: "required", patternErrorMsg: "patternErrorMsg", pattern: "pattern", classes: "classes", containerClasses: "containerClasses", isArabicForm: "isArabicForm" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\">\r\n <textarea #input id=\"{{id}}\" class=\"form-control {{classes}}\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" style=\"height: 135px;\"\r\n [ngClass]=\"{\r\n 'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,\r\n 'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </textarea>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [".form-floating label{min-width:100%}.form-floating label:before{content:\"\";position:absolute;top:.9em;z-index:-1;width:110%;height:2em;background-color:#fff;box-shadow:0 -1px #fff}.form-floating>.form-control:focus~label,.form-floating>.form-control:not(:placeholder-shown)~label,.form-floating>.form-select~label{opacity:.95;color:gray}@media (max-width: 1699px){.form-floating label:before{width:107%!important}}@media (max-width: 770px){.form-floating label:before{width:97%!important}}\n"], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
475
|
+
}
|
|
476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TextareaInputComponent, decorators: [{
|
|
477
|
+
type: Component,
|
|
478
|
+
args: [{ selector: 'ipa-textarea-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <textarea #input id=\"{{id}}\" class=\"form-control {{classes}}\" [required]=\"required\" pattern=\"{{pattern}}\"\r\n placeholder=\"{{placeholder}}\" [formControl]=\"formControl\" (input)=\"onChange(controlDir.control?.value)\"\r\n (blur)=\"onTouched()\" style=\"height: 135px;\"\r\n [ngClass]=\"{\r\n 'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,\r\n 'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </textarea>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [".form-floating label{min-width:100%}.form-floating label:before{content:\"\";position:absolute;top:.9em;z-index:-1;width:110%;height:2em;background-color:#fff;box-shadow:0 -1px #fff}.form-floating>.form-control:focus~label,.form-floating>.form-control:not(:placeholder-shown)~label,.form-floating>.form-select~label{opacity:.95;color:gray}@media (max-width: 1699px){.form-floating label:before{width:107%!important}}@media (max-width: 770px){.form-floating label:before{width:97%!important}}\n"] }]
|
|
479
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
480
|
+
type: Self
|
|
481
|
+
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { input: [{
|
|
482
|
+
type: ViewChild,
|
|
483
|
+
args: ['input', { static: true }]
|
|
484
|
+
}], id: [{
|
|
485
|
+
type: Input
|
|
486
|
+
}], placeholder: [{
|
|
487
|
+
type: Input
|
|
488
|
+
}], label: [{
|
|
489
|
+
type: Input
|
|
490
|
+
}], required: [{
|
|
491
|
+
type: Input
|
|
492
|
+
}], patternErrorMsg: [{
|
|
493
|
+
type: Input
|
|
494
|
+
}], pattern: [{
|
|
495
|
+
type: Input
|
|
496
|
+
}], classes: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}], containerClasses: [{
|
|
499
|
+
type: Input
|
|
500
|
+
}], isArabicForm: [{
|
|
501
|
+
type: Input
|
|
502
502
|
}] } });
|
|
503
503
|
|
|
504
|
-
class DropdownInputComponent {
|
|
505
|
-
constructor(validationService, controlDir) {
|
|
506
|
-
this.validationService = validationService;
|
|
507
|
-
this.controlDir = controlDir;
|
|
508
|
-
this.label = 'text input';
|
|
509
|
-
this.items = [];
|
|
510
|
-
this.required = false;
|
|
511
|
-
this.searchable = false;
|
|
512
|
-
this.notFoundText = 'لا يوجد بيانات';
|
|
513
|
-
this.isArabicForm = true;
|
|
514
|
-
this.fromGenerateForm = false;
|
|
515
|
-
this.formControl = new UntypedFormControl('');
|
|
516
|
-
this.controlDir.valueAccessor = this;
|
|
517
|
-
}
|
|
518
|
-
ngOnInit() {
|
|
519
|
-
const control = this.controlDir.control;
|
|
520
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
521
|
-
control?.setValidators(validators);
|
|
522
|
-
control?.updateValueAndValidity();
|
|
523
|
-
this.formControl = control;
|
|
524
|
-
}
|
|
525
|
-
onChange(event) { }
|
|
526
|
-
onTouched() { }
|
|
527
|
-
writeValue(obj) {
|
|
528
|
-
if (this.input)
|
|
529
|
-
this.input.value = obj || '';
|
|
530
|
-
}
|
|
531
|
-
registerOnChange(fn) {
|
|
532
|
-
this.onChange = fn;
|
|
533
|
-
}
|
|
534
|
-
registerOnTouched(fn) {
|
|
535
|
-
this.onTouched = fn;
|
|
536
|
-
}
|
|
537
|
-
get errorMessage() {
|
|
538
|
-
this.errorMsg = this.validationService.getErrorMessage(this.formControl, '', this.isArabicForm);
|
|
539
|
-
return this.errorMsg;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
545
|
-
type: Component,
|
|
546
|
-
args: [{ selector: 'ipa-dropdown-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <!-- searchable is false -->\r\n <ng-container *ngIf=\"!searchable\">\r\n <select #select id=\"{{id}}\" class=\"form-select {{classes}}\" [required]=\"required\" [formControl]=\"formControl\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <option *ngIf=\"firstItemLabel\" value=\"\">{{firstItemLabel}}</option>\r\n <option *ngFor=\"let item of items\"\r\n [value]=\"valueField ? fromGenerateForm ? item[textField] : item[valueField] : item\">\r\n {{textField ? item[textField] : item}}\r\n </option>\r\n </select>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n </ng-container>\r\n\r\n <!-- searchable is true -->\r\n <ng-select *ngIf=\"searchable\" #select dir=\"rtl\" class=\"{{classes}}\" [formControl]=\"formControl\" [items]=\"items\"\r\n [placeholder]=\"label\" [notFoundText]=\"notFoundText\" [required]=\"required\"\r\n [bindValue]=\"fromGenerateForm? textField : valueField\" [bindLabel]=\"textField\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </ng-select>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>" }]
|
|
547
|
-
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
548
|
-
type: Self
|
|
549
|
-
}] }]; }, propDecorators: { input: [{
|
|
550
|
-
type: ViewChild,
|
|
551
|
-
args: ['select', { static: true }]
|
|
552
|
-
}], id: [{
|
|
553
|
-
type: Input
|
|
554
|
-
}], label: [{
|
|
555
|
-
type: Input
|
|
556
|
-
}], items: [{
|
|
557
|
-
type: Input
|
|
558
|
-
}], textField: [{
|
|
559
|
-
type: Input
|
|
560
|
-
}], valueField: [{
|
|
561
|
-
type: Input
|
|
562
|
-
}], required: [{
|
|
563
|
-
type: Input
|
|
564
|
-
}], firstItemLabel: [{
|
|
565
|
-
type: Input
|
|
566
|
-
}], searchable: [{
|
|
567
|
-
type: Input
|
|
568
|
-
}], notFoundText: [{
|
|
569
|
-
type: Input
|
|
570
|
-
}], classes: [{
|
|
571
|
-
type: Input
|
|
572
|
-
}], containerClasses: [{
|
|
573
|
-
type: Input
|
|
574
|
-
}], isArabicForm: [{
|
|
575
|
-
type: Input
|
|
576
|
-
}], fromGenerateForm: [{
|
|
577
|
-
type: Input
|
|
504
|
+
class DropdownInputComponent {
|
|
505
|
+
constructor(validationService, controlDir) {
|
|
506
|
+
this.validationService = validationService;
|
|
507
|
+
this.controlDir = controlDir;
|
|
508
|
+
this.label = 'text input';
|
|
509
|
+
this.items = [];
|
|
510
|
+
this.required = false;
|
|
511
|
+
this.searchable = false;
|
|
512
|
+
this.notFoundText = 'لا يوجد بيانات';
|
|
513
|
+
this.isArabicForm = true;
|
|
514
|
+
this.fromGenerateForm = false;
|
|
515
|
+
this.formControl = new UntypedFormControl('');
|
|
516
|
+
this.controlDir.valueAccessor = this;
|
|
517
|
+
}
|
|
518
|
+
ngOnInit() {
|
|
519
|
+
const control = this.controlDir.control;
|
|
520
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
521
|
+
control?.setValidators(validators);
|
|
522
|
+
control?.updateValueAndValidity();
|
|
523
|
+
this.formControl = control;
|
|
524
|
+
}
|
|
525
|
+
onChange(event) { }
|
|
526
|
+
onTouched() { }
|
|
527
|
+
writeValue(obj) {
|
|
528
|
+
if (this.input)
|
|
529
|
+
this.input.value = obj || '';
|
|
530
|
+
}
|
|
531
|
+
registerOnChange(fn) {
|
|
532
|
+
this.onChange = fn;
|
|
533
|
+
}
|
|
534
|
+
registerOnTouched(fn) {
|
|
535
|
+
this.onTouched = fn;
|
|
536
|
+
}
|
|
537
|
+
get errorMessage() {
|
|
538
|
+
this.errorMsg = this.validationService.getErrorMessage(this.formControl, '', this.isArabicForm);
|
|
539
|
+
return this.errorMsg;
|
|
540
|
+
}
|
|
541
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: DropdownInputComponent, deps: [{ token: IPAFormService }, { token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
542
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: DropdownInputComponent, selector: "ipa-dropdown-input", inputs: { id: "id", label: "label", items: "items", textField: "textField", valueField: "valueField", required: "required", firstItemLabel: "firstItemLabel", searchable: "searchable", notFoundText: "notFoundText", classes: "classes", containerClasses: "containerClasses", isArabicForm: "isArabicForm", fromGenerateForm: "fromGenerateForm" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["select"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"form-floating {{containerClasses}}\">\r\n <!-- searchable is false -->\r\n <ng-container *ngIf=\"!searchable\">\r\n <select #select id=\"{{id}}\" class=\"form-select {{classes}}\" [required]=\"required\" [formControl]=\"formControl\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <option *ngIf=\"firstItemLabel\" value=\"\">{{firstItemLabel}}</option>\r\n <option *ngFor=\"let item of items\"\r\n [value]=\"valueField ? fromGenerateForm ? item[textField] : item[valueField] : item\">\r\n {{textField ? item[textField] : item}}\r\n </option>\r\n </select>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n </ng-container>\r\n\r\n <!-- searchable is true -->\r\n <ng-select *ngIf=\"searchable\" #select dir=\"rtl\" class=\"{{classes}}\" [formControl]=\"formControl\" [items]=\"items\"\r\n [placeholder]=\"label\" [notFoundText]=\"notFoundText\" [required]=\"required\"\r\n [bindValue]=\"fromGenerateForm? textField : valueField\" [bindLabel]=\"textField\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </ng-select>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
543
|
+
}
|
|
544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: DropdownInputComponent, decorators: [{
|
|
545
|
+
type: Component,
|
|
546
|
+
args: [{ selector: 'ipa-dropdown-input', template: "<div class=\"form-floating {{containerClasses}}\">\r\n <!-- searchable is false -->\r\n <ng-container *ngIf=\"!searchable\">\r\n <select #select id=\"{{id}}\" class=\"form-select {{classes}}\" [required]=\"required\" [formControl]=\"formControl\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n <option *ngIf=\"firstItemLabel\" value=\"\">{{firstItemLabel}}</option>\r\n <option *ngFor=\"let item of items\"\r\n [value]=\"valueField ? fromGenerateForm ? item[textField] : item[valueField] : item\">\r\n {{textField ? item[textField] : item}}\r\n </option>\r\n </select>\r\n <label for=\"{{id}}\">{{label}}</label>\r\n </ng-container>\r\n\r\n <!-- searchable is true -->\r\n <ng-select *ngIf=\"searchable\" #select dir=\"rtl\" class=\"{{classes}}\" [formControl]=\"formControl\" [items]=\"items\"\r\n [placeholder]=\"label\" [notFoundText]=\"notFoundText\" [required]=\"required\"\r\n [bindValue]=\"fromGenerateForm? textField : valueField\" [bindLabel]=\"textField\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': \r\n (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\">\r\n </ng-select>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n</div>" }]
|
|
547
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2$1.NgControl, decorators: [{
|
|
548
|
+
type: Self
|
|
549
|
+
}] }]; }, propDecorators: { input: [{
|
|
550
|
+
type: ViewChild,
|
|
551
|
+
args: ['select', { static: true }]
|
|
552
|
+
}], id: [{
|
|
553
|
+
type: Input
|
|
554
|
+
}], label: [{
|
|
555
|
+
type: Input
|
|
556
|
+
}], items: [{
|
|
557
|
+
type: Input
|
|
558
|
+
}], textField: [{
|
|
559
|
+
type: Input
|
|
560
|
+
}], valueField: [{
|
|
561
|
+
type: Input
|
|
562
|
+
}], required: [{
|
|
563
|
+
type: Input
|
|
564
|
+
}], firstItemLabel: [{
|
|
565
|
+
type: Input
|
|
566
|
+
}], searchable: [{
|
|
567
|
+
type: Input
|
|
568
|
+
}], notFoundText: [{
|
|
569
|
+
type: Input
|
|
570
|
+
}], classes: [{
|
|
571
|
+
type: Input
|
|
572
|
+
}], containerClasses: [{
|
|
573
|
+
type: Input
|
|
574
|
+
}], isArabicForm: [{
|
|
575
|
+
type: Input
|
|
576
|
+
}], fromGenerateForm: [{
|
|
577
|
+
type: Input
|
|
578
578
|
}] } });
|
|
579
579
|
|
|
580
|
-
class LoaderService {
|
|
581
|
-
constructor() {
|
|
582
|
-
this.isLoading = new BehaviorSubject(false);
|
|
583
|
-
this.urls = [];
|
|
584
|
-
}
|
|
585
|
-
setExceptionUrls(urls) {
|
|
586
|
-
this.urls = urls;
|
|
587
|
-
}
|
|
588
|
-
addExceptionUrl(url) {
|
|
589
|
-
this.urls.push(url);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
595
|
-
type: Injectable,
|
|
596
|
-
args: [{
|
|
597
|
-
providedIn: 'root',
|
|
598
|
-
}]
|
|
580
|
+
class LoaderService {
|
|
581
|
+
constructor() {
|
|
582
|
+
this.isLoading = new BehaviorSubject(false);
|
|
583
|
+
this.urls = [];
|
|
584
|
+
}
|
|
585
|
+
setExceptionUrls(urls) {
|
|
586
|
+
this.urls = urls;
|
|
587
|
+
}
|
|
588
|
+
addExceptionUrl(url) {
|
|
589
|
+
this.urls.push(url);
|
|
590
|
+
}
|
|
591
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
592
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoaderService, providedIn: 'root' }); }
|
|
593
|
+
}
|
|
594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoaderService, decorators: [{
|
|
595
|
+
type: Injectable,
|
|
596
|
+
args: [{
|
|
597
|
+
providedIn: 'root',
|
|
598
|
+
}]
|
|
599
599
|
}], ctorParameters: function () { return []; } });
|
|
600
600
|
|
|
601
|
-
class LoaderComponent {
|
|
602
|
-
constructor(loaderService, cdr) {
|
|
603
|
-
this.loaderService = loaderService;
|
|
604
|
-
this.cdr = cdr;
|
|
605
|
-
this.loading = true;
|
|
606
|
-
this.isLocal = false;
|
|
607
|
-
}
|
|
608
|
-
ngAfterViewInit() {
|
|
609
|
-
this.loaderService.isLoading.subscribe((v) => {
|
|
610
|
-
this.loading = v;
|
|
611
|
-
const loader = document.getElementById('cover-spin');
|
|
612
|
-
if (loader) {
|
|
613
|
-
if (this.loading) {
|
|
614
|
-
loader.style.display = 'flex';
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
if (loader.style.display !== 'none')
|
|
618
|
-
loader.style.display = 'none';
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
this.cdr.detectChanges();
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
628
|
-
type: Component,
|
|
629
|
-
args: [{ selector: 'ipa-loader', template: "<div id=\"cover-spin\" *ngIf=\"loading && isLocal\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n", styles: ["#cover-spin{display:flex}\n"] }]
|
|
630
|
-
}], ctorParameters: function () { return [{ type: LoaderService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { isLocal: [{
|
|
631
|
-
type: Input
|
|
601
|
+
class LoaderComponent {
|
|
602
|
+
constructor(loaderService, cdr) {
|
|
603
|
+
this.loaderService = loaderService;
|
|
604
|
+
this.cdr = cdr;
|
|
605
|
+
this.loading = true;
|
|
606
|
+
this.isLocal = false;
|
|
607
|
+
}
|
|
608
|
+
ngAfterViewInit() {
|
|
609
|
+
this.loaderService.isLoading.subscribe((v) => {
|
|
610
|
+
this.loading = v;
|
|
611
|
+
const loader = document.getElementById('cover-spin');
|
|
612
|
+
if (loader) {
|
|
613
|
+
if (this.loading) {
|
|
614
|
+
loader.style.display = 'flex';
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
if (loader.style.display !== 'none')
|
|
618
|
+
loader.style.display = 'none';
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
this.cdr.detectChanges();
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoaderComponent, deps: [{ token: LoaderService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
625
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: LoaderComponent, selector: "ipa-loader", inputs: { isLocal: "isLocal" }, ngImport: i0, template: "<div id=\"cover-spin\" *ngIf=\"loading && isLocal\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n", styles: ["#cover-spin{display:flex}\n"], dependencies: [{ kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
626
|
+
}
|
|
627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoaderComponent, decorators: [{
|
|
628
|
+
type: Component,
|
|
629
|
+
args: [{ selector: 'ipa-loader', template: "<div id=\"cover-spin\" *ngIf=\"loading && isLocal\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n", styles: ["#cover-spin{display:flex}\n"] }]
|
|
630
|
+
}], ctorParameters: function () { return [{ type: LoaderService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { isLocal: [{
|
|
631
|
+
type: Input
|
|
632
632
|
}] } });
|
|
633
633
|
|
|
634
|
-
class FileUploadComponent {
|
|
635
|
-
constructor(
|
|
636
|
-
// private authService: AuthService,
|
|
637
|
-
toastrService) {
|
|
638
|
-
this.toastrService = toastrService;
|
|
639
|
-
this.isArabicForm = true;
|
|
640
|
-
this.label = '';
|
|
641
|
-
this.required = false;
|
|
642
|
-
this.acceptedFiles = '';
|
|
643
|
-
this.multiple = 1; // set maxFiles (NOT uploadMultiple)in the config object,
|
|
644
|
-
this.maxFileSize = 2;
|
|
645
|
-
this.method = 'POST';
|
|
646
|
-
this.autoUpload = false;
|
|
647
|
-
this.apiUrl = 'apiUrl';
|
|
648
|
-
this.successUpload = new EventEmitter();
|
|
649
|
-
this.fileAdded = new EventEmitter();
|
|
650
|
-
this.fileDeleted = new EventEmitter();
|
|
651
|
-
this.dragEnter = false;
|
|
652
|
-
this.errors = [];
|
|
653
|
-
this.filesAdded = [];
|
|
654
|
-
this.currentFiles = [];
|
|
655
|
-
this.formControl = new UntypedFormControl('');
|
|
656
|
-
}
|
|
657
|
-
ngOnInit() {
|
|
658
|
-
this.setConfiguration();
|
|
659
|
-
}
|
|
660
|
-
operationCompleted(e) {
|
|
661
|
-
if (this.filesAdded.length > 0) {
|
|
662
|
-
this.successUpload.emit(this.filesAdded);
|
|
663
|
-
this.filesAdded = [];
|
|
664
|
-
}
|
|
665
|
-
this.dropzoneDir.reset();
|
|
666
|
-
}
|
|
667
|
-
onUploadSuccess(e) {
|
|
668
|
-
const file = e[0];
|
|
669
|
-
if (file.status === 'success') {
|
|
670
|
-
this.filesAdded.push(file);
|
|
671
|
-
}
|
|
672
|
-
const message = this.isArabicForm
|
|
673
|
-
? 'تم تحميل المرفقات بنجاح'
|
|
674
|
-
: 'Attachments uploaded successfully';
|
|
675
|
-
this.toastrService.success(message);
|
|
676
|
-
}
|
|
677
|
-
onUploadError(e) {
|
|
678
|
-
if (e[1]) {
|
|
679
|
-
this.errors = [];
|
|
680
|
-
this.errors.push(`${e[1]} (${e[0].name})`);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
fileWasAdded(e) {
|
|
684
|
-
const myDropzone = this.dropzoneDir.dropzone();
|
|
685
|
-
if (this.multiple === 1) {
|
|
686
|
-
this.currentFiles = [];
|
|
687
|
-
this.filesAdded = [];
|
|
688
|
-
this.errors = [];
|
|
689
|
-
const files = myDropzone.files;
|
|
690
|
-
if (files.length > 1) {
|
|
691
|
-
myDropzone.removeFile(files[0]);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
this.currentFiles.push(e);
|
|
695
|
-
this.fileAdded.emit(e);
|
|
696
|
-
}
|
|
697
|
-
sending(e) {
|
|
698
|
-
this.errors = [];
|
|
699
|
-
}
|
|
700
|
-
reset(e) { }
|
|
701
|
-
deleteFile(file) {
|
|
702
|
-
this.currentFiles = this.currentFiles.filter((x) => x.name !== file.name && x.size !== file.size);
|
|
703
|
-
this.errors = [];
|
|
704
|
-
this.fileDeleted.emit();
|
|
705
|
-
}
|
|
706
|
-
setConfiguration() {
|
|
707
|
-
this.label = (this.isArabicForm ? 'رفع ' : 'Upload ') + this.label;
|
|
708
|
-
this.config = {
|
|
709
|
-
url: this.apiUrl,
|
|
710
|
-
method: this.method,
|
|
711
|
-
headers: {
|
|
712
|
-
Authorization: 'Bearer ' + this.authorization,
|
|
713
|
-
},
|
|
714
|
-
maxFilesize: this.maxFileSize,
|
|
715
|
-
maxFiles: this.multiple,
|
|
716
|
-
uploadMultiple: this.multiple > 1,
|
|
717
|
-
dictInvalidFileType: this.isArabicForm
|
|
718
|
-
? 'صيغة الملف غير مسموح بها'
|
|
719
|
-
: 'the file format is not allowed',
|
|
720
|
-
dictFileTooBig: this.isArabicForm
|
|
721
|
-
? 'الحجم تجاوز الحد المسموح'
|
|
722
|
-
: `the file size must be less than or equal (${this.maxFileSize}) MB`,
|
|
723
|
-
dictMaxFilesExceeded: this.isArabicForm
|
|
724
|
-
? 'الرجاء حذف الملفات الموجودة حاليا لتتمكن من رفع هذا الملف'
|
|
725
|
-
: 'Please delete existing files to be able to upload this file',
|
|
726
|
-
acceptedFiles: this.acceptedFiles,
|
|
727
|
-
autoProcessQueue: this.autoUpload,
|
|
728
|
-
previewTemplate: '<span></span>',
|
|
729
|
-
dictRemoveFile: '',
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
736
|
-
type: Component,
|
|
737
|
-
args: [{ selector: 'ipa-file-upload', template: "<div class=\"file-upload\">\r\n <div class=\"upload-overlay\" [dropzone]=\"config\" (error)=\"onUploadError($event)\"\r\n (queueComplete)=\"operationCompleted($event)\" (success)=\"onUploadSuccess($event)\" (dragenter)=\"dragEnter = true\"\r\n (dragLeave)=\"dragEnter = false\" (drop)=\"dragEnter = false\" (dragEnd)=\"dragEnter = false\"\r\n [class.active-border]=\"dragEnter\" (sending)=\"sending($event)\" (reset)=\"reset($event)\"\r\n (addedFile)=\"fileWasAdded($event)\">\r\n </div>\r\n <div class=\"upload-btn-wrapper\">\r\n <div>\r\n <div class=\"subtitle mb-2\">\r\n {{label}}\r\n <span *ngIf=\"required\" class=\"required\">*</span>\r\n </div>\r\n <hr>\r\n <span style=\"font-size: 12px;\">{{isArabicForm? '\u0642\u0645 \u0628\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0647\u0646\u0627' : 'drag or click here'}}</span>\r\n <i class=\"fas fa-upload upload-icon mr-2\"></i>\r\n </div>\r\n <div *ngIf=\"acceptedFiles.length > 0\" class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627:' : 'Allowed format:'}} \r\n <span class=\"extensions\">{{ acceptedFiles }}</span>\r\n </div>\r\n <div class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0642\u0635\u0649 \u062D\u062C\u0645 \u0644\u0644\u0645\u0631\u0641\u0642:' : 'Attachment Size:'}}\r\n <span class=\"extensions\">{{ maxFileSize }} MB</span>\r\n </div>\r\n </div>\r\n</div>\r\n<div id=\"attachment-status\" style=\"text-align: center; margin-top:10px;\">\r\n <span style=\"font-size: 14px; margin: auto; font-weight:bold;\" *ngFor=\"let file of currentFiles\">\r\n {{ file.name }} <i (click)=\"deleteFile(file)\" class=\"fas fa-trash\"\r\n style=\"color:firebrick; cursor: pointer;\"></i>\r\n <br>\r\n </span>\r\n <ul class=\"list-unstyled\">\r\n <li class=\"text-danger\" style=\"font-size: 12px;\" *ngFor=\"let error of errors\">{{error}}</li>\r\n </ul>\r\n</div>", styles: [".subtitle{border-bottom:none;display:block;line-height:2}.file-upload{border:dashed 1px #ccc;display:block;min-height:150px;border-radius:15px;width:350px;cursor:pointer;position:relative;margin:auto}.upload-overlay{position:absolute;width:100%;height:100%}.upload-btn-wrapper{text-align:center}.upload-icon{margin-right:5px}.list-unstyled{margin:10px!important;padding:14px!important;list-style:none}.allowed-extensions{color:#4d7297}.required{color:#dc3545;font-size:20px}\n"] }]
|
|
738
|
-
}], ctorParameters: function () { return [{ type: i1.ToastrService }]; }, propDecorators: { dropzoneDir: [{
|
|
739
|
-
type: ViewChild,
|
|
740
|
-
args: [DropzoneDirective, { static: false }]
|
|
741
|
-
}], isArabicForm: [{
|
|
742
|
-
type: Input
|
|
743
|
-
}], label: [{
|
|
744
|
-
type: Input
|
|
745
|
-
}], required: [{
|
|
746
|
-
type: Input
|
|
747
|
-
}], acceptedFiles: [{
|
|
748
|
-
type: Input
|
|
749
|
-
}], multiple: [{
|
|
750
|
-
type: Input
|
|
751
|
-
}], maxFileSize: [{
|
|
752
|
-
type: Input
|
|
753
|
-
}], method: [{
|
|
754
|
-
type: Input
|
|
755
|
-
}], autoUpload: [{
|
|
756
|
-
type: Input
|
|
757
|
-
}], apiUrl: [{
|
|
758
|
-
type: Input
|
|
759
|
-
}], authorization: [{
|
|
760
|
-
type: Input
|
|
761
|
-
}], successUpload: [{
|
|
762
|
-
type: Output
|
|
763
|
-
}], fileAdded: [{
|
|
764
|
-
type: Output
|
|
765
|
-
}], fileDeleted: [{
|
|
766
|
-
type: Output
|
|
634
|
+
class FileUploadComponent {
|
|
635
|
+
constructor(
|
|
636
|
+
// private authService: AuthService,
|
|
637
|
+
toastrService) {
|
|
638
|
+
this.toastrService = toastrService;
|
|
639
|
+
this.isArabicForm = true;
|
|
640
|
+
this.label = '';
|
|
641
|
+
this.required = false;
|
|
642
|
+
this.acceptedFiles = '';
|
|
643
|
+
this.multiple = 1; // set maxFiles (NOT uploadMultiple)in the config object,
|
|
644
|
+
this.maxFileSize = 2;
|
|
645
|
+
this.method = 'POST';
|
|
646
|
+
this.autoUpload = false;
|
|
647
|
+
this.apiUrl = 'apiUrl';
|
|
648
|
+
this.successUpload = new EventEmitter();
|
|
649
|
+
this.fileAdded = new EventEmitter();
|
|
650
|
+
this.fileDeleted = new EventEmitter();
|
|
651
|
+
this.dragEnter = false;
|
|
652
|
+
this.errors = [];
|
|
653
|
+
this.filesAdded = [];
|
|
654
|
+
this.currentFiles = [];
|
|
655
|
+
this.formControl = new UntypedFormControl('');
|
|
656
|
+
}
|
|
657
|
+
ngOnInit() {
|
|
658
|
+
this.setConfiguration();
|
|
659
|
+
}
|
|
660
|
+
operationCompleted(e) {
|
|
661
|
+
if (this.filesAdded.length > 0) {
|
|
662
|
+
this.successUpload.emit(this.filesAdded);
|
|
663
|
+
this.filesAdded = [];
|
|
664
|
+
}
|
|
665
|
+
this.dropzoneDir.reset();
|
|
666
|
+
}
|
|
667
|
+
onUploadSuccess(e) {
|
|
668
|
+
const file = e[0];
|
|
669
|
+
if (file.status === 'success') {
|
|
670
|
+
this.filesAdded.push(file);
|
|
671
|
+
}
|
|
672
|
+
const message = this.isArabicForm
|
|
673
|
+
? 'تم تحميل المرفقات بنجاح'
|
|
674
|
+
: 'Attachments uploaded successfully';
|
|
675
|
+
this.toastrService.success(message);
|
|
676
|
+
}
|
|
677
|
+
onUploadError(e) {
|
|
678
|
+
if (e[1]) {
|
|
679
|
+
this.errors = [];
|
|
680
|
+
this.errors.push(`${e[1]} (${e[0].name})`);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
fileWasAdded(e) {
|
|
684
|
+
const myDropzone = this.dropzoneDir.dropzone();
|
|
685
|
+
if (this.multiple === 1) {
|
|
686
|
+
this.currentFiles = [];
|
|
687
|
+
this.filesAdded = [];
|
|
688
|
+
this.errors = [];
|
|
689
|
+
const files = myDropzone.files;
|
|
690
|
+
if (files.length > 1) {
|
|
691
|
+
myDropzone.removeFile(files[0]);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
this.currentFiles.push(e);
|
|
695
|
+
this.fileAdded.emit(e);
|
|
696
|
+
}
|
|
697
|
+
sending(e) {
|
|
698
|
+
this.errors = [];
|
|
699
|
+
}
|
|
700
|
+
reset(e) { }
|
|
701
|
+
deleteFile(file) {
|
|
702
|
+
this.currentFiles = this.currentFiles.filter((x) => x.name !== file.name && x.size !== file.size);
|
|
703
|
+
this.errors = [];
|
|
704
|
+
this.fileDeleted.emit();
|
|
705
|
+
}
|
|
706
|
+
setConfiguration() {
|
|
707
|
+
this.label = (this.isArabicForm ? 'رفع ' : 'Upload ') + this.label;
|
|
708
|
+
this.config = {
|
|
709
|
+
url: this.apiUrl,
|
|
710
|
+
method: this.method,
|
|
711
|
+
headers: {
|
|
712
|
+
Authorization: 'Bearer ' + this.authorization,
|
|
713
|
+
},
|
|
714
|
+
maxFilesize: this.maxFileSize,
|
|
715
|
+
maxFiles: this.multiple,
|
|
716
|
+
uploadMultiple: this.multiple > 1,
|
|
717
|
+
dictInvalidFileType: this.isArabicForm
|
|
718
|
+
? 'صيغة الملف غير مسموح بها'
|
|
719
|
+
: 'the file format is not allowed',
|
|
720
|
+
dictFileTooBig: this.isArabicForm
|
|
721
|
+
? 'الحجم تجاوز الحد المسموح'
|
|
722
|
+
: `the file size must be less than or equal (${this.maxFileSize}) MB`,
|
|
723
|
+
dictMaxFilesExceeded: this.isArabicForm
|
|
724
|
+
? 'الرجاء حذف الملفات الموجودة حاليا لتتمكن من رفع هذا الملف'
|
|
725
|
+
: 'Please delete existing files to be able to upload this file',
|
|
726
|
+
acceptedFiles: this.acceptedFiles,
|
|
727
|
+
autoProcessQueue: this.autoUpload,
|
|
728
|
+
previewTemplate: '<span></span>',
|
|
729
|
+
dictRemoveFile: '',
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: FileUploadComponent, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
733
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: FileUploadComponent, selector: "ipa-file-upload", inputs: { isArabicForm: "isArabicForm", label: "label", required: "required", acceptedFiles: "acceptedFiles", multiple: "multiple", maxFileSize: "maxFileSize", method: "method", autoUpload: "autoUpload", apiUrl: "apiUrl", authorization: "authorization" }, outputs: { successUpload: "successUpload", fileAdded: "fileAdded", fileDeleted: "fileDeleted" }, viewQueries: [{ propertyName: "dropzoneDir", first: true, predicate: DropzoneDirective, descendants: true }], ngImport: i0, template: "<div class=\"file-upload\">\r\n <div class=\"upload-overlay\" [dropzone]=\"config\" (error)=\"onUploadError($event)\"\r\n (queueComplete)=\"operationCompleted($event)\" (success)=\"onUploadSuccess($event)\" (dragenter)=\"dragEnter = true\"\r\n (dragLeave)=\"dragEnter = false\" (drop)=\"dragEnter = false\" (dragEnd)=\"dragEnter = false\"\r\n [class.active-border]=\"dragEnter\" (sending)=\"sending($event)\" (reset)=\"reset($event)\"\r\n (addedFile)=\"fileWasAdded($event)\">\r\n </div>\r\n <div class=\"upload-btn-wrapper\">\r\n <div>\r\n <div class=\"subtitle mb-2\">\r\n {{label}}\r\n <span *ngIf=\"required\" class=\"required\">*</span>\r\n </div>\r\n <hr>\r\n <span style=\"font-size: 12px;\">{{isArabicForm? '\u0642\u0645 \u0628\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0647\u0646\u0627' : 'drag or click here'}}</span>\r\n <i class=\"fas fa-upload upload-icon mr-2\"></i>\r\n </div>\r\n <div *ngIf=\"acceptedFiles.length > 0\" class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627:' : 'Allowed format:'}} \r\n <span class=\"extensions\">{{ acceptedFiles }}</span>\r\n </div>\r\n <div class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0642\u0635\u0649 \u062D\u062C\u0645 \u0644\u0644\u0645\u0631\u0641\u0642:' : 'Attachment Size:'}}\r\n <span class=\"extensions\">{{ maxFileSize }} MB</span>\r\n </div>\r\n </div>\r\n</div>\r\n<div id=\"attachment-status\" style=\"text-align: center; margin-top:10px;\">\r\n <span style=\"font-size: 14px; margin: auto; font-weight:bold;\" *ngFor=\"let file of currentFiles\">\r\n {{ file.name }} <i (click)=\"deleteFile(file)\" class=\"fas fa-trash\"\r\n style=\"color:firebrick; cursor: pointer;\"></i>\r\n <br>\r\n </span>\r\n <ul class=\"list-unstyled\">\r\n <li class=\"text-danger\" style=\"font-size: 12px;\" *ngFor=\"let error of errors\">{{error}}</li>\r\n </ul>\r\n</div>", styles: [".subtitle{border-bottom:none;display:block;line-height:2}.file-upload{border:dashed 1px #ccc;display:block;min-height:150px;border-radius:15px;width:350px;cursor:pointer;position:relative;margin:auto}.upload-overlay{position:absolute;width:100%;height:100%}.upload-btn-wrapper{text-align:center}.upload-icon{margin-right:5px}.list-unstyled{margin:10px!important;padding:14px!important;list-style:none}.allowed-extensions{color:#4d7297}.required{color:#dc3545;font-size:20px}\n"], dependencies: [{ kind: "directive", type: i2$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DropzoneDirective, selector: "[dropzone]", inputs: ["disabled", "dropzone"], outputs: ["init", "error", "success", "sending", "canceled", "complete", "processing", "drop", "dragStart", "dragEnd", "dragEnter", "dragOver", "dragLeave", "thumbnail", "addedFile", "addedFiles", "removedFile", "uploadProgress", "maxFilesReached", "maxFilesExceeded", "errorMultiple", "successMultiple", "sendingMultiple", "canceledMultiple", "completeMultiple", "processingMultiple", "reset", "queueComplete", "totalUploadProgress"], exportAs: ["ngxDropzone"] }] }); }
|
|
734
|
+
}
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: FileUploadComponent, decorators: [{
|
|
736
|
+
type: Component,
|
|
737
|
+
args: [{ selector: 'ipa-file-upload', template: "<div class=\"file-upload\">\r\n <div class=\"upload-overlay\" [dropzone]=\"config\" (error)=\"onUploadError($event)\"\r\n (queueComplete)=\"operationCompleted($event)\" (success)=\"onUploadSuccess($event)\" (dragenter)=\"dragEnter = true\"\r\n (dragLeave)=\"dragEnter = false\" (drop)=\"dragEnter = false\" (dragEnd)=\"dragEnter = false\"\r\n [class.active-border]=\"dragEnter\" (sending)=\"sending($event)\" (reset)=\"reset($event)\"\r\n (addedFile)=\"fileWasAdded($event)\">\r\n </div>\r\n <div class=\"upload-btn-wrapper\">\r\n <div>\r\n <div class=\"subtitle mb-2\">\r\n {{label}}\r\n <span *ngIf=\"required\" class=\"required\">*</span>\r\n </div>\r\n <hr>\r\n <span style=\"font-size: 12px;\">{{isArabicForm? '\u0642\u0645 \u0628\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0647\u0646\u0627' : 'drag or click here'}}</span>\r\n <i class=\"fas fa-upload upload-icon mr-2\"></i>\r\n </div>\r\n <div *ngIf=\"acceptedFiles.length > 0\" class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627:' : 'Allowed format:'}} \r\n <span class=\"extensions\">{{ acceptedFiles }}</span>\r\n </div>\r\n <div class=\"allowed-extensions\">\r\n {{isArabicForm? '\u0627\u0642\u0635\u0649 \u062D\u062C\u0645 \u0644\u0644\u0645\u0631\u0641\u0642:' : 'Attachment Size:'}}\r\n <span class=\"extensions\">{{ maxFileSize }} MB</span>\r\n </div>\r\n </div>\r\n</div>\r\n<div id=\"attachment-status\" style=\"text-align: center; margin-top:10px;\">\r\n <span style=\"font-size: 14px; margin: auto; font-weight:bold;\" *ngFor=\"let file of currentFiles\">\r\n {{ file.name }} <i (click)=\"deleteFile(file)\" class=\"fas fa-trash\"\r\n style=\"color:firebrick; cursor: pointer;\"></i>\r\n <br>\r\n </span>\r\n <ul class=\"list-unstyled\">\r\n <li class=\"text-danger\" style=\"font-size: 12px;\" *ngFor=\"let error of errors\">{{error}}</li>\r\n </ul>\r\n</div>", styles: [".subtitle{border-bottom:none;display:block;line-height:2}.file-upload{border:dashed 1px #ccc;display:block;min-height:150px;border-radius:15px;width:350px;cursor:pointer;position:relative;margin:auto}.upload-overlay{position:absolute;width:100%;height:100%}.upload-btn-wrapper{text-align:center}.upload-icon{margin-right:5px}.list-unstyled{margin:10px!important;padding:14px!important;list-style:none}.allowed-extensions{color:#4d7297}.required{color:#dc3545;font-size:20px}\n"] }]
|
|
738
|
+
}], ctorParameters: function () { return [{ type: i1.ToastrService }]; }, propDecorators: { dropzoneDir: [{
|
|
739
|
+
type: ViewChild,
|
|
740
|
+
args: [DropzoneDirective, { static: false }]
|
|
741
|
+
}], isArabicForm: [{
|
|
742
|
+
type: Input
|
|
743
|
+
}], label: [{
|
|
744
|
+
type: Input
|
|
745
|
+
}], required: [{
|
|
746
|
+
type: Input
|
|
747
|
+
}], acceptedFiles: [{
|
|
748
|
+
type: Input
|
|
749
|
+
}], multiple: [{
|
|
750
|
+
type: Input
|
|
751
|
+
}], maxFileSize: [{
|
|
752
|
+
type: Input
|
|
753
|
+
}], method: [{
|
|
754
|
+
type: Input
|
|
755
|
+
}], autoUpload: [{
|
|
756
|
+
type: Input
|
|
757
|
+
}], apiUrl: [{
|
|
758
|
+
type: Input
|
|
759
|
+
}], authorization: [{
|
|
760
|
+
type: Input
|
|
761
|
+
}], successUpload: [{
|
|
762
|
+
type: Output
|
|
763
|
+
}], fileAdded: [{
|
|
764
|
+
type: Output
|
|
765
|
+
}], fileDeleted: [{
|
|
766
|
+
type: Output
|
|
767
767
|
}] } });
|
|
768
768
|
|
|
769
|
-
class RecaptchaComponent {
|
|
770
|
-
constructor(controlDir) {
|
|
771
|
-
this.controlDir = controlDir;
|
|
772
|
-
this.siteKey = '6LefJQYdAAAAAIlxmfkjNlWidMk8VukIZcs6lO5e';
|
|
773
|
-
this.recaptchaSize = 'normal';
|
|
774
|
-
this.lang = 'ar';
|
|
775
|
-
this.recaptchaType = 'image';
|
|
776
|
-
this.theme = 'light';
|
|
777
|
-
this.useGlobalDomain = true;
|
|
778
|
-
this.formControl = new UntypedFormControl('');
|
|
779
|
-
this.controlDir.valueAccessor = this;
|
|
780
|
-
}
|
|
781
|
-
ngOnInit() {
|
|
782
|
-
const control = this.controlDir.control;
|
|
783
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
784
|
-
control?.setValidators(validators);
|
|
785
|
-
control?.updateValueAndValidity();
|
|
786
|
-
this.formControl = control;
|
|
787
|
-
}
|
|
788
|
-
onChange(event) { }
|
|
789
|
-
onTouched() { }
|
|
790
|
-
writeValue(obj) { }
|
|
791
|
-
registerOnChange(fn) {
|
|
792
|
-
this.onChange = fn;
|
|
793
|
-
}
|
|
794
|
-
registerOnTouched(fn) {
|
|
795
|
-
this.onTouched = fn;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
801
|
-
type: Component,
|
|
802
|
-
args: [{ selector: 'ipa-recaptcha', template: "<ngx-recaptcha2 [siteKey]=\"siteKey\" [size]=\"recaptchaSize\" [hl]=\"lang\" [theme]=\"theme\" [type]=\"recaptchaType\"\n [useGlobalDomain]=\"useGlobalDomain\" [formControl]=\"formControl\">\n</ngx-recaptcha2>" }]
|
|
803
|
-
}], ctorParameters: function () { return [{ type: i2$1.NgControl, decorators: [{
|
|
804
|
-
type: Self
|
|
805
|
-
}] }]; }, propDecorators: { siteKey: [{
|
|
806
|
-
type: Input
|
|
807
|
-
}], recaptchaSize: [{
|
|
808
|
-
type: Input
|
|
809
|
-
}], lang: [{
|
|
810
|
-
type: Input
|
|
811
|
-
}], recaptchaType: [{
|
|
812
|
-
type: Input
|
|
813
|
-
}], theme: [{
|
|
814
|
-
type: Input
|
|
815
|
-
}], useGlobalDomain: [{
|
|
816
|
-
type: Input
|
|
769
|
+
class RecaptchaComponent {
|
|
770
|
+
constructor(controlDir) {
|
|
771
|
+
this.controlDir = controlDir;
|
|
772
|
+
this.siteKey = '6LefJQYdAAAAAIlxmfkjNlWidMk8VukIZcs6lO5e';
|
|
773
|
+
this.recaptchaSize = 'normal';
|
|
774
|
+
this.lang = 'ar';
|
|
775
|
+
this.recaptchaType = 'image';
|
|
776
|
+
this.theme = 'light';
|
|
777
|
+
this.useGlobalDomain = true;
|
|
778
|
+
this.formControl = new UntypedFormControl('');
|
|
779
|
+
this.controlDir.valueAccessor = this;
|
|
780
|
+
}
|
|
781
|
+
ngOnInit() {
|
|
782
|
+
const control = this.controlDir.control;
|
|
783
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
784
|
+
control?.setValidators(validators);
|
|
785
|
+
control?.updateValueAndValidity();
|
|
786
|
+
this.formControl = control;
|
|
787
|
+
}
|
|
788
|
+
onChange(event) { }
|
|
789
|
+
onTouched() { }
|
|
790
|
+
writeValue(obj) { }
|
|
791
|
+
registerOnChange(fn) {
|
|
792
|
+
this.onChange = fn;
|
|
793
|
+
}
|
|
794
|
+
registerOnTouched(fn) {
|
|
795
|
+
this.onTouched = fn;
|
|
796
|
+
}
|
|
797
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: RecaptchaComponent, deps: [{ token: i2$1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
798
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: RecaptchaComponent, selector: "ipa-recaptcha", inputs: { siteKey: "siteKey", recaptchaSize: "recaptchaSize", lang: "lang", recaptchaType: "recaptchaType", theme: "theme", useGlobalDomain: "useGlobalDomain" }, ngImport: i0, template: "<ngx-recaptcha2 [siteKey]=\"siteKey\" [size]=\"recaptchaSize\" [hl]=\"lang\" [theme]=\"theme\" [type]=\"recaptchaType\"\n [useGlobalDomain]=\"useGlobalDomain\" [formControl]=\"formControl\">\n</ngx-recaptcha2>", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2$3.ReCaptcha2Component, selector: "ngx-recaptcha2", inputs: ["theme", "size"] }] }); }
|
|
799
|
+
}
|
|
800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: RecaptchaComponent, decorators: [{
|
|
801
|
+
type: Component,
|
|
802
|
+
args: [{ selector: 'ipa-recaptcha', template: "<ngx-recaptcha2 [siteKey]=\"siteKey\" [size]=\"recaptchaSize\" [hl]=\"lang\" [theme]=\"theme\" [type]=\"recaptchaType\"\n [useGlobalDomain]=\"useGlobalDomain\" [formControl]=\"formControl\">\n</ngx-recaptcha2>" }]
|
|
803
|
+
}], ctorParameters: function () { return [{ type: i2$1.NgControl, decorators: [{
|
|
804
|
+
type: Self
|
|
805
|
+
}] }]; }, propDecorators: { siteKey: [{
|
|
806
|
+
type: Input
|
|
807
|
+
}], recaptchaSize: [{
|
|
808
|
+
type: Input
|
|
809
|
+
}], lang: [{
|
|
810
|
+
type: Input
|
|
811
|
+
}], recaptchaType: [{
|
|
812
|
+
type: Input
|
|
813
|
+
}], theme: [{
|
|
814
|
+
type: Input
|
|
815
|
+
}], useGlobalDomain: [{
|
|
816
|
+
type: Input
|
|
817
817
|
}] } });
|
|
818
818
|
|
|
819
|
-
class GenerateFormComponent {
|
|
820
|
-
constructor(validationService) {
|
|
821
|
-
this.validationService = validationService;
|
|
822
|
-
this.isArabicForm = true;
|
|
823
|
-
this.recaptchaSize = 'normal';
|
|
824
|
-
this.lang = 'ar';
|
|
825
|
-
this.recaptchaType = 'image';
|
|
826
|
-
this.theme = 'light';
|
|
827
|
-
this.useGlobalDomain = true;
|
|
828
|
-
// file upload outputs
|
|
829
|
-
this.successUpload = new EventEmitter();
|
|
830
|
-
this.fileAdded = new EventEmitter();
|
|
831
|
-
this.fileDeleted = new EventEmitter();
|
|
832
|
-
}
|
|
833
|
-
ngOnInit() {
|
|
834
|
-
this.changeDataValueForEngForm();
|
|
835
|
-
this.createForm();
|
|
836
|
-
}
|
|
837
|
-
getFormControls(formControlName) {
|
|
838
|
-
return this.generateForm.get('items' + formControlName);
|
|
839
|
-
}
|
|
840
|
-
getErrorMessage(formControlName) {
|
|
841
|
-
const formControl = this.generateForm.controls[formControlName];
|
|
842
|
-
this.errorMsg = this.validationService.getErrorMessage(formControl, '', this.isArabicForm);
|
|
843
|
-
return this.errorMsg;
|
|
844
|
-
}
|
|
845
|
-
SuccessUpload(event) {
|
|
846
|
-
this.successUpload.emit(event);
|
|
847
|
-
}
|
|
848
|
-
FileAdded(file, formControlName) {
|
|
849
|
-
this.generateForm.controls[formControlName].patchValue(file);
|
|
850
|
-
this.fileAdded.emit(file);
|
|
851
|
-
}
|
|
852
|
-
FileDeleted(event, formControlName) {
|
|
853
|
-
this.generateForm.controls[formControlName].patchValue(null);
|
|
854
|
-
this.fileDeleted.emit(event);
|
|
855
|
-
}
|
|
856
|
-
changeDataValueForEngForm() {
|
|
857
|
-
this.form.columns = this.form.columns.map((column) => {
|
|
858
|
-
return {
|
|
859
|
-
...column,
|
|
860
|
-
data: column.data?.map((item) => {
|
|
861
|
-
const value = item[column.textField];
|
|
862
|
-
return {
|
|
863
|
-
...item,
|
|
864
|
-
[column.textField]: this.isArabicForm
|
|
865
|
-
? value.split(',')[0]
|
|
866
|
-
: value.split(',')[1],
|
|
867
|
-
};
|
|
868
|
-
}),
|
|
869
|
-
};
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
createForm() {
|
|
873
|
-
this.form.columns.forEach((column) => {
|
|
874
|
-
if (column.type === 'checkbox') {
|
|
875
|
-
this.addCheckboxControl(column);
|
|
876
|
-
}
|
|
877
|
-
else {
|
|
878
|
-
this.generateForm.addControl(column.formControlName, new UntypedFormControl(column.type === 'file' && column.multipleFile > 1 ? [] : null, [
|
|
879
|
-
column.required ? Validators.required : Validators.nullValidator,
|
|
880
|
-
column.validationPattern
|
|
881
|
-
? Validators.pattern(column.validationPattern)
|
|
882
|
-
: Validators.nullValidator,
|
|
883
|
-
['select', 'radio', 'file', 'recaptcha'].indexOf(column.type) <=
|
|
884
|
-
-1
|
|
885
|
-
? Validators.maxLength(column.size)
|
|
886
|
-
: Validators.nullValidator,
|
|
887
|
-
column.type === 'number'
|
|
888
|
-
? Validators.min(1)
|
|
889
|
-
: Validators.nullValidator,
|
|
890
|
-
column.formControlName === 'email'
|
|
891
|
-
? IPAFormService.email
|
|
892
|
-
: Validators.nullValidator,
|
|
893
|
-
column.formControlName === 'mobileNo'
|
|
894
|
-
? IPAFormService.mobileNo
|
|
895
|
-
: Validators.nullValidator,
|
|
896
|
-
column.formControlName === 'userId'
|
|
897
|
-
? IPAFormService.checkID
|
|
898
|
-
: Validators.nullValidator,
|
|
899
|
-
]));
|
|
900
|
-
}
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
addCheckboxControl(column) {
|
|
904
|
-
let checkboxGroup = new UntypedFormArray(column.data.map((item) => {
|
|
905
|
-
return new UntypedFormGroup({
|
|
906
|
-
[column.valueField]: new UntypedFormControl(item[column.valueField]),
|
|
907
|
-
[column.textField]: new UntypedFormControl(item[column.textField]),
|
|
908
|
-
checkbox: new UntypedFormControl(false),
|
|
909
|
-
});
|
|
910
|
-
}));
|
|
911
|
-
this.generateForm.addControl(column.formControlName, new UntypedFormControl(null, column.required ? Validators.required : Validators.nullValidator));
|
|
912
|
-
this.generateForm.addControl('items' + column.formControlName, checkboxGroup);
|
|
913
|
-
checkboxGroup.valueChanges.subscribe((value) => {
|
|
914
|
-
let selectedItems = this.getCheckboxSelectedValues(value);
|
|
915
|
-
if (selectedItems) {
|
|
916
|
-
this.generateForm.controls[column.formControlName].patchValue(selectedItems.map((x) => x[column.textField]));
|
|
917
|
-
}
|
|
918
|
-
else {
|
|
919
|
-
this.generateForm.controls[column.formControlName].patchValue(null);
|
|
920
|
-
this.generateForm.controls[column.formControlName].markAsTouched();
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
getCheckboxSelectedValues(items) {
|
|
925
|
-
let selectedItems = items.filter((item) => item.checkbox);
|
|
926
|
-
return selectedItems.length > 0 ? selectedItems : null;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
GenerateFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: GenerateFormComponent, deps: [{ token: IPAFormService }], target: i0.ɵɵFactoryTarget.Component });
|
|
930
|
-
GenerateFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: GenerateFormComponent, selector: "ipa-generate-form", inputs: { generateForm: "generateForm", form: "form", isArabicForm: "isArabicForm", siteKey: "siteKey", recaptchaSize: "recaptchaSize", lang: "lang", recaptchaType: "recaptchaType", theme: "theme", useGlobalDomain: "useGlobalDomain" }, outputs: { successUpload: "successUpload", fileAdded: "fileAdded", fileDeleted: "fileDeleted" }, ngImport: i0, template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [items]=\"column.data!\"\r\n [valueField]=\"column.valueField!\" [textField]=\"column.textField!\" [required]=\"column.required\"\r\n [searchable]=\"column.searchable!\" [notFoundText]=\"column.notFoundText!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\" [fromGenerateForm]=\"true\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container [formArrayName]=\"'items'+ column.formControlName\"\r\n *ngFor=\"let control of getFormControls(column.formControlName).controls; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\" [formGroupName]=\"i\">\r\n <input [id]=\"column.formControlName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.formControlName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container *ngFor=\"let item of column.data; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\">\r\n <input [id]=\"column.formControlName+item[column.valueField!]\" class=\"form-check-input\"\r\n type=\"radio\" [formControlName]=\"column.formControlName\" [value]=\"item[column.textField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.formControlName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\" [class]=\"column.containerClasses\">\r\n <ipa-file-upload [isArabicForm]=\"isArabicForm\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [acceptedFiles]=\"column.acceptedFiles!\" [multiple]=\"column.multipleFile!\"\r\n [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\" [autoUpload]=\"column.autoUploadFile!\"\r\n [apiUrl]=\"column.apiUrl?? 'apiUrl' \" [authorization]=\"column.authorization!\" ngDefaultControl\r\n [formControlName]=\"column.formControlName\" (successUpload)=\"SuccessUpload($event)\"\r\n (fileAdded)=\"FileAdded($event, column.formControlName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.formControlName)\">\r\n </ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\" [class]=\"column.containerClasses\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"isArabicForm? 'ar':'en'\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.formControlName}}\">\r\n </ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [type]=\"column.type\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { 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.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { 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.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: TextInputComponent, selector: "ipa-text-input", inputs: ["id", "type", "placeholder", "label", "required", "patternErrorMsg", "onlyNumber", "pattern", "classes", "containerClasses", "isArabicForm"] }, { kind: "component", type: TextareaInputComponent, selector: "ipa-textarea-input", inputs: ["id", "placeholder", "label", "required", "patternErrorMsg", "pattern", "classes", "containerClasses", "isArabicForm"] }, { kind: "component", type: DropdownInputComponent, selector: "ipa-dropdown-input", inputs: ["id", "label", "items", "textField", "valueField", "required", "firstItemLabel", "searchable", "notFoundText", "classes", "containerClasses", "isArabicForm", "fromGenerateForm"] }, { kind: "component", type: FileUploadComponent, selector: "ipa-file-upload", inputs: ["isArabicForm", "label", "required", "acceptedFiles", "multiple", "maxFileSize", "method", "autoUpload", "apiUrl", "authorization"], outputs: ["successUpload", "fileAdded", "fileDeleted"] }, { kind: "component", type: RecaptchaComponent, selector: "ipa-recaptcha", inputs: ["siteKey", "recaptchaSize", "lang", "recaptchaType", "theme", "useGlobalDomain"] }] });
|
|
931
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
932
|
-
type: Component,
|
|
933
|
-
args: [{ selector: 'ipa-generate-form', template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [items]=\"column.data!\"\r\n [valueField]=\"column.valueField!\" [textField]=\"column.textField!\" [required]=\"column.required\"\r\n [searchable]=\"column.searchable!\" [notFoundText]=\"column.notFoundText!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\" [fromGenerateForm]=\"true\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container [formArrayName]=\"'items'+ column.formControlName\"\r\n *ngFor=\"let control of getFormControls(column.formControlName).controls; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\" [formGroupName]=\"i\">\r\n <input [id]=\"column.formControlName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.formControlName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container *ngFor=\"let item of column.data; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\">\r\n <input [id]=\"column.formControlName+item[column.valueField!]\" class=\"form-check-input\"\r\n type=\"radio\" [formControlName]=\"column.formControlName\" [value]=\"item[column.textField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.formControlName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\" [class]=\"column.containerClasses\">\r\n <ipa-file-upload [isArabicForm]=\"isArabicForm\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [acceptedFiles]=\"column.acceptedFiles!\" [multiple]=\"column.multipleFile!\"\r\n [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\" [autoUpload]=\"column.autoUploadFile!\"\r\n [apiUrl]=\"column.apiUrl?? 'apiUrl' \" [authorization]=\"column.authorization!\" ngDefaultControl\r\n [formControlName]=\"column.formControlName\" (successUpload)=\"SuccessUpload($event)\"\r\n (fileAdded)=\"FileAdded($event, column.formControlName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.formControlName)\">\r\n </ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\" [class]=\"column.containerClasses\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"isArabicForm? 'ar':'en'\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.formControlName}}\">\r\n </ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [type]=\"column.type\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>" }]
|
|
934
|
-
}], ctorParameters: function () { return [{ type: IPAFormService }]; }, propDecorators: { generateForm: [{
|
|
935
|
-
type: Input
|
|
936
|
-
}], form: [{
|
|
937
|
-
type: Input
|
|
938
|
-
}], isArabicForm: [{
|
|
939
|
-
type: Input
|
|
940
|
-
}], siteKey: [{
|
|
941
|
-
type: Input
|
|
942
|
-
}], recaptchaSize: [{
|
|
943
|
-
type: Input
|
|
944
|
-
}], lang: [{
|
|
945
|
-
type: Input
|
|
946
|
-
}], recaptchaType: [{
|
|
947
|
-
type: Input
|
|
948
|
-
}], theme: [{
|
|
949
|
-
type: Input
|
|
950
|
-
}], useGlobalDomain: [{
|
|
951
|
-
type: Input
|
|
952
|
-
}], successUpload: [{
|
|
953
|
-
type: Output
|
|
954
|
-
}], fileAdded: [{
|
|
955
|
-
type: Output
|
|
956
|
-
}], fileDeleted: [{
|
|
957
|
-
type: Output
|
|
819
|
+
class GenerateFormComponent {
|
|
820
|
+
constructor(validationService) {
|
|
821
|
+
this.validationService = validationService;
|
|
822
|
+
this.isArabicForm = true;
|
|
823
|
+
this.recaptchaSize = 'normal';
|
|
824
|
+
this.lang = 'ar';
|
|
825
|
+
this.recaptchaType = 'image';
|
|
826
|
+
this.theme = 'light';
|
|
827
|
+
this.useGlobalDomain = true;
|
|
828
|
+
// file upload outputs
|
|
829
|
+
this.successUpload = new EventEmitter();
|
|
830
|
+
this.fileAdded = new EventEmitter();
|
|
831
|
+
this.fileDeleted = new EventEmitter();
|
|
832
|
+
}
|
|
833
|
+
ngOnInit() {
|
|
834
|
+
this.changeDataValueForEngForm();
|
|
835
|
+
this.createForm();
|
|
836
|
+
}
|
|
837
|
+
getFormControls(formControlName) {
|
|
838
|
+
return this.generateForm.get('items' + formControlName);
|
|
839
|
+
}
|
|
840
|
+
getErrorMessage(formControlName) {
|
|
841
|
+
const formControl = this.generateForm.controls[formControlName];
|
|
842
|
+
this.errorMsg = this.validationService.getErrorMessage(formControl, '', this.isArabicForm);
|
|
843
|
+
return this.errorMsg;
|
|
844
|
+
}
|
|
845
|
+
SuccessUpload(event) {
|
|
846
|
+
this.successUpload.emit(event);
|
|
847
|
+
}
|
|
848
|
+
FileAdded(file, formControlName) {
|
|
849
|
+
this.generateForm.controls[formControlName].patchValue(file);
|
|
850
|
+
this.fileAdded.emit(file);
|
|
851
|
+
}
|
|
852
|
+
FileDeleted(event, formControlName) {
|
|
853
|
+
this.generateForm.controls[formControlName].patchValue(null);
|
|
854
|
+
this.fileDeleted.emit(event);
|
|
855
|
+
}
|
|
856
|
+
changeDataValueForEngForm() {
|
|
857
|
+
this.form.columns = this.form.columns.map((column) => {
|
|
858
|
+
return {
|
|
859
|
+
...column,
|
|
860
|
+
data: column.data?.map((item) => {
|
|
861
|
+
const value = item[column.textField];
|
|
862
|
+
return {
|
|
863
|
+
...item,
|
|
864
|
+
[column.textField]: this.isArabicForm
|
|
865
|
+
? value.split(',')[0]
|
|
866
|
+
: value.split(',')[1],
|
|
867
|
+
};
|
|
868
|
+
}),
|
|
869
|
+
};
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
createForm() {
|
|
873
|
+
this.form.columns.forEach((column) => {
|
|
874
|
+
if (column.type === 'checkbox') {
|
|
875
|
+
this.addCheckboxControl(column);
|
|
876
|
+
}
|
|
877
|
+
else {
|
|
878
|
+
this.generateForm.addControl(column.formControlName, new UntypedFormControl(column.type === 'file' && column.multipleFile > 1 ? [] : null, [
|
|
879
|
+
column.required ? Validators.required : Validators.nullValidator,
|
|
880
|
+
column.validationPattern
|
|
881
|
+
? Validators.pattern(column.validationPattern)
|
|
882
|
+
: Validators.nullValidator,
|
|
883
|
+
['select', 'radio', 'file', 'recaptcha'].indexOf(column.type) <=
|
|
884
|
+
-1
|
|
885
|
+
? Validators.maxLength(column.size)
|
|
886
|
+
: Validators.nullValidator,
|
|
887
|
+
column.type === 'number'
|
|
888
|
+
? Validators.min(1)
|
|
889
|
+
: Validators.nullValidator,
|
|
890
|
+
column.formControlName === 'email'
|
|
891
|
+
? IPAFormService.email
|
|
892
|
+
: Validators.nullValidator,
|
|
893
|
+
column.formControlName === 'mobileNo'
|
|
894
|
+
? IPAFormService.mobileNo
|
|
895
|
+
: Validators.nullValidator,
|
|
896
|
+
column.formControlName === 'userId'
|
|
897
|
+
? IPAFormService.checkID
|
|
898
|
+
: Validators.nullValidator,
|
|
899
|
+
]));
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
addCheckboxControl(column) {
|
|
904
|
+
let checkboxGroup = new UntypedFormArray(column.data.map((item) => {
|
|
905
|
+
return new UntypedFormGroup({
|
|
906
|
+
[column.valueField]: new UntypedFormControl(item[column.valueField]),
|
|
907
|
+
[column.textField]: new UntypedFormControl(item[column.textField]),
|
|
908
|
+
checkbox: new UntypedFormControl(false),
|
|
909
|
+
});
|
|
910
|
+
}));
|
|
911
|
+
this.generateForm.addControl(column.formControlName, new UntypedFormControl(null, column.required ? Validators.required : Validators.nullValidator));
|
|
912
|
+
this.generateForm.addControl('items' + column.formControlName, checkboxGroup);
|
|
913
|
+
checkboxGroup.valueChanges.subscribe((value) => {
|
|
914
|
+
let selectedItems = this.getCheckboxSelectedValues(value);
|
|
915
|
+
if (selectedItems) {
|
|
916
|
+
this.generateForm.controls[column.formControlName].patchValue(selectedItems.map((x) => x[column.textField]));
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
this.generateForm.controls[column.formControlName].patchValue(null);
|
|
920
|
+
this.generateForm.controls[column.formControlName].markAsTouched();
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
getCheckboxSelectedValues(items) {
|
|
925
|
+
let selectedItems = items.filter((item) => item.checkbox);
|
|
926
|
+
return selectedItems.length > 0 ? selectedItems : null;
|
|
927
|
+
}
|
|
928
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GenerateFormComponent, deps: [{ token: IPAFormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
929
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: GenerateFormComponent, selector: "ipa-generate-form", inputs: { generateForm: "generateForm", form: "form", isArabicForm: "isArabicForm", siteKey: "siteKey", recaptchaSize: "recaptchaSize", lang: "lang", recaptchaType: "recaptchaType", theme: "theme", useGlobalDomain: "useGlobalDomain" }, outputs: { successUpload: "successUpload", fileAdded: "fileAdded", fileDeleted: "fileDeleted" }, ngImport: i0, template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [items]=\"column.data!\"\r\n [valueField]=\"column.valueField!\" [textField]=\"column.textField!\" [required]=\"column.required\"\r\n [searchable]=\"column.searchable!\" [notFoundText]=\"column.notFoundText!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\" [fromGenerateForm]=\"true\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container [formArrayName]=\"'items'+ column.formControlName\"\r\n *ngFor=\"let control of getFormControls(column.formControlName).controls; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\" [formGroupName]=\"i\">\r\n <input [id]=\"column.formControlName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.formControlName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container *ngFor=\"let item of column.data; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\">\r\n <input [id]=\"column.formControlName+item[column.valueField!]\" class=\"form-check-input\"\r\n type=\"radio\" [formControlName]=\"column.formControlName\" [value]=\"item[column.textField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.formControlName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\" [class]=\"column.containerClasses\">\r\n <ipa-file-upload [isArabicForm]=\"isArabicForm\" [required]=\"column.required\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [acceptedFiles]=\"column.acceptedFiles!\" [multiple]=\"column.multipleFile!\"\r\n [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\" [autoUpload]=\"column.autoUploadFile!\"\r\n [apiUrl]=\"column.apiUrl?? 'apiUrl' \" [authorization]=\"column.authorization!\" ngDefaultControl\r\n [formControlName]=\"column.formControlName\" (successUpload)=\"SuccessUpload($event)\"\r\n (fileAdded)=\"FileAdded($event, column.formControlName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.formControlName)\">\r\n </ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\" [class]=\"column.containerClasses\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"isArabicForm? 'ar':'en'\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.formControlName}}\">\r\n </ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [type]=\"column.type\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { 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.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { 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.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: TextInputComponent, selector: "ipa-text-input", inputs: ["id", "type", "placeholder", "label", "required", "patternErrorMsg", "onlyNumber", "pattern", "classes", "containerClasses", "isArabicForm"] }, { kind: "component", type: TextareaInputComponent, selector: "ipa-textarea-input", inputs: ["id", "placeholder", "label", "required", "patternErrorMsg", "pattern", "classes", "containerClasses", "isArabicForm"] }, { kind: "component", type: DropdownInputComponent, selector: "ipa-dropdown-input", inputs: ["id", "label", "items", "textField", "valueField", "required", "firstItemLabel", "searchable", "notFoundText", "classes", "containerClasses", "isArabicForm", "fromGenerateForm"] }, { kind: "component", type: FileUploadComponent, selector: "ipa-file-upload", inputs: ["isArabicForm", "label", "required", "acceptedFiles", "multiple", "maxFileSize", "method", "autoUpload", "apiUrl", "authorization"], outputs: ["successUpload", "fileAdded", "fileDeleted"] }, { kind: "component", type: RecaptchaComponent, selector: "ipa-recaptcha", inputs: ["siteKey", "recaptchaSize", "lang", "recaptchaType", "theme", "useGlobalDomain"] }] }); }
|
|
930
|
+
}
|
|
931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GenerateFormComponent, decorators: [{
|
|
932
|
+
type: Component,
|
|
933
|
+
args: [{ selector: 'ipa-generate-form', template: "<form [formGroup]=\"generateForm\">\r\n <ng-container *ngFor=\"let column of form.columns\">\r\n <div [ngSwitch]=\"column.type\">\r\n <!-- TEXTAREA -->\r\n <div *ngSwitchCase=\"'textArea'\">\r\n <ipa-textarea-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-textarea-input>\r\n </div>\r\n\r\n <!-- DROP DOWN LIST -->\r\n <div *ngSwitchCase=\"'select'\">\r\n <ipa-dropdown-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\" [items]=\"column.data!\"\r\n [valueField]=\"column.valueField!\" [textField]=\"column.textField!\" [required]=\"column.required\"\r\n [searchable]=\"column.searchable!\" [notFoundText]=\"column.notFoundText!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\" [fromGenerateForm]=\"true\">\r\n </ipa-dropdown-input>\r\n </div>\r\n\r\n <!-- CHECKBOX -->\r\n <div *ngSwitchCase=\"'checkbox'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container [formArrayName]=\"'items'+ column.formControlName\"\r\n *ngFor=\"let control of getFormControls(column.formControlName).controls; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\" [formGroupName]=\"i\">\r\n <input [id]=\"column.formControlName+control.value[column.valueField!]\" class=\"form-check-input\"\r\n type=\"checkbox\" formControlName=\"checkbox\">\r\n <label class=\"form-check-label\"\r\n [for]=\"column.formControlName+control.value[column.valueField!]\">\r\n {{control.value[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- RADIO -->\r\n <div *ngSwitchCase=\"'radio'\" [class]=\"column.containerClasses\">\r\n <label>{{isArabicForm? column.arabicLabel : column.englishLabel}}</label>\r\n <ng-container *ngFor=\"let item of column.data; let i = index\">\r\n <div class=\"form-check {{column.inputClasses}}\">\r\n <input [id]=\"column.formControlName+item[column.valueField!]\" class=\"form-check-input\"\r\n type=\"radio\" [formControlName]=\"column.formControlName\" [value]=\"item[column.textField!]\">\r\n <label class=\"form-check-label\" [for]=\"column.formControlName+item[column.valueField!]\">\r\n {{item[column.textField!]}}\r\n </label>\r\n </div>\r\n </ng-container>\r\n <div class=\"invalid-feedback\" style=\"display: block !important;\"\r\n *ngIf=\"getErrorMessage(column.formControlName) !== null\">\r\n {{errorMsg}}\r\n </div>\r\n </div>\r\n\r\n <!-- FILE UPLOAD -->\r\n <div *ngSwitchCase=\"'file'\" [class]=\"column.containerClasses\">\r\n <ipa-file-upload [isArabicForm]=\"isArabicForm\" [required]=\"column.required\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [acceptedFiles]=\"column.acceptedFiles!\" [multiple]=\"column.multipleFile!\"\r\n [maxFileSize]=\"column.size!\" [method]=\"column.apiURlMethod!\" [autoUpload]=\"column.autoUploadFile!\"\r\n [apiUrl]=\"column.apiUrl?? 'apiUrl' \" [authorization]=\"column.authorization!\" ngDefaultControl\r\n [formControlName]=\"column.formControlName\" (successUpload)=\"SuccessUpload($event)\"\r\n (fileAdded)=\"FileAdded($event, column.formControlName)\"\r\n (fileDeleted)=\"FileDeleted($event, column.formControlName)\">\r\n </ipa-file-upload>\r\n </div>\r\n\r\n <!-- recaptcha -->\r\n <div *ngSwitchCase=\"'recaptcha'\" [class]=\"column.containerClasses\">\r\n <ipa-recaptcha [recaptchaSize]=\"recaptchaSize\" [lang]=\"isArabicForm? 'ar':'en'\" [theme]=\"theme\"\r\n [recaptchaType]=\"recaptchaType\" [useGlobalDomain]=\"useGlobalDomain\"\r\n formControlName=\"{{column.formControlName}}\">\r\n </ipa-recaptcha>\r\n </div>\r\n\r\n <!-- DEFAULT -->\r\n <div *ngSwitchDefault>\r\n <ipa-text-input [formControlName]=\"column.formControlName\" [id]=\"column.formControlName\"\r\n [type]=\"column.type\" [label]=\"isArabicForm? column.arabicLabel : column.englishLabel\"\r\n [required]=\"column.required\"\r\n [patternErrorMsg]=\"isArabicForm? column.patternArErrorMsg! : column.patternEnErrorMsg!\"\r\n [classes]=\"column.inputClasses!\" [containerClasses]=\"column.containerClasses!\"\r\n [isArabicForm]=\"isArabicForm\">\r\n </ipa-text-input>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</form>" }]
|
|
934
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }]; }, propDecorators: { generateForm: [{
|
|
935
|
+
type: Input
|
|
936
|
+
}], form: [{
|
|
937
|
+
type: Input
|
|
938
|
+
}], isArabicForm: [{
|
|
939
|
+
type: Input
|
|
940
|
+
}], siteKey: [{
|
|
941
|
+
type: Input
|
|
942
|
+
}], recaptchaSize: [{
|
|
943
|
+
type: Input
|
|
944
|
+
}], lang: [{
|
|
945
|
+
type: Input
|
|
946
|
+
}], recaptchaType: [{
|
|
947
|
+
type: Input
|
|
948
|
+
}], theme: [{
|
|
949
|
+
type: Input
|
|
950
|
+
}], useGlobalDomain: [{
|
|
951
|
+
type: Input
|
|
952
|
+
}], successUpload: [{
|
|
953
|
+
type: Output
|
|
954
|
+
}], fileAdded: [{
|
|
955
|
+
type: Output
|
|
956
|
+
}], fileDeleted: [{
|
|
957
|
+
type: Output
|
|
958
958
|
}] } });
|
|
959
959
|
|
|
960
|
-
class DatepickerComponent {
|
|
961
|
-
constructor(ipaFormService, calendar, controlDir, config, cd) {
|
|
962
|
-
this.ipaFormService = ipaFormService;
|
|
963
|
-
this.calendar = calendar;
|
|
964
|
-
this.controlDir = controlDir;
|
|
965
|
-
this.cd = cd;
|
|
966
|
-
this.label = 'datepicker';
|
|
967
|
-
this.patternErrorMsg = 'invalid pattern';
|
|
968
|
-
this.required = false;
|
|
969
|
-
this.isArabicForm = true;
|
|
970
|
-
this.today = this.calendar.getToday();
|
|
971
|
-
this.formControl = new UntypedFormControl('');
|
|
972
|
-
this.controlDir.valueAccessor = this;
|
|
973
|
-
config.container = null;
|
|
974
|
-
config.placement = 'bottom-center';
|
|
975
|
-
}
|
|
976
|
-
ngAfterContentChecked() {
|
|
977
|
-
this.cd.detectChanges();
|
|
978
|
-
}
|
|
979
|
-
ngOnInit() {
|
|
980
|
-
const control = this.controlDir.control;
|
|
981
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
982
|
-
if (this.isHijriDatepicker)
|
|
983
|
-
validators.push(IPAFormService.validHijriDate);
|
|
984
|
-
control?.setValidators(validators);
|
|
985
|
-
control?.updateValueAndValidity();
|
|
986
|
-
this.formControl = control;
|
|
987
|
-
}
|
|
988
|
-
onChange(event) { }
|
|
989
|
-
onTouched() { }
|
|
990
|
-
writeValue(obj) { }
|
|
991
|
-
registerOnChange(fn) {
|
|
992
|
-
this.onChange = fn;
|
|
993
|
-
}
|
|
994
|
-
registerOnTouched(fn) {
|
|
995
|
-
this.onTouched = fn;
|
|
996
|
-
}
|
|
997
|
-
openDatepicker(event) {
|
|
998
|
-
if (!this.datepicker.isOpen()) {
|
|
999
|
-
this.datepicker.toggle();
|
|
1000
|
-
event.preventDefault();
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
this.datepicker.close();
|
|
1004
|
-
}
|
|
1005
|
-
get errorMessage() {
|
|
1006
|
-
this.errorMsg = this.ipaFormService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
1007
|
-
return this.errorMsg;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1013
|
-
type: Component,
|
|
1014
|
-
args: [{ selector: 'ipa-datepicker', template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1015
|
-
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2.NgbCalendar }, { type: i2$1.NgControl, decorators: [{
|
|
1016
|
-
type: Self
|
|
1017
|
-
}] }, { type: i2.NgbInputDatepickerConfig }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { datepicker: [{
|
|
1018
|
-
type: ViewChild,
|
|
1019
|
-
args: ['d']
|
|
1020
|
-
}], id: [{
|
|
1021
|
-
type: Input
|
|
1022
|
-
}], label: [{
|
|
1023
|
-
type: Input
|
|
1024
|
-
}], patternErrorMsg: [{
|
|
1025
|
-
type: Input
|
|
1026
|
-
}], required: [{
|
|
1027
|
-
type: Input
|
|
1028
|
-
}], maxDate: [{
|
|
1029
|
-
type: Input
|
|
1030
|
-
}], minDate: [{
|
|
1031
|
-
type: Input
|
|
1032
|
-
}], classes: [{
|
|
1033
|
-
type: Input
|
|
1034
|
-
}], containerClasses: [{
|
|
1035
|
-
type: Input
|
|
1036
|
-
}], isArabicForm: [{
|
|
1037
|
-
type: Input
|
|
960
|
+
class DatepickerComponent {
|
|
961
|
+
constructor(ipaFormService, calendar, controlDir, config, cd) {
|
|
962
|
+
this.ipaFormService = ipaFormService;
|
|
963
|
+
this.calendar = calendar;
|
|
964
|
+
this.controlDir = controlDir;
|
|
965
|
+
this.cd = cd;
|
|
966
|
+
this.label = 'datepicker';
|
|
967
|
+
this.patternErrorMsg = 'invalid pattern';
|
|
968
|
+
this.required = false;
|
|
969
|
+
this.isArabicForm = true;
|
|
970
|
+
this.today = this.calendar.getToday();
|
|
971
|
+
this.formControl = new UntypedFormControl('');
|
|
972
|
+
this.controlDir.valueAccessor = this;
|
|
973
|
+
config.container = null;
|
|
974
|
+
config.placement = 'bottom-center';
|
|
975
|
+
}
|
|
976
|
+
ngAfterContentChecked() {
|
|
977
|
+
this.cd.detectChanges();
|
|
978
|
+
}
|
|
979
|
+
ngOnInit() {
|
|
980
|
+
const control = this.controlDir.control;
|
|
981
|
+
const validators = control?.validator ? [control.validator] : [];
|
|
982
|
+
if (this.isHijriDatepicker)
|
|
983
|
+
validators.push(IPAFormService.validHijriDate);
|
|
984
|
+
control?.setValidators(validators);
|
|
985
|
+
control?.updateValueAndValidity();
|
|
986
|
+
this.formControl = control;
|
|
987
|
+
}
|
|
988
|
+
onChange(event) { }
|
|
989
|
+
onTouched() { }
|
|
990
|
+
writeValue(obj) { }
|
|
991
|
+
registerOnChange(fn) {
|
|
992
|
+
this.onChange = fn;
|
|
993
|
+
}
|
|
994
|
+
registerOnTouched(fn) {
|
|
995
|
+
this.onTouched = fn;
|
|
996
|
+
}
|
|
997
|
+
openDatepicker(event) {
|
|
998
|
+
if (!this.datepicker.isOpen()) {
|
|
999
|
+
this.datepicker.toggle();
|
|
1000
|
+
event.preventDefault();
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
this.datepicker.close();
|
|
1004
|
+
}
|
|
1005
|
+
get errorMessage() {
|
|
1006
|
+
this.errorMsg = this.ipaFormService.getErrorMessage(this.formControl, this.patternErrorMsg, this.isArabicForm);
|
|
1007
|
+
return this.errorMsg;
|
|
1008
|
+
}
|
|
1009
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: DatepickerComponent, deps: [{ token: IPAFormService }, { token: i2.NgbCalendar }, { token: i2$1.NgControl, self: true }, { token: i2.NgbInputDatepickerConfig }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1010
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: DatepickerComponent, selector: "ipa-datepicker", inputs: { id: "id", label: "label", patternErrorMsg: "patternErrorMsg", required: "required", maxDate: "maxDate", minDate: "minDate", classes: "classes", containerClasses: "containerClasses", isArabicForm: "isArabicForm" }, viewQueries: [{ propertyName: "datepicker", first: true, predicate: ["d"], descendants: true }], ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }] }); }
|
|
1011
|
+
}
|
|
1012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
1013
|
+
type: Component,
|
|
1014
|
+
args: [{ selector: 'ipa-datepicker', template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1015
|
+
}], ctorParameters: function () { return [{ type: IPAFormService }, { type: i2.NgbCalendar }, { type: i2$1.NgControl, decorators: [{
|
|
1016
|
+
type: Self
|
|
1017
|
+
}] }, { type: i2.NgbInputDatepickerConfig }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { datepicker: [{
|
|
1018
|
+
type: ViewChild,
|
|
1019
|
+
args: ['d']
|
|
1020
|
+
}], id: [{
|
|
1021
|
+
type: Input
|
|
1022
|
+
}], label: [{
|
|
1023
|
+
type: Input
|
|
1024
|
+
}], patternErrorMsg: [{
|
|
1025
|
+
type: Input
|
|
1026
|
+
}], required: [{
|
|
1027
|
+
type: Input
|
|
1028
|
+
}], maxDate: [{
|
|
1029
|
+
type: Input
|
|
1030
|
+
}], minDate: [{
|
|
1031
|
+
type: Input
|
|
1032
|
+
}], classes: [{
|
|
1033
|
+
type: Input
|
|
1034
|
+
}], containerClasses: [{
|
|
1035
|
+
type: Input
|
|
1036
|
+
}], isArabicForm: [{
|
|
1037
|
+
type: Input
|
|
1038
1038
|
}] } });
|
|
1039
1039
|
|
|
1040
|
-
const WEEKDAYS$1 = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
1041
|
-
const MONTHS$1 = [
|
|
1042
|
-
'محرم',
|
|
1043
|
-
'صفر',
|
|
1044
|
-
'ربيع الأول',
|
|
1045
|
-
'ربيع الآخر',
|
|
1046
|
-
'جمادى الأولى',
|
|
1047
|
-
'جمادى الآخرة',
|
|
1048
|
-
'رجب',
|
|
1049
|
-
'شعبان',
|
|
1050
|
-
'رمضان',
|
|
1051
|
-
'شوال',
|
|
1052
|
-
'ذو القعدة',
|
|
1053
|
-
'ذو الحجة',
|
|
1054
|
-
];
|
|
1055
|
-
class IslamicI18n extends NgbDatepickerI18n {
|
|
1056
|
-
getMonthShortName(month) {
|
|
1057
|
-
return MONTHS$1[month - 1];
|
|
1058
|
-
}
|
|
1059
|
-
getMonthFullName(month) {
|
|
1060
|
-
return MONTHS$1[month - 1];
|
|
1061
|
-
}
|
|
1062
|
-
getWeekdayLabel(weekday, width) {
|
|
1063
|
-
return WEEKDAYS$1[weekday - 1];
|
|
1064
|
-
}
|
|
1065
|
-
getDayAriaLabel(date) {
|
|
1066
|
-
return `${date.day}-${date.month}-${date.year}`;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1072
|
-
type: Injectable
|
|
1040
|
+
const WEEKDAYS$1 = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
1041
|
+
const MONTHS$1 = [
|
|
1042
|
+
'محرم',
|
|
1043
|
+
'صفر',
|
|
1044
|
+
'ربيع الأول',
|
|
1045
|
+
'ربيع الآخر',
|
|
1046
|
+
'جمادى الأولى',
|
|
1047
|
+
'جمادى الآخرة',
|
|
1048
|
+
'رجب',
|
|
1049
|
+
'شعبان',
|
|
1050
|
+
'رمضان',
|
|
1051
|
+
'شوال',
|
|
1052
|
+
'ذو القعدة',
|
|
1053
|
+
'ذو الحجة',
|
|
1054
|
+
];
|
|
1055
|
+
class IslamicI18n extends NgbDatepickerI18n {
|
|
1056
|
+
getMonthShortName(month) {
|
|
1057
|
+
return MONTHS$1[month - 1];
|
|
1058
|
+
}
|
|
1059
|
+
getMonthFullName(month) {
|
|
1060
|
+
return MONTHS$1[month - 1];
|
|
1061
|
+
}
|
|
1062
|
+
getWeekdayLabel(weekday, width) {
|
|
1063
|
+
return WEEKDAYS$1[weekday - 1];
|
|
1064
|
+
}
|
|
1065
|
+
getDayAriaLabel(date) {
|
|
1066
|
+
return `${date.day}-${date.month}-${date.year}`;
|
|
1067
|
+
}
|
|
1068
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IslamicI18n, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1069
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IslamicI18n }); }
|
|
1070
|
+
}
|
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: IslamicI18n, decorators: [{
|
|
1072
|
+
type: Injectable
|
|
1073
1073
|
}] });
|
|
1074
1074
|
|
|
1075
|
-
class HijriDatepickerComponent extends DatepickerComponent {
|
|
1076
|
-
constructor() {
|
|
1077
|
-
super(...arguments);
|
|
1078
|
-
this.isHijriDatepicker = true;
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
{
|
|
1085
|
-
|
|
1086
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1087
|
-
type: Component,
|
|
1088
|
-
args: [{ selector: 'ipa-hijri-datepicker', providers: [
|
|
1089
|
-
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
1090
|
-
{ provide: NgbDatepickerI18n, useClass: IslamicI18n },
|
|
1091
|
-
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1075
|
+
class HijriDatepickerComponent extends DatepickerComponent {
|
|
1076
|
+
constructor() {
|
|
1077
|
+
super(...arguments);
|
|
1078
|
+
this.isHijriDatepicker = true;
|
|
1079
|
+
}
|
|
1080
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: HijriDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1081
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: HijriDatepickerComponent, selector: "ipa-hijri-datepicker", providers: [
|
|
1082
|
+
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
1083
|
+
{ provide: NgbDatepickerI18n, useClass: IslamicI18n },
|
|
1084
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }] }); }
|
|
1085
|
+
}
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: HijriDatepickerComponent, decorators: [{
|
|
1087
|
+
type: Component,
|
|
1088
|
+
args: [{ selector: 'ipa-hijri-datepicker', providers: [
|
|
1089
|
+
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
1090
|
+
{ provide: NgbDatepickerI18n, useClass: IslamicI18n },
|
|
1091
|
+
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1092
1092
|
}] });
|
|
1093
1093
|
|
|
1094
|
-
const WEEKDAYS = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
1095
|
-
const MONTHS = [
|
|
1096
|
-
'يناير',
|
|
1097
|
-
'فبراير',
|
|
1098
|
-
'مارس',
|
|
1099
|
-
'أبريل',
|
|
1100
|
-
'مايو',
|
|
1101
|
-
'يونيو',
|
|
1102
|
-
'يوليو',
|
|
1103
|
-
'اغسطس',
|
|
1104
|
-
'سبتمبر',
|
|
1105
|
-
'أكتوبر',
|
|
1106
|
-
'نوفمبر',
|
|
1107
|
-
'ديسمبر',
|
|
1108
|
-
];
|
|
1109
|
-
class Gregorian18n extends NgbDatepickerI18n {
|
|
1110
|
-
getMonthShortName(month) {
|
|
1111
|
-
return MONTHS[month - 1];
|
|
1112
|
-
}
|
|
1113
|
-
getMonthFullName(month) {
|
|
1114
|
-
return MONTHS[month - 1];
|
|
1115
|
-
}
|
|
1116
|
-
getWeekdayLabel(weekday, width) {
|
|
1117
|
-
return WEEKDAYS[weekday - 1];
|
|
1118
|
-
}
|
|
1119
|
-
getDayAriaLabel(date) {
|
|
1120
|
-
return `${date.day}-${date.month}-${date.year}`;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1126
|
-
type: Injectable
|
|
1094
|
+
const WEEKDAYS = ['ن', 'ث', 'ر', 'خ', 'ج', 'س', 'ح'];
|
|
1095
|
+
const MONTHS = [
|
|
1096
|
+
'يناير',
|
|
1097
|
+
'فبراير',
|
|
1098
|
+
'مارس',
|
|
1099
|
+
'أبريل',
|
|
1100
|
+
'مايو',
|
|
1101
|
+
'يونيو',
|
|
1102
|
+
'يوليو',
|
|
1103
|
+
'اغسطس',
|
|
1104
|
+
'سبتمبر',
|
|
1105
|
+
'أكتوبر',
|
|
1106
|
+
'نوفمبر',
|
|
1107
|
+
'ديسمبر',
|
|
1108
|
+
];
|
|
1109
|
+
class Gregorian18n extends NgbDatepickerI18n {
|
|
1110
|
+
getMonthShortName(month) {
|
|
1111
|
+
return MONTHS[month - 1];
|
|
1112
|
+
}
|
|
1113
|
+
getMonthFullName(month) {
|
|
1114
|
+
return MONTHS[month - 1];
|
|
1115
|
+
}
|
|
1116
|
+
getWeekdayLabel(weekday, width) {
|
|
1117
|
+
return WEEKDAYS[weekday - 1];
|
|
1118
|
+
}
|
|
1119
|
+
getDayAriaLabel(date) {
|
|
1120
|
+
return `${date.day}-${date.month}-${date.year}`;
|
|
1121
|
+
}
|
|
1122
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Gregorian18n, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1123
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Gregorian18n }); }
|
|
1124
|
+
}
|
|
1125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Gregorian18n, decorators: [{
|
|
1126
|
+
type: Injectable
|
|
1127
1127
|
}] });
|
|
1128
1128
|
|
|
1129
|
-
class GregorianDatepickerComponent extends DatepickerComponent {
|
|
1130
|
-
constructor() {
|
|
1131
|
-
super(...arguments);
|
|
1132
|
-
this.isHijriDatepicker = false;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
{
|
|
1139
|
-
|
|
1140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1141
|
-
type: Component,
|
|
1142
|
-
args: [{ selector: 'ipa-gregorian-datepicker', providers: [
|
|
1143
|
-
{ provide: NgbCalendar, useClass: NgbCalendarGregorian },
|
|
1144
|
-
{ provide: NgbDatepickerI18n, useClass: Gregorian18n },
|
|
1145
|
-
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1129
|
+
class GregorianDatepickerComponent extends DatepickerComponent {
|
|
1130
|
+
constructor() {
|
|
1131
|
+
super(...arguments);
|
|
1132
|
+
this.isHijriDatepicker = false;
|
|
1133
|
+
}
|
|
1134
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GregorianDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1135
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: GregorianDatepickerComponent, selector: "ipa-gregorian-datepicker", providers: [
|
|
1136
|
+
{ provide: NgbCalendar, useClass: NgbCalendarGregorian },
|
|
1137
|
+
{ provide: NgbDatepickerI18n, useClass: Gregorian18n },
|
|
1138
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], dependencies: [{ kind: "directive", type: i2$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "contentTemplate", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }] }); }
|
|
1139
|
+
}
|
|
1140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GregorianDatepickerComponent, decorators: [{
|
|
1141
|
+
type: Component,
|
|
1142
|
+
args: [{ selector: 'ipa-gregorian-datepicker', providers: [
|
|
1143
|
+
{ provide: NgbCalendar, useClass: NgbCalendarGregorian },
|
|
1144
|
+
{ provide: NgbDatepickerI18n, useClass: Gregorian18n },
|
|
1145
|
+
], template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker\r\n #d=\"ngbDatepicker\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\"\r\n [required]=\"required\" style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\"\r\n placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\">{{label}}</label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
1146
1146
|
}] });
|
|
1147
1147
|
|
|
1148
|
-
class ShareButtonComponent {
|
|
1149
|
-
constructor() {
|
|
1150
|
-
this.title = '';
|
|
1151
|
-
this.description = '';
|
|
1152
|
-
this.btnLabel = '';
|
|
1153
|
-
}
|
|
1154
|
-
ngAfterViewInit() {
|
|
1155
|
-
const elements = document.getElementsByClassName('sb-show-icon');
|
|
1156
|
-
if (!elements[0].getAttribute('id')) {
|
|
1157
|
-
elements[0].setAttribute('type', 'button');
|
|
1158
|
-
elements[0].setAttribute('id', 'IPAShareBtn');
|
|
1159
|
-
const label = document.createElement('label');
|
|
1160
|
-
label.innerHTML = this.btnLabel;
|
|
1161
|
-
label.classList.add('sm-share-title');
|
|
1162
|
-
label.classList.add('me-1');
|
|
1163
|
-
elements[0].before(label);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1170
|
-
type: Component,
|
|
1171
|
-
args: [{ selector: 'ipa-share-button', template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>" }]
|
|
1172
|
-
}], ctorParameters: function () { return []; }, propDecorators: { title: [{
|
|
1173
|
-
type: Input
|
|
1174
|
-
}], description: [{
|
|
1175
|
-
type: Input
|
|
1176
|
-
}], btnLabel: [{
|
|
1177
|
-
type: Input
|
|
1148
|
+
class ShareButtonComponent {
|
|
1149
|
+
constructor() {
|
|
1150
|
+
this.title = '';
|
|
1151
|
+
this.description = '';
|
|
1152
|
+
this.btnLabel = '';
|
|
1153
|
+
}
|
|
1154
|
+
ngAfterViewInit() {
|
|
1155
|
+
const elements = document.getElementsByClassName('sb-show-icon');
|
|
1156
|
+
if (!elements[0].getAttribute('id')) {
|
|
1157
|
+
elements[0].setAttribute('type', 'button');
|
|
1158
|
+
elements[0].setAttribute('id', 'IPAShareBtn');
|
|
1159
|
+
const label = document.createElement('label');
|
|
1160
|
+
label.innerHTML = this.btnLabel;
|
|
1161
|
+
label.classList.add('sm-share-title');
|
|
1162
|
+
label.classList.add('me-1');
|
|
1163
|
+
elements[0].before(label);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1167
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: ShareButtonComponent, selector: "ipa-share-button", inputs: { title: "title", description: "description", btnLabel: "btnLabel" }, ngImport: i0, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>", styles: [""], dependencies: [{ kind: "component", type: i1$1.SharePopupComponent, selector: "share-popup-button", inputs: ["theme", "icon", "text", "include", "exclude", "closeIcon", "url", "title", "description", "image", "tags", "autoSetMeta", "show", "showIcon", "showText", "disabled", "hasBackdrop", "backdropClass"], outputs: ["opened", "closed", "popupClosed"] }] }); }
|
|
1168
|
+
}
|
|
1169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonComponent, decorators: [{
|
|
1170
|
+
type: Component,
|
|
1171
|
+
args: [{ selector: 'ipa-share-button', template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>" }]
|
|
1172
|
+
}], ctorParameters: function () { return []; }, propDecorators: { title: [{
|
|
1173
|
+
type: Input
|
|
1174
|
+
}], description: [{
|
|
1175
|
+
type: Input
|
|
1176
|
+
}], btnLabel: [{
|
|
1177
|
+
type: Input
|
|
1178
1178
|
}] } });
|
|
1179
1179
|
|
|
1180
|
-
class ShareButtonModule {
|
|
1181
|
-
constructor(library) {
|
|
1182
|
-
library.addIconPacks(fas);
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1202
|
-
type: NgModule,
|
|
1203
|
-
args: [{
|
|
1204
|
-
declarations: [ShareButtonComponent],
|
|
1205
|
-
imports: [
|
|
1206
|
-
ShareIconsModule,
|
|
1207
|
-
ShareButtonsPopupModule,
|
|
1208
|
-
OverlayModule,
|
|
1209
|
-
FontAwesomeModule,
|
|
1210
|
-
],
|
|
1211
|
-
exports: [
|
|
1212
|
-
ShareButtonComponent,
|
|
1213
|
-
ShareIconsModule,
|
|
1214
|
-
ShareButtonsPopupModule,
|
|
1215
|
-
OverlayModule,
|
|
1216
|
-
FontAwesomeModule,
|
|
1217
|
-
]
|
|
1218
|
-
}]
|
|
1180
|
+
class ShareButtonModule {
|
|
1181
|
+
constructor(library) {
|
|
1182
|
+
library.addIconPacks(fas);
|
|
1183
|
+
}
|
|
1184
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonModule, deps: [{ token: i1$2.FaIconLibrary }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1185
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonModule, declarations: [ShareButtonComponent], imports: [ShareIconsModule,
|
|
1186
|
+
ShareButtonsPopupModule,
|
|
1187
|
+
OverlayModule,
|
|
1188
|
+
FontAwesomeModule], exports: [ShareButtonComponent,
|
|
1189
|
+
ShareIconsModule,
|
|
1190
|
+
ShareButtonsPopupModule,
|
|
1191
|
+
OverlayModule,
|
|
1192
|
+
FontAwesomeModule] }); }
|
|
1193
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonModule, imports: [ShareIconsModule,
|
|
1194
|
+
ShareButtonsPopupModule,
|
|
1195
|
+
OverlayModule,
|
|
1196
|
+
FontAwesomeModule, ShareIconsModule,
|
|
1197
|
+
ShareButtonsPopupModule,
|
|
1198
|
+
OverlayModule,
|
|
1199
|
+
FontAwesomeModule] }); }
|
|
1200
|
+
}
|
|
1201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ShareButtonModule, decorators: [{
|
|
1202
|
+
type: NgModule,
|
|
1203
|
+
args: [{
|
|
1204
|
+
declarations: [ShareButtonComponent],
|
|
1205
|
+
imports: [
|
|
1206
|
+
ShareIconsModule,
|
|
1207
|
+
ShareButtonsPopupModule,
|
|
1208
|
+
OverlayModule,
|
|
1209
|
+
FontAwesomeModule,
|
|
1210
|
+
],
|
|
1211
|
+
exports: [
|
|
1212
|
+
ShareButtonComponent,
|
|
1213
|
+
ShareIconsModule,
|
|
1214
|
+
ShareButtonsPopupModule,
|
|
1215
|
+
OverlayModule,
|
|
1216
|
+
FontAwesomeModule,
|
|
1217
|
+
]
|
|
1218
|
+
}]
|
|
1219
1219
|
}], ctorParameters: function () { return [{ type: i1$2.FaIconLibrary }]; } });
|
|
1220
1220
|
|
|
1221
|
-
class NgIPALibraryModule {
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1265
|
-
type: NgModule,
|
|
1266
|
-
args: [{
|
|
1267
|
-
declarations: [
|
|
1268
|
-
TextInputComponent,
|
|
1269
|
-
TextareaInputComponent,
|
|
1270
|
-
DropdownInputComponent,
|
|
1271
|
-
LoaderComponent,
|
|
1272
|
-
GenerateFormComponent,
|
|
1273
|
-
FileUploadComponent,
|
|
1274
|
-
DatepickerComponent,
|
|
1275
|
-
HijriDatepickerComponent,
|
|
1276
|
-
GregorianDatepickerComponent,
|
|
1277
|
-
RecaptchaComponent,
|
|
1278
|
-
],
|
|
1279
|
-
imports: [
|
|
1280
|
-
CommonModule,
|
|
1281
|
-
FormsModule,
|
|
1282
|
-
ReactiveFormsModule,
|
|
1283
|
-
ToastrModule,
|
|
1284
|
-
DropzoneModule,
|
|
1285
|
-
NgxCaptchaModule,
|
|
1286
|
-
PipesModule,
|
|
1287
|
-
NgbDatepickerModule,
|
|
1288
|
-
ShareButtonModule,
|
|
1289
|
-
NgSelectModule,
|
|
1290
|
-
],
|
|
1291
|
-
exports: [
|
|
1292
|
-
TextInputComponent,
|
|
1293
|
-
TextareaInputComponent,
|
|
1294
|
-
DropdownInputComponent,
|
|
1295
|
-
LoaderComponent,
|
|
1296
|
-
GenerateFormComponent,
|
|
1297
|
-
FileUploadComponent,
|
|
1298
|
-
PipesModule,
|
|
1299
|
-
HijriDatepickerComponent,
|
|
1300
|
-
GregorianDatepickerComponent,
|
|
1301
|
-
ShareButtonModule,
|
|
1302
|
-
RecaptchaComponent,
|
|
1303
|
-
],
|
|
1304
|
-
}]
|
|
1221
|
+
class NgIPALibraryModule {
|
|
1222
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgIPALibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1223
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: NgIPALibraryModule, declarations: [TextInputComponent,
|
|
1224
|
+
TextareaInputComponent,
|
|
1225
|
+
DropdownInputComponent,
|
|
1226
|
+
LoaderComponent,
|
|
1227
|
+
GenerateFormComponent,
|
|
1228
|
+
FileUploadComponent,
|
|
1229
|
+
DatepickerComponent,
|
|
1230
|
+
HijriDatepickerComponent,
|
|
1231
|
+
GregorianDatepickerComponent,
|
|
1232
|
+
RecaptchaComponent], imports: [CommonModule,
|
|
1233
|
+
FormsModule,
|
|
1234
|
+
ReactiveFormsModule,
|
|
1235
|
+
ToastrModule,
|
|
1236
|
+
DropzoneModule,
|
|
1237
|
+
NgxCaptchaModule,
|
|
1238
|
+
PipesModule,
|
|
1239
|
+
NgbDatepickerModule,
|
|
1240
|
+
ShareButtonModule,
|
|
1241
|
+
NgSelectModule], exports: [TextInputComponent,
|
|
1242
|
+
TextareaInputComponent,
|
|
1243
|
+
DropdownInputComponent,
|
|
1244
|
+
LoaderComponent,
|
|
1245
|
+
GenerateFormComponent,
|
|
1246
|
+
FileUploadComponent,
|
|
1247
|
+
PipesModule,
|
|
1248
|
+
HijriDatepickerComponent,
|
|
1249
|
+
GregorianDatepickerComponent,
|
|
1250
|
+
ShareButtonModule,
|
|
1251
|
+
RecaptchaComponent] }); }
|
|
1252
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgIPALibraryModule, imports: [CommonModule,
|
|
1253
|
+
FormsModule,
|
|
1254
|
+
ReactiveFormsModule,
|
|
1255
|
+
ToastrModule,
|
|
1256
|
+
DropzoneModule,
|
|
1257
|
+
NgxCaptchaModule,
|
|
1258
|
+
PipesModule,
|
|
1259
|
+
NgbDatepickerModule,
|
|
1260
|
+
ShareButtonModule,
|
|
1261
|
+
NgSelectModule, PipesModule,
|
|
1262
|
+
ShareButtonModule] }); }
|
|
1263
|
+
}
|
|
1264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgIPALibraryModule, decorators: [{
|
|
1265
|
+
type: NgModule,
|
|
1266
|
+
args: [{
|
|
1267
|
+
declarations: [
|
|
1268
|
+
TextInputComponent,
|
|
1269
|
+
TextareaInputComponent,
|
|
1270
|
+
DropdownInputComponent,
|
|
1271
|
+
LoaderComponent,
|
|
1272
|
+
GenerateFormComponent,
|
|
1273
|
+
FileUploadComponent,
|
|
1274
|
+
DatepickerComponent,
|
|
1275
|
+
HijriDatepickerComponent,
|
|
1276
|
+
GregorianDatepickerComponent,
|
|
1277
|
+
RecaptchaComponent,
|
|
1278
|
+
],
|
|
1279
|
+
imports: [
|
|
1280
|
+
CommonModule,
|
|
1281
|
+
FormsModule,
|
|
1282
|
+
ReactiveFormsModule,
|
|
1283
|
+
ToastrModule,
|
|
1284
|
+
DropzoneModule,
|
|
1285
|
+
NgxCaptchaModule,
|
|
1286
|
+
PipesModule,
|
|
1287
|
+
NgbDatepickerModule,
|
|
1288
|
+
ShareButtonModule,
|
|
1289
|
+
NgSelectModule,
|
|
1290
|
+
],
|
|
1291
|
+
exports: [
|
|
1292
|
+
TextInputComponent,
|
|
1293
|
+
TextareaInputComponent,
|
|
1294
|
+
DropdownInputComponent,
|
|
1295
|
+
LoaderComponent,
|
|
1296
|
+
GenerateFormComponent,
|
|
1297
|
+
FileUploadComponent,
|
|
1298
|
+
PipesModule,
|
|
1299
|
+
HijriDatepickerComponent,
|
|
1300
|
+
GregorianDatepickerComponent,
|
|
1301
|
+
ShareButtonModule,
|
|
1302
|
+
RecaptchaComponent,
|
|
1303
|
+
],
|
|
1304
|
+
}]
|
|
1305
1305
|
}] });
|
|
1306
1306
|
|
|
1307
|
-
class LoadingInterceptor {
|
|
1308
|
-
constructor(loaderService) {
|
|
1309
|
-
this.loaderService = loaderService;
|
|
1310
|
-
this.requests = [];
|
|
1311
|
-
}
|
|
1312
|
-
removeRequest(req) {
|
|
1313
|
-
const i = this.requests.indexOf(req);
|
|
1314
|
-
if (i >= 0) {
|
|
1315
|
-
this.requests.splice(i, 1);
|
|
1316
|
-
}
|
|
1317
|
-
this.loaderService.isLoading.next(this.requests.length > 0);
|
|
1318
|
-
}
|
|
1319
|
-
intercept(req, next) {
|
|
1320
|
-
if (this.isException(req)) {
|
|
1321
|
-
return next.handle(req);
|
|
1322
|
-
}
|
|
1323
|
-
this.requests.push(req);
|
|
1324
|
-
this.loaderService.isLoading.next(true);
|
|
1325
|
-
return new Observable((observer) => {
|
|
1326
|
-
const subscription = next.handle(req).subscribe((event) => {
|
|
1327
|
-
if (event instanceof HttpResponse) {
|
|
1328
|
-
this.removeRequest(req);
|
|
1329
|
-
observer.next(event);
|
|
1330
|
-
}
|
|
1331
|
-
}, (err) => {
|
|
1332
|
-
this.removeRequest(req);
|
|
1333
|
-
observer.error(err);
|
|
1334
|
-
}, () => {
|
|
1335
|
-
this.removeRequest(req);
|
|
1336
|
-
observer.complete();
|
|
1337
|
-
});
|
|
1338
|
-
// remove request from queue when cancelled
|
|
1339
|
-
return () => {
|
|
1340
|
-
this.removeRequest(req);
|
|
1341
|
-
subscription.unsubscribe();
|
|
1342
|
-
};
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
isException(req) {
|
|
1346
|
-
for (const url of this.loaderService.urls) {
|
|
1347
|
-
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1348
|
-
return true;
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
return false;
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1357
|
-
type: Injectable
|
|
1307
|
+
class LoadingInterceptor {
|
|
1308
|
+
constructor(loaderService) {
|
|
1309
|
+
this.loaderService = loaderService;
|
|
1310
|
+
this.requests = [];
|
|
1311
|
+
}
|
|
1312
|
+
removeRequest(req) {
|
|
1313
|
+
const i = this.requests.indexOf(req);
|
|
1314
|
+
if (i >= 0) {
|
|
1315
|
+
this.requests.splice(i, 1);
|
|
1316
|
+
}
|
|
1317
|
+
this.loaderService.isLoading.next(this.requests.length > 0);
|
|
1318
|
+
}
|
|
1319
|
+
intercept(req, next) {
|
|
1320
|
+
if (this.isException(req)) {
|
|
1321
|
+
return next.handle(req);
|
|
1322
|
+
}
|
|
1323
|
+
this.requests.push(req);
|
|
1324
|
+
this.loaderService.isLoading.next(true);
|
|
1325
|
+
return new Observable((observer) => {
|
|
1326
|
+
const subscription = next.handle(req).subscribe((event) => {
|
|
1327
|
+
if (event instanceof HttpResponse) {
|
|
1328
|
+
this.removeRequest(req);
|
|
1329
|
+
observer.next(event);
|
|
1330
|
+
}
|
|
1331
|
+
}, (err) => {
|
|
1332
|
+
this.removeRequest(req);
|
|
1333
|
+
observer.error(err);
|
|
1334
|
+
}, () => {
|
|
1335
|
+
this.removeRequest(req);
|
|
1336
|
+
observer.complete();
|
|
1337
|
+
});
|
|
1338
|
+
// remove request from queue when cancelled
|
|
1339
|
+
return () => {
|
|
1340
|
+
this.removeRequest(req);
|
|
1341
|
+
subscription.unsubscribe();
|
|
1342
|
+
};
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
isException(req) {
|
|
1346
|
+
for (const url of this.loaderService.urls) {
|
|
1347
|
+
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
return false;
|
|
1352
|
+
}
|
|
1353
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoadingInterceptor, deps: [{ token: LoaderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1354
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoadingInterceptor }); }
|
|
1355
|
+
}
|
|
1356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: LoadingInterceptor, decorators: [{
|
|
1357
|
+
type: Injectable
|
|
1358
1358
|
}], ctorParameters: function () { return [{ type: LoaderService }]; } });
|
|
1359
1359
|
|
|
1360
|
-
class CommonService {
|
|
1361
|
-
constructor(toastrService) {
|
|
1362
|
-
this.toastrService = toastrService;
|
|
1363
|
-
}
|
|
1364
|
-
copyToClipboard(copyText, message) {
|
|
1365
|
-
navigator.clipboard.writeText(copyText.toString());
|
|
1366
|
-
this.toastrService.success(message, '', {
|
|
1367
|
-
positionClass: 'toast-bottom-right',
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
print(element, title, classes) {
|
|
1371
|
-
const styles = this.getElementTag('style');
|
|
1372
|
-
const links = this.getElementTag('link');
|
|
1373
|
-
const scripts = this.getElementTag('script');
|
|
1374
|
-
const printContents = document.getElementById(element)?.innerHTML;
|
|
1375
|
-
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
1360
|
+
class CommonService {
|
|
1361
|
+
constructor(toastrService) {
|
|
1362
|
+
this.toastrService = toastrService;
|
|
1363
|
+
}
|
|
1364
|
+
copyToClipboard(copyText, message) {
|
|
1365
|
+
navigator.clipboard.writeText(copyText.toString());
|
|
1366
|
+
this.toastrService.success(message, '', {
|
|
1367
|
+
positionClass: 'toast-bottom-right',
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
print(element, title, classes) {
|
|
1371
|
+
const styles = this.getElementTag('style');
|
|
1372
|
+
const links = this.getElementTag('link');
|
|
1373
|
+
const scripts = this.getElementTag('script');
|
|
1374
|
+
const printContents = document.getElementById(element)?.innerHTML;
|
|
1375
|
+
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
1376
1376
|
const data = `
|
|
1377
1377
|
<!DOCTYPE html>
|
|
1378
1378
|
<head>
|
|
@@ -1396,461 +1396,461 @@ class CommonService {
|
|
|
1396
1396
|
${scripts}
|
|
1397
1397
|
</body>
|
|
1398
1398
|
|
|
1399
|
-
</html>`;
|
|
1400
|
-
popupWin?.document.open();
|
|
1401
|
-
popupWin?.document.write(data);
|
|
1402
|
-
popupWin?.document.close();
|
|
1403
|
-
popupWin?.focus();
|
|
1404
|
-
popupWin?.addEventListener('focus', () => {
|
|
1405
|
-
setTimeout(() => {
|
|
1406
|
-
if (popupWin.document.hasFocus()) {
|
|
1407
|
-
popupWin.print();
|
|
1408
|
-
popupWin.close();
|
|
1409
|
-
}
|
|
1410
|
-
}, 1000);
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
getElementTag(tag) {
|
|
1414
|
-
const html = [];
|
|
1415
|
-
const elements = document.getElementsByTagName(tag);
|
|
1416
|
-
for (let index = 0; index < elements.length; index++) {
|
|
1417
|
-
html.push(elements[index].outerHTML);
|
|
1418
|
-
}
|
|
1419
|
-
return html.join('\r\n');
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1425
|
-
type: Injectable,
|
|
1426
|
-
args: [{
|
|
1427
|
-
providedIn: 'root',
|
|
1428
|
-
}]
|
|
1399
|
+
</html>`;
|
|
1400
|
+
popupWin?.document.open();
|
|
1401
|
+
popupWin?.document.write(data);
|
|
1402
|
+
popupWin?.document.close();
|
|
1403
|
+
popupWin?.focus();
|
|
1404
|
+
popupWin?.addEventListener('focus', () => {
|
|
1405
|
+
setTimeout(() => {
|
|
1406
|
+
if (popupWin.document.hasFocus()) {
|
|
1407
|
+
popupWin.print();
|
|
1408
|
+
popupWin.close();
|
|
1409
|
+
}
|
|
1410
|
+
}, 1000);
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
getElementTag(tag) {
|
|
1414
|
+
const html = [];
|
|
1415
|
+
const elements = document.getElementsByTagName(tag);
|
|
1416
|
+
for (let index = 0; index < elements.length; index++) {
|
|
1417
|
+
html.push(elements[index].outerHTML);
|
|
1418
|
+
}
|
|
1419
|
+
return html.join('\r\n');
|
|
1420
|
+
}
|
|
1421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: CommonService, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1422
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: CommonService, providedIn: 'root' }); }
|
|
1423
|
+
}
|
|
1424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: CommonService, decorators: [{
|
|
1425
|
+
type: Injectable,
|
|
1426
|
+
args: [{
|
|
1427
|
+
providedIn: 'root',
|
|
1428
|
+
}]
|
|
1429
1429
|
}], ctorParameters: function () { return [{ type: i1.ToastrService }]; } });
|
|
1430
1430
|
|
|
1431
|
-
class ErrorService {
|
|
1432
|
-
constructor(toastrService, commonService) {
|
|
1433
|
-
this.toastrService = toastrService;
|
|
1434
|
-
this.commonService = commonService;
|
|
1435
|
-
this.urls = [];
|
|
1436
|
-
}
|
|
1437
|
-
setExceptionUrls(urls) {
|
|
1438
|
-
this.urls = urls;
|
|
1439
|
-
}
|
|
1440
|
-
addExceptionUrl(url) {
|
|
1441
|
-
this.urls.push(url);
|
|
1442
|
-
}
|
|
1443
|
-
showErrorMsg(response, toastrConfig) {
|
|
1444
|
-
if (response.errors && response.errors.length > 0) {
|
|
1445
|
-
toastrConfig.enableHtml = true;
|
|
1446
|
-
let msg = '';
|
|
1447
|
-
response.errors.forEach((error) => {
|
|
1448
|
-
msg += `<li>${error}</li>`;
|
|
1449
|
-
});
|
|
1450
|
-
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1451
|
-
}
|
|
1452
|
-
else {
|
|
1453
|
-
this.toastrService.error('', response.message, toastrConfig);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
show500ErrorMsg(response, toastrConfig) {
|
|
1457
|
-
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1458
|
-
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1459
|
-
toastr.onShown.subscribe(() => {
|
|
1460
|
-
this.addCopyButton(response.message + '\n' + msg);
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
addCopyButton(copyText) {
|
|
1464
|
-
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1465
|
-
const icon = document.createElement('i');
|
|
1466
|
-
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1467
|
-
icon.addEventListener('click', () => {
|
|
1468
|
-
this.commonService.copyToClipboard(copyText, 'تم نسخ الرسالة إلى الحافظة');
|
|
1469
|
-
});
|
|
1470
|
-
messageToast.appendChild(icon);
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1476
|
-
type: Injectable,
|
|
1477
|
-
args: [{
|
|
1478
|
-
providedIn: 'root',
|
|
1479
|
-
}]
|
|
1431
|
+
class ErrorService {
|
|
1432
|
+
constructor(toastrService, commonService) {
|
|
1433
|
+
this.toastrService = toastrService;
|
|
1434
|
+
this.commonService = commonService;
|
|
1435
|
+
this.urls = [];
|
|
1436
|
+
}
|
|
1437
|
+
setExceptionUrls(urls) {
|
|
1438
|
+
this.urls = urls;
|
|
1439
|
+
}
|
|
1440
|
+
addExceptionUrl(url) {
|
|
1441
|
+
this.urls.push(url);
|
|
1442
|
+
}
|
|
1443
|
+
showErrorMsg(response, toastrConfig) {
|
|
1444
|
+
if (response.errors && response.errors.length > 0) {
|
|
1445
|
+
toastrConfig.enableHtml = true;
|
|
1446
|
+
let msg = '';
|
|
1447
|
+
response.errors.forEach((error) => {
|
|
1448
|
+
msg += `<li>${error}</li>`;
|
|
1449
|
+
});
|
|
1450
|
+
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1451
|
+
}
|
|
1452
|
+
else {
|
|
1453
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
show500ErrorMsg(response, toastrConfig) {
|
|
1457
|
+
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1458
|
+
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1459
|
+
toastr.onShown.subscribe(() => {
|
|
1460
|
+
this.addCopyButton(response.message + '\n' + msg);
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
addCopyButton(copyText) {
|
|
1464
|
+
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1465
|
+
const icon = document.createElement('i');
|
|
1466
|
+
icon.classList.add('ms-2', 'fas', 'fa-copy');
|
|
1467
|
+
icon.addEventListener('click', () => {
|
|
1468
|
+
this.commonService.copyToClipboard(copyText, 'تم نسخ الرسالة إلى الحافظة');
|
|
1469
|
+
});
|
|
1470
|
+
messageToast.appendChild(icon);
|
|
1471
|
+
}
|
|
1472
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorService, deps: [{ token: i1.ToastrService }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1473
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorService, providedIn: 'root' }); }
|
|
1474
|
+
}
|
|
1475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorService, decorators: [{
|
|
1476
|
+
type: Injectable,
|
|
1477
|
+
args: [{
|
|
1478
|
+
providedIn: 'root',
|
|
1479
|
+
}]
|
|
1480
1480
|
}], ctorParameters: function () { return [{ type: i1.ToastrService }, { type: CommonService }]; } });
|
|
1481
1481
|
|
|
1482
|
-
class ErrorInterceptor {
|
|
1483
|
-
constructor(errorService) {
|
|
1484
|
-
this.errorService = errorService;
|
|
1485
|
-
}
|
|
1486
|
-
intercept(req, next) {
|
|
1487
|
-
if (this.isException(req)) {
|
|
1488
|
-
return next.handle(req);
|
|
1489
|
-
}
|
|
1490
|
-
return next.handle(req).pipe(catchError((error) => {
|
|
1491
|
-
const response = error.error;
|
|
1492
|
-
const toastrConfig = {
|
|
1493
|
-
disableTimeOut: true,
|
|
1494
|
-
closeButton: true,
|
|
1495
|
-
tapToDismiss: false,
|
|
1496
|
-
};
|
|
1497
|
-
switch (response.statusCode) {
|
|
1498
|
-
case 500:
|
|
1499
|
-
this.errorService.show500ErrorMsg(response, toastrConfig);
|
|
1500
|
-
break;
|
|
1501
|
-
default:
|
|
1502
|
-
this.errorService.showErrorMsg(response, toastrConfig);
|
|
1503
|
-
break;
|
|
1504
|
-
}
|
|
1505
|
-
return throwError(() => error);
|
|
1506
|
-
}));
|
|
1507
|
-
}
|
|
1508
|
-
isException(req) {
|
|
1509
|
-
for (const url of this.errorService.urls) {
|
|
1510
|
-
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1511
|
-
return true;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
return false;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1520
|
-
type: Injectable
|
|
1482
|
+
class ErrorInterceptor {
|
|
1483
|
+
constructor(errorService) {
|
|
1484
|
+
this.errorService = errorService;
|
|
1485
|
+
}
|
|
1486
|
+
intercept(req, next) {
|
|
1487
|
+
if (this.isException(req)) {
|
|
1488
|
+
return next.handle(req);
|
|
1489
|
+
}
|
|
1490
|
+
return next.handle(req).pipe(catchError((error) => {
|
|
1491
|
+
const response = error.error;
|
|
1492
|
+
const toastrConfig = {
|
|
1493
|
+
disableTimeOut: true,
|
|
1494
|
+
closeButton: true,
|
|
1495
|
+
tapToDismiss: false,
|
|
1496
|
+
};
|
|
1497
|
+
switch (response.statusCode) {
|
|
1498
|
+
case 500:
|
|
1499
|
+
this.errorService.show500ErrorMsg(response, toastrConfig);
|
|
1500
|
+
break;
|
|
1501
|
+
default:
|
|
1502
|
+
this.errorService.showErrorMsg(response, toastrConfig);
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1505
|
+
return throwError(() => error);
|
|
1506
|
+
}));
|
|
1507
|
+
}
|
|
1508
|
+
isException(req) {
|
|
1509
|
+
for (const url of this.errorService.urls) {
|
|
1510
|
+
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1511
|
+
return true;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorInterceptor, deps: [{ token: ErrorService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1517
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorInterceptor }); }
|
|
1518
|
+
}
|
|
1519
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: ErrorInterceptor, decorators: [{
|
|
1520
|
+
type: Injectable
|
|
1521
1521
|
}], ctorParameters: function () { return [{ type: ErrorService }]; } });
|
|
1522
1522
|
|
|
1523
|
-
class AuthService {
|
|
1524
|
-
constructor() {
|
|
1525
|
-
this.currentUser = new BehaviorSubject({ exp: 0 });
|
|
1526
|
-
this.currentUserUrl = '';
|
|
1527
|
-
}
|
|
1528
|
-
getToken() {
|
|
1529
|
-
return localStorage.getItem('token') ?? '';
|
|
1530
|
-
}
|
|
1531
|
-
getDecodedToken() {
|
|
1532
|
-
return this.decodeJwt(this.getToken());
|
|
1533
|
-
}
|
|
1534
|
-
setCurrentUser() {
|
|
1535
|
-
const decodedToken = this.getDecodedToken();
|
|
1536
|
-
this.currentUser.next({
|
|
1537
|
-
nameid: decodedToken.nameid,
|
|
1538
|
-
email: decodedToken.email,
|
|
1539
|
-
given_name: decodedToken.given_name,
|
|
1540
|
-
exp: decodedToken.exp,
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
|
-
getTokenFromHidden() {
|
|
1544
|
-
return (document.querySelector('[id$=hfToken]').value ?? '');
|
|
1545
|
-
}
|
|
1546
|
-
getDecodedTokenFromHidden() {
|
|
1547
|
-
return this.decodeJwt(this.getTokenFromHidden());
|
|
1548
|
-
}
|
|
1549
|
-
setCurrentUserFromHidden() {
|
|
1550
|
-
const decodedToken = this.getDecodedTokenFromHidden();
|
|
1551
|
-
this.currentUser.next({
|
|
1552
|
-
nameid: decodedToken.nameid?.split('\\')[1],
|
|
1553
|
-
email: decodedToken.email,
|
|
1554
|
-
given_name: decodedToken.given_name,
|
|
1555
|
-
exp: decodedToken.exp,
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
setCurrentUserUrl(url) {
|
|
1559
|
-
this.currentUserUrl = url;
|
|
1560
|
-
}
|
|
1561
|
-
decodeJwt(token) {
|
|
1562
|
-
const base64Url = token.split('.')[1];
|
|
1563
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
1564
|
-
const jsonPayload = decodeURIComponent(atob(base64)
|
|
1565
|
-
.split('')
|
|
1566
|
-
.map((c) => {
|
|
1567
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
1568
|
-
})
|
|
1569
|
-
.join(''));
|
|
1570
|
-
return JSON.parse(jsonPayload);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1576
|
-
type: Injectable,
|
|
1577
|
-
args: [{
|
|
1578
|
-
providedIn: 'root',
|
|
1579
|
-
}]
|
|
1523
|
+
class AuthService {
|
|
1524
|
+
constructor() {
|
|
1525
|
+
this.currentUser = new BehaviorSubject({ exp: 0 });
|
|
1526
|
+
this.currentUserUrl = '';
|
|
1527
|
+
}
|
|
1528
|
+
getToken() {
|
|
1529
|
+
return localStorage.getItem('token') ?? '';
|
|
1530
|
+
}
|
|
1531
|
+
getDecodedToken() {
|
|
1532
|
+
return this.decodeJwt(this.getToken());
|
|
1533
|
+
}
|
|
1534
|
+
setCurrentUser() {
|
|
1535
|
+
const decodedToken = this.getDecodedToken();
|
|
1536
|
+
this.currentUser.next({
|
|
1537
|
+
nameid: decodedToken.nameid,
|
|
1538
|
+
email: decodedToken.email,
|
|
1539
|
+
given_name: decodedToken.given_name,
|
|
1540
|
+
exp: decodedToken.exp,
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
getTokenFromHidden() {
|
|
1544
|
+
return (document.querySelector('[id$=hfToken]').value ?? '');
|
|
1545
|
+
}
|
|
1546
|
+
getDecodedTokenFromHidden() {
|
|
1547
|
+
return this.decodeJwt(this.getTokenFromHidden());
|
|
1548
|
+
}
|
|
1549
|
+
setCurrentUserFromHidden() {
|
|
1550
|
+
const decodedToken = this.getDecodedTokenFromHidden();
|
|
1551
|
+
this.currentUser.next({
|
|
1552
|
+
nameid: decodedToken.nameid?.split('\\')[1],
|
|
1553
|
+
email: decodedToken.email,
|
|
1554
|
+
given_name: decodedToken.given_name,
|
|
1555
|
+
exp: decodedToken.exp,
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
setCurrentUserUrl(url) {
|
|
1559
|
+
this.currentUserUrl = url;
|
|
1560
|
+
}
|
|
1561
|
+
decodeJwt(token) {
|
|
1562
|
+
const base64Url = token.split('.')[1];
|
|
1563
|
+
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
1564
|
+
const jsonPayload = decodeURIComponent(atob(base64)
|
|
1565
|
+
.split('')
|
|
1566
|
+
.map((c) => {
|
|
1567
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
1568
|
+
})
|
|
1569
|
+
.join(''));
|
|
1570
|
+
return JSON.parse(jsonPayload);
|
|
1571
|
+
}
|
|
1572
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1573
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
|
1574
|
+
}
|
|
1575
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AuthService, decorators: [{
|
|
1576
|
+
type: Injectable,
|
|
1577
|
+
args: [{
|
|
1578
|
+
providedIn: 'root',
|
|
1579
|
+
}]
|
|
1580
1580
|
}], ctorParameters: function () { return []; } });
|
|
1581
1581
|
|
|
1582
|
-
class TokenService {
|
|
1583
|
-
constructor() {
|
|
1584
|
-
this.urls = [];
|
|
1585
|
-
}
|
|
1586
|
-
setExceptionUrls(urls) {
|
|
1587
|
-
this.urls = urls;
|
|
1588
|
-
}
|
|
1589
|
-
addExceptionUrl(url) {
|
|
1590
|
-
this.urls.push(url);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1596
|
-
type: Injectable,
|
|
1597
|
-
args: [{
|
|
1598
|
-
providedIn: 'root',
|
|
1599
|
-
}]
|
|
1582
|
+
class TokenService {
|
|
1583
|
+
constructor() {
|
|
1584
|
+
this.urls = [];
|
|
1585
|
+
}
|
|
1586
|
+
setExceptionUrls(urls) {
|
|
1587
|
+
this.urls = urls;
|
|
1588
|
+
}
|
|
1589
|
+
addExceptionUrl(url) {
|
|
1590
|
+
this.urls.push(url);
|
|
1591
|
+
}
|
|
1592
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1593
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenService, providedIn: 'root' }); }
|
|
1594
|
+
}
|
|
1595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenService, decorators: [{
|
|
1596
|
+
type: Injectable,
|
|
1597
|
+
args: [{
|
|
1598
|
+
providedIn: 'root',
|
|
1599
|
+
}]
|
|
1600
1600
|
}], ctorParameters: function () { return []; } });
|
|
1601
1601
|
|
|
1602
|
-
class TokenInterceptor {
|
|
1603
|
-
constructor(authService, http, loaderService, tokenService) {
|
|
1604
|
-
this.authService = authService;
|
|
1605
|
-
this.http = http;
|
|
1606
|
-
this.loaderService = loaderService;
|
|
1607
|
-
this.tokenService = tokenService;
|
|
1608
|
-
this.refresh = true;
|
|
1609
|
-
this.loaderService.addExceptionUrl({
|
|
1610
|
-
path: '/api/users?refresh',
|
|
1611
|
-
method: 'GET',
|
|
1612
|
-
});
|
|
1613
|
-
this.tokenService.addExceptionUrl({
|
|
1614
|
-
path: '/api/users?refresh',
|
|
1615
|
-
method: 'GET',
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
intercept(request, next) {
|
|
1619
|
-
if (this.isException(request)) {
|
|
1620
|
-
return next.handle(request);
|
|
1621
|
-
}
|
|
1622
|
-
const token = this.authService.getToken();
|
|
1623
|
-
if (token) {
|
|
1624
|
-
this.isTokenExpired(token);
|
|
1625
|
-
request = request.clone({
|
|
1626
|
-
setHeaders: {
|
|
1627
|
-
Authorization: `Bearer ${token}`,
|
|
1628
|
-
},
|
|
1629
|
-
});
|
|
1630
|
-
}
|
|
1631
|
-
return next.handle(request);
|
|
1632
|
-
}
|
|
1633
|
-
isTokenExpired(token) {
|
|
1634
|
-
const redirectPath = location.pathname;
|
|
1635
|
-
const decodedToken = this.authService.getDecodedToken();
|
|
1636
|
-
const expDate = new Date((decodedToken.exp ?? 0) * 1000);
|
|
1637
|
-
if (expDate < new Date()) {
|
|
1638
|
-
location.replace('/ar/login?redirect=' + redirectPath);
|
|
1639
|
-
return;
|
|
1640
|
-
}
|
|
1641
|
-
else {
|
|
1642
|
-
if (this.authService.currentUserUrl) {
|
|
1643
|
-
if (this.refresh) {
|
|
1644
|
-
this.http
|
|
1645
|
-
.get(this.authService.currentUserUrl + `users?refresh`, {
|
|
1646
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
1647
|
-
})
|
|
1648
|
-
.subscribe((user) => {
|
|
1649
|
-
localStorage.setItem('token', user.token);
|
|
1650
|
-
this.refresh = false;
|
|
1651
|
-
setTimeout(() => {
|
|
1652
|
-
this.refresh = true;
|
|
1653
|
-
}, 60 * 1000);
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
else {
|
|
1658
|
-
throw new Error("provide current base user api url using this function authService.setCurrentUserUrl('https://...')");
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
isException(req) {
|
|
1663
|
-
for (const url of this.tokenService.urls) {
|
|
1664
|
-
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1665
|
-
return true;
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
return false;
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1674
|
-
type: Injectable
|
|
1602
|
+
class TokenInterceptor {
|
|
1603
|
+
constructor(authService, http, loaderService, tokenService) {
|
|
1604
|
+
this.authService = authService;
|
|
1605
|
+
this.http = http;
|
|
1606
|
+
this.loaderService = loaderService;
|
|
1607
|
+
this.tokenService = tokenService;
|
|
1608
|
+
this.refresh = true;
|
|
1609
|
+
this.loaderService.addExceptionUrl({
|
|
1610
|
+
path: '/api/users?refresh',
|
|
1611
|
+
method: 'GET',
|
|
1612
|
+
});
|
|
1613
|
+
this.tokenService.addExceptionUrl({
|
|
1614
|
+
path: '/api/users?refresh',
|
|
1615
|
+
method: 'GET',
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
intercept(request, next) {
|
|
1619
|
+
if (this.isException(request)) {
|
|
1620
|
+
return next.handle(request);
|
|
1621
|
+
}
|
|
1622
|
+
const token = this.authService.getToken();
|
|
1623
|
+
if (token) {
|
|
1624
|
+
this.isTokenExpired(token);
|
|
1625
|
+
request = request.clone({
|
|
1626
|
+
setHeaders: {
|
|
1627
|
+
Authorization: `Bearer ${token}`,
|
|
1628
|
+
},
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
return next.handle(request);
|
|
1632
|
+
}
|
|
1633
|
+
isTokenExpired(token) {
|
|
1634
|
+
const redirectPath = location.pathname;
|
|
1635
|
+
const decodedToken = this.authService.getDecodedToken();
|
|
1636
|
+
const expDate = new Date((decodedToken.exp ?? 0) * 1000);
|
|
1637
|
+
if (expDate < new Date()) {
|
|
1638
|
+
location.replace('/ar/login?redirect=' + redirectPath);
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
else {
|
|
1642
|
+
if (this.authService.currentUserUrl) {
|
|
1643
|
+
if (this.refresh) {
|
|
1644
|
+
this.http
|
|
1645
|
+
.get(this.authService.currentUserUrl + `users?refresh`, {
|
|
1646
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
1647
|
+
})
|
|
1648
|
+
.subscribe((user) => {
|
|
1649
|
+
localStorage.setItem('token', user.token);
|
|
1650
|
+
this.refresh = false;
|
|
1651
|
+
setTimeout(() => {
|
|
1652
|
+
this.refresh = true;
|
|
1653
|
+
}, 60 * 1000);
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
else {
|
|
1658
|
+
throw new Error("provide current base user api url using this function authService.setCurrentUserUrl('https://...')");
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
isException(req) {
|
|
1663
|
+
for (const url of this.tokenService.urls) {
|
|
1664
|
+
if (req.url.includes(url.path) && req.method === url.method) {
|
|
1665
|
+
return true;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$4.HttpClient }, { token: LoaderService }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1671
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenInterceptor }); }
|
|
1672
|
+
}
|
|
1673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: TokenInterceptor, decorators: [{
|
|
1674
|
+
type: Injectable
|
|
1675
1675
|
}], ctorParameters: function () { return [{ type: AuthService }, { type: i2$4.HttpClient }, { type: LoaderService }, { type: TokenService }]; } });
|
|
1676
1676
|
|
|
1677
|
-
class myIPATokenInterceptor {
|
|
1678
|
-
constructor(authService) {
|
|
1679
|
-
this.authService = authService;
|
|
1680
|
-
}
|
|
1681
|
-
intercept(request, next) {
|
|
1682
|
-
const token = this.authService.getTokenFromHidden();
|
|
1683
|
-
if (token) {
|
|
1684
|
-
request = request.clone({
|
|
1685
|
-
setHeaders: {
|
|
1686
|
-
Authorization: `Bearer ${token}`,
|
|
1687
|
-
},
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
return next.handle(request);
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1696
|
-
type: Injectable
|
|
1677
|
+
class myIPATokenInterceptor {
|
|
1678
|
+
constructor(authService) {
|
|
1679
|
+
this.authService = authService;
|
|
1680
|
+
}
|
|
1681
|
+
intercept(request, next) {
|
|
1682
|
+
const token = this.authService.getTokenFromHidden();
|
|
1683
|
+
if (token) {
|
|
1684
|
+
request = request.clone({
|
|
1685
|
+
setHeaders: {
|
|
1686
|
+
Authorization: `Bearer ${token}`,
|
|
1687
|
+
},
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
return next.handle(request);
|
|
1691
|
+
}
|
|
1692
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: myIPATokenInterceptor, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1693
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: myIPATokenInterceptor }); }
|
|
1694
|
+
}
|
|
1695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: myIPATokenInterceptor, decorators: [{
|
|
1696
|
+
type: Injectable
|
|
1697
1697
|
}], ctorParameters: function () { return [{ type: AuthService }]; } });
|
|
1698
1698
|
|
|
1699
|
-
class BreadcrumbsService {
|
|
1700
|
-
constructor() { }
|
|
1701
|
-
setPageTitle(text) {
|
|
1702
|
-
const titleEl = document.querySelector('.sub-section-title');
|
|
1703
|
-
if (titleEl) {
|
|
1704
|
-
titleEl.textContent = text;
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
setMainPageTitle(text, url) {
|
|
1708
|
-
const div = document.getElementsByClassName('main-section-title');
|
|
1709
|
-
if (div && div.length > 0) {
|
|
1710
|
-
div[0].innerHTML = `<a id="site-url" href="${url}">${text}</a>`;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
addBreadcrumb(nodeName, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1714
|
-
const spans = document.getElementById('ctl00_path')?.children;
|
|
1715
|
-
//get last child
|
|
1716
|
-
const lastIndex = spans?.item(spans.length - 1);
|
|
1717
|
-
const innerHTML = lastIndex.innerHTML;
|
|
1718
|
-
lastIndex.innerHTML = '';
|
|
1719
|
-
lastIndex.classList.remove(...['bc-current']);
|
|
1720
|
-
//add new link
|
|
1721
|
-
lastIndex.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1722
|
-
//add new span and empty span
|
|
1723
|
-
const newSpan = this.createSpan(nodeName, spanClasses);
|
|
1724
|
-
const emptySpan = document.createElement('span');
|
|
1725
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
1726
|
-
}
|
|
1727
|
-
addBreadcrumbList(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1728
|
-
const spans = document.getElementById('ctl00_path')?.childNodes;
|
|
1729
|
-
//get last child
|
|
1730
|
-
const lastSpan = spans?.item(spans.length - 1);
|
|
1731
|
-
const innerHTML = lastSpan.innerHTML;
|
|
1732
|
-
lastSpan.classList.remove(...[spanClasses]);
|
|
1733
|
-
lastSpan.innerHTML = '';
|
|
1734
|
-
//add new link
|
|
1735
|
-
lastSpan.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1736
|
-
for (let i = 0; i < nodeList.length; i++) {
|
|
1737
|
-
const lastIndex = spans?.item(spans.length - 1);
|
|
1738
|
-
if (nodeList[i].nodeUrl) {
|
|
1739
|
-
const newSpan = document.createElement('span');
|
|
1740
|
-
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1741
|
-
const emptySpan = document.createElement('span');
|
|
1742
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
1743
|
-
}
|
|
1744
|
-
else {
|
|
1745
|
-
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1746
|
-
const emptySpan = document.createElement('span');
|
|
1747
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
createBreadcrumbs(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1752
|
-
const currentSpan = document.getElementById('ctl00_path');
|
|
1753
|
-
currentSpan.innerHTML = '';
|
|
1754
|
-
const newSpan = document.createElement('span');
|
|
1755
|
-
currentSpan?.appendChild(newSpan);
|
|
1756
|
-
newSpan.appendChild(this.createLink(nodeList[0].nodeName, nodeList[0].nodeUrl, linkClasses));
|
|
1757
|
-
const spans = currentSpan?.children;
|
|
1758
|
-
for (let i = 1; i < nodeList.length; i++) {
|
|
1759
|
-
const lastIndex = spans?.item(spans.length - 1);
|
|
1760
|
-
if (nodeList[i].nodeUrl) {
|
|
1761
|
-
const newSpan = document.createElement('span');
|
|
1762
|
-
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1763
|
-
const emptySpan = document.createElement('span');
|
|
1764
|
-
lastIndex?.after(...[emptySpan, newSpan]);
|
|
1765
|
-
}
|
|
1766
|
-
else {
|
|
1767
|
-
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1768
|
-
const emptySpan = document.createElement('span');
|
|
1769
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
removeLastBreadcrumb() {
|
|
1774
|
-
const spans = document.getElementById('ctl00_path')?.children;
|
|
1775
|
-
spans?.item(spans.length - 1)?.remove();
|
|
1776
|
-
spans?.item(spans.length - 1)?.remove();
|
|
1777
|
-
this.setCurrentNode(spans);
|
|
1778
|
-
}
|
|
1779
|
-
removeBreadcrumbByNodeName(nodeName) {
|
|
1780
|
-
const spans = document.getElementById('ctl00_path')
|
|
1781
|
-
?.children;
|
|
1782
|
-
let index = -1;
|
|
1783
|
-
for (let i = 0; i < spans.length; i++) {
|
|
1784
|
-
const span = spans.item(i);
|
|
1785
|
-
if (span?.textContent?.trim() === nodeName) {
|
|
1786
|
-
index = i;
|
|
1787
|
-
break;
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
const lastNode = spans.length - 1 === index;
|
|
1791
|
-
if (index !== -1 && !lastNode) {
|
|
1792
|
-
spans?.item(index)?.remove();
|
|
1793
|
-
spans?.item(index)?.remove();
|
|
1794
|
-
}
|
|
1795
|
-
else {
|
|
1796
|
-
spans?.item(index)?.remove();
|
|
1797
|
-
spans?.item(index - 1)?.remove();
|
|
1798
|
-
}
|
|
1799
|
-
if (lastNode) {
|
|
1800
|
-
this.setCurrentNode(spans);
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
removeLastBreadcrumbsByLength(length) {
|
|
1804
|
-
const spans = document.getElementById('ctl00_path')
|
|
1805
|
-
?.children;
|
|
1806
|
-
while (length > 0) {
|
|
1807
|
-
spans?.item(spans.length - 1)?.remove();
|
|
1808
|
-
spans?.item(spans.length - 1)?.remove();
|
|
1809
|
-
length--;
|
|
1810
|
-
}
|
|
1811
|
-
if (spans.length > 0) {
|
|
1812
|
-
this.setCurrentNode(spans);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
createLink(innerHTML, href, classes) {
|
|
1816
|
-
const link = document.createElement('a');
|
|
1817
|
-
link.innerHTML = ' ' + innerHTML;
|
|
1818
|
-
link.href = href ?? '';
|
|
1819
|
-
link.classList.add(...[classes]);
|
|
1820
|
-
return link;
|
|
1821
|
-
}
|
|
1822
|
-
createSpan(innerHTML, classes) {
|
|
1823
|
-
const span = document.createElement('span');
|
|
1824
|
-
span.classList.add(...[classes]);
|
|
1825
|
-
span.innerHTML = ' ' + innerHTML;
|
|
1826
|
-
return span;
|
|
1827
|
-
}
|
|
1828
|
-
setCurrentNode(spans) {
|
|
1829
|
-
const lastSpan = spans?.item(spans.length - 1);
|
|
1830
|
-
const lastSpanLink = spans
|
|
1831
|
-
?.item(spans.length - 1)
|
|
1832
|
-
?.children.item(0);
|
|
1833
|
-
lastSpan?.classList.add(...['bc-current']);
|
|
1834
|
-
lastSpan.innerHTML = lastSpanLink.innerHTML;
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1840
|
-
type: Injectable,
|
|
1841
|
-
args: [{
|
|
1842
|
-
providedIn: 'root',
|
|
1843
|
-
}]
|
|
1699
|
+
class BreadcrumbsService {
|
|
1700
|
+
constructor() { }
|
|
1701
|
+
setPageTitle(text) {
|
|
1702
|
+
const titleEl = document.querySelector('.sub-section-title');
|
|
1703
|
+
if (titleEl) {
|
|
1704
|
+
titleEl.textContent = text;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
setMainPageTitle(text, url) {
|
|
1708
|
+
const div = document.getElementsByClassName('main-section-title');
|
|
1709
|
+
if (div && div.length > 0) {
|
|
1710
|
+
div[0].innerHTML = `<a id="site-url" href="${url}">${text}</a>`;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
addBreadcrumb(nodeName, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1714
|
+
const spans = document.getElementById('ctl00_path')?.children;
|
|
1715
|
+
//get last child
|
|
1716
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1717
|
+
const innerHTML = lastIndex.innerHTML;
|
|
1718
|
+
lastIndex.innerHTML = '';
|
|
1719
|
+
lastIndex.classList.remove(...['bc-current']);
|
|
1720
|
+
//add new link
|
|
1721
|
+
lastIndex.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1722
|
+
//add new span and empty span
|
|
1723
|
+
const newSpan = this.createSpan(nodeName, spanClasses);
|
|
1724
|
+
const emptySpan = document.createElement('span');
|
|
1725
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1726
|
+
}
|
|
1727
|
+
addBreadcrumbList(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1728
|
+
const spans = document.getElementById('ctl00_path')?.childNodes;
|
|
1729
|
+
//get last child
|
|
1730
|
+
const lastSpan = spans?.item(spans.length - 1);
|
|
1731
|
+
const innerHTML = lastSpan.innerHTML;
|
|
1732
|
+
lastSpan.classList.remove(...[spanClasses]);
|
|
1733
|
+
lastSpan.innerHTML = '';
|
|
1734
|
+
//add new link
|
|
1735
|
+
lastSpan.appendChild(this.createLink(innerHTML, location.pathname, linkClasses));
|
|
1736
|
+
for (let i = 0; i < nodeList.length; i++) {
|
|
1737
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1738
|
+
if (nodeList[i].nodeUrl) {
|
|
1739
|
+
const newSpan = document.createElement('span');
|
|
1740
|
+
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1741
|
+
const emptySpan = document.createElement('span');
|
|
1742
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1746
|
+
const emptySpan = document.createElement('span');
|
|
1747
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
createBreadcrumbs(nodeList, spanClasses = 'bc-current', linkClasses = 'bc-node') {
|
|
1752
|
+
const currentSpan = document.getElementById('ctl00_path');
|
|
1753
|
+
currentSpan.innerHTML = '';
|
|
1754
|
+
const newSpan = document.createElement('span');
|
|
1755
|
+
currentSpan?.appendChild(newSpan);
|
|
1756
|
+
newSpan.appendChild(this.createLink(nodeList[0].nodeName, nodeList[0].nodeUrl, linkClasses));
|
|
1757
|
+
const spans = currentSpan?.children;
|
|
1758
|
+
for (let i = 1; i < nodeList.length; i++) {
|
|
1759
|
+
const lastIndex = spans?.item(spans.length - 1);
|
|
1760
|
+
if (nodeList[i].nodeUrl) {
|
|
1761
|
+
const newSpan = document.createElement('span');
|
|
1762
|
+
newSpan.appendChild(this.createLink(nodeList[i].nodeName, nodeList[i].nodeUrl, linkClasses));
|
|
1763
|
+
const emptySpan = document.createElement('span');
|
|
1764
|
+
lastIndex?.after(...[emptySpan, newSpan]);
|
|
1765
|
+
}
|
|
1766
|
+
else {
|
|
1767
|
+
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
1768
|
+
const emptySpan = document.createElement('span');
|
|
1769
|
+
lastIndex.after(...[emptySpan, newSpan]);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
removeLastBreadcrumb() {
|
|
1774
|
+
const spans = document.getElementById('ctl00_path')?.children;
|
|
1775
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1776
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1777
|
+
this.setCurrentNode(spans);
|
|
1778
|
+
}
|
|
1779
|
+
removeBreadcrumbByNodeName(nodeName) {
|
|
1780
|
+
const spans = document.getElementById('ctl00_path')
|
|
1781
|
+
?.children;
|
|
1782
|
+
let index = -1;
|
|
1783
|
+
for (let i = 0; i < spans.length; i++) {
|
|
1784
|
+
const span = spans.item(i);
|
|
1785
|
+
if (span?.textContent?.trim() === nodeName) {
|
|
1786
|
+
index = i;
|
|
1787
|
+
break;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
const lastNode = spans.length - 1 === index;
|
|
1791
|
+
if (index !== -1 && !lastNode) {
|
|
1792
|
+
spans?.item(index)?.remove();
|
|
1793
|
+
spans?.item(index)?.remove();
|
|
1794
|
+
}
|
|
1795
|
+
else {
|
|
1796
|
+
spans?.item(index)?.remove();
|
|
1797
|
+
spans?.item(index - 1)?.remove();
|
|
1798
|
+
}
|
|
1799
|
+
if (lastNode) {
|
|
1800
|
+
this.setCurrentNode(spans);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
removeLastBreadcrumbsByLength(length) {
|
|
1804
|
+
const spans = document.getElementById('ctl00_path')
|
|
1805
|
+
?.children;
|
|
1806
|
+
while (length > 0) {
|
|
1807
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1808
|
+
spans?.item(spans.length - 1)?.remove();
|
|
1809
|
+
length--;
|
|
1810
|
+
}
|
|
1811
|
+
if (spans.length > 0) {
|
|
1812
|
+
this.setCurrentNode(spans);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
createLink(innerHTML, href, classes) {
|
|
1816
|
+
const link = document.createElement('a');
|
|
1817
|
+
link.innerHTML = ' ' + innerHTML;
|
|
1818
|
+
link.href = href ?? '';
|
|
1819
|
+
link.classList.add(...[classes]);
|
|
1820
|
+
return link;
|
|
1821
|
+
}
|
|
1822
|
+
createSpan(innerHTML, classes) {
|
|
1823
|
+
const span = document.createElement('span');
|
|
1824
|
+
span.classList.add(...[classes]);
|
|
1825
|
+
span.innerHTML = ' ' + innerHTML;
|
|
1826
|
+
return span;
|
|
1827
|
+
}
|
|
1828
|
+
setCurrentNode(spans) {
|
|
1829
|
+
const lastSpan = spans?.item(spans.length - 1);
|
|
1830
|
+
const lastSpanLink = spans
|
|
1831
|
+
?.item(spans.length - 1)
|
|
1832
|
+
?.children.item(0);
|
|
1833
|
+
lastSpan?.classList.add(...['bc-current']);
|
|
1834
|
+
lastSpan.innerHTML = lastSpanLink.innerHTML;
|
|
1835
|
+
}
|
|
1836
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: BreadcrumbsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1837
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: BreadcrumbsService, providedIn: 'root' }); }
|
|
1838
|
+
}
|
|
1839
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: BreadcrumbsService, decorators: [{
|
|
1840
|
+
type: Injectable,
|
|
1841
|
+
args: [{
|
|
1842
|
+
providedIn: 'root',
|
|
1843
|
+
}]
|
|
1844
1844
|
}], ctorParameters: function () { return []; } });
|
|
1845
1845
|
|
|
1846
|
-
/*
|
|
1847
|
-
* Public API Surface of ipa-library
|
|
1846
|
+
/*
|
|
1847
|
+
* Public API Surface of ipa-library
|
|
1848
1848
|
*/
|
|
1849
|
+
// module
|
|
1849
1850
|
|
|
1850
|
-
/**
|
|
1851
|
-
* Generated bundle index. Do not edit.
|
|
1851
|
+
/**
|
|
1852
|
+
* Generated bundle index. Do not edit.
|
|
1852
1853
|
*/
|
|
1853
1854
|
|
|
1854
1855
|
export { AuthService, BreadcrumbsService, CommonService, DropdownInputComponent, ErrorInterceptor, ErrorService, FileUploadComponent, GenerateFormComponent, GregorianDatepickerComponent, HijriDatePipe, HijriDatepickerComponent, IPAFormService, LoaderComponent, LoaderService, LoadingInterceptor, NgIPALibraryModule, PipesModule, RecaptchaComponent, ShareButtonComponent, ShareButtonModule, TextInputComponent, TextareaInputComponent, TokenInterceptor, TokenService, myIPATokenInterceptor };
|
|
1855
1856
|
//# sourceMappingURL=ng-ipa-library.mjs.map
|
|
1856
|
-
//# sourceMappingURL=ng-ipa-library.mjs.map
|