@eqproject/eqp-dynamic-module 0.0.7 → 0.0.9
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/bundles/eqproject-eqp-dynamic-module.umd.js +3991 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js +17 -0
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -0
- package/eqproject-eqp-dynamic-module.d.ts +6 -0
- package/eqproject-eqp-dynamic-module.metadata.json +1 -0
- package/esm2015/eqproject-eqp-dynamic-module.js +7 -0
- package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +262 -0
- package/esm2015/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +649 -0
- package/esm2015/lib/components/private/add-form-field/add-form-field.component.js +577 -0
- package/esm2015/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +127 -0
- package/esm2015/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +170 -0
- package/esm2015/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +56 -0
- package/esm2015/lib/components/private/field-templates/date-field-template/date-field-template.component.js +71 -0
- package/esm2015/lib/components/private/field-templates/image-field-template/image-field-template.component.js +196 -0
- package/esm2015/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +115 -0
- package/esm2015/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +71 -0
- package/esm2015/lib/components/private/field-templates/text-field-template/text-field-template.component.js +67 -0
- package/esm2015/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +51 -0
- package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +130 -0
- package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +216 -0
- package/esm2015/lib/components/private/spinner/spinner.component.js +23 -0
- package/esm2015/lib/eqp-dynamic-module.module.js +69 -0
- package/esm2015/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
- package/esm2015/lib/interfaces/iRootObject.interface.js +1 -0
- package/esm2015/lib/models/baseField.model.js +36 -0
- package/esm2015/lib/models/baseObj.model.js +9 -0
- package/esm2015/lib/models/context.model.js +8 -0
- package/esm2015/lib/models/endPointConfiguration.model.js +23 -0
- package/esm2015/lib/models/entity.model.js +7 -0
- package/esm2015/lib/models/fields/attachmentField.model.js +22 -0
- package/esm2015/lib/models/fields/booleanField.model.js +12 -0
- package/esm2015/lib/models/fields/dateField.model.js +11 -0
- package/esm2015/lib/models/fields/imageField.model.js +8 -0
- package/esm2015/lib/models/fields/listValueField.model.js +14 -0
- package/esm2015/lib/models/fields/lookupField.model.js +5 -0
- package/esm2015/lib/models/fields/numericField.model.js +5 -0
- package/esm2015/lib/models/fields/testareaField.model.js +4 -0
- package/esm2015/lib/models/fields/textField.model.js +14 -0
- package/esm2015/lib/models/form.model.js +24 -0
- package/esm2015/lib/models/record.model.js +8 -0
- package/esm2015/lib/modules/material.module.js +108 -0
- package/esm2015/lib/services/custom-form-validators.service.js +19 -0
- package/esm2015/lib/services/eqp-dynamic-module-dialog.service.js +113 -0
- package/esm2015/lib/services/spinner.service.js +43 -0
- package/esm2015/lib/services/utilityHelper.services.js +387 -0
- package/esm2015/public-api.js +39 -0
- package/esm5/eqproject-eqp-dynamic-module.js +7 -0
- package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +269 -0
- package/esm5/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.js +664 -0
- package/esm5/lib/components/private/add-form-field/add-form-field.component.js +588 -0
- package/esm5/lib/components/private/dynamic-module-field/dynamic-module-field.component.js +128 -0
- package/esm5/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.js +173 -0
- package/esm5/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.js +57 -0
- package/esm5/lib/components/private/field-templates/date-field-template/date-field-template.component.js +72 -0
- package/esm5/lib/components/private/field-templates/image-field-template/image-field-template.component.js +206 -0
- package/esm5/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.js +119 -0
- package/esm5/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.js +72 -0
- package/esm5/lib/components/private/field-templates/text-field-template/text-field-template.component.js +68 -0
- package/esm5/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.js +52 -0
- package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +133 -0
- package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +220 -0
- package/esm5/lib/components/private/spinner/spinner.component.js +24 -0
- package/esm5/lib/eqp-dynamic-module.module.js +72 -0
- package/esm5/lib/interfaces/iBaseFieldComponent.interface.js +1 -0
- package/esm5/lib/interfaces/iRootObject.interface.js +1 -0
- package/esm5/lib/models/baseField.model.js +43 -0
- package/esm5/lib/models/baseObj.model.js +13 -0
- package/esm5/lib/models/context.model.js +14 -0
- package/esm5/lib/models/endPointConfiguration.model.js +33 -0
- package/esm5/lib/models/entity.model.js +14 -0
- package/esm5/lib/models/fields/attachmentField.model.js +29 -0
- package/esm5/lib/models/fields/booleanField.model.js +19 -0
- package/esm5/lib/models/fields/dateField.model.js +18 -0
- package/esm5/lib/models/fields/imageField.model.js +19 -0
- package/esm5/lib/models/fields/listValueField.model.js +25 -0
- package/esm5/lib/models/fields/lookupField.model.js +12 -0
- package/esm5/lib/models/fields/numericField.model.js +12 -0
- package/esm5/lib/models/fields/testareaField.model.js +11 -0
- package/esm5/lib/models/fields/textField.model.js +21 -0
- package/esm5/lib/models/form.model.js +39 -0
- package/esm5/lib/models/record.model.js +14 -0
- package/esm5/lib/modules/material.module.js +111 -0
- package/esm5/lib/services/custom-form-validators.service.js +23 -0
- package/esm5/lib/services/eqp-dynamic-module-dialog.service.js +123 -0
- package/esm5/lib/services/spinner.service.js +46 -0
- package/esm5/lib/services/utilityHelper.services.js +396 -0
- package/esm5/public-api.js +39 -0
- package/fesm2015/eqproject-eqp-dynamic-module.js +3580 -0
- package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -0
- package/fesm5/eqproject-eqp-dynamic-module.js +3766 -0
- package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -0
- package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +101 -0
- package/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.d.ts +235 -0
- package/lib/components/private/add-form-field/add-form-field.component.d.ts +199 -0
- package/lib/components/private/dynamic-module-field/dynamic-module-field.component.d.ts +55 -0
- package/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.d.ts +68 -0
- package/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.d.ts +21 -0
- package/lib/components/private/field-templates/date-field-template/date-field-template.component.d.ts +27 -0
- package/lib/components/private/field-templates/image-field-template/image-field-template.component.d.ts +65 -0
- package/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.d.ts +51 -0
- package/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.d.ts +26 -0
- package/lib/components/private/field-templates/text-field-template/text-field-template.component.d.ts +22 -0
- package/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.d.ts +20 -0
- package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +52 -0
- package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +64 -0
- package/lib/components/private/spinner/spinner.component.d.ts +9 -0
- package/lib/eqp-dynamic-module.module.d.ts +2 -0
- package/{src/lib/interfaces/iBaseFieldComponent.interface.ts → lib/interfaces/iBaseFieldComponent.interface.d.ts} +1 -1
- package/{src/lib/interfaces/iRootObject.interface.ts → lib/interfaces/iRootObject.interface.d.ts} +1 -1
- package/{src/lib/models/baseField.model.ts → lib/models/baseField.model.d.ts} +5 -14
- package/{src/lib/models/baseObj.model.ts → lib/models/baseObj.model.d.ts} +3 -3
- package/lib/models/context.model.d.ts +9 -0
- package/{src/lib/models/endPointConfiguration.model.ts → lib/models/endPointConfiguration.model.d.ts} +12 -16
- package/{src/lib/models/entity.model.ts → lib/models/entity.model.d.ts} +1 -2
- package/lib/models/fields/attachmentField.model.d.ts +17 -0
- package/{src/lib/models/fields/booleanField.model.ts → lib/models/fields/booleanField.model.d.ts} +4 -8
- package/{src/lib/models/fields/dateField.model.ts → lib/models/fields/dateField.model.d.ts} +3 -5
- package/{src/lib/models/fields/imageField.model.ts → lib/models/fields/imageField.model.d.ts} +3 -8
- package/{src/lib/models/fields/listValueField.model.ts → lib/models/fields/listValueField.model.d.ts} +8 -13
- package/{src/lib/models/fields/lookupField.model.ts → lib/models/fields/lookupField.model.d.ts} +2 -5
- package/{src/lib/models/fields/numericField.model.ts → lib/models/fields/numericField.model.d.ts} +2 -3
- package/{src/lib/models/fields/testareaField.model.ts → lib/models/fields/testareaField.model.d.ts} +2 -3
- package/lib/models/fields/textField.model.d.ts +15 -0
- package/{src/lib/models/form.model.ts → lib/models/form.model.d.ts} +12 -25
- package/{src/lib/models/record.model.ts → lib/models/record.model.d.ts} +5 -4
- package/lib/modules/material.module.d.ts +2 -0
- package/lib/services/custom-form-validators.service.d.ts +5 -0
- package/lib/services/eqp-dynamic-module-dialog.service.d.ts +34 -0
- package/lib/services/spinner.service.d.ts +15 -0
- package/lib/services/utilityHelper.services.d.ts +77 -0
- package/package.json +41 -31
- package/{src/public-api.ts → public-api.d.ts} +0 -3
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -18
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.html +0 -10
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.scss +0 -3
- package/src/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.ts +0 -228
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.html +0 -212
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.scss +0 -30
- package/src/lib/components/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.ts +0 -692
- package/src/lib/components/private/add-form-field/add-form-field.component.html +0 -417
- package/src/lib/components/private/add-form-field/add-form-field.component.scss +0 -38
- package/src/lib/components/private/add-form-field/add-form-field.component.ts +0 -599
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.html +0 -42
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.scss +0 -0
- package/src/lib/components/private/dynamic-module-field/dynamic-module-field.component.ts +0 -125
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.html +0 -25
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/attachment-field-template/attachment-field-template.component.ts +0 -172
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.html +0 -32
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/boolean-field-template/boolean-field-template.component.ts +0 -53
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.html +0 -6
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/date-field-template/date-field-template.component.ts +0 -70
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.html +0 -57
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.scss +0 -4
- package/src/lib/components/private/field-templates/image-field-template/image-field-template.component.ts +0 -203
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.html +0 -46
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.scss +0 -13
- package/src/lib/components/private/field-templates/list-value-field-template/list-value-field-template.component.ts +0 -114
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.html +0 -6
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/numeric-field-template/numeric-field-template.component.ts +0 -70
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.html +0 -5
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/text-field-template/text-field-template.component.ts +0 -65
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.html +0 -5
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.scss +0 -0
- package/src/lib/components/private/field-templates/textarea-field-template/textarea-field-template.component.ts +0 -48
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.html +0 -74
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.scss +0 -0
- package/src/lib/components/private/form-records/add-form-record/add-form-record.component.ts +0 -117
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.html +0 -14
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.scss +0 -7
- package/src/lib/components/private/form-records/list-form-record/list-form-record.component.ts +0 -213
- package/src/lib/components/private/spinner/spinner.component.html +0 -3
- package/src/lib/components/private/spinner/spinner.component.scss +0 -100
- package/src/lib/components/private/spinner/spinner.component.ts +0 -19
- package/src/lib/eqp-dynamic-module.module.ts +0 -65
- package/src/lib/models/context.model.ts +0 -10
- package/src/lib/models/fields/attachmentField.model.ts +0 -32
- package/src/lib/models/fields/textField.model.ts +0 -18
- package/src/lib/modules/material.module.ts +0 -104
- package/src/lib/services/custom-form-validators.service.ts +0 -21
- package/src/lib/services/eqp-dynamic-module-dialog.service.ts +0 -114
- package/src/lib/services/spinner.service.ts +0 -40
- package/src/lib/services/utilityHelper.services.ts +0 -413
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -6
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
//Angular Material Components
|
|
4
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
5
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
6
|
-
import { MatInputModule } from '@angular/material/input';
|
|
7
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
8
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
9
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
10
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
11
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
12
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
13
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
14
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
15
|
-
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
16
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
17
|
-
import { MatListModule } from '@angular/material/list';
|
|
18
|
-
import { MatGridListModule } from '@angular/material/grid-list';
|
|
19
|
-
import { MatCardModule } from '@angular/material/card';
|
|
20
|
-
import { MatStepperModule } from '@angular/material/stepper';
|
|
21
|
-
import { MatTabsModule } from '@angular/material/tabs';
|
|
22
|
-
import { MatExpansionModule } from '@angular/material/expansion';
|
|
23
|
-
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
24
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
25
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
26
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
27
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
28
|
-
import { MatDialogModule } from '@angular/material/dialog';
|
|
29
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
30
|
-
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
31
|
-
import { MatTableModule } from '@angular/material/table';
|
|
32
|
-
import { MatSortModule } from '@angular/material/sort';
|
|
33
|
-
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
34
|
-
import { MatNativeDateModule } from '@angular/material/core';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@NgModule({
|
|
38
|
-
imports: [
|
|
39
|
-
MatCheckboxModule,
|
|
40
|
-
MatButtonModule,
|
|
41
|
-
MatInputModule,
|
|
42
|
-
MatAutocompleteModule,
|
|
43
|
-
MatDatepickerModule,
|
|
44
|
-
MatFormFieldModule,
|
|
45
|
-
MatRadioModule,
|
|
46
|
-
MatSelectModule,
|
|
47
|
-
MatSliderModule,
|
|
48
|
-
MatSlideToggleModule,
|
|
49
|
-
MatMenuModule,
|
|
50
|
-
MatSidenavModule,
|
|
51
|
-
MatToolbarModule,
|
|
52
|
-
MatListModule,
|
|
53
|
-
MatGridListModule,
|
|
54
|
-
MatCardModule,
|
|
55
|
-
MatStepperModule,
|
|
56
|
-
MatTabsModule,
|
|
57
|
-
MatExpansionModule,
|
|
58
|
-
MatButtonToggleModule,
|
|
59
|
-
MatChipsModule,
|
|
60
|
-
MatIconModule,
|
|
61
|
-
MatProgressSpinnerModule,
|
|
62
|
-
MatProgressBarModule,
|
|
63
|
-
MatDialogModule,
|
|
64
|
-
MatTooltipModule,
|
|
65
|
-
MatSnackBarModule,
|
|
66
|
-
MatTableModule,
|
|
67
|
-
MatSortModule,
|
|
68
|
-
MatPaginatorModule,
|
|
69
|
-
MatDatepickerModule,
|
|
70
|
-
MatNativeDateModule
|
|
71
|
-
],
|
|
72
|
-
exports: [
|
|
73
|
-
MatCheckboxModule,
|
|
74
|
-
MatButtonModule,
|
|
75
|
-
MatInputModule,
|
|
76
|
-
MatAutocompleteModule,
|
|
77
|
-
MatDatepickerModule,
|
|
78
|
-
MatFormFieldModule,
|
|
79
|
-
MatRadioModule,
|
|
80
|
-
MatSelectModule,
|
|
81
|
-
MatSliderModule,
|
|
82
|
-
MatSlideToggleModule,
|
|
83
|
-
MatMenuModule,
|
|
84
|
-
MatSidenavModule,
|
|
85
|
-
MatToolbarModule,
|
|
86
|
-
MatListModule,
|
|
87
|
-
MatGridListModule,
|
|
88
|
-
MatCardModule,
|
|
89
|
-
MatStepperModule,
|
|
90
|
-
MatTabsModule,
|
|
91
|
-
MatExpansionModule,
|
|
92
|
-
MatButtonToggleModule,
|
|
93
|
-
MatChipsModule,
|
|
94
|
-
MatIconModule,
|
|
95
|
-
MatProgressSpinnerModule,
|
|
96
|
-
MatProgressBarModule,
|
|
97
|
-
MatDialogModule,
|
|
98
|
-
MatTooltipModule,
|
|
99
|
-
MatSnackBarModule,
|
|
100
|
-
MatTableModule,
|
|
101
|
-
MatSortModule,
|
|
102
|
-
MatPaginatorModule],
|
|
103
|
-
})
|
|
104
|
-
export class MaterialModule { }
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AbstractControl, ValidationErrors } from "@angular/forms";
|
|
2
|
-
|
|
3
|
-
export class ArrayValidators {
|
|
4
|
-
public static minLenght(minLenght: number): (AbstractControl) => ValidationErrors | null {
|
|
5
|
-
var validationFunction = (control: AbstractControl): ValidationErrors | null => {
|
|
6
|
-
return !!control && !!control.value && Array.isArray(control.value) && control.value.length >= minLenght
|
|
7
|
-
? null
|
|
8
|
-
: { hasMinLenght: false };
|
|
9
|
-
};
|
|
10
|
-
return validationFunction;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public static maxLenght(maxLenght: number): (AbstractControl) => ValidationErrors | null {
|
|
14
|
-
var validationFunction = (control: AbstractControl): ValidationErrors | null => {
|
|
15
|
-
return !!control && !!control.value && Array.isArray(control.value) && control.value.length <= maxLenght
|
|
16
|
-
? null
|
|
17
|
-
: { hasMinLenght: false };
|
|
18
|
-
};
|
|
19
|
-
return validationFunction;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@angular/core";
|
|
2
|
-
import Swal from 'sweetalert2';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root'
|
|
6
|
-
})
|
|
7
|
-
export class EqpDynamicModuleDialogService {
|
|
8
|
-
|
|
9
|
-
constructor() { }
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Mostra uno sweet alert di tipo SUCCESS con il messaggio passato come parametro.
|
|
13
|
-
* @param message Messaggio da mostrare nello sweetalert
|
|
14
|
-
* @param title Titolo dello sweetalert (di default mostra 'Operazione completata')
|
|
15
|
-
*/
|
|
16
|
-
static Success(message: string, title: string = null) {
|
|
17
|
-
let currentTitle = title != null ? title : 'Operazione completata con successo.';
|
|
18
|
-
Swal.fire(currentTitle, message, 'success');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
|
|
23
|
-
* @param message Messaggio d'errore da mostrare nello sweetalert
|
|
24
|
-
* @param title Titolo dello sweetalert (di default mostra 'Errore')
|
|
25
|
-
*/
|
|
26
|
-
static Error(message: string | string[], title: string = null) {
|
|
27
|
-
let currentTitle = title != null ? title : 'Errore';
|
|
28
|
-
if (Array.isArray(message)) {
|
|
29
|
-
currentTitle = title != null ? title : 'Errore';
|
|
30
|
-
let htmlErrors: string = message.join("<br>");
|
|
31
|
-
Swal.fire({
|
|
32
|
-
title: currentTitle,
|
|
33
|
-
html: htmlErrors,
|
|
34
|
-
icon: 'error'
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
Swal.fire(currentTitle, message, 'error');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
|
|
45
|
-
* CONFERMA lancia la funzione di callback passata come parametro
|
|
46
|
-
* @param message Messaggio da mostrare nello sweetalert
|
|
47
|
-
* @param title Titolo dello sweetalert (di default mostra 'Info')
|
|
48
|
-
*/
|
|
49
|
-
static Confirm(message: string | string[], confirmCallback: any, isWarning: boolean = false, title: string = null, customWidth: string = null) {
|
|
50
|
-
|
|
51
|
-
let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
|
|
52
|
-
if (Array.isArray(message)) {
|
|
53
|
-
let htmlErrors: string = message.join("<br>");
|
|
54
|
-
Swal.fire({
|
|
55
|
-
title: currentTitle,
|
|
56
|
-
html: htmlErrors,
|
|
57
|
-
width: customWidth ? customWidth : '32rem',
|
|
58
|
-
icon: !isWarning ? 'question' : 'warning',
|
|
59
|
-
showCancelButton: true,
|
|
60
|
-
allowOutsideClick: false,
|
|
61
|
-
allowEscapeKey: false
|
|
62
|
-
}).then((result) => {
|
|
63
|
-
if (result.value && confirmCallback) {
|
|
64
|
-
confirmCallback();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
Swal.fire({
|
|
70
|
-
title: currentTitle,
|
|
71
|
-
text: message,
|
|
72
|
-
width: customWidth ? customWidth : '32rem',
|
|
73
|
-
icon: !isWarning ? 'question' : 'warning',
|
|
74
|
-
showCancelButton: true,
|
|
75
|
-
allowOutsideClick: false,
|
|
76
|
-
allowEscapeKey: false
|
|
77
|
-
}).then((result) => {
|
|
78
|
-
if (result.value && confirmCallback) {
|
|
79
|
-
confirmCallback();
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
|
|
87
|
-
* @param message Messaggio da mostrare nello sweetalert
|
|
88
|
-
* @param title Titolo dello sweetalert (di default mostra 'Info')
|
|
89
|
-
*/
|
|
90
|
-
static Info(message: string, title: string = null, isToast: boolean = null) {
|
|
91
|
-
let currentTitle = title != null ? title : "Informazione:";
|
|
92
|
-
Swal.fire(currentTitle, message, 'info');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
|
|
97
|
-
* @param message Messaggio da mostrare nello sweetalert
|
|
98
|
-
* @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
|
|
99
|
-
*/
|
|
100
|
-
static Warning(message: string | string[], title: string = null, isToast: boolean = null) {
|
|
101
|
-
let currentTitle = title != null ? title : "Attenzione!";
|
|
102
|
-
|
|
103
|
-
if (Array.isArray(message)) {
|
|
104
|
-
let htmlWarnings: string = message.join("<br>");
|
|
105
|
-
Swal.fire({
|
|
106
|
-
title: currentTitle,
|
|
107
|
-
html: htmlWarnings,
|
|
108
|
-
icon: 'warning'
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
Swal.fire(currentTitle, message, 'warning');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@angular/core";
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root'
|
|
6
|
-
})
|
|
7
|
-
export class SpinnerService {
|
|
8
|
-
isLoading = new Subject<boolean>();
|
|
9
|
-
|
|
10
|
-
private requestsCount: number = 0;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Mostra lo spinner
|
|
14
|
-
*/
|
|
15
|
-
show() {
|
|
16
|
-
setTimeout(() => {
|
|
17
|
-
this.isLoading.next(true);
|
|
18
|
-
}, 100);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Nasconde lo spinner
|
|
23
|
-
*/
|
|
24
|
-
hide() {
|
|
25
|
-
setTimeout(() => {
|
|
26
|
-
this.isLoading.next(false);
|
|
27
|
-
}, 100);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
addRequestCounter() {
|
|
31
|
-
this.requestsCount++;
|
|
32
|
-
this.show();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
removeRequestCounter() {
|
|
36
|
-
this.requestsCount--;
|
|
37
|
-
if (this.requestsCount == 0)
|
|
38
|
-
this.hide();
|
|
39
|
-
}
|
|
40
|
-
}
|