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