@elite.framework/ng.core 1.0.65 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -22
- package/directives/README.md +3 -0
- package/fesm2022/{elite.framework-ng.core-src-lib-directives.mjs → elite.framework-ng.core-directives.mjs} +7 -7
- package/fesm2022/elite.framework-ng.core-directives.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.core-models.mjs +47 -0
- package/fesm2022/elite.framework-ng.core-models.mjs.map +1 -0
- package/fesm2022/{elite.framework-ng.core-src-lib-pipes.mjs → elite.framework-ng.core-pipes.mjs} +7 -7
- package/fesm2022/elite.framework-ng.core-pipes.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.core-providers.mjs +18 -0
- package/fesm2022/elite.framework-ng.core-providers.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.core-services.mjs +509 -0
- package/fesm2022/elite.framework-ng.core-services.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.core-tokens.mjs +17 -0
- package/fesm2022/elite.framework-ng.core-tokens.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.core.mjs +7 -2239
- package/fesm2022/elite.framework-ng.core.mjs.map +1 -1
- package/index.d.ts +4 -648
- package/models/README.md +3 -0
- package/models/index.d.ts +135 -0
- package/package.json +26 -170
- package/pipes/README.md +3 -0
- package/providers/README.md +3 -0
- package/providers/index.d.ts +6 -0
- package/services/README.md +3 -0
- package/services/index.d.ts +250 -0
- package/tokens/README.md +3 -0
- package/tokens/index.d.ts +15 -0
- package/fesm2022/elite.framework-ng.core-src-lib-components-attachments.mjs +0 -204
- package/fesm2022/elite.framework-ng.core-src-lib-components-attachments.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-breadcrumb.mjs +0 -132
- package/fesm2022/elite.framework-ng.core-src-lib-components-breadcrumb.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-color-picker.mjs +0 -76
- package/fesm2022/elite.framework-ng.core-src-lib-components-color-picker.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-column-settings-popover.mjs +0 -172
- package/fesm2022/elite.framework-ng.core-src-lib-components-column-settings-popover.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-condition-editor.mjs +0 -794
- package/fesm2022/elite.framework-ng.core-src-lib-components-condition-editor.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-custom-switch.mjs +0 -110
- package/fesm2022/elite.framework-ng.core-src-lib-components-custom-switch.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-deactivation-reason.mjs +0 -130
- package/fesm2022/elite.framework-ng.core-src-lib-components-deactivation-reason.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-button.mjs +0 -50
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-button.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-field.mjs +0 -154
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-field.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-template.mjs +0 -24
- package/fesm2022/elite.framework-ng.core-src-lib-components-form-template.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-image.mjs +0 -100
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-image.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-label.mjs +0 -78
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-avatar-label.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button-selector.mjs +0 -167
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button-selector.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button.mjs +0 -62
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-button.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-split-button.mjs +0 -50
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-split-button.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-username-with-domain.mjs +0 -76
- package/fesm2022/elite.framework-ng.core-src-lib-components-formly-username-with-domain.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-autocomplete.mjs +0 -163
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-autocomplete.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-button.mjs +0 -133
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-button.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-card.mjs +0 -214
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-card.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-crud-table.mjs +0 -385
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-crud-table.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-errormessage.mjs +0 -23
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-errormessage.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-formly-fields.mjs +0 -53
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-formly-fields.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-loadingspinner.mjs +0 -23
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-loadingspinner.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-search.mjs +0 -85
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-search.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-selector.mjs +0 -430
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-selector.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-table.mjs +0 -216
- package/fesm2022/elite.framework-ng.core-src-lib-components-generic-table.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-header-wrapper.mjs +0 -18
- package/fesm2022/elite.framework-ng.core-src-lib-components-header-wrapper.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-icon-picker.mjs +0 -195
- package/fesm2022/elite.framework-ng.core-src-lib-components-icon-picker.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-input-switch.mjs +0 -94
- package/fesm2022/elite.framework-ng.core-src-lib-components-input-switch.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-input-with-icon.mjs +0 -55
- package/fesm2022/elite.framework-ng.core-src-lib-components-input-with-icon.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-label-type.mjs +0 -112
- package/fesm2022/elite.framework-ng.core-src-lib-components-label-type.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-odata-query-builder.mjs +0 -297
- package/fesm2022/elite.framework-ng.core-src-lib-components-odata-query-builder.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-repeat.mjs +0 -135
- package/fesm2022/elite.framework-ng.core-src-lib-components-repeat.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-cards.mjs +0 -40
- package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-cards.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-toggles.mjs +0 -41
- package/fesm2022/elite.framework-ng.core-src-lib-components-sidebar-toggles.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-tabs.mjs +0 -45
- package/fesm2022/elite.framework-ng.core-src-lib-components-tabs.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-tag-type.mjs +0 -192
- package/fesm2022/elite.framework-ng.core-src-lib-components-tag-type.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-text-editor.mjs +0 -44
- package/fesm2022/elite.framework-ng.core-src-lib-components-text-editor.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-components-wrappers.mjs +0 -174
- package/fesm2022/elite.framework-ng.core-src-lib-components-wrappers.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-directives.mjs.map +0 -1
- package/fesm2022/elite.framework-ng.core-src-lib-pipes.mjs.map +0 -1
- package/src/lib/components/attachments/index.d.ts +0 -31
- package/src/lib/components/breadcrumb/index.d.ts +0 -10
- package/src/lib/components/color-picker/index.d.ts +0 -9
- package/src/lib/components/column-settings-popover/index.d.ts +0 -39
- package/src/lib/components/condition-editor/index.d.ts +0 -73
- package/src/lib/components/custom-switch/index.d.ts +0 -12
- package/src/lib/components/deactivation-reason/index.d.ts +0 -24
- package/src/lib/components/form-button/index.d.ts +0 -10
- package/src/lib/components/form-field/index.d.ts +0 -30
- package/src/lib/components/form-template/index.d.ts +0 -9
- package/src/lib/components/formly-avatar-image/index.d.ts +0 -11
- package/src/lib/components/formly-avatar-label/index.d.ts +0 -29
- package/src/lib/components/formly-button/index.d.ts +0 -13
- package/src/lib/components/formly-button-selector/index.d.ts +0 -28
- package/src/lib/components/formly-split-button/index.d.ts +0 -16
- package/src/lib/components/formly-username-with-domain/index.d.ts +0 -12
- package/src/lib/components/generic-autocomplete/index.d.ts +0 -34
- package/src/lib/components/generic-button/index.d.ts +0 -35
- package/src/lib/components/generic-card/index.d.ts +0 -90
- package/src/lib/components/generic-crud-table/index.d.ts +0 -120
- package/src/lib/components/generic-errormessage/index.d.ts +0 -10
- package/src/lib/components/generic-formly-fields/index.d.ts +0 -22
- package/src/lib/components/generic-loadingspinner/index.d.ts +0 -9
- package/src/lib/components/generic-search/index.d.ts +0 -29
- package/src/lib/components/generic-selector/index.d.ts +0 -66
- package/src/lib/components/generic-table/index.d.ts +0 -60
- package/src/lib/components/header-wrapper/index.d.ts +0 -8
- package/src/lib/components/icon-picker/index.d.ts +0 -23
- package/src/lib/components/input-switch/index.d.ts +0 -9
- package/src/lib/components/input-with-icon/index.d.ts +0 -10
- package/src/lib/components/label-type/index.d.ts +0 -19
- package/src/lib/components/odata-query-builder/index.d.ts +0 -81
- package/src/lib/components/repeat/index.d.ts +0 -17
- package/src/lib/components/sidebar-cards/index.d.ts +0 -18
- package/src/lib/components/sidebar-toggles/index.d.ts +0 -18
- package/src/lib/components/tabs/index.d.ts +0 -10
- package/src/lib/components/tag-type/index.d.ts +0 -27
- package/src/lib/components/text-editor/index.d.ts +0 -9
- package/src/lib/components/wrappers/index.d.ts +0 -24
- /package/{src/lib/directives → directives}/index.d.ts +0 -0
- /package/{src/lib/pipes → pipes}/index.d.ts +0 -0
|
@@ -1,2250 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
4
|
-
import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
|
|
5
|
-
import { throwError, catchError, map, Subject, takeUntil } from 'rxjs';
|
|
6
|
-
import * as i1$1 from '@angular/common/http';
|
|
7
|
-
import { HttpParams } from '@angular/common/http';
|
|
8
|
-
import Swal from 'sweetalert2';
|
|
9
|
-
import * as i1$3 from '@ngx-formly/core';
|
|
10
|
-
import { FieldType, FormlyAttributes, FieldWrapper, FormlyModule, FormlyForm } from '@ngx-formly/core';
|
|
11
|
-
import * as i1$2 from '@angular/forms';
|
|
12
|
-
import { ReactiveFormsModule, UntypedFormControl, FormGroup, FormsModule } from '@angular/forms';
|
|
13
|
-
import { FormlyFormFieldModule as FormlyFormFieldModule$1 } from '@ngx-formly/primeng/form-field';
|
|
14
|
-
import * as i2$3 from 'primeng/datepicker';
|
|
15
|
-
import { DatePickerModule } from 'primeng/datepicker';
|
|
16
|
-
import * as i3 from 'primeng/inputtext';
|
|
17
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
18
|
-
import * as i3$1 from '@ngx-translate/core';
|
|
19
|
-
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
20
|
-
import { InputNumber } from 'primeng/inputnumber';
|
|
21
|
-
import * as i3$2 from 'primeng/radiobutton';
|
|
22
|
-
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
23
|
-
import * as i4 from '@ngx-formly/core/select';
|
|
24
|
-
import { FormlySelectModule as FormlySelectModule$1 } from '@ngx-formly/core/select';
|
|
25
|
-
import * as i3$3 from 'primeng/select';
|
|
26
|
-
import { SelectModule } from 'primeng/select';
|
|
27
|
-
import * as i2 from 'primeng/api';
|
|
28
|
-
import * as i2$1 from 'primeng/checkbox';
|
|
29
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
30
|
-
import * as i2$2 from 'primeng/textarea';
|
|
31
|
-
import { TextareaModule } from 'primeng/textarea';
|
|
32
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
33
|
-
import * as i3$4 from 'primeng/button';
|
|
34
|
-
import { ButtonModule } from 'primeng/button';
|
|
35
|
-
import * as i1$4 from 'primeng/dynamicdialog';
|
|
2
|
+
import { Component } from '@angular/core';
|
|
36
3
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function coreOptionsFactory({ ...options }) {
|
|
41
|
-
return {
|
|
42
|
-
...options,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
class AutofocusDirective {
|
|
47
|
-
el;
|
|
48
|
-
autoFocus = true;
|
|
49
|
-
constructor(el) {
|
|
50
|
-
this.el = el;
|
|
51
|
-
}
|
|
52
|
-
ngOnChanges() {
|
|
53
|
-
if (this.autoFocus === '' || this.autoFocus === true) {
|
|
54
|
-
this.el.nativeElement.focus();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
58
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: AutofocusDirective, isStandalone: true, selector: "[appAutofocus]", inputs: { autoFocus: ["appAutofocus", "autoFocus"] }, usesOnChanges: true, ngImport: i0 });
|
|
59
|
-
}
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutofocusDirective, decorators: [{
|
|
61
|
-
type: Directive,
|
|
62
|
-
args: [{
|
|
63
|
-
selector: '[appAutofocus]',
|
|
64
|
-
standalone: true
|
|
65
|
-
}]
|
|
66
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { autoFocus: [{
|
|
67
|
-
type: Input,
|
|
68
|
-
args: ['appAutofocus']
|
|
69
|
-
}] } });
|
|
70
|
-
|
|
71
|
-
class RtlLang {
|
|
72
|
-
el;
|
|
73
|
-
renderer;
|
|
74
|
-
lang = 'ar';
|
|
75
|
-
constructor(el, renderer) {
|
|
76
|
-
this.el = el;
|
|
77
|
-
this.renderer = renderer;
|
|
78
|
-
}
|
|
79
|
-
ngOnChanges(changes) {
|
|
80
|
-
const direction = this.lang === 'ar' ? 'rtl' : 'ltr';
|
|
81
|
-
this.renderer.setStyle(this.el.nativeElement, 'direction', direction);
|
|
82
|
-
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RtlLang, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
84
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: RtlLang, isStandalone: true, selector: "[appRtlLang]", inputs: { lang: ["appRtlLang", "lang"] }, usesOnChanges: true, ngImport: i0 });
|
|
85
|
-
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RtlLang, decorators: [{
|
|
87
|
-
type: Directive,
|
|
88
|
-
args: [{
|
|
89
|
-
selector: '[appRtlLang]'
|
|
90
|
-
}]
|
|
91
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { lang: [{
|
|
92
|
-
type: Input,
|
|
93
|
-
args: ['appRtlLang']
|
|
94
|
-
}] } });
|
|
95
|
-
|
|
96
|
-
// tafqeet.pipe.ts
|
|
97
|
-
class TafqeetPipe {
|
|
98
|
-
transform(value, currencyName = 'ريال سعودي') {
|
|
99
|
-
if (value == null || isNaN(value))
|
|
100
|
-
return '';
|
|
101
|
-
const [intPart, fracPart] = value.toFixed(2).split('.').map(Number);
|
|
102
|
-
const intText = this.toArabicWords(intPart);
|
|
103
|
-
const fracText = this.toArabicWords(fracPart);
|
|
104
|
-
let result = `${intText} ${currencyName}`;
|
|
105
|
-
if (fracPart > 0) {
|
|
106
|
-
result += ` و${fracText} هللة`;
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
toArabicWords(n) {
|
|
111
|
-
const units = [
|
|
112
|
-
'', 'واحد', 'اثنان', 'ثلاثة', 'أربعة', 'خمسة', 'ستة', 'سبعة', 'ثمانية', 'تسعة'
|
|
113
|
-
];
|
|
114
|
-
const teens = [
|
|
115
|
-
'عشرة', 'أحد عشر', 'اثنا عشر', 'ثلاثة عشر', 'أربعة عشر', 'خمسة عشر',
|
|
116
|
-
'ستة عشر', 'سبعة عشر', 'ثمانية عشر', 'تسعة عشر'
|
|
117
|
-
];
|
|
118
|
-
const tens = [
|
|
119
|
-
'', '', 'عشرون', 'ثلاثون', 'أربعون', 'خمسون', 'ستون', 'سبعون', 'ثمانون', 'تسعون'
|
|
120
|
-
];
|
|
121
|
-
const hundreds = [
|
|
122
|
-
'', 'مائة', 'مائتان', 'ثلاثمائة', 'أربعمائة', 'خمسمائة', 'ستمائة', 'سبعمائة', 'ثمانمائة', 'تسعمائة'
|
|
123
|
-
];
|
|
124
|
-
if (n === 0)
|
|
125
|
-
return 'صفر';
|
|
126
|
-
let words = [];
|
|
127
|
-
if (n >= 100) {
|
|
128
|
-
const h = Math.floor(n / 100);
|
|
129
|
-
words.push(hundreds[h]);
|
|
130
|
-
n %= 100;
|
|
131
|
-
}
|
|
132
|
-
if (n >= 10 && n < 20) {
|
|
133
|
-
words.push(teens[n - 10]);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
const t = Math.floor(n / 10);
|
|
137
|
-
const u = n % 10;
|
|
138
|
-
if (u > 0) {
|
|
139
|
-
words.push(units[u]);
|
|
140
|
-
}
|
|
141
|
-
if (t > 0) {
|
|
142
|
-
words.push(tens[t]);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return words.reverse().filter(w => !!w).join(' و ');
|
|
146
|
-
}
|
|
147
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
148
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, isStandalone: true, name: "tafqeet" });
|
|
149
|
-
}
|
|
150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TafqeetPipe, decorators: [{
|
|
151
|
-
type: Pipe,
|
|
152
|
-
args: [{
|
|
153
|
-
name: 'tafqeet'
|
|
154
|
-
}]
|
|
155
|
-
}] });
|
|
156
|
-
|
|
157
|
-
class TimeAgoWithFullDatePipe {
|
|
158
|
-
datePipe;
|
|
159
|
-
constructor(datePipe) {
|
|
160
|
-
this.datePipe = datePipe;
|
|
161
|
-
} // حقن DatePipe
|
|
162
|
-
transform(value) {
|
|
163
|
-
if (!value)
|
|
164
|
-
return '';
|
|
165
|
-
const date = typeof value === 'string' ? new Date(value) : value;
|
|
166
|
-
const now = new Date();
|
|
167
|
-
const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
168
|
-
let relativeTime;
|
|
169
|
-
if (seconds < 10) { // في بضع ثوانٍ (لأن "few seconds" في Freshdesk تكون قصيرة جداً)
|
|
170
|
-
relativeTime = 'منذ بضع ثوانٍ';
|
|
171
|
-
}
|
|
172
|
-
else if (seconds < 60) {
|
|
173
|
-
relativeTime = `منذ ${seconds} ثانية`;
|
|
174
|
-
}
|
|
175
|
-
else if (seconds < 120) { // 1 to 2 minutes
|
|
176
|
-
relativeTime = 'منذ دقيقة واحدة';
|
|
177
|
-
}
|
|
178
|
-
else if (seconds < 3600) { // less than 1 hour
|
|
179
|
-
relativeTime = `منذ ${Math.floor(seconds / 60)} دقيقة`;
|
|
180
|
-
}
|
|
181
|
-
else if (seconds < 7200) { // 1 to 2 hours
|
|
182
|
-
relativeTime = 'منذ ساعة واحدة';
|
|
183
|
-
}
|
|
184
|
-
else if (seconds < 86400) { // less than 24 hours
|
|
185
|
-
relativeTime = `منذ ${Math.floor(seconds / 3600)} ساعة`;
|
|
186
|
-
}
|
|
187
|
-
else if (seconds < 172800) { // 1 to 2 days
|
|
188
|
-
relativeTime = 'منذ يوم واحد';
|
|
189
|
-
}
|
|
190
|
-
else if (seconds < 2592000) { // less than 30 days (approx. 1 month)
|
|
191
|
-
relativeTime = `منذ ${Math.floor(seconds / 86400)} يومًا`;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
// For longer periods, Freshdesk typically just shows the full date
|
|
195
|
-
// We'll still keep the 'منذ X' for now based on previous request,
|
|
196
|
-
// but you might consider just returning the full date for older items.
|
|
197
|
-
const months = Math.floor(seconds / 2592000); // 30 days * 24 hours * 60 minutes * 60 seconds
|
|
198
|
-
if (months < 12) {
|
|
199
|
-
relativeTime = `منذ ${months} شهرًا`;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
relativeTime = `منذ ${Math.floor(months / 12)} سنة`;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// تنسيق التاريخ الكامل بالضبط كما في Freshdesk: "Sat, 26 Jul 2025 at 9:41 PM"
|
|
206
|
-
const fullDateFormatted = this.datePipe.transform(date, 'E, d MMM yyyy at h:mm a', 'en-US');
|
|
207
|
-
// دمج الوقت النسبي مع التاريخ الكامل
|
|
208
|
-
return `${relativeTime} (${fullDateFormatted})`;
|
|
209
|
-
}
|
|
210
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, deps: [{ token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
211
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, isStandalone: true, name: "timeAgoWithFullDate", pure: false });
|
|
212
|
-
}
|
|
213
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TimeAgoWithFullDatePipe, decorators: [{
|
|
214
|
-
type: Pipe,
|
|
215
|
-
args: [{
|
|
216
|
-
name: 'timeAgoWithFullDate', // تغيير الاسم ليعكس وظيفته الشاملة
|
|
217
|
-
pure: false // مهم لتحديث الـ Pipe بشكل متكرر
|
|
218
|
-
}]
|
|
219
|
-
}], ctorParameters: () => [{ type: i1.DatePipe }] });
|
|
220
|
-
|
|
221
|
-
class AttachmentDto {
|
|
222
|
-
id;
|
|
223
|
-
binaryObjectId;
|
|
224
|
-
description;
|
|
225
|
-
mimeType;
|
|
226
|
-
fileName;
|
|
227
|
-
base64;
|
|
228
|
-
caption;
|
|
229
|
-
link;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
class ListResultDto {
|
|
233
|
-
items;
|
|
234
|
-
constructor(initialValues = {}) {
|
|
235
|
-
for (const key in initialValues) {
|
|
236
|
-
if (checkHasProp(initialValues, key)) {
|
|
237
|
-
this[key] = initialValues[key];
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
class PagedResultDto extends ListResultDto {
|
|
243
|
-
totalCount;
|
|
244
|
-
constructor(initialValues = {}) {
|
|
245
|
-
super(initialValues);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
class GeneralResponse {
|
|
249
|
-
success;
|
|
250
|
-
result;
|
|
251
|
-
targetUrl;
|
|
252
|
-
// error?: IGeneralErrorInfo;
|
|
253
|
-
error;
|
|
254
|
-
unAuthorizedRequest;
|
|
255
|
-
constructor() {
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function checkHasProp(object, key) {
|
|
259
|
-
return Object.prototype.hasOwnProperty.call(object, key);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
var Rest;
|
|
263
|
-
(function (Rest) {
|
|
264
|
-
let Observe;
|
|
265
|
-
(function (Observe) {
|
|
266
|
-
Observe["Body"] = "body";
|
|
267
|
-
Observe["Events"] = "events";
|
|
268
|
-
Observe["Response"] = "response";
|
|
269
|
-
})(Observe = Rest.Observe || (Rest.Observe = {}));
|
|
270
|
-
let ResponseType;
|
|
271
|
-
(function (ResponseType) {
|
|
272
|
-
ResponseType["ArrayBuffer"] = "arraybuffer";
|
|
273
|
-
ResponseType["Blob"] = "blob";
|
|
274
|
-
ResponseType["JSON"] = "json";
|
|
275
|
-
ResponseType["Text"] = "text";
|
|
276
|
-
})(ResponseType = Rest.ResponseType || (Rest.ResponseType = {}));
|
|
277
|
-
})(Rest || (Rest = {}));
|
|
278
|
-
|
|
279
|
-
class RestService {
|
|
280
|
-
options;
|
|
281
|
-
http;
|
|
282
|
-
environment = inject(ENVIRONMENT);
|
|
283
|
-
constructor(options, http) {
|
|
284
|
-
this.options = options;
|
|
285
|
-
this.http = http;
|
|
286
|
-
}
|
|
287
|
-
getApiFromStore(apiName) {
|
|
288
|
-
return this.environment.apiUrl;
|
|
289
|
-
}
|
|
290
|
-
handleError(err) {
|
|
291
|
-
// this.httpErrorReporter.reportError(err);
|
|
292
|
-
return throwError(() => err);
|
|
293
|
-
}
|
|
294
|
-
request(request, config, api) {
|
|
295
|
-
// debugger
|
|
296
|
-
config = config || {};
|
|
297
|
-
api = api || this.getApiFromStore(config.apiName);
|
|
298
|
-
const { method, params, ...options } = request;
|
|
299
|
-
const { observe = Rest.Observe.Body, skipHandleError } = config;
|
|
300
|
-
const url = this.removeDuplicateSlashes(api + request.url);
|
|
301
|
-
const httpClient = this.getHttpClient(config.skipAddingHeader ?? false);
|
|
302
|
-
return httpClient
|
|
303
|
-
.request(method, url, {
|
|
304
|
-
observe,
|
|
305
|
-
...(params && {
|
|
306
|
-
params: this.getParams(params, config.httpParamEncoder),
|
|
307
|
-
}),
|
|
308
|
-
...options,
|
|
309
|
-
})
|
|
310
|
-
.pipe(catchError(err => (skipHandleError ? throwError(() => err) : this.handleError(err))));
|
|
311
|
-
}
|
|
312
|
-
getHttpClient(isExternal) {
|
|
313
|
-
return /* isExternal ? this.externalHttp : */ this.http;
|
|
314
|
-
}
|
|
315
|
-
getParams(params, encoder) {
|
|
316
|
-
const filteredParams = Object.entries(params).reduce((acc, [key, value]) => {
|
|
317
|
-
if (isUndefinedOrEmptyString(value))
|
|
318
|
-
return acc;
|
|
319
|
-
if (value === null && !this.options.sendNullsAsQueryParam)
|
|
320
|
-
return acc;
|
|
321
|
-
acc[key] = value;
|
|
322
|
-
return acc;
|
|
323
|
-
}, {});
|
|
324
|
-
return encoder
|
|
325
|
-
? new HttpParams({ encoder, fromObject: filteredParams })
|
|
326
|
-
: new HttpParams({ fromObject: filteredParams });
|
|
327
|
-
}
|
|
328
|
-
removeDuplicateSlashes(url) {
|
|
329
|
-
return url.replace(/([^:]\/)\/+/g, '$1');
|
|
330
|
-
}
|
|
331
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, deps: [{ token: CORE_OPTIONS }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
332
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, providedIn: 'root' });
|
|
333
|
-
}
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: RestService, decorators: [{
|
|
335
|
-
type: Injectable,
|
|
336
|
-
args: [{
|
|
337
|
-
providedIn: 'root',
|
|
338
|
-
}]
|
|
339
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
340
|
-
type: Inject,
|
|
341
|
-
args: [CORE_OPTIONS]
|
|
342
|
-
}] }, { type: i1$1.HttpClient }] });
|
|
343
|
-
function isUndefinedOrEmptyString(value) {
|
|
344
|
-
return value === undefined || value === '';
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
class BaseService {
|
|
348
|
-
restService;
|
|
349
|
-
apiName = '';
|
|
350
|
-
moduleName = '';
|
|
351
|
-
constructor(restService) {
|
|
352
|
-
this.restService = restService;
|
|
353
|
-
}
|
|
354
|
-
get = (id) => this.restService.request({
|
|
355
|
-
method: 'GET',
|
|
356
|
-
url: `/${this.moduleName}/${this.apiName}/${id}`,
|
|
357
|
-
}, { apiName: this.apiName });
|
|
358
|
-
getList = (input, endpoint) => {
|
|
359
|
-
const params = Object.keys(input).reduce((acc, key) => {
|
|
360
|
-
acc[key] = input[key];
|
|
361
|
-
return acc;
|
|
362
|
-
}, {});
|
|
363
|
-
const url = endpoint ? endpoint : `/${this.moduleName}/${this.apiName}`;
|
|
364
|
-
return this.restService.request({
|
|
365
|
-
method: 'GET',
|
|
366
|
-
url: url,
|
|
367
|
-
params: params,
|
|
368
|
-
}, { apiName: this.apiName })
|
|
369
|
-
.pipe(map(response => response));
|
|
370
|
-
};
|
|
371
|
-
create = (input) => this.restService.request({
|
|
372
|
-
method: 'POST',
|
|
373
|
-
url: `/${this.moduleName}/${this.apiName}`,
|
|
374
|
-
body: input,
|
|
375
|
-
}, { apiName: this.apiName });
|
|
376
|
-
update = (id, input) => this.restService.request({
|
|
377
|
-
method: 'PUT',
|
|
378
|
-
url: `/${this.moduleName}/${this.apiName}/${id}`,
|
|
379
|
-
body: input,
|
|
380
|
-
}, { apiName: this.apiName });
|
|
381
|
-
delete = (id) => this.restService.request({
|
|
382
|
-
method: 'DELETE',
|
|
383
|
-
url: `/${this.moduleName}/${this.apiName}/${id}`,
|
|
384
|
-
}, { apiName: this.apiName });
|
|
385
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, deps: [{ token: RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
386
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, providedIn: 'root' });
|
|
387
|
-
}
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseService, decorators: [{
|
|
389
|
-
type: Injectable,
|
|
390
|
-
args: [{
|
|
391
|
-
providedIn: 'root',
|
|
392
|
-
}]
|
|
393
|
-
}], ctorParameters: () => [{ type: RestService }] });
|
|
394
|
-
|
|
395
|
-
// src/app/services/generic.service.ts
|
|
396
|
-
/**
|
|
397
|
-
* GenericService<T, K>:
|
|
398
|
-
* - T = نوع الكائن (Model)
|
|
399
|
-
* - K = نوع المفتاح الأساسي (ID)، افتراضي number
|
|
400
|
-
*
|
|
401
|
-
* يحتوي على جميع دوال الـ CRUD القياسية للتوريث في الخدمات المتخصصة.
|
|
402
|
-
*/
|
|
403
|
-
class GenericService {
|
|
404
|
-
http;
|
|
405
|
-
constructor(http) {
|
|
406
|
-
this.http = http;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* جلب كل السجلات
|
|
410
|
-
*/
|
|
411
|
-
getAll() {
|
|
412
|
-
// ملاحظة: يمكن إضافة معالج أخطاء مركزي هنا أو عبر Interceptor
|
|
413
|
-
return this.http.get(this.baseUrl);
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* جلب سجل واحد بناءً على المعرف
|
|
417
|
-
*/
|
|
418
|
-
getById(id) {
|
|
419
|
-
// ملاحظة: تأكد أن الـ endpoint يدعم GET برقم المعرف
|
|
420
|
-
return this.http.get(`${this.baseUrl}/${id}`);
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* إنشاء سجل جديد
|
|
424
|
-
*/
|
|
425
|
-
create(item) {
|
|
426
|
-
// ملاحظة: استخدم Partial<T> للسماح ببعض الحقول الاختيارية
|
|
427
|
-
return this.http.post(this.baseUrl, item);
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* تحديث سجل موجود
|
|
431
|
-
*/
|
|
432
|
-
update(id, item) {
|
|
433
|
-
// ملاحظة: هنا نُعيد Observable<void> لأن API قد لا تُرجع الجسم نفسه
|
|
434
|
-
return this.http.put(`${this.baseUrl}`, item);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* حذف سجل
|
|
438
|
-
*/
|
|
439
|
-
delete(id) {
|
|
440
|
-
// ملاحظة: يُفضّل استخدام Confirm قبل الحذف في الواجهة
|
|
441
|
-
return this.http.delete(`${this.baseUrl}/${id}`);
|
|
442
|
-
}
|
|
443
|
-
/** endpoint قابل للتخصيص — يمكن للفرع override–ها */
|
|
444
|
-
getPageUrl() {
|
|
445
|
-
return this.baseUrl;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* جلب صفحة من البيانات مع دعم الفلاتر والفرز
|
|
449
|
-
* @param pageIndex صفر-based
|
|
450
|
-
* @param pageSize عدد السجلات
|
|
451
|
-
* @param filters كائن Partial<T> أو Record<string,any>
|
|
452
|
-
* @param sort نص الفرز، مثلاً "eiNa:desc"
|
|
453
|
-
*/
|
|
454
|
-
getPage(pageIndex, pageSize, filters, sort) {
|
|
455
|
-
// debugger
|
|
456
|
-
let params = new HttpParams()
|
|
457
|
-
.set('pageIndex', pageIndex.toString())
|
|
458
|
-
.set('pageSize', pageSize.toString());
|
|
459
|
-
if (filters) {
|
|
460
|
-
Object.entries(filters).forEach(([key, val]) => {
|
|
461
|
-
if (val != null && val !== '') {
|
|
462
|
-
params = params.set(key, val.toString());
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
if (sort) {
|
|
467
|
-
params = params.set('sort', sort);
|
|
468
|
-
}
|
|
469
|
-
// return this.http
|
|
470
|
-
// .get<T[]>(this.getPageUrl(), { params, observe: 'response' })
|
|
471
|
-
// .pipe(
|
|
472
|
-
// map((resp: HttpResponse<T[]>) => ({
|
|
473
|
-
// items: resp.body || [],
|
|
474
|
-
// totalCount: Number(resp.headers.get('X-Total-Count')) || resp.body?.length || 0
|
|
475
|
-
// }))
|
|
476
|
-
// );
|
|
477
|
-
return this.http.get(this.getPageUrl(), { params });
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// Define the `Request` token
|
|
482
|
-
const REQUEST = new InjectionToken('REQUEST');
|
|
483
|
-
class SsrCookieService {
|
|
484
|
-
document;
|
|
485
|
-
platformId;
|
|
486
|
-
request;
|
|
487
|
-
documentIsAccessible;
|
|
488
|
-
static initialUrl = '';
|
|
489
|
-
constructor(document,
|
|
490
|
-
// Get the `PLATFORM_ID` so we can check if we're in a browser.
|
|
491
|
-
platformId, request) {
|
|
492
|
-
this.document = document;
|
|
493
|
-
this.platformId = platformId;
|
|
494
|
-
this.request = request;
|
|
495
|
-
this.documentIsAccessible = isPlatformBrowser(this.platformId);
|
|
496
|
-
SsrCookieService.initialUrl = this.documentIsAccessible ? this.document.location.href : this.request?.url;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Get cookie Regular Expression
|
|
500
|
-
*
|
|
501
|
-
* @param name Cookie name
|
|
502
|
-
* @returns property RegExp
|
|
503
|
-
*
|
|
504
|
-
* @author: Stepan Suvorov
|
|
505
|
-
* @since: 1.0.0
|
|
506
|
-
*/
|
|
507
|
-
static getCookieRegExp(name) {
|
|
508
|
-
const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
|
|
509
|
-
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
|
513
|
-
*
|
|
514
|
-
* @param encodedURIComponent A value representing an encoded URI component.
|
|
515
|
-
*
|
|
516
|
-
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
|
517
|
-
*
|
|
518
|
-
* @author: Stepan Suvorov
|
|
519
|
-
* @since: 1.0.0
|
|
520
|
-
*/
|
|
521
|
-
static safeDecodeURIComponent(encodedURIComponent) {
|
|
522
|
-
try {
|
|
523
|
-
return decodeURIComponent(encodedURIComponent);
|
|
524
|
-
}
|
|
525
|
-
catch {
|
|
526
|
-
// probably it is not uri encoded. return as is
|
|
527
|
-
return encodedURIComponent;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Return `true` if {@link Document} is accessible, otherwise return `false`
|
|
532
|
-
*
|
|
533
|
-
* @param name Cookie name
|
|
534
|
-
* @returns boolean - whether cookie with specified name exists
|
|
535
|
-
*
|
|
536
|
-
* @author: Stepan Suvorov
|
|
537
|
-
* @since: 1.0.0
|
|
538
|
-
*/
|
|
539
|
-
check(name) {
|
|
540
|
-
name = encodeURIComponent(name);
|
|
541
|
-
const regExp = SsrCookieService.getCookieRegExp(name);
|
|
542
|
-
return regExp.test((this.documentIsAccessible ? this.document.cookie : this.request?.headers.cookie) ?? '');
|
|
543
|
-
}
|
|
544
|
-
isDocumentIsAccessible() {
|
|
545
|
-
return this.documentIsAccessible;
|
|
546
|
-
}
|
|
547
|
-
get url() {
|
|
548
|
-
return this.documentIsAccessible ? this.document.location.href : this.request?.url;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Get cookies by name
|
|
552
|
-
*
|
|
553
|
-
* @param name Cookie name
|
|
554
|
-
* @returns property value
|
|
555
|
-
*
|
|
556
|
-
* @author: Stepan Suvorov
|
|
557
|
-
* @since: 1.0.0
|
|
558
|
-
*/
|
|
559
|
-
get(name) {
|
|
560
|
-
if (this.check(name)) {
|
|
561
|
-
name = encodeURIComponent(name);
|
|
562
|
-
const regExp = SsrCookieService.getCookieRegExp(name);
|
|
563
|
-
const result = regExp.exec((this.documentIsAccessible ? this.document.cookie : this.request?.headers.cookie) ?? '');
|
|
564
|
-
return result[1] ? SsrCookieService.safeDecodeURIComponent(result[1]) : '';
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
return '';
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Get all cookies in JSON format
|
|
572
|
-
*
|
|
573
|
-
* @returns all the cookies in json
|
|
574
|
-
*
|
|
575
|
-
* @author: Stepan Suvorov
|
|
576
|
-
* @since: 1.0.0
|
|
577
|
-
*/
|
|
578
|
-
getAll() {
|
|
579
|
-
const cookies = {};
|
|
580
|
-
const cookieString = this.documentIsAccessible ? this.document?.cookie : this.request?.headers.cookie;
|
|
581
|
-
if (cookieString && cookieString !== '') {
|
|
582
|
-
cookieString.split(';').forEach((currentCookie) => {
|
|
583
|
-
const [cookieName, cookieValue] = currentCookie.split('=');
|
|
584
|
-
cookies[SsrCookieService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = SsrCookieService.safeDecodeURIComponent(cookieValue);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
return cookies;
|
|
588
|
-
}
|
|
589
|
-
set(name, value, expiresOrOptions, path, domain, secure, sameSite, partitioned) {
|
|
590
|
-
if (!this.documentIsAccessible) {
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {
|
|
594
|
-
const optionsBody = {
|
|
595
|
-
expires: expiresOrOptions,
|
|
596
|
-
path,
|
|
597
|
-
domain,
|
|
598
|
-
secure,
|
|
599
|
-
sameSite: sameSite ? sameSite : 'Lax',
|
|
600
|
-
partitioned,
|
|
601
|
-
};
|
|
602
|
-
this.set(name, value, optionsBody);
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
|
|
606
|
-
const options = expiresOrOptions ? expiresOrOptions : {};
|
|
607
|
-
if (options.expires) {
|
|
608
|
-
if (typeof options.expires === 'number') {
|
|
609
|
-
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
|
|
610
|
-
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
cookieString += 'expires=' + options.expires.toUTCString() + ';';
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
if (options.path) {
|
|
617
|
-
cookieString += 'path=' + options.path + ';';
|
|
618
|
-
}
|
|
619
|
-
if (options.domain) {
|
|
620
|
-
cookieString += 'domain=' + options.domain + ';';
|
|
621
|
-
}
|
|
622
|
-
if (options.secure === false && options.sameSite === 'None') {
|
|
623
|
-
options.secure = true;
|
|
624
|
-
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
|
|
625
|
-
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
|
|
626
|
-
}
|
|
627
|
-
if (options.secure) {
|
|
628
|
-
cookieString += 'secure;';
|
|
629
|
-
}
|
|
630
|
-
if (!options.sameSite) {
|
|
631
|
-
options.sameSite = 'Lax';
|
|
632
|
-
}
|
|
633
|
-
cookieString += 'sameSite=' + options.sameSite + ';';
|
|
634
|
-
if (options.partitioned) {
|
|
635
|
-
cookieString += 'Partitioned;';
|
|
636
|
-
}
|
|
637
|
-
this.document.cookie = cookieString;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Delete cookie by name
|
|
641
|
-
*
|
|
642
|
-
* @param name Cookie name
|
|
643
|
-
* @param path Cookie path
|
|
644
|
-
* @param domain Cookie domain
|
|
645
|
-
* @param secure Cookie secure flag
|
|
646
|
-
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
|
647
|
-
*
|
|
648
|
-
* @author: Stepan Suvorov
|
|
649
|
-
* @since: 1.0.0
|
|
650
|
-
*/
|
|
651
|
-
delete(name, path, domain, secure, sameSite = 'Lax') {
|
|
652
|
-
if (!this.documentIsAccessible) {
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
|
|
656
|
-
this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite });
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Delete all cookies
|
|
660
|
-
*
|
|
661
|
-
* @param path Cookie path
|
|
662
|
-
* @param domain Cookie domain
|
|
663
|
-
* @param secure Is the Cookie secure
|
|
664
|
-
* @param sameSite Is the cookie same site
|
|
665
|
-
*
|
|
666
|
-
* @author: Stepan Suvorov
|
|
667
|
-
* @since: 1.0.0
|
|
668
|
-
*/
|
|
669
|
-
deleteAll(path, domain, secure, sameSite = 'Lax') {
|
|
670
|
-
if (!this.documentIsAccessible) {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
const cookies = this.getAll();
|
|
674
|
-
for (const cookieName in cookies) {
|
|
675
|
-
if (cookies.hasOwnProperty(cookieName)) {
|
|
676
|
-
this.delete(cookieName, path, domain, secure, sameSite);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: REQUEST, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
681
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, providedIn: 'root' });
|
|
682
|
-
}
|
|
683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SsrCookieService, decorators: [{
|
|
684
|
-
type: Injectable,
|
|
685
|
-
args: [{
|
|
686
|
-
providedIn: 'root',
|
|
687
|
-
}]
|
|
688
|
-
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
689
|
-
type: Inject,
|
|
690
|
-
args: [DOCUMENT]
|
|
691
|
-
}] }, { type: undefined, decorators: [{
|
|
692
|
-
type: Inject,
|
|
693
|
-
args: [PLATFORM_ID]
|
|
694
|
-
}] }, { type: undefined, decorators: [{
|
|
695
|
-
type: Optional
|
|
696
|
-
}, {
|
|
697
|
-
type: Inject,
|
|
698
|
-
args: [REQUEST]
|
|
699
|
-
}] }] });
|
|
700
|
-
|
|
701
|
-
// app/shared/services/swal.service.ts
|
|
702
|
-
class SwalService {
|
|
703
|
-
/** رسالة تأكيد قبل تنفيذ إجراء */
|
|
704
|
-
confirm(title = 'هل أنت متأكد؟', text = 'لن يمكنك التراجع عن هذا الإجراء', confirmButtonText = 'نعم', cancelButtonText = 'إلغاء') {
|
|
705
|
-
return Swal.fire({
|
|
706
|
-
icon: 'warning',
|
|
707
|
-
title,
|
|
708
|
-
text,
|
|
709
|
-
showCancelButton: true,
|
|
710
|
-
confirmButtonText,
|
|
711
|
-
cancelButtonText,
|
|
712
|
-
// reverseButtons: true,
|
|
713
|
-
customClass: {
|
|
714
|
-
container: 'swal2-container' // ✅ أضف هذه الفئة
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
/** رسالة نجاح */
|
|
719
|
-
success(title, text, timer = 2000) {
|
|
720
|
-
return Swal.fire({
|
|
721
|
-
icon: 'success',
|
|
722
|
-
title,
|
|
723
|
-
text,
|
|
724
|
-
timer,
|
|
725
|
-
showConfirmButton: false,
|
|
726
|
-
customClass: {
|
|
727
|
-
container: 'swal2-container' // ✅ أضف هذه الفئة
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
/** رسالة خطأ */
|
|
732
|
-
error(title, text, footer) {
|
|
733
|
-
return Swal.fire({
|
|
734
|
-
icon: 'error',
|
|
735
|
-
title,
|
|
736
|
-
text,
|
|
737
|
-
footer,
|
|
738
|
-
customClass: {
|
|
739
|
-
container: 'swal2-container' // ✅ أضف هذه الفئة
|
|
740
|
-
}
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
/** رسالة معلومات */
|
|
744
|
-
info(title, text) {
|
|
745
|
-
return Swal.fire({
|
|
746
|
-
icon: 'info',
|
|
747
|
-
title,
|
|
748
|
-
text,
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
/** عرض نافذة SweetAlert2 بأي خيارات تريد */
|
|
752
|
-
alert(options) {
|
|
753
|
-
return Swal.fire(options);
|
|
754
|
-
}
|
|
755
|
-
/** Toast بسيط قابل لإعادة الاستخدام */
|
|
756
|
-
toast(title, icon = 'info', position = 'top-end', timer = 3000) {
|
|
757
|
-
const Toast = Swal.mixin({
|
|
758
|
-
toast: true,
|
|
759
|
-
position,
|
|
760
|
-
timer,
|
|
761
|
-
showConfirmButton: false,
|
|
762
|
-
});
|
|
763
|
-
Toast.fire({ icon, title });
|
|
764
|
-
}
|
|
765
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
766
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, providedIn: 'root' });
|
|
767
|
-
}
|
|
768
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: SwalService, decorators: [{
|
|
769
|
-
type: Injectable,
|
|
770
|
-
args: [{ providedIn: 'root' }]
|
|
771
|
-
}] });
|
|
772
|
-
|
|
773
|
-
// core/providers/environment.provider.ts
|
|
774
|
-
function provideEnvironmentConfig(config) {
|
|
775
|
-
return {
|
|
776
|
-
provide: ENVIRONMENT,
|
|
777
|
-
useValue: config
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
// export * from './formly.config';
|
|
782
|
-
|
|
783
|
-
class FormlyFieldInput extends FieldType {
|
|
784
|
-
inputElement;
|
|
785
|
-
inputNumberElement; // p-inputNumber component reference
|
|
786
|
-
ngAfterViewInit() {
|
|
787
|
-
if (this.props.autofocus) {
|
|
788
|
-
setTimeout(() => {
|
|
789
|
-
if (this.props.type === 'number' && this.inputNumberElement?.el?.nativeElement) {
|
|
790
|
-
// Focus for p-inputNumber
|
|
791
|
-
this.inputNumberElement.el.nativeElement.querySelector('input')?.focus();
|
|
792
|
-
}
|
|
793
|
-
else if (this.inputElement?.nativeElement) {
|
|
794
|
-
// Focus for regular input
|
|
795
|
-
this.inputElement.nativeElement.focus();
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
801
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldInput, isStandalone: true, selector: "formly-field-primeng-input", viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "inputNumberElement", first: true, predicate: ["inputNumberElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
802
|
-
<input
|
|
803
|
-
*ngIf="props.type !== 'number'; else numberTmp"
|
|
804
|
-
pInputText
|
|
805
|
-
[type]="props['type'] || 'text'"
|
|
806
|
-
[formControl]="formControl"
|
|
807
|
-
[formlyAttributes]="field"
|
|
808
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
809
|
-
class="w-full rounded-none block"
|
|
810
|
-
#inputElement
|
|
811
|
-
/>
|
|
812
|
-
<ng-template #numberTmp>
|
|
813
|
-
<p-inputNumber
|
|
814
|
-
[formControl]="formControl"
|
|
815
|
-
[formlyAttributes]="field"
|
|
816
|
-
class="w-full rounded-none block"
|
|
817
|
-
[min]="props['min'] || 0"
|
|
818
|
-
[showButtons]="props['showButtons'] ?? false"
|
|
819
|
-
buttonLayout="horizontal"
|
|
820
|
-
spinnerMode="horizontal"
|
|
821
|
-
[useGrouping]="props['useGrouping']"
|
|
822
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
823
|
-
#inputNumberElement>
|
|
824
|
-
<ng-template #incrementbuttonicon>
|
|
825
|
-
<span class="pi pi-plus"></span>
|
|
826
|
-
</ng-template>
|
|
827
|
-
<ng-template #decrementbuttonicon>
|
|
828
|
-
<span class="pi pi-minus"></span>
|
|
829
|
-
</ng-template>
|
|
830
|
-
</p-inputNumber>
|
|
831
|
-
</ng-template>
|
|
832
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule$1 }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
833
|
-
}
|
|
834
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldInput, decorators: [{
|
|
835
|
-
type: Component,
|
|
836
|
-
args: [{
|
|
837
|
-
selector: 'formly-field-primeng-input',
|
|
838
|
-
template: `
|
|
839
|
-
<input
|
|
840
|
-
*ngIf="props.type !== 'number'; else numberTmp"
|
|
841
|
-
pInputText
|
|
842
|
-
[type]="props['type'] || 'text'"
|
|
843
|
-
[formControl]="formControl"
|
|
844
|
-
[formlyAttributes]="field"
|
|
845
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
846
|
-
class="w-full rounded-none block"
|
|
847
|
-
#inputElement
|
|
848
|
-
/>
|
|
849
|
-
<ng-template #numberTmp>
|
|
850
|
-
<p-inputNumber
|
|
851
|
-
[formControl]="formControl"
|
|
852
|
-
[formlyAttributes]="field"
|
|
853
|
-
class="w-full rounded-none block"
|
|
854
|
-
[min]="props['min'] || 0"
|
|
855
|
-
[showButtons]="props['showButtons'] ?? false"
|
|
856
|
-
buttonLayout="horizontal"
|
|
857
|
-
spinnerMode="horizontal"
|
|
858
|
-
[useGrouping]="props['useGrouping']"
|
|
859
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
860
|
-
#inputNumberElement>
|
|
861
|
-
<ng-template #incrementbuttonicon>
|
|
862
|
-
<span class="pi pi-plus"></span>
|
|
863
|
-
</ng-template>
|
|
864
|
-
<ng-template #decrementbuttonicon>
|
|
865
|
-
<span class="pi pi-minus"></span>
|
|
866
|
-
</ng-template>
|
|
867
|
-
</p-inputNumber>
|
|
868
|
-
</ng-template>
|
|
869
|
-
`,
|
|
870
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
871
|
-
standalone: true,
|
|
872
|
-
imports: [
|
|
873
|
-
CommonModule,
|
|
874
|
-
ReactiveFormsModule,
|
|
875
|
-
DatePickerModule,
|
|
876
|
-
FormlyFormFieldModule$1,
|
|
877
|
-
FormlyAttributes,
|
|
878
|
-
InputTextModule,
|
|
879
|
-
TranslateModule,
|
|
880
|
-
InputNumber
|
|
881
|
-
]
|
|
882
|
-
}]
|
|
883
|
-
}], propDecorators: { inputElement: [{
|
|
884
|
-
type: ViewChild,
|
|
885
|
-
args: ['inputElement']
|
|
886
|
-
}], inputNumberElement: [{
|
|
887
|
-
type: ViewChild,
|
|
888
|
-
args: ['inputNumberElement']
|
|
889
|
-
}] } });
|
|
890
|
-
|
|
891
|
-
function withFormlyFieldInput() {
|
|
892
|
-
return {
|
|
893
|
-
types: [
|
|
894
|
-
{
|
|
895
|
-
name: 'input',
|
|
896
|
-
component: FormlyFieldInput,
|
|
897
|
-
wrappers: ['form-field'],
|
|
898
|
-
},
|
|
899
|
-
{ name: 'string', extends: 'input' },
|
|
900
|
-
{
|
|
901
|
-
name: 'number',
|
|
902
|
-
extends: 'input',
|
|
903
|
-
defaultOptions: {
|
|
904
|
-
props: {
|
|
905
|
-
type: 'number',
|
|
906
|
-
},
|
|
907
|
-
},
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
name: 'integer',
|
|
911
|
-
extends: 'input',
|
|
912
|
-
defaultOptions: {
|
|
913
|
-
props: {
|
|
914
|
-
type: 'number',
|
|
915
|
-
},
|
|
916
|
-
},
|
|
917
|
-
},
|
|
918
|
-
],
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
class FormlyWrapperFormField extends FieldWrapper {
|
|
923
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormField, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
924
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyWrapperFormField, isStandalone: false, selector: "formly-wrapper-primeng-form-field", usesInheritance: true, ngImport: i0, template: `
|
|
925
|
-
<div class="p-field">
|
|
926
|
-
<!-- text-lg -->
|
|
927
|
-
@if (props.label && props.hideLabel !== true) {
|
|
928
|
-
<label [for]="id" class="font-bold">
|
|
929
|
-
{{ props.label | translate }}
|
|
930
|
-
@if (props.required && props.hideRequiredMarker !== true) {
|
|
931
|
-
<span aria-hidden="true">*</span>
|
|
932
|
-
}
|
|
933
|
-
</label>
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
<div class="mb-2"></div>
|
|
937
|
-
<ng-container #fieldComponent></ng-container>
|
|
938
|
-
|
|
939
|
-
@if (showError) {
|
|
940
|
-
<small class="text-red-600 text-sm mt-1 block font-medium">
|
|
941
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
|
942
|
-
</small>
|
|
943
|
-
}
|
|
944
|
-
</div>
|
|
945
|
-
`, isInline: true, dependencies: [{ kind: "component", type: i1$3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
|
|
946
|
-
}
|
|
947
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormField, decorators: [{
|
|
948
|
-
type: Component,
|
|
949
|
-
args: [{
|
|
950
|
-
selector: 'formly-wrapper-primeng-form-field',
|
|
951
|
-
standalone: false,
|
|
952
|
-
template: `
|
|
953
|
-
<div class="p-field">
|
|
954
|
-
<!-- text-lg -->
|
|
955
|
-
@if (props.label && props.hideLabel !== true) {
|
|
956
|
-
<label [for]="id" class="font-bold">
|
|
957
|
-
{{ props.label | translate }}
|
|
958
|
-
@if (props.required && props.hideRequiredMarker !== true) {
|
|
959
|
-
<span aria-hidden="true">*</span>
|
|
960
|
-
}
|
|
961
|
-
</label>
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
<div class="mb-2"></div>
|
|
965
|
-
<ng-container #fieldComponent></ng-container>
|
|
966
|
-
|
|
967
|
-
@if (showError) {
|
|
968
|
-
<small class="text-red-600 text-sm mt-1 block font-medium">
|
|
969
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
|
970
|
-
</small>
|
|
971
|
-
}
|
|
972
|
-
</div>
|
|
973
|
-
`,
|
|
974
|
-
}]
|
|
975
|
-
}] });
|
|
976
|
-
class FormlyWrapperFormFieldNo extends FieldWrapper {
|
|
977
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormFieldNo, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
978
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyWrapperFormFieldNo, isStandalone: false, selector: "formly-wrapper-primeng-form-field-no", usesInheritance: true, ngImport: i0, template: `
|
|
979
|
-
<div class="p-field">
|
|
980
|
-
<!-- text-lg -->
|
|
981
|
-
@if (props.label && props.hideLabel !== true) {
|
|
982
|
-
<label [for]="id" class="font-bold">
|
|
983
|
-
@if (props.required && props.hideRequiredMarker !== true) {
|
|
984
|
-
<span aria-hidden="true">*</span>
|
|
985
|
-
}
|
|
986
|
-
</label>
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
<ng-container #fieldComponent></ng-container>
|
|
990
|
-
|
|
991
|
-
@if (showError) {
|
|
992
|
-
<small class="text-red-600 text-sm mt-1 block font-medium">
|
|
993
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
|
994
|
-
</small>
|
|
995
|
-
}
|
|
996
|
-
</div>
|
|
997
|
-
`, isInline: true, dependencies: [{ kind: "component", type: i1$3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }] });
|
|
998
|
-
}
|
|
999
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyWrapperFormFieldNo, decorators: [{
|
|
1000
|
-
type: Component,
|
|
1001
|
-
args: [{
|
|
1002
|
-
selector: 'formly-wrapper-primeng-form-field-no',
|
|
1003
|
-
standalone: false,
|
|
1004
|
-
template: `
|
|
1005
|
-
<div class="p-field">
|
|
1006
|
-
<!-- text-lg -->
|
|
1007
|
-
@if (props.label && props.hideLabel !== true) {
|
|
1008
|
-
<label [for]="id" class="font-bold">
|
|
1009
|
-
@if (props.required && props.hideRequiredMarker !== true) {
|
|
1010
|
-
<span aria-hidden="true">*</span>
|
|
1011
|
-
}
|
|
1012
|
-
</label>
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
<ng-container #fieldComponent></ng-container>
|
|
1016
|
-
|
|
1017
|
-
@if (showError) {
|
|
1018
|
-
<small class="text-red-600 text-sm mt-1 block font-medium">
|
|
1019
|
-
<formly-validation-message [field]="field"></formly-validation-message>
|
|
1020
|
-
</small>
|
|
1021
|
-
}
|
|
1022
|
-
</div>
|
|
1023
|
-
`,
|
|
1024
|
-
}]
|
|
1025
|
-
}] });
|
|
1026
|
-
|
|
1027
|
-
function withFormlyFormField() {
|
|
1028
|
-
return {
|
|
1029
|
-
wrappers: [
|
|
1030
|
-
{
|
|
1031
|
-
name: 'form-field',
|
|
1032
|
-
component: FormlyWrapperFormField,
|
|
1033
|
-
},
|
|
1034
|
-
{
|
|
1035
|
-
name: 'form-field-no',
|
|
1036
|
-
component: FormlyWrapperFormFieldNo,
|
|
1037
|
-
},
|
|
1038
|
-
],
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
class FormlyFormFieldModule {
|
|
1043
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1044
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, declarations: [FormlyWrapperFormField,
|
|
1045
|
-
FormlyWrapperFormFieldNo], imports: [CommonModule, ReactiveFormsModule, i1$3.FormlyModule, TranslateModule, TranslatePipe], exports: [FormlyWrapperFormField] });
|
|
1046
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField()), TranslateModule] });
|
|
1047
|
-
}
|
|
1048
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFormFieldModule, decorators: [{
|
|
1049
|
-
type: NgModule,
|
|
1050
|
-
args: [{
|
|
1051
|
-
declarations: [
|
|
1052
|
-
FormlyWrapperFormField,
|
|
1053
|
-
FormlyWrapperFormFieldNo,
|
|
1054
|
-
// FormlyFormFieldWrapperComponent,
|
|
1055
|
-
],
|
|
1056
|
-
imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField()), TranslateModule, TranslatePipe],
|
|
1057
|
-
exports: [FormlyWrapperFormField]
|
|
1058
|
-
}]
|
|
1059
|
-
}] });
|
|
1060
|
-
|
|
1061
|
-
// import { FormlyFormFieldModule } from '../../components/form-field';
|
|
1062
|
-
class FormlyInputModule {
|
|
1063
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1064
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, imports: [CommonModule,
|
|
1065
|
-
ReactiveFormsModule,
|
|
1066
|
-
InputTextModule,
|
|
1067
|
-
FormlyFormFieldModule, i1$3.FormlyModule] });
|
|
1068
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, imports: [CommonModule,
|
|
1069
|
-
ReactiveFormsModule,
|
|
1070
|
-
InputTextModule,
|
|
1071
|
-
FormlyFormFieldModule,
|
|
1072
|
-
FormlyModule.forChild(withFormlyFieldInput())] });
|
|
1073
|
-
}
|
|
1074
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyInputModule, decorators: [{
|
|
1075
|
-
type: NgModule,
|
|
1076
|
-
args: [{
|
|
1077
|
-
// declarations: [FormlyFieldInput],
|
|
1078
|
-
imports: [
|
|
1079
|
-
CommonModule,
|
|
1080
|
-
ReactiveFormsModule,
|
|
1081
|
-
InputTextModule,
|
|
1082
|
-
FormlyFormFieldModule,
|
|
1083
|
-
FormlyModule.forChild(withFormlyFieldInput()),
|
|
1084
|
-
],
|
|
1085
|
-
}]
|
|
1086
|
-
}] });
|
|
1087
|
-
|
|
1088
|
-
class FormlyFieldRadio extends FieldType {
|
|
1089
|
-
get disabledControl() {
|
|
1090
|
-
return new UntypedFormControl({ value: this.formControl.value, disabled: true });
|
|
1091
|
-
}
|
|
1092
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldRadio, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1093
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldRadio, isStandalone: false, selector: "formly-field-primeng-radio", usesInheritance: true, ngImport: i0, template: `
|
|
1094
|
-
<div
|
|
1095
|
-
class="p-field-radiobutton"
|
|
1096
|
-
*ngFor="let option of props.options | formlySelectOptions: field | async; let index = index"
|
|
1097
|
-
>
|
|
1098
|
-
<p-radioButton
|
|
1099
|
-
[name]="field.name || id"
|
|
1100
|
-
[formControl]="option.disabled ? disabledControl : formControl"
|
|
1101
|
-
[value]="option.value"
|
|
1102
|
-
[inputId]="id + index"
|
|
1103
|
-
>
|
|
1104
|
-
</p-radioButton>
|
|
1105
|
-
<label [for]="id + index" class="ml-2">{{ option.label }}</label>
|
|
1106
|
-
</div>
|
|
1107
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3$2.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "styleClass", "autofocus", "binary", "variant", "size"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1108
|
-
}
|
|
1109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldRadio, decorators: [{
|
|
1110
|
-
type: Component,
|
|
1111
|
-
args: [{
|
|
1112
|
-
selector: 'formly-field-primeng-radio',
|
|
1113
|
-
template: `
|
|
1114
|
-
<div
|
|
1115
|
-
class="p-field-radiobutton"
|
|
1116
|
-
*ngFor="let option of props.options | formlySelectOptions: field | async; let index = index"
|
|
1117
|
-
>
|
|
1118
|
-
<p-radioButton
|
|
1119
|
-
[name]="field.name || id"
|
|
1120
|
-
[formControl]="option.disabled ? disabledControl : formControl"
|
|
1121
|
-
[value]="option.value"
|
|
1122
|
-
[inputId]="id + index"
|
|
1123
|
-
>
|
|
1124
|
-
</p-radioButton>
|
|
1125
|
-
<label [for]="id + index" class="ml-2">{{ option.label }}</label>
|
|
1126
|
-
</div>
|
|
1127
|
-
`,
|
|
1128
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1129
|
-
standalone: false
|
|
1130
|
-
}]
|
|
1131
|
-
}] });
|
|
1132
|
-
|
|
1133
|
-
function withFormlyFieldRadio() {
|
|
1134
|
-
return {
|
|
1135
|
-
types: [
|
|
1136
|
-
{
|
|
1137
|
-
name: 'radio',
|
|
1138
|
-
component: FormlyFieldRadio,
|
|
1139
|
-
wrappers: ['form-field'],
|
|
1140
|
-
},
|
|
1141
|
-
],
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
class FormlyRadioModule {
|
|
1146
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1147
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, declarations: [FormlyFieldRadio], imports: [CommonModule,
|
|
1148
|
-
ReactiveFormsModule,
|
|
1149
|
-
RadioButtonModule,
|
|
1150
|
-
FormlyFormFieldModule,
|
|
1151
|
-
FormlySelectModule$1, i1$3.FormlyModule] });
|
|
1152
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, imports: [CommonModule,
|
|
1153
|
-
ReactiveFormsModule,
|
|
1154
|
-
RadioButtonModule,
|
|
1155
|
-
FormlyFormFieldModule,
|
|
1156
|
-
FormlySelectModule$1,
|
|
1157
|
-
FormlyModule.forChild(withFormlyFieldRadio())] });
|
|
1158
|
-
}
|
|
1159
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyRadioModule, decorators: [{
|
|
1160
|
-
type: NgModule,
|
|
1161
|
-
args: [{
|
|
1162
|
-
declarations: [FormlyFieldRadio],
|
|
1163
|
-
imports: [
|
|
1164
|
-
CommonModule,
|
|
1165
|
-
ReactiveFormsModule,
|
|
1166
|
-
RadioButtonModule,
|
|
1167
|
-
FormlyFormFieldModule,
|
|
1168
|
-
FormlySelectModule$1,
|
|
1169
|
-
FormlyModule.forChild(withFormlyFieldRadio()),
|
|
1170
|
-
],
|
|
1171
|
-
}]
|
|
1172
|
-
}] });
|
|
1173
|
-
|
|
1174
|
-
class FormlyFieldSelect extends FieldType {
|
|
1175
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1176
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: FormlyFieldSelect, isStandalone: true, selector: "formly-field-primeng-select", usesInheritance: true, ngImport: i0, template: `
|
|
1177
|
-
<p-select
|
|
1178
|
-
[options]="(props.options | formlySelectOptions: field | async) ?? []"
|
|
1179
|
-
[formControl]="formControl"
|
|
1180
|
-
[formlyAttributes]="field"
|
|
1181
|
-
[showClear]="!props.required"
|
|
1182
|
-
[appendTo]="props.appendTo"
|
|
1183
|
-
[filter]="props.filter"
|
|
1184
|
-
[filterBy]="props.filterBy ?? 'label'"
|
|
1185
|
-
[optionLabel]="'label'"
|
|
1186
|
-
[optionValue]="'value'"
|
|
1187
|
-
(onChange)="props.change && props.change(field, $event)"
|
|
1188
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
1189
|
-
[styleClass]="'w-full rounded-none block'"
|
|
1190
|
-
>
|
|
1191
|
-
<!-- Template for each option in the dropdown -->
|
|
1192
|
-
<ng-template let-option pTemplate="item">
|
|
1193
|
-
<div class="flex items-center gap-2">
|
|
1194
|
-
<!-- Example: add an icon if option has one -->
|
|
1195
|
-
@if (option.icon) {
|
|
1196
|
-
|
|
1197
|
-
<i [class]="option.icon"></i>
|
|
1198
|
-
}
|
|
1199
|
-
<span>{{ option.label | translate }}</span>
|
|
1200
|
-
<!-- Example: show description -->
|
|
1201
|
-
@if (option.description) {
|
|
1202
|
-
|
|
1203
|
-
<small class="text-gray-500"> - {{ option.description | translate}}</small>
|
|
1204
|
-
}
|
|
1205
|
-
</div>
|
|
1206
|
-
</ng-template>
|
|
1207
|
-
|
|
1208
|
-
<!-- Template for selected value -->
|
|
1209
|
-
<ng-template let-selected pTemplate="selectedItem">
|
|
1210
|
-
<div class="flex items-center gap-2">
|
|
1211
|
-
@if (selected?.icon) {
|
|
1212
|
-
<i [class]="selected.icon"></i>
|
|
1213
|
-
}
|
|
1214
|
-
<span>{{ selected?.label | translate}}</span>
|
|
1215
|
-
</div>
|
|
1216
|
-
</ng-template>
|
|
1217
|
-
</p-select>
|
|
1218
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i3$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FormlySelectModule$1 }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1219
|
-
}
|
|
1220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldSelect, decorators: [{
|
|
1221
|
-
type: Component,
|
|
1222
|
-
args: [{
|
|
1223
|
-
selector: 'formly-field-primeng-select',
|
|
1224
|
-
template: `
|
|
1225
|
-
<p-select
|
|
1226
|
-
[options]="(props.options | formlySelectOptions: field | async) ?? []"
|
|
1227
|
-
[formControl]="formControl"
|
|
1228
|
-
[formlyAttributes]="field"
|
|
1229
|
-
[showClear]="!props.required"
|
|
1230
|
-
[appendTo]="props.appendTo"
|
|
1231
|
-
[filter]="props.filter"
|
|
1232
|
-
[filterBy]="props.filterBy ?? 'label'"
|
|
1233
|
-
[optionLabel]="'label'"
|
|
1234
|
-
[optionValue]="'value'"
|
|
1235
|
-
(onChange)="props.change && props.change(field, $event)"
|
|
1236
|
-
[placeholder]="(props['placeholder'] ?? '')| translate"
|
|
1237
|
-
[styleClass]="'w-full rounded-none block'"
|
|
1238
|
-
>
|
|
1239
|
-
<!-- Template for each option in the dropdown -->
|
|
1240
|
-
<ng-template let-option pTemplate="item">
|
|
1241
|
-
<div class="flex items-center gap-2">
|
|
1242
|
-
<!-- Example: add an icon if option has one -->
|
|
1243
|
-
@if (option.icon) {
|
|
1244
|
-
|
|
1245
|
-
<i [class]="option.icon"></i>
|
|
1246
|
-
}
|
|
1247
|
-
<span>{{ option.label | translate }}</span>
|
|
1248
|
-
<!-- Example: show description -->
|
|
1249
|
-
@if (option.description) {
|
|
1250
|
-
|
|
1251
|
-
<small class="text-gray-500"> - {{ option.description | translate}}</small>
|
|
1252
|
-
}
|
|
1253
|
-
</div>
|
|
1254
|
-
</ng-template>
|
|
1255
|
-
|
|
1256
|
-
<!-- Template for selected value -->
|
|
1257
|
-
<ng-template let-selected pTemplate="selectedItem">
|
|
1258
|
-
<div class="flex items-center gap-2">
|
|
1259
|
-
@if (selected?.icon) {
|
|
1260
|
-
<i [class]="selected.icon"></i>
|
|
1261
|
-
}
|
|
1262
|
-
<span>{{ selected?.label | translate}}</span>
|
|
1263
|
-
</div>
|
|
1264
|
-
</ng-template>
|
|
1265
|
-
</p-select>
|
|
1266
|
-
`,
|
|
1267
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1268
|
-
standalone: true,
|
|
1269
|
-
imports: [CommonModule,
|
|
1270
|
-
ReactiveFormsModule,
|
|
1271
|
-
DatePickerModule,
|
|
1272
|
-
FormlyFormFieldModule, FormlyAttributes, SelectModule, FormlySelectModule$1, TranslateModule]
|
|
1273
|
-
}]
|
|
1274
|
-
}] });
|
|
1275
|
-
|
|
1276
|
-
function withFormlyFieldSelect() {
|
|
1277
|
-
return {
|
|
1278
|
-
types: [
|
|
1279
|
-
{
|
|
1280
|
-
name: 'select',
|
|
1281
|
-
component: FormlyFieldSelect,
|
|
1282
|
-
wrappers: ['form-field'],
|
|
1283
|
-
},
|
|
1284
|
-
{ name: 'enum', extends: 'select' },
|
|
1285
|
-
],
|
|
1286
|
-
};
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
class FormlySelectModule {
|
|
1290
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1291
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, imports: [CommonModule,
|
|
1292
|
-
ReactiveFormsModule,
|
|
1293
|
-
SelectModule,
|
|
1294
|
-
FormlyFormFieldModule,
|
|
1295
|
-
FormlySelectModule$1, i1$3.FormlyModule] });
|
|
1296
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, imports: [CommonModule,
|
|
1297
|
-
ReactiveFormsModule,
|
|
1298
|
-
SelectModule,
|
|
1299
|
-
FormlyFormFieldModule,
|
|
1300
|
-
FormlySelectModule$1,
|
|
1301
|
-
FormlyModule.forChild(withFormlyFieldSelect())] });
|
|
1302
|
-
}
|
|
1303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlySelectModule, decorators: [{
|
|
1304
|
-
type: NgModule,
|
|
1305
|
-
args: [{
|
|
1306
|
-
// declarations: [FormlyFieldSelect],
|
|
1307
|
-
imports: [
|
|
1308
|
-
CommonModule,
|
|
1309
|
-
ReactiveFormsModule,
|
|
1310
|
-
SelectModule,
|
|
1311
|
-
FormlyFormFieldModule,
|
|
1312
|
-
FormlySelectModule$1,
|
|
1313
|
-
FormlyModule.forChild(withFormlyFieldSelect()),
|
|
1314
|
-
],
|
|
1315
|
-
}]
|
|
1316
|
-
}] });
|
|
1317
|
-
|
|
1318
|
-
class FormlyFieldCheckbox extends FieldType {
|
|
1319
|
-
defaultOptions = { props: { hideLabel: true } };
|
|
1320
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1321
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldCheckbox, isStandalone: true, selector: "formly-field-primeng-checkbox", usesInheritance: true, ngImport: i0, template: `
|
|
1322
|
-
<!-- <div class="p-field-checkbox flex items-center gap-1">
|
|
1323
|
-
|
|
1324
|
-
<p-checkbox
|
|
1325
|
-
[binary]="true"
|
|
1326
|
-
[formControl]="formControl"
|
|
1327
|
-
[formlyAttributes]="field"
|
|
1328
|
-
[inputId]="id"
|
|
1329
|
-
|
|
1330
|
-
/>
|
|
1331
|
-
<label [for]="id" class="ml-2">{{ (props['label'] ?? '') | translate}}</label>
|
|
1332
|
-
</div> -->
|
|
1333
|
-
|
|
1334
|
-
<div class="flex items-center justify-end rtl:flex-row-reverse w-full px-2 py-1" style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1335
|
-
<!-- text-lg -->
|
|
1336
|
-
<label [for]="id" class="font-bold text-gray-800 mr-2 whitespace-nowrap">
|
|
1337
|
-
{{ (to.label ?? '') | translate }}
|
|
1338
|
-
</label>
|
|
1339
|
-
<p-checkbox
|
|
1340
|
-
[binary]="true"
|
|
1341
|
-
[formControl]="formControl"
|
|
1342
|
-
[formlyAttributes]="field"
|
|
1343
|
-
[inputId]="id"
|
|
1344
|
-
|
|
1345
|
-
/>
|
|
1346
|
-
</div>
|
|
1347
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$1.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1348
|
-
}
|
|
1349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldCheckbox, decorators: [{
|
|
1350
|
-
type: Component,
|
|
1351
|
-
args: [{
|
|
1352
|
-
selector: 'formly-field-primeng-checkbox',
|
|
1353
|
-
template: `
|
|
1354
|
-
<!-- <div class="p-field-checkbox flex items-center gap-1">
|
|
1355
|
-
|
|
1356
|
-
<p-checkbox
|
|
1357
|
-
[binary]="true"
|
|
1358
|
-
[formControl]="formControl"
|
|
1359
|
-
[formlyAttributes]="field"
|
|
1360
|
-
[inputId]="id"
|
|
1361
|
-
|
|
1362
|
-
/>
|
|
1363
|
-
<label [for]="id" class="ml-2">{{ (props['label'] ?? '') | translate}}</label>
|
|
1364
|
-
</div> -->
|
|
1365
|
-
|
|
1366
|
-
<div class="flex items-center justify-end rtl:flex-row-reverse w-full px-2 py-1" style=" border-radius: var(--p-inputtext-border-radius);">
|
|
1367
|
-
<!-- text-lg -->
|
|
1368
|
-
<label [for]="id" class="font-bold text-gray-800 mr-2 whitespace-nowrap">
|
|
1369
|
-
{{ (to.label ?? '') | translate }}
|
|
1370
|
-
</label>
|
|
1371
|
-
<p-checkbox
|
|
1372
|
-
[binary]="true"
|
|
1373
|
-
[formControl]="formControl"
|
|
1374
|
-
[formlyAttributes]="field"
|
|
1375
|
-
[inputId]="id"
|
|
1376
|
-
|
|
1377
|
-
/>
|
|
1378
|
-
</div>
|
|
1379
|
-
`,
|
|
1380
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1381
|
-
standalone: true,
|
|
1382
|
-
imports: [CommonModule, ReactiveFormsModule, DatePickerModule, FormlyFormFieldModule, FormlyAttributes, TranslateModule, CheckboxModule]
|
|
1383
|
-
}]
|
|
1384
|
-
}] });
|
|
1385
|
-
|
|
1386
|
-
function withFormlyFieldCheckbox() {
|
|
1387
|
-
return {
|
|
1388
|
-
types: [
|
|
1389
|
-
{
|
|
1390
|
-
name: 'checkbox',
|
|
1391
|
-
component: FormlyFieldCheckbox,
|
|
1392
|
-
wrappers: ['form-field'],
|
|
1393
|
-
},
|
|
1394
|
-
{
|
|
1395
|
-
name: 'boolean',
|
|
1396
|
-
extends: 'checkbox',
|
|
1397
|
-
},
|
|
1398
|
-
],
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
class FormlyCheckboxModule {
|
|
1403
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1404
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, imports: [CommonModule,
|
|
1405
|
-
ReactiveFormsModule,
|
|
1406
|
-
CheckboxModule,
|
|
1407
|
-
FormlyFormFieldModule, i1$3.FormlyModule] });
|
|
1408
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, imports: [CommonModule,
|
|
1409
|
-
ReactiveFormsModule,
|
|
1410
|
-
CheckboxModule,
|
|
1411
|
-
FormlyFormFieldModule,
|
|
1412
|
-
FormlyModule.forChild(withFormlyFieldCheckbox())] });
|
|
1413
|
-
}
|
|
1414
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyCheckboxModule, decorators: [{
|
|
1415
|
-
type: NgModule,
|
|
1416
|
-
args: [{
|
|
1417
|
-
// declarations: [FormlyFieldCheckbox],
|
|
1418
|
-
imports: [
|
|
1419
|
-
CommonModule,
|
|
1420
|
-
ReactiveFormsModule,
|
|
1421
|
-
CheckboxModule,
|
|
1422
|
-
FormlyFormFieldModule,
|
|
1423
|
-
FormlyModule.forChild(withFormlyFieldCheckbox()),
|
|
1424
|
-
],
|
|
1425
|
-
}]
|
|
1426
|
-
}] });
|
|
1427
|
-
|
|
1428
|
-
class FormlyFieldTextArea extends FieldType {
|
|
1429
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldTextArea, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1430
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldTextArea, isStandalone: true, selector: "formly-field-primeng-textarea", usesInheritance: true, ngImport: i0, template: ` <textarea [formControl]="formControl" [formlyAttributes]="field" class="w-full rounded-none block" [placeholder]="(props['placeholder'] ?? '')| translate" pInputTextarea></textarea> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: SelectModule }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i2$2.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "pSize", "variant", "fluid", "invalid"], outputs: ["onResize"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1431
|
-
}
|
|
1432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldTextArea, decorators: [{
|
|
1433
|
-
type: Component,
|
|
1434
|
-
args: [{
|
|
1435
|
-
selector: 'formly-field-primeng-textarea',
|
|
1436
|
-
template: ` <textarea [formControl]="formControl" [formlyAttributes]="field" class="w-full rounded-none block" [placeholder]="(props['placeholder'] ?? '')| translate" pInputTextarea></textarea> `,
|
|
1437
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1438
|
-
standalone: true,
|
|
1439
|
-
imports: [
|
|
1440
|
-
CommonModule,
|
|
1441
|
-
ReactiveFormsModule,
|
|
1442
|
-
DatePickerModule,
|
|
1443
|
-
FormlyFormFieldModule,
|
|
1444
|
-
FormlyAttributes,
|
|
1445
|
-
SelectModule,
|
|
1446
|
-
TextareaModule,
|
|
1447
|
-
TranslateModule
|
|
1448
|
-
]
|
|
1449
|
-
}]
|
|
1450
|
-
}] });
|
|
1451
|
-
|
|
1452
|
-
function withFormlyFieldTextArea() {
|
|
1453
|
-
return {
|
|
1454
|
-
types: [
|
|
1455
|
-
{
|
|
1456
|
-
name: 'textarea',
|
|
1457
|
-
component: FormlyFieldTextArea,
|
|
1458
|
-
wrappers: ['form-field'],
|
|
1459
|
-
},
|
|
1460
|
-
],
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
class FormlyTextAreaModule {
|
|
1465
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1466
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, imports: [CommonModule,
|
|
1467
|
-
ReactiveFormsModule,
|
|
1468
|
-
TextareaModule,
|
|
1469
|
-
FormlyFormFieldModule, i1$3.FormlyModule] });
|
|
1470
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, imports: [CommonModule,
|
|
1471
|
-
ReactiveFormsModule,
|
|
1472
|
-
TextareaModule,
|
|
1473
|
-
FormlyFormFieldModule,
|
|
1474
|
-
FormlyModule.forChild(withFormlyFieldTextArea())] });
|
|
1475
|
-
}
|
|
1476
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyTextAreaModule, decorators: [{
|
|
1477
|
-
type: NgModule,
|
|
1478
|
-
args: [{
|
|
1479
|
-
// declarations: [FormlyFieldTextArea],
|
|
1480
|
-
imports: [
|
|
1481
|
-
CommonModule,
|
|
1482
|
-
ReactiveFormsModule,
|
|
1483
|
-
TextareaModule,
|
|
1484
|
-
FormlyFormFieldModule,
|
|
1485
|
-
FormlyModule.forChild(withFormlyFieldTextArea()),
|
|
1486
|
-
],
|
|
1487
|
-
}]
|
|
1488
|
-
}] });
|
|
1489
|
-
|
|
1490
|
-
class FormlyFieldDatepicker extends FieldType {
|
|
1491
|
-
defaultOptions = {
|
|
1492
|
-
props: {
|
|
1493
|
-
numberOfMonths: 1,
|
|
1494
|
-
},
|
|
1495
|
-
};
|
|
1496
|
-
ngOnInit() {
|
|
1497
|
-
const value = this.formControl.value;
|
|
1498
|
-
// Convert incoming string to Date
|
|
1499
|
-
if (typeof value === 'string') {
|
|
1500
|
-
const parsed = new Date(value);
|
|
1501
|
-
if (!isNaN(parsed.getTime())) {
|
|
1502
|
-
this.formControl.setValue(parsed, { emitEvent: false });
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
// Convert back to string when user selects date (if needed)
|
|
1506
|
-
this.formControl.valueChanges.subscribe(val => {
|
|
1507
|
-
if (val instanceof Date && this.props?.dataType === 'string') {
|
|
1508
|
-
const pad = (n) => n.toString().padStart(2, '0');
|
|
1509
|
-
const year = val.getFullYear();
|
|
1510
|
-
const month = pad(val.getMonth() + 1); // months are 0-based
|
|
1511
|
-
const day = pad(val.getDate());
|
|
1512
|
-
let result = `${year}-${month}-${day}`;
|
|
1513
|
-
if (this.props?.showTime) {
|
|
1514
|
-
const hours = pad(val.getHours());
|
|
1515
|
-
const minutes = pad(val.getMinutes());
|
|
1516
|
-
const seconds = pad(val.getSeconds());
|
|
1517
|
-
result += `T${hours}:${minutes}:${seconds}`;
|
|
1518
|
-
}
|
|
1519
|
-
if (this.formControl.value !== result) {
|
|
1520
|
-
this.formControl.setValue(result, { emitEvent: false });
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
onDateSelect(date) {
|
|
1526
|
-
if (this.props?.dataType === 'string') {
|
|
1527
|
-
const formatted = this.props.showTime === true
|
|
1528
|
-
? this.toLocalDateTimeString(date)
|
|
1529
|
-
: this.toLocalDateOnlyString(date);
|
|
1530
|
-
this.formControl.setValue(formatted);
|
|
1531
|
-
}
|
|
1532
|
-
else {
|
|
1533
|
-
this.formControl.setValue(date);
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
onTouched() {
|
|
1537
|
-
this.formControl.markAsTouched();
|
|
1538
|
-
}
|
|
1539
|
-
toLocalDateOnlyString(date) {
|
|
1540
|
-
const pad = (n) => n.toString().padStart(2, '0');
|
|
1541
|
-
const year = date.getFullYear();
|
|
1542
|
-
const month = pad(date.getMonth() + 1);
|
|
1543
|
-
const day = pad(date.getDate());
|
|
1544
|
-
return `${year}-${month}-${day}`;
|
|
1545
|
-
}
|
|
1546
|
-
toLocalDateTimeString(date) {
|
|
1547
|
-
const pad = (n) => n.toString().padStart(2, '0');
|
|
1548
|
-
const year = date.getFullYear();
|
|
1549
|
-
const month = pad(date.getMonth() + 1);
|
|
1550
|
-
const day = pad(date.getDate());
|
|
1551
|
-
const hours = pad(date.getHours());
|
|
1552
|
-
const minutes = pad(date.getMinutes());
|
|
1553
|
-
const seconds = pad(date.getSeconds());
|
|
1554
|
-
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
|
1555
|
-
}
|
|
1556
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldDatepicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1557
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: FormlyFieldDatepicker, isStandalone: true, selector: "formly-field-primeng-datepicker", usesInheritance: true, ngImport: i0, template: `
|
|
1558
|
-
<p-datepicker
|
|
1559
|
-
[dataType]="props.dataType ?? 'string'"
|
|
1560
|
-
[dateFormat]="props.dateFormat ?? (props.showTime ? 'yy-mm-dd' : 'yy-mm-dd')"
|
|
1561
|
-
[hourFormat]="props.hourFormat || '12'"
|
|
1562
|
-
[timeOnly]="props.timeOnly || false"
|
|
1563
|
-
[icon]="props.icon"
|
|
1564
|
-
[showTime]="props.showTime || false"
|
|
1565
|
-
[showIcon]="props.showIcon || true"
|
|
1566
|
-
[showButtonBar]="props.showButtonBar"
|
|
1567
|
-
[showOtherMonths]="props.showOtherMonths"
|
|
1568
|
-
[selectOtherMonths]="props.selectOtherMonths"
|
|
1569
|
-
[selectionMode]="props.selectionMode || 'single'"
|
|
1570
|
-
[numberOfMonths]="props.numberOfMonths || 0"
|
|
1571
|
-
[inline]="props.inline"
|
|
1572
|
-
[readonlyInput]="props.readonlyInput"
|
|
1573
|
-
[touchUI]="props.touchUI"
|
|
1574
|
-
[formControl]="formControl"
|
|
1575
|
-
[formlyAttributes]="field"
|
|
1576
|
-
[placeholder]="(props['placeholder'] ?? '') | translate"
|
|
1577
|
-
[styleClass]="'w-full rounded-none block text-base'"
|
|
1578
|
-
appendTo="body"
|
|
1579
|
-
(onSelect)="onDateSelect($event)"
|
|
1580
|
-
(onBlur)="onTouched()"
|
|
1581
|
-
></p-datepicker>
|
|
1582
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$3.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormlyFormFieldModule }, { kind: "directive", type: FormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1583
|
-
}
|
|
1584
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyFieldDatepicker, decorators: [{
|
|
1585
|
-
type: Component,
|
|
1586
|
-
args: [{
|
|
1587
|
-
selector: 'formly-field-primeng-datepicker',
|
|
1588
|
-
template: `
|
|
1589
|
-
<p-datepicker
|
|
1590
|
-
[dataType]="props.dataType ?? 'string'"
|
|
1591
|
-
[dateFormat]="props.dateFormat ?? (props.showTime ? 'yy-mm-dd' : 'yy-mm-dd')"
|
|
1592
|
-
[hourFormat]="props.hourFormat || '12'"
|
|
1593
|
-
[timeOnly]="props.timeOnly || false"
|
|
1594
|
-
[icon]="props.icon"
|
|
1595
|
-
[showTime]="props.showTime || false"
|
|
1596
|
-
[showIcon]="props.showIcon || true"
|
|
1597
|
-
[showButtonBar]="props.showButtonBar"
|
|
1598
|
-
[showOtherMonths]="props.showOtherMonths"
|
|
1599
|
-
[selectOtherMonths]="props.selectOtherMonths"
|
|
1600
|
-
[selectionMode]="props.selectionMode || 'single'"
|
|
1601
|
-
[numberOfMonths]="props.numberOfMonths || 0"
|
|
1602
|
-
[inline]="props.inline"
|
|
1603
|
-
[readonlyInput]="props.readonlyInput"
|
|
1604
|
-
[touchUI]="props.touchUI"
|
|
1605
|
-
[formControl]="formControl"
|
|
1606
|
-
[formlyAttributes]="field"
|
|
1607
|
-
[placeholder]="(props['placeholder'] ?? '') | translate"
|
|
1608
|
-
[styleClass]="'w-full rounded-none block text-base'"
|
|
1609
|
-
appendTo="body"
|
|
1610
|
-
(onSelect)="onDateSelect($event)"
|
|
1611
|
-
(onBlur)="onTouched()"
|
|
1612
|
-
></p-datepicker>
|
|
1613
|
-
`,
|
|
1614
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1615
|
-
standalone: true,
|
|
1616
|
-
imports: [
|
|
1617
|
-
CommonModule,
|
|
1618
|
-
ReactiveFormsModule,
|
|
1619
|
-
DatePickerModule,
|
|
1620
|
-
FormlyFormFieldModule,
|
|
1621
|
-
FormlyAttributes,
|
|
1622
|
-
TranslateModule,
|
|
1623
|
-
],
|
|
1624
|
-
}]
|
|
1625
|
-
}] });
|
|
1626
|
-
|
|
1627
|
-
function withFormlyFieldDatepicker() {
|
|
1628
|
-
return {
|
|
1629
|
-
types: [
|
|
1630
|
-
{
|
|
1631
|
-
name: 'datepicker',
|
|
1632
|
-
component: FormlyFieldDatepicker,
|
|
1633
|
-
wrappers: ['form-field'],
|
|
1634
|
-
},
|
|
1635
|
-
],
|
|
1636
|
-
};
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
class FormlyDatepickerModule {
|
|
1640
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1641
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, imports: [CommonModule,
|
|
1642
|
-
ReactiveFormsModule,
|
|
1643
|
-
DatePickerModule,
|
|
1644
|
-
FormlyFormFieldModule, i1$3.FormlyModule] });
|
|
1645
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, imports: [CommonModule,
|
|
1646
|
-
ReactiveFormsModule,
|
|
1647
|
-
DatePickerModule,
|
|
1648
|
-
FormlyFormFieldModule,
|
|
1649
|
-
FormlyModule.forChild(withFormlyFieldDatepicker())] });
|
|
1650
|
-
}
|
|
1651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FormlyDatepickerModule, decorators: [{
|
|
1652
|
-
type: NgModule,
|
|
1653
|
-
args: [{
|
|
1654
|
-
// declarations: [FormlyFieldDatepicker],
|
|
1655
|
-
imports: [
|
|
1656
|
-
CommonModule,
|
|
1657
|
-
ReactiveFormsModule,
|
|
1658
|
-
DatePickerModule,
|
|
1659
|
-
FormlyFormFieldModule,
|
|
1660
|
-
FormlyModule.forChild(withFormlyFieldDatepicker()),
|
|
1661
|
-
],
|
|
1662
|
-
}]
|
|
1663
|
-
}] });
|
|
1664
|
-
|
|
1665
|
-
class DeactivationReasonFormComponent {
|
|
1666
|
-
ref;
|
|
1667
|
-
config;
|
|
1668
|
-
form = new FormGroup({});
|
|
1669
|
-
model = {};
|
|
1670
|
-
fields;
|
|
1671
|
-
loading = false;
|
|
1672
|
-
errorMessage = null;
|
|
1673
|
-
destroy$ = new Subject();
|
|
1674
|
-
idField;
|
|
1675
|
-
constructor(ref, config) {
|
|
1676
|
-
this.ref = ref;
|
|
1677
|
-
this.config = config;
|
|
1678
|
-
this.model = config.data?.model || {};
|
|
1679
|
-
this.idField = this.config.data.idField;
|
|
1680
|
-
this.fields = [
|
|
1681
|
-
{
|
|
1682
|
-
key: 'deactivationReason',
|
|
1683
|
-
type: 'textarea',
|
|
1684
|
-
props: {
|
|
1685
|
-
label: 'DeactivationReason',
|
|
1686
|
-
placeholder: 'DeactivationReason',
|
|
1687
|
-
rows: 5,
|
|
1688
|
-
required: true,
|
|
1689
|
-
},
|
|
1690
|
-
},
|
|
1691
|
-
];
|
|
1692
|
-
}
|
|
1693
|
-
onSubmit() {
|
|
1694
|
-
if (this.form.invalid)
|
|
1695
|
-
return;
|
|
1696
|
-
// this.loading = true;
|
|
1697
|
-
// this.errorMessage = null;
|
|
1698
|
-
const service = this.config.data.service;
|
|
1699
|
-
const id = this.model[this.idField];
|
|
1700
|
-
this.model.isActive = false;
|
|
1701
|
-
const operation$ = service.update(id, this.model);
|
|
1702
|
-
operation$.pipe(takeUntil(this.destroy$)).subscribe({
|
|
1703
|
-
next: () => {
|
|
1704
|
-
this.ref.close(this.model); // نجاح العملية
|
|
1705
|
-
},
|
|
1706
|
-
error: (err) => {
|
|
1707
|
-
this.loading = false;
|
|
1708
|
-
this.errorMessage = err.error?.message ||
|
|
1709
|
-
err.message ||
|
|
1710
|
-
'حدث خطأ أثناء الحفظ. يرجى المحاولة مرة أخرى.';
|
|
1711
|
-
}
|
|
1712
|
-
});
|
|
1713
|
-
}
|
|
1714
|
-
ngOnDestroy() {
|
|
1715
|
-
this.destroy$.next();
|
|
1716
|
-
this.destroy$.complete();
|
|
1717
|
-
}
|
|
1718
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: DeactivationReasonFormComponent, deps: [{ token: i1$4.DynamicDialogRef }, { token: i1$4.DynamicDialogConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
1719
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: DeactivationReasonFormComponent, isStandalone: true, selector: "app-deactivation-reason-form", ngImport: i0, template: `
|
|
1720
|
-
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="p-4 space-y-4">
|
|
1721
|
-
<formly-form [form]="form" [fields]="fields" [model]="model"></formly-form>
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
<div class="bottom-0 left-0 right-0 bg-gray-200 border-t border-gray-400 px-4 py-3 flex justify-end gap-2">
|
|
1725
|
-
|
|
1726
|
-
<p-button
|
|
1727
|
-
[label]="( 'SAVE') | translate"
|
|
1728
|
-
size="small"
|
|
1729
|
-
[disabled]="form.invalid"
|
|
1730
|
-
[type]="'submit'">
|
|
1731
|
-
</p-button>
|
|
1732
|
-
|
|
1733
|
-
<p-button
|
|
1734
|
-
[label]="'CANCEL' | translate "
|
|
1735
|
-
severity="danger"
|
|
1736
|
-
size="small"
|
|
1737
|
-
(onClick)="ref.close(false)">
|
|
1738
|
-
</p-button>
|
|
1739
|
-
|
|
1740
|
-
</div>
|
|
1741
|
-
</form>
|
|
1742
|
-
`, isInline: true, dependencies: [{ kind: "component", type: FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$4.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] });
|
|
4
|
+
class NgCore {
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NgCore, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.8", type: NgCore, isStandalone: true, selector: "lib-ng-core", ngImport: i0, template: "<p>NgCore works!</p>\n", styles: [""] });
|
|
1743
7
|
}
|
|
1744
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NgCore, decorators: [{
|
|
1745
9
|
type: Component,
|
|
1746
|
-
args: [{
|
|
1747
|
-
selector: 'app-deactivation-reason-form',
|
|
1748
|
-
template: `
|
|
1749
|
-
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="p-4 space-y-4">
|
|
1750
|
-
<formly-form [form]="form" [fields]="fields" [model]="model"></formly-form>
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
<div class="bottom-0 left-0 right-0 bg-gray-200 border-t border-gray-400 px-4 py-3 flex justify-end gap-2">
|
|
1754
|
-
|
|
1755
|
-
<p-button
|
|
1756
|
-
[label]="( 'SAVE') | translate"
|
|
1757
|
-
size="small"
|
|
1758
|
-
[disabled]="form.invalid"
|
|
1759
|
-
[type]="'submit'">
|
|
1760
|
-
</p-button>
|
|
1761
|
-
|
|
1762
|
-
<p-button
|
|
1763
|
-
[label]="'CANCEL' | translate "
|
|
1764
|
-
severity="danger"
|
|
1765
|
-
size="small"
|
|
1766
|
-
(onClick)="ref.close(false)">
|
|
1767
|
-
</p-button>
|
|
1768
|
-
|
|
1769
|
-
</div>
|
|
1770
|
-
</form>
|
|
1771
|
-
`,
|
|
1772
|
-
imports: [FormlyForm, CommonModule, ReactiveFormsModule, FormsModule, TranslateModule, ButtonModule]
|
|
1773
|
-
}]
|
|
1774
|
-
}], ctorParameters: () => [{ type: i1$4.DynamicDialogRef }, { type: i1$4.DynamicDialogConfig }] });
|
|
1775
|
-
|
|
1776
|
-
// src/app/shared/components/base-crud.component.ts
|
|
1777
|
-
class BaseCrud {
|
|
1778
|
-
list = [];
|
|
1779
|
-
paginator = true;
|
|
1780
|
-
canLoad = true;
|
|
1781
|
-
loading = false;
|
|
1782
|
-
errorMsg = '';
|
|
1783
|
-
first = 0;
|
|
1784
|
-
rows = 10;
|
|
1785
|
-
totalRecords = 0;
|
|
1786
|
-
searchGlobal = '';
|
|
1787
|
-
sort;
|
|
1788
|
-
pageFilters = {};
|
|
1789
|
-
currentFilters = {};
|
|
1790
|
-
mode = '';
|
|
1791
|
-
scrollHeight = '400px';
|
|
1792
|
-
swalService = inject(SwalService);
|
|
1793
|
-
dialogRef;
|
|
1794
|
-
dialogVisible = false;
|
|
1795
|
-
drawerVisible = false;
|
|
1796
|
-
selectedItem = null;
|
|
1797
|
-
defaultModel = null;
|
|
1798
|
-
// selectedItem: T | any = {};
|
|
1799
|
-
isViewMode = false;
|
|
1800
|
-
isEditMode = false;
|
|
1801
|
-
displayMode = 'drawer';
|
|
1802
|
-
router = inject(Router);
|
|
1803
|
-
route = inject(ActivatedRoute);
|
|
1804
|
-
loadPage(pageIndex, pageSize) {
|
|
1805
|
-
if (this.canLoad) {
|
|
1806
|
-
this.loading = true;
|
|
1807
|
-
var filters = {
|
|
1808
|
-
maxResultCount: pageSize,
|
|
1809
|
-
skipCount: pageIndex,
|
|
1810
|
-
sorting: this.sort,
|
|
1811
|
-
...this.currentFilters,
|
|
1812
|
-
...this.pageFilters,
|
|
1813
|
-
...(this.searchGlobal ? { filter: this.searchGlobal } : {}),
|
|
1814
|
-
};
|
|
1815
|
-
//
|
|
1816
|
-
this.service.getList(filters)
|
|
1817
|
-
.subscribe({
|
|
1818
|
-
next: (res) => {
|
|
1819
|
-
//
|
|
1820
|
-
this.list = res.items;
|
|
1821
|
-
this.totalRecords = res.totalCount;
|
|
1822
|
-
this.loading = false;
|
|
1823
|
-
},
|
|
1824
|
-
error: err => {
|
|
1825
|
-
this.errorMsg = err.error?.message || err.message || 'خطأ في التحميل';
|
|
1826
|
-
this.loading = false;
|
|
1827
|
-
}
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
onSearch(filters) {
|
|
1832
|
-
//
|
|
1833
|
-
if (filters && typeof filters === 'object' && !Array.isArray(filters)) {
|
|
1834
|
-
this.pageFilters = filters;
|
|
1835
|
-
}
|
|
1836
|
-
else {
|
|
1837
|
-
this.searchGlobal = filters;
|
|
1838
|
-
}
|
|
1839
|
-
this.loadPage(0, 10);
|
|
1840
|
-
}
|
|
1841
|
-
onPageChange(event) {
|
|
1842
|
-
// فك المتغيّرات مع قيمة افتراضية لفلاتر
|
|
1843
|
-
const { first = this.first, rows = this.rows, sort = this.sort, filters = {} } = event;
|
|
1844
|
-
this.first = first;
|
|
1845
|
-
this.rows = rows;
|
|
1846
|
-
this.sort = sort;
|
|
1847
|
-
// const pageIndex = Math.floor(first / rows);
|
|
1848
|
-
const skipCount = first;
|
|
1849
|
-
const pageIndex = skipCount;
|
|
1850
|
-
// الوصول للفلتر العام عبر الصيغة المربعة
|
|
1851
|
-
const globalValue = filters['global'];
|
|
1852
|
-
this.searchGlobal = typeof globalValue === 'string' ? globalValue : '';
|
|
1853
|
-
// فلترة خاصة بحقل واحد
|
|
1854
|
-
// const fieldFilters = { ...filters };
|
|
1855
|
-
// delete fieldFilters['global'];
|
|
1856
|
-
// this.currentFilters = fieldFilters as Partial<F>;
|
|
1857
|
-
this.loadPage(pageIndex, rows);
|
|
1858
|
-
}
|
|
1859
|
-
openEditor(item, mode) {
|
|
1860
|
-
this.mode = mode;
|
|
1861
|
-
this.selectedItem = item ?? this.defaultModel ?? {};
|
|
1862
|
-
this.isEditMode = mode === 'edit';
|
|
1863
|
-
this.isViewMode = mode === 'view';
|
|
1864
|
-
// resolve displayMode (string or map)
|
|
1865
|
-
const modeConfig = typeof this.displayMode === 'string'
|
|
1866
|
-
? this.displayMode
|
|
1867
|
-
: this.displayMode[mode] ?? 'drawer';
|
|
1868
|
-
switch (modeConfig) {
|
|
1869
|
-
case 'drawer':
|
|
1870
|
-
this.drawerVisible = true;
|
|
1871
|
-
break;
|
|
1872
|
-
case 'dialog':
|
|
1873
|
-
this.dialogVisible = true;
|
|
1874
|
-
break;
|
|
1875
|
-
case 'route':
|
|
1876
|
-
const id = item ? item[this.idField] : 'new';
|
|
1877
|
-
if (mode === 'add') {
|
|
1878
|
-
this.router.navigate([mode], { relativeTo: this.route });
|
|
1879
|
-
}
|
|
1880
|
-
else {
|
|
1881
|
-
this.router.navigate([id, mode], { relativeTo: this.route });
|
|
1882
|
-
}
|
|
1883
|
-
break;
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
visibleChange(value) {
|
|
1887
|
-
const modeConfig = typeof this.displayMode === 'string'
|
|
1888
|
-
? this.displayMode
|
|
1889
|
-
: this.displayMode[this.mode] ?? 'drawer';
|
|
1890
|
-
if (modeConfig === 'dialog') {
|
|
1891
|
-
this.dialogVisible = value;
|
|
1892
|
-
}
|
|
1893
|
-
else if (modeConfig === 'drawer') {
|
|
1894
|
-
this.drawerVisible = value;
|
|
1895
|
-
}
|
|
1896
|
-
else {
|
|
1897
|
-
// route mode does not use drawer/dialog
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
// onTableAction(event: { name: string; row: T | null }): void {
|
|
1901
|
-
// switch (event.name) {
|
|
1902
|
-
// case 'add': this.openDrawer(null,event.name); break;
|
|
1903
|
-
// case 'view': this.openDrawer(event.row!,event.name); break;
|
|
1904
|
-
// case 'edit': this.openDrawer(event.row!,event.name); break;
|
|
1905
|
-
// case 'delete': this.onDelete(event.row!);break;
|
|
1906
|
-
// case 'state': this.openDeactivationReason(event.row!);break;
|
|
1907
|
-
// }
|
|
1908
|
-
// }
|
|
1909
|
-
onTableAction(event) {
|
|
1910
|
-
switch (event.name) {
|
|
1911
|
-
case 'add':
|
|
1912
|
-
case 'edit':
|
|
1913
|
-
case 'view':
|
|
1914
|
-
this.openEditor(event.row, event.name);
|
|
1915
|
-
break;
|
|
1916
|
-
case 'delete':
|
|
1917
|
-
this.onDelete(event.row);
|
|
1918
|
-
break;
|
|
1919
|
-
case 'state':
|
|
1920
|
-
this.openDeactivationReason(event.row);
|
|
1921
|
-
break;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
openDrawer(item, mode) {
|
|
1925
|
-
this.mode = mode;
|
|
1926
|
-
// this.drawerVisible = !this.drawerVisible;
|
|
1927
|
-
if (item == null) {
|
|
1928
|
-
this.selectedItem = this.defaultModel || {};
|
|
1929
|
-
}
|
|
1930
|
-
else {
|
|
1931
|
-
this.selectedItem = item;
|
|
1932
|
-
}
|
|
1933
|
-
if (mode == 'edit') {
|
|
1934
|
-
this.drawerVisible = true;
|
|
1935
|
-
this.isEditMode = true;
|
|
1936
|
-
this.isViewMode = false;
|
|
1937
|
-
// this.isEditMode = item !=null ;
|
|
1938
|
-
}
|
|
1939
|
-
if (mode == 'add') {
|
|
1940
|
-
this.drawerVisible = true;
|
|
1941
|
-
this.isViewMode = false;
|
|
1942
|
-
this.isEditMode = false;
|
|
1943
|
-
}
|
|
1944
|
-
if (mode == 'view') {
|
|
1945
|
-
// this.drawerVisible = true;
|
|
1946
|
-
this.dialogVisible = true;
|
|
1947
|
-
this.isViewMode = true;
|
|
1948
|
-
this.isEditMode = false;
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
openDeactivationReason(model) {
|
|
1952
|
-
this.selectedItem = model;
|
|
1953
|
-
if (this.selectedItem.isActive == true) {
|
|
1954
|
-
const ref = this.dialogService.open(DeactivationReasonFormComponent, {
|
|
1955
|
-
header: 'السبب (في حال تم إيقافه)',
|
|
1956
|
-
width: '30vw',
|
|
1957
|
-
data: { model: { ...model },
|
|
1958
|
-
fields: this.formFields,
|
|
1959
|
-
service: this.service,
|
|
1960
|
-
idField: this.idField },
|
|
1961
|
-
});
|
|
1962
|
-
ref.onClose.subscribe((result) => {
|
|
1963
|
-
if (result) {
|
|
1964
|
-
this.selectedItem.isActive = false;
|
|
1965
|
-
this.selectedItem.deactivationReason = result.deactivationReason;
|
|
1966
|
-
// Optionally: save model via API
|
|
1967
|
-
}
|
|
1968
|
-
});
|
|
1969
|
-
}
|
|
1970
|
-
else {
|
|
1971
|
-
this.selectedItem.isActive = true;
|
|
1972
|
-
this.selectedItem.deactivationReason = "";
|
|
1973
|
-
const id = this.selectedItem[this.idField];
|
|
1974
|
-
this.service.update(id, this.selectedItem).subscribe({
|
|
1975
|
-
next: () => {
|
|
1976
|
-
},
|
|
1977
|
-
error: (err) => {
|
|
1978
|
-
this.loading = false;
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
// onDelete(item: any): void {
|
|
1984
|
-
// if (!confirm('هل تريد الحذف فعلاً؟')) return;
|
|
1985
|
-
// const id = (item as any)[this.idField];
|
|
1986
|
-
// this.service.delete(id).subscribe(() => {
|
|
1987
|
-
// this.loadPage(0, this.rows);
|
|
1988
|
-
// });
|
|
1989
|
-
// }
|
|
1990
|
-
onDelete(item) {
|
|
1991
|
-
const id = item[this.idField];
|
|
1992
|
-
this.swalService.confirm('تأكيد الحذف', 'هل تريد حذف هذا السجل فعلاً؟', 'نعم، احذف', 'إلغاء').then((result) => {
|
|
1993
|
-
if (result.isConfirmed) {
|
|
1994
|
-
this.service.delete(id).subscribe({
|
|
1995
|
-
next: () => {
|
|
1996
|
-
this.loadPage(0, this.rows);
|
|
1997
|
-
this.swalService.success('تم الحذف بنجاح');
|
|
1998
|
-
},
|
|
1999
|
-
error: (err) => {
|
|
2000
|
-
this.loading = false;
|
|
2001
|
-
const msg = err.error?.title ||
|
|
2002
|
-
err.message ||
|
|
2003
|
-
'حدث خطأ أثناء الحفظ. يرجى المحاولة مرة أخرى.';
|
|
2004
|
-
// this.errorMessage = msg;
|
|
2005
|
-
// ❌ رسالة خطأ
|
|
2006
|
-
this.swalService.error('فشل الحذف', msg);
|
|
2007
|
-
}
|
|
2008
|
-
});
|
|
2009
|
-
}
|
|
2010
|
-
});
|
|
2011
|
-
}
|
|
2012
|
-
get columns() {
|
|
2013
|
-
const flattenFields = (fields) => {
|
|
2014
|
-
return fields.flatMap(field => {
|
|
2015
|
-
// Check for nested group/panel
|
|
2016
|
-
if (field.fieldGroup?.length) {
|
|
2017
|
-
return flattenFields(field.fieldGroup);
|
|
2018
|
-
}
|
|
2019
|
-
// Skip fields with no props or table.hidden === true
|
|
2020
|
-
if (!field.props || field.props['table']?.hidden === true) {
|
|
2021
|
-
return [];
|
|
2022
|
-
}
|
|
2023
|
-
// Determine the column type: table.type > field.type > 'label-type'
|
|
2024
|
-
// const tableType = field.props['table']?.type || field.type || 'label-type';
|
|
2025
|
-
const tableType = field.props['table']?.type || 'label-type';
|
|
2026
|
-
//
|
|
2027
|
-
return [{
|
|
2028
|
-
type: tableType,
|
|
2029
|
-
key: field['key'], // always set key for table rendering
|
|
2030
|
-
props: {
|
|
2031
|
-
...field.props, // base props
|
|
2032
|
-
...field.props['table']?.props // table-specific overrides
|
|
2033
|
-
},
|
|
2034
|
-
expressions: field.props['table']?.expressions
|
|
2035
|
-
}];
|
|
2036
|
-
});
|
|
2037
|
-
};
|
|
2038
|
-
return flattenFields(this.formFields);
|
|
2039
|
-
}
|
|
2040
|
-
get filters() {
|
|
2041
|
-
const flattenForFilter = (fields) => {
|
|
2042
|
-
return fields.flatMap(field => {
|
|
2043
|
-
if (field.fieldGroup?.length) {
|
|
2044
|
-
// Recursively handle nested panels/groups
|
|
2045
|
-
return flattenForFilter(field.fieldGroup);
|
|
2046
|
-
}
|
|
2047
|
-
// Skip fields with no props or filter.hidden === true
|
|
2048
|
-
if (!field.props || field.props['filter']?.hidden === true) {
|
|
2049
|
-
return [];
|
|
2050
|
-
}
|
|
2051
|
-
return [field];
|
|
2052
|
-
});
|
|
2053
|
-
};
|
|
2054
|
-
return flattenForFilter(this.formFields);
|
|
2055
|
-
}
|
|
2056
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseCrud, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2057
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: BaseCrud, isStandalone: true, ngImport: i0 });
|
|
2058
|
-
}
|
|
2059
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: BaseCrud, decorators: [{
|
|
2060
|
-
type: Directive
|
|
10
|
+
args: [{ selector: 'lib-ng-core', imports: [], template: "<p>NgCore works!</p>\n" }]
|
|
2061
11
|
}] });
|
|
2062
12
|
|
|
2063
|
-
const DEFAULT_CONTROL_CLASS = [
|
|
2064
|
-
'w-full',
|
|
2065
|
-
'border',
|
|
2066
|
-
'border-gray-300',
|
|
2067
|
-
'rounded',
|
|
2068
|
-
'focus:outline-none',
|
|
2069
|
-
'focus:ring-2',
|
|
2070
|
-
'focus:ring-green-400',
|
|
2071
|
-
].join(' ');
|
|
2072
|
-
function numberField(key, label, required = false, className = 'col-span-1') {
|
|
2073
|
-
return {
|
|
2074
|
-
key,
|
|
2075
|
-
type: 'input',
|
|
2076
|
-
className,
|
|
2077
|
-
wrappers: ['form-field'],
|
|
2078
|
-
templateOptions: {
|
|
2079
|
-
type: "number",
|
|
2080
|
-
label,
|
|
2081
|
-
required,
|
|
2082
|
-
attributes: { class: DEFAULT_CONTROL_CLASS },
|
|
2083
|
-
},
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
function textField(key, label, required = false, className = 'col-span-1',
|
|
2087
|
-
// ✅ تم تغيير هذا البراميتر ليقبل خصائص إضافية لـ templateOptions
|
|
2088
|
-
extraTemplateOptions) {
|
|
2089
|
-
return {
|
|
2090
|
-
key,
|
|
2091
|
-
type: 'advanced-input',
|
|
2092
|
-
className,
|
|
2093
|
-
wrappers: ['form-field'],
|
|
2094
|
-
props: {
|
|
2095
|
-
label,
|
|
2096
|
-
required,
|
|
2097
|
-
attributes: {
|
|
2098
|
-
class: DEFAULT_CONTROL_CLASS,
|
|
2099
|
-
},
|
|
2100
|
-
// ✅ دمج الخصائص الإضافية هنا
|
|
2101
|
-
...extraTemplateOptions,
|
|
2102
|
-
},
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
function textField2(key, label, required = false, className = 'col-span-1', expressions) {
|
|
2106
|
-
return {
|
|
2107
|
-
key,
|
|
2108
|
-
type: 'input',
|
|
2109
|
-
className,
|
|
2110
|
-
wrappers: ['form-field'],
|
|
2111
|
-
templateOptions: {
|
|
2112
|
-
label,
|
|
2113
|
-
required,
|
|
2114
|
-
attributes: {
|
|
2115
|
-
class: DEFAULT_CONTROL_CLASS,
|
|
2116
|
-
},
|
|
2117
|
-
// ✅ اضف disabled ليتضبب الحقل إذا كان readonly
|
|
2118
|
-
},
|
|
2119
|
-
expressions,
|
|
2120
|
-
};
|
|
2121
|
-
}
|
|
2122
|
-
function textareaField(key, label, rows = 3, className = 'col-span-1') {
|
|
2123
|
-
return {
|
|
2124
|
-
key,
|
|
2125
|
-
type: 'textarea',
|
|
2126
|
-
className,
|
|
2127
|
-
wrappers: ['form-field'],
|
|
2128
|
-
templateOptions: {
|
|
2129
|
-
label,
|
|
2130
|
-
rows,
|
|
2131
|
-
attributes: { class: DEFAULT_CONTROL_CLASS },
|
|
2132
|
-
},
|
|
2133
|
-
};
|
|
2134
|
-
}
|
|
2135
|
-
function selectField({ key, label, options = [], className, defaultValue, fullWidth = false, required = false, }) {
|
|
2136
|
-
const config = {
|
|
2137
|
-
key,
|
|
2138
|
-
type: 'select',
|
|
2139
|
-
className: className ?? (fullWidth ? 'col-span-2' : 'col-span-1'),
|
|
2140
|
-
wrappers: ['form-field'],
|
|
2141
|
-
templateOptions: {
|
|
2142
|
-
label,
|
|
2143
|
-
options,
|
|
2144
|
-
required,
|
|
2145
|
-
placeholder: `اختر ${label}`,
|
|
2146
|
-
showClear: true,
|
|
2147
|
-
filter: true,
|
|
2148
|
-
appendTo: 'body',
|
|
2149
|
-
optionLabel: 'label',
|
|
2150
|
-
optionValue: 'value',
|
|
2151
|
-
attributes: { class: DEFAULT_CONTROL_CLASS },
|
|
2152
|
-
},
|
|
2153
|
-
};
|
|
2154
|
-
if (options !== undefined) {
|
|
2155
|
-
config.templateOptions.options = options;
|
|
2156
|
-
}
|
|
2157
|
-
if (defaultValue !== undefined) {
|
|
2158
|
-
config.defaultValue = defaultValue;
|
|
2159
|
-
}
|
|
2160
|
-
return config;
|
|
2161
|
-
}
|
|
2162
|
-
// export function checkboxField(
|
|
2163
|
-
// key: string,
|
|
2164
|
-
// label: string,
|
|
2165
|
-
// required = false,
|
|
2166
|
-
// className = 'col-span-1',
|
|
2167
|
-
// useNumberMapping = false
|
|
2168
|
-
// ): FormlyFieldConfig {
|
|
2169
|
-
// const field: FormlyFieldConfig = {
|
|
2170
|
-
// key,
|
|
2171
|
-
// type: 'checkbox',
|
|
2172
|
-
// className,
|
|
2173
|
-
// wrappers: ['form-field'],
|
|
2174
|
-
// templateOptions: {
|
|
2175
|
-
// label,
|
|
2176
|
-
// required,
|
|
2177
|
-
// attributes: {
|
|
2178
|
-
// class: 'flex items-center gap-2',
|
|
2179
|
-
// },
|
|
2180
|
-
// },
|
|
2181
|
-
// };
|
|
2182
|
-
// if (useNumberMapping) {
|
|
2183
|
-
// field.hooks = {
|
|
2184
|
-
// onInit: (field) => {
|
|
2185
|
-
// // ✅ تهيئة القيمة داخل الفورم كنترول
|
|
2186
|
-
// const initialValue = field.model?.[key];
|
|
2187
|
-
// if (initialValue === 1 || initialValue === 2) {
|
|
2188
|
-
// field.formControl?.setValue(initialValue === 1, { emitEvent: false });
|
|
2189
|
-
// }
|
|
2190
|
-
// // ✅ تحويل عند تغيّر القيمة من الـ checkbox
|
|
2191
|
-
// field.formControl?.valueChanges.subscribe(val => {
|
|
2192
|
-
// const newValue = val ? 1 : 2;
|
|
2193
|
-
// if (field.model) {
|
|
2194
|
-
// field.model[key] = newValue;
|
|
2195
|
-
// }
|
|
2196
|
-
// });
|
|
2197
|
-
// }
|
|
2198
|
-
// };
|
|
2199
|
-
// }
|
|
2200
|
-
// return field;
|
|
2201
|
-
// }
|
|
2202
|
-
function checkboxField(key, label, required = false, className = 'col-span-1') {
|
|
2203
|
-
return {
|
|
2204
|
-
key,
|
|
2205
|
-
type: 'checkbox',
|
|
2206
|
-
className,
|
|
2207
|
-
wrappers: ['form-field'],
|
|
2208
|
-
templateOptions: {
|
|
2209
|
-
label,
|
|
2210
|
-
required,
|
|
2211
|
-
attributes: {
|
|
2212
|
-
class: 'flex items-center gap-2',
|
|
2213
|
-
},
|
|
2214
|
-
},
|
|
2215
|
-
hooks: {
|
|
2216
|
-
onInit: (field) => {
|
|
2217
|
-
const val = field.model?.[key];
|
|
2218
|
-
if (val === 1) {
|
|
2219
|
-
field.formControl?.setValue(true, { emitEvent: false });
|
|
2220
|
-
}
|
|
2221
|
-
else if (val === 2) {
|
|
2222
|
-
field.formControl?.setValue(false, { emitEvent: false });
|
|
2223
|
-
}
|
|
2224
|
-
else if (val === undefined) {
|
|
2225
|
-
field.model[key] = 2; // تعيين القيمة الافتراضية في الموديل
|
|
2226
|
-
field.formControl?.setValue(false, { emitEvent: false });
|
|
2227
|
-
}
|
|
2228
|
-
else {
|
|
2229
|
-
field.formControl?.setValue(false, { emitEvent: false });
|
|
2230
|
-
}
|
|
2231
|
-
field.formControl?.valueChanges.subscribe(val => {
|
|
2232
|
-
const newVal = val ? 1 : 2;
|
|
2233
|
-
if (field.model && field.model[key] !== newVal) {
|
|
2234
|
-
field.model[key] = newVal;
|
|
2235
|
-
}
|
|
2236
|
-
});
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
};
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
// export * from './lib/components';
|
|
2243
|
-
// export * from './lib/components/InputWithIconType';
|
|
2244
|
-
|
|
2245
13
|
/**
|
|
2246
14
|
* Generated bundle index. Do not edit.
|
|
2247
15
|
*/
|
|
2248
16
|
|
|
2249
|
-
export {
|
|
17
|
+
export { NgCore };
|
|
2250
18
|
//# sourceMappingURL=elite.framework-ng.core.mjs.map
|