ng-ipa-library 0.7.6 → 0.7.7
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/ng-ipa-library.umd.js +2092 -0
- package/bundles/ng-ipa-library.umd.js.map +1 -0
- package/esm2015/lib/core/components/loading/loading.component.js +27 -0
- package/esm2015/lib/core/interceptors/error.interceptor.js +46 -0
- package/esm2015/lib/core/interceptors/loading.interceptor.js +58 -0
- package/esm2015/lib/core/interceptors/token.interceptor.js +69 -0
- package/esm2015/lib/core/services/auth.service.js +48 -0
- package/esm2015/lib/core/services/error.service.js +22 -0
- package/esm2015/lib/core/services/loader.service.js +24 -0
- package/esm2015/lib/generate-form/generate-form.component.js +120 -0
- package/esm2015/lib/ipa-form/datepicker/datepicker.component.js +70 -0
- package/esm2015/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.js +28 -0
- package/esm2015/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.js +38 -0
- package/esm2015/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.js +38 -0
- package/esm2015/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.js +28 -0
- package/esm2015/lib/ipa-form/dropdown-input/dropdown-input.component.js +81 -0
- package/esm2015/lib/ipa-form/file-upload/file-upload.component.js +128 -0
- package/esm2015/lib/ipa-form/ipa-form.service.js +251 -0
- package/esm2015/lib/ipa-form/recaptcha/recaptcha.component.js +59 -0
- package/esm2015/lib/ipa-form/text-input/text-input.component.js +76 -0
- package/esm2015/lib/ipa-form/textarea-input/textarea-input.component.js +73 -0
- package/esm2015/lib/models/apiException.js +2 -0
- package/esm2015/lib/models/apiResponse.js +2 -0
- package/esm2015/lib/models/breadcrumbs.model.js +2 -0
- package/esm2015/lib/models/decodedToken.model.js +2 -0
- package/esm2015/lib/models/exceptionUrl.model.js +2 -0
- package/esm2015/lib/models/generateForm.model.js +2 -0
- package/esm2015/lib/models/pagedResult.js +2 -0
- package/esm2015/lib/models/user.model.js +2 -0
- package/esm2015/lib/ng-ipa-library.module.js +109 -0
- package/esm2015/lib/pipes/hijri-date.pipe.js +18 -0
- package/esm2015/lib/pipes/pipes.module.js +16 -0
- package/esm2015/lib/services/breadcrumbs.service.js +151 -0
- package/esm2015/lib/services/common.service.js +66 -0
- package/esm2015/lib/share-button/share-button.component.js +37 -0
- package/esm2015/lib/share-button/share-button.module.js +52 -0
- package/esm2015/ng-ipa-library.js +5 -0
- package/esm2015/public-api.js +39 -0
- package/fesm2015/ng-ipa-library.js +1629 -0
- package/fesm2015/ng-ipa-library.js.map +1 -0
- package/lib/core/components/loading/loading.component.d.ts +12 -0
- package/lib/core/interceptors/error.interceptor.d.ts +14 -0
- package/lib/core/interceptors/loading.interceptor.d.ts +14 -0
- package/lib/core/interceptors/token.interceptor.d.ts +15 -0
- package/lib/core/services/auth.service.d.ts +15 -0
- package/lib/core/services/error.service.d.ts +10 -0
- package/lib/core/services/loader.service.d.ts +12 -0
- package/lib/generate-form/generate-form.component.d.ts +32 -0
- package/lib/ipa-form/datepicker/datepicker.component.d.ts +31 -0
- package/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.d.ts +6 -0
- package/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.d.ts +11 -0
- package/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.d.ts +11 -0
- package/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.d.ts +6 -0
- package/lib/ipa-form/dropdown-input/dropdown-input.component.d.ts +31 -0
- package/lib/ipa-form/file-upload/file-upload.component.d.ts +36 -0
- package/lib/ipa-form/ipa-form.service.d.ts +49 -0
- package/lib/ipa-form/recaptcha/recaptcha.component.d.ts +22 -0
- package/lib/ipa-form/text-input/text-input.component.d.ts +30 -0
- package/lib/ipa-form/textarea-input/textarea-input.component.d.ts +29 -0
- package/{src/lib/models/apiException.ts → lib/models/apiException.d.ts} +1 -2
- package/lib/models/apiResponse.d.ts +4 -0
- package/lib/models/breadcrumbs.model.d.ts +4 -0
- package/lib/models/decodedToken.model.d.ts +6 -0
- package/lib/models/exceptionUrl.model.d.ts +4 -0
- package/lib/models/generateForm.model.d.ts +27 -0
- package/lib/models/pagedResult.d.ts +4 -0
- package/lib/models/user.model.d.ts +7 -0
- package/lib/ng-ipa-library.module.d.ts +25 -0
- package/lib/pipes/hijri-date.pipe.d.ts +7 -0
- package/lib/pipes/pipes.module.d.ts +7 -0
- package/lib/services/breadcrumbs.service.d.ts +18 -0
- package/lib/services/common.service.d.ts +8 -0
- package/lib/share-button/share-button.component.d.ts +11 -0
- package/lib/share-button/share-button.module.d.ts +13 -0
- package/ng-ipa-library.d.ts +5 -0
- package/package.json +30 -24
- package/{src/public-api.ts → public-api.d.ts} +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -43
- package/src/lib/core/components/loading/loading.component.html +0 -3
- package/src/lib/core/components/loading/loading.component.scss +0 -3
- package/src/lib/core/components/loading/loading.component.ts +0 -23
- package/src/lib/core/interceptors/error.interceptor.ts +0 -61
- package/src/lib/core/interceptors/loading.interceptor.ts +0 -69
- package/src/lib/core/interceptors/token.interceptor.ts +0 -77
- package/src/lib/core/services/auth.service.ts +0 -48
- package/src/lib/core/services/error.service.ts +0 -19
- package/src/lib/core/services/loader.service.ts +0 -21
- package/src/lib/generate-form/generate-form.component.html +0 -85
- package/src/lib/generate-form/generate-form.component.scss +0 -0
- package/src/lib/generate-form/generate-form.component.ts +0 -119
- package/src/lib/ipa-form/datepicker/datepicker.component.html +0 -21
- package/src/lib/ipa-form/datepicker/datepicker.component.scss +0 -13
- package/src/lib/ipa-form/datepicker/datepicker.component.ts +0 -67
- package/src/lib/ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component.ts +0 -15
- package/src/lib/ipa-form/datepicker/gregorian-datepicker/gregorian18n.ts +0 -38
- package/src/lib/ipa-form/datepicker/hijri-datepicker/IslamicI18n.ts +0 -38
- package/src/lib/ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component.ts +0 -14
- package/src/lib/ipa-form/dropdown-input/dropdown-input.component.html +0 -22
- package/src/lib/ipa-form/dropdown-input/dropdown-input.component.scss +0 -0
- package/src/lib/ipa-form/dropdown-input/dropdown-input.component.ts +0 -68
- package/src/lib/ipa-form/file-upload/file-upload.component.html +0 -37
- package/src/lib/ipa-form/file-upload/file-upload.component.scss +0 -45
- package/src/lib/ipa-form/file-upload/file-upload.component.ts +0 -109
- package/src/lib/ipa-form/ipa-form.service.ts +0 -294
- package/src/lib/ipa-form/recaptcha/recaptcha.component.html +0 -3
- package/src/lib/ipa-form/recaptcha/recaptcha.component.scss +0 -0
- package/src/lib/ipa-form/recaptcha/recaptcha.component.ts +0 -42
- package/src/lib/ipa-form/text-input/text-input.component.html +0 -10
- package/src/lib/ipa-form/text-input/text-input.component.scss +0 -0
- package/src/lib/ipa-form/text-input/text-input.component.ts +0 -69
- package/src/lib/ipa-form/textarea-input/textarea-input.component.html +0 -11
- package/src/lib/ipa-form/textarea-input/textarea-input.component.scss +0 -0
- package/src/lib/ipa-form/textarea-input/textarea-input.component.ts +0 -69
- package/src/lib/models/apiResponse.ts +0 -4
- package/src/lib/models/breadcrumbs.model.ts +0 -4
- package/src/lib/models/decodedToken.model.ts +0 -6
- package/src/lib/models/exceptionUrl.model.ts +0 -4
- package/src/lib/models/generateForm.model.ts +0 -29
- package/src/lib/models/pagedResult.ts +0 -4
- package/src/lib/models/user.model.ts +0 -7
- package/src/lib/ng-ipa-library.component.ts +0 -15
- package/src/lib/ng-ipa-library.module.ts +0 -63
- package/src/lib/pipes/hijri-date.pipe.ts +0 -15
- package/src/lib/pipes/pipes.module.ts +0 -8
- package/src/lib/services/breadcrumbs.service.ts +0 -189
- package/src/lib/services/common.service.ts +0 -63
- package/src/lib/share-button/share-button.component.html +0 -3
- package/src/lib/share-button/share-button.component.scss +0 -0
- package/src/lib/share-button/share-button.component.ts +0 -23
- package/src/lib/share-button/share-button.module.ts +0 -32
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="form-floating {{containerClasses}}">
|
|
2
|
-
<textarea #input id="{{id}}" class="form-control {{classes}}" [required]="required" pattern="{{pattern}}"
|
|
3
|
-
placeholder="{{placeholder}}" [formControl]="formControl" (input)="onChange(controlDir.control?.value)"
|
|
4
|
-
(blur)="onTouched()"
|
|
5
|
-
[ngClass]="{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}">
|
|
6
|
-
</textarea>
|
|
7
|
-
<label for="{{id}}">{{label}}</label>
|
|
8
|
-
<div class="invalid-feedback" *ngIf="errorMessage !== null">
|
|
9
|
-
{{errorMsg}}
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
File without changes
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
ElementRef,
|
|
4
|
-
Input,
|
|
5
|
-
OnInit,
|
|
6
|
-
Self,
|
|
7
|
-
ViewChild,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { FormControl, NgControl } from '@angular/forms';
|
|
10
|
-
import { IPAFormService } from '../ipa-form.service';
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'ipa-textarea-input',
|
|
14
|
-
templateUrl: './textarea-input.component.html',
|
|
15
|
-
styleUrls: ['./textarea-input.component.scss'],
|
|
16
|
-
})
|
|
17
|
-
export class TextareaInputComponent implements OnInit {
|
|
18
|
-
@ViewChild('input', { static: true }) input: ElementRef<any> =
|
|
19
|
-
new ElementRef<any>(null);
|
|
20
|
-
@Input() id!: string;
|
|
21
|
-
@Input() placeholder = 'please enter text';
|
|
22
|
-
@Input() label: string = 'textarea input';
|
|
23
|
-
@Input() required = false;
|
|
24
|
-
@Input() patternErrorMsg = 'invalid pattern';
|
|
25
|
-
@Input() pattern!: string;
|
|
26
|
-
@Input() classes!: string;
|
|
27
|
-
@Input() containerClasses!: string;
|
|
28
|
-
formControl: FormControl = new FormControl('');
|
|
29
|
-
errorMsg!: string | null;
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
private validationService: IPAFormService,
|
|
33
|
-
@Self() public controlDir: NgControl
|
|
34
|
-
) {
|
|
35
|
-
this.controlDir.valueAccessor = this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ngOnInit(): void {
|
|
39
|
-
const control = this.controlDir.control;
|
|
40
|
-
const validators = control?.validator ? [control.validator] : [];
|
|
41
|
-
|
|
42
|
-
control?.setValidators(validators);
|
|
43
|
-
control?.updateValueAndValidity();
|
|
44
|
-
this.formControl = control as FormControl;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
onChange(event: any): void {}
|
|
48
|
-
|
|
49
|
-
onTouched(): void {}
|
|
50
|
-
writeValue(obj: any): void {
|
|
51
|
-
this.input.nativeElement.value = obj || '';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
registerOnChange(fn: any): void {
|
|
55
|
-
this.onChange = fn;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
registerOnTouched(fn: any): void {
|
|
59
|
-
this.onTouched = fn;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get errorMessage(): string | null {
|
|
63
|
-
this.errorMsg = this.validationService.getErrorMessage(
|
|
64
|
-
this.formControl,
|
|
65
|
-
this.patternErrorMsg
|
|
66
|
-
);
|
|
67
|
-
return this.errorMsg;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface GenerateForm {
|
|
2
|
-
columns: Column[];
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export interface Column {
|
|
6
|
-
arabicLabel: string;
|
|
7
|
-
englishName: string;
|
|
8
|
-
validationPattern?: string;
|
|
9
|
-
inputClasses?: string;
|
|
10
|
-
containerClasses?: string;
|
|
11
|
-
valueField?: string;
|
|
12
|
-
textField?: string;
|
|
13
|
-
patternErrorMsg?: string;
|
|
14
|
-
type: string;
|
|
15
|
-
size?: number;
|
|
16
|
-
required: boolean;
|
|
17
|
-
data?: Data[] | any[];
|
|
18
|
-
acceptedFiles?: string;
|
|
19
|
-
multipleFile?: number;
|
|
20
|
-
apiUrl?: string;
|
|
21
|
-
autoUploadFile?: boolean;
|
|
22
|
-
apiURlMethod?: string;
|
|
23
|
-
authorization?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface Data {
|
|
27
|
-
id: number;
|
|
28
|
-
description: string;
|
|
29
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { ToastrModule } from 'ngx-toastr';
|
|
5
|
-
import { DropzoneModule } from 'ngx-dropzone-wrapper';
|
|
6
|
-
import { NgxCaptchaModule } from 'ngx-captcha';
|
|
7
|
-
import { PipesModule } from './pipes/pipes.module';
|
|
8
|
-
import { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';
|
|
9
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
|
10
|
-
|
|
11
|
-
import { TextInputComponent } from './ipa-form/text-input/text-input.component';
|
|
12
|
-
import { TextareaInputComponent } from './ipa-form/textarea-input/textarea-input.component';
|
|
13
|
-
import { DropdownInputComponent } from './ipa-form/dropdown-input/dropdown-input.component';
|
|
14
|
-
import { LoaderComponent } from './core/components/loading/loading.component';
|
|
15
|
-
import { GenerateFormComponent } from './generate-form/generate-form.component';
|
|
16
|
-
import { FileUploadComponent } from './ipa-form/file-upload/file-upload.component';
|
|
17
|
-
import { DatepickerComponent } from './ipa-form/datepicker/datepicker.component';
|
|
18
|
-
import { HijriDatepickerComponent } from './ipa-form/datepicker/hijri-datepicker/hijri-datepicker.component';
|
|
19
|
-
import { GregorianDatepickerComponent } from './ipa-form/datepicker/gregorian-datepicker/gregorian-datepicker.component';
|
|
20
|
-
import { ShareButtonModule } from './share-button/share-button.module';
|
|
21
|
-
import { RecaptchaComponent } from './ipa-form/recaptcha/recaptcha.component';
|
|
22
|
-
|
|
23
|
-
@NgModule({
|
|
24
|
-
declarations: [
|
|
25
|
-
TextInputComponent,
|
|
26
|
-
TextareaInputComponent,
|
|
27
|
-
DropdownInputComponent,
|
|
28
|
-
LoaderComponent,
|
|
29
|
-
GenerateFormComponent,
|
|
30
|
-
FileUploadComponent,
|
|
31
|
-
DatepickerComponent,
|
|
32
|
-
HijriDatepickerComponent,
|
|
33
|
-
GregorianDatepickerComponent,
|
|
34
|
-
RecaptchaComponent,
|
|
35
|
-
],
|
|
36
|
-
imports: [
|
|
37
|
-
CommonModule,
|
|
38
|
-
FormsModule,
|
|
39
|
-
ReactiveFormsModule,
|
|
40
|
-
ToastrModule,
|
|
41
|
-
DropzoneModule,
|
|
42
|
-
NgxCaptchaModule,
|
|
43
|
-
PipesModule,
|
|
44
|
-
NgbDatepickerModule,
|
|
45
|
-
ShareButtonModule,
|
|
46
|
-
NgSelectModule,
|
|
47
|
-
],
|
|
48
|
-
exports: [
|
|
49
|
-
TextInputComponent,
|
|
50
|
-
TextareaInputComponent,
|
|
51
|
-
DropdownInputComponent,
|
|
52
|
-
LoaderComponent,
|
|
53
|
-
GenerateFormComponent,
|
|
54
|
-
FileUploadComponent,
|
|
55
|
-
PipesModule,
|
|
56
|
-
HijriDatepickerComponent,
|
|
57
|
-
GregorianDatepickerComponent,
|
|
58
|
-
ShareButtonModule,
|
|
59
|
-
RecaptchaComponent,
|
|
60
|
-
NgSelectModule,
|
|
61
|
-
],
|
|
62
|
-
})
|
|
63
|
-
export class NgIPALibraryModule {}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import momentHijri from 'moment-hijri';
|
|
3
|
-
@Pipe({
|
|
4
|
-
name: 'hijriDate',
|
|
5
|
-
})
|
|
6
|
-
export class HijriDatePipe implements PipeTransform {
|
|
7
|
-
transform(
|
|
8
|
-
date: string,
|
|
9
|
-
format: string = 'iYYYY-iMM-iDD',
|
|
10
|
-
lang: 'ar' | 'en' = 'en'
|
|
11
|
-
): string {
|
|
12
|
-
momentHijri.locale(lang);
|
|
13
|
-
return momentHijri(date).format(format);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { Breadcrumbs } from '../models/breadcrumbs.model';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class BreadcrumbsService {
|
|
8
|
-
constructor() {}
|
|
9
|
-
|
|
10
|
-
setPageTitle(text: string) {
|
|
11
|
-
const titleEl = document.querySelector('.sub-section-title');
|
|
12
|
-
if (titleEl) {
|
|
13
|
-
titleEl.textContent = text;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
setMainPageTitle(text: string, url: string) {
|
|
18
|
-
const div = document.getElementsByClassName('main-section-title');
|
|
19
|
-
if (div && div.length > 0) {
|
|
20
|
-
div[0].innerHTML = `<a id="site-url" href="${url}">${text}</a>`;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
addBreadcrumb(
|
|
25
|
-
nodeName: string,
|
|
26
|
-
spanClasses = 'bc-current',
|
|
27
|
-
linkClasses = 'bc-node'
|
|
28
|
-
) {
|
|
29
|
-
const spans = document.getElementById('ctl00_path')?.children;
|
|
30
|
-
//get last child
|
|
31
|
-
const lastIndex = spans?.item(spans.length - 1) as HTMLSpanElement;
|
|
32
|
-
const innerHTML = lastIndex.innerHTML;
|
|
33
|
-
lastIndex.innerHTML = '';
|
|
34
|
-
lastIndex.classList.remove(...['bc-current']);
|
|
35
|
-
//add new link
|
|
36
|
-
lastIndex.appendChild(
|
|
37
|
-
this.createLink(innerHTML, location.pathname, linkClasses)
|
|
38
|
-
);
|
|
39
|
-
//add new span and empty span
|
|
40
|
-
const newSpan = this.createSpan(nodeName, spanClasses);
|
|
41
|
-
const emptySpan = document.createElement('span');
|
|
42
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
addBreadcrumbList(
|
|
46
|
-
nodeList: Breadcrumbs[],
|
|
47
|
-
spanClasses = 'bc-current',
|
|
48
|
-
linkClasses = 'bc-node'
|
|
49
|
-
) {
|
|
50
|
-
const spans = document.getElementById('ctl00_path')?.childNodes;
|
|
51
|
-
//get last child
|
|
52
|
-
const lastSpan = spans?.item(spans.length - 1) as HTMLSpanElement;
|
|
53
|
-
const innerHTML = lastSpan.innerHTML;
|
|
54
|
-
lastSpan.classList.remove(...[spanClasses]);
|
|
55
|
-
lastSpan.innerHTML = '';
|
|
56
|
-
//add new link
|
|
57
|
-
lastSpan.appendChild(
|
|
58
|
-
this.createLink(innerHTML, location.pathname, linkClasses)
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
for (let i = 0; i < nodeList.length; i++) {
|
|
62
|
-
const lastIndex = spans?.item(spans.length - 1) as HTMLSpanElement;
|
|
63
|
-
if (nodeList[i].nodeUrl) {
|
|
64
|
-
const newSpan = document.createElement('span');
|
|
65
|
-
newSpan.appendChild(
|
|
66
|
-
this.createLink(
|
|
67
|
-
nodeList[i].nodeName,
|
|
68
|
-
nodeList[i].nodeUrl,
|
|
69
|
-
linkClasses
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
const emptySpan = document.createElement('span');
|
|
73
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
74
|
-
} else {
|
|
75
|
-
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
76
|
-
const emptySpan = document.createElement('span');
|
|
77
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
createBreadcrumbs(
|
|
83
|
-
nodeList: Breadcrumbs[],
|
|
84
|
-
spanClasses = 'bc-current',
|
|
85
|
-
linkClasses = 'bc-node'
|
|
86
|
-
) {
|
|
87
|
-
const currentSpan = document.getElementById(
|
|
88
|
-
'ctl00_path'
|
|
89
|
-
) as HTMLSpanElement;
|
|
90
|
-
currentSpan.innerHTML = '';
|
|
91
|
-
const newSpan = document.createElement('span');
|
|
92
|
-
currentSpan?.appendChild(newSpan);
|
|
93
|
-
newSpan.appendChild(
|
|
94
|
-
this.createLink(nodeList[0].nodeName, nodeList[0].nodeUrl, linkClasses)
|
|
95
|
-
);
|
|
96
|
-
const spans = currentSpan?.children;
|
|
97
|
-
for (let i = 1; i < nodeList.length; i++) {
|
|
98
|
-
const lastIndex = spans?.item(spans.length - 1) as HTMLSpanElement;
|
|
99
|
-
if (nodeList[i].nodeUrl) {
|
|
100
|
-
const newSpan = document.createElement('span');
|
|
101
|
-
newSpan.appendChild(
|
|
102
|
-
this.createLink(
|
|
103
|
-
nodeList[i].nodeName,
|
|
104
|
-
nodeList[i].nodeUrl,
|
|
105
|
-
linkClasses
|
|
106
|
-
)
|
|
107
|
-
);
|
|
108
|
-
const emptySpan = document.createElement('span');
|
|
109
|
-
lastIndex?.after(...[emptySpan, newSpan]);
|
|
110
|
-
} else {
|
|
111
|
-
const newSpan = this.createSpan(nodeList[i].nodeName, spanClasses);
|
|
112
|
-
const emptySpan = document.createElement('span');
|
|
113
|
-
lastIndex.after(...[emptySpan, newSpan]);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
removeLastBreadcrumb() {
|
|
119
|
-
const spans = document.getElementById('ctl00_path')?.children;
|
|
120
|
-
spans?.item(spans.length - 1)?.remove();
|
|
121
|
-
spans?.item(spans.length - 1)?.remove();
|
|
122
|
-
this.setCurrentNode(spans);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
removeBreadcrumbByNodeName(nodeName: string) {
|
|
126
|
-
const spans = document.getElementById('ctl00_path')
|
|
127
|
-
?.children as HTMLCollection;
|
|
128
|
-
let index = -1;
|
|
129
|
-
for (let i = 0; i < spans.length; i++) {
|
|
130
|
-
const span = spans.item(i);
|
|
131
|
-
if (span?.textContent?.trim() === nodeName) {
|
|
132
|
-
index = i;
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const lastNode = spans.length - 1 === index;
|
|
137
|
-
if (index !== -1 && !lastNode) {
|
|
138
|
-
spans?.item(index)?.remove();
|
|
139
|
-
spans?.item(index)?.remove();
|
|
140
|
-
} else {
|
|
141
|
-
spans?.item(index)?.remove();
|
|
142
|
-
spans?.item(index - 1)?.remove();
|
|
143
|
-
}
|
|
144
|
-
if (lastNode) {
|
|
145
|
-
this.setCurrentNode(spans);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
removeLastBreadcrumbsByLength(length: number) {
|
|
150
|
-
const spans = document.getElementById('ctl00_path')
|
|
151
|
-
?.children as HTMLCollection;
|
|
152
|
-
while (length > 0) {
|
|
153
|
-
spans?.item(spans.length - 1)?.remove();
|
|
154
|
-
spans?.item(spans.length - 1)?.remove();
|
|
155
|
-
length--;
|
|
156
|
-
}
|
|
157
|
-
if (spans.length > 0) {
|
|
158
|
-
this.setCurrentNode(spans);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private createLink(
|
|
163
|
-
innerHTML: string,
|
|
164
|
-
href: string | null,
|
|
165
|
-
classes: string
|
|
166
|
-
): HTMLAnchorElement {
|
|
167
|
-
const link = document.createElement('a');
|
|
168
|
-
link.innerHTML = ' ' + innerHTML;
|
|
169
|
-
link.href = href ?? '';
|
|
170
|
-
link.classList.add(...[classes]);
|
|
171
|
-
return link;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private createSpan(innerHTML: string, classes: string): HTMLSpanElement {
|
|
175
|
-
const span = document.createElement('span');
|
|
176
|
-
span.classList.add(...[classes]);
|
|
177
|
-
span.innerHTML = ' ' + innerHTML;
|
|
178
|
-
return span;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
private setCurrentNode(spans?: HTMLCollection) {
|
|
182
|
-
const lastSpan = spans?.item(spans.length - 1) as HTMLSpanElement;
|
|
183
|
-
const lastSpanLink = spans
|
|
184
|
-
?.item(spans.length - 1)
|
|
185
|
-
?.children.item(0) as HTMLAnchorElement;
|
|
186
|
-
lastSpan?.classList.add(...['bc-current']);
|
|
187
|
-
lastSpan.innerHTML = lastSpanLink.innerHTML;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Injectable({
|
|
4
|
-
providedIn: 'root',
|
|
5
|
-
})
|
|
6
|
-
export class CommonService {
|
|
7
|
-
constructor() {}
|
|
8
|
-
|
|
9
|
-
print(element: string, title: string, classes?: string) {
|
|
10
|
-
const styles = this.getElementTag('style');
|
|
11
|
-
const linkes = this.getElementTag('link');
|
|
12
|
-
const scripts = this.getElementTag('script');
|
|
13
|
-
|
|
14
|
-
const printContents = document.getElementById(element)?.innerHTML;
|
|
15
|
-
const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
|
|
16
|
-
const data = `
|
|
17
|
-
<!DOCTYPE html>
|
|
18
|
-
<head>
|
|
19
|
-
<title> ${title} </title>
|
|
20
|
-
<meta charset="utf-8">
|
|
21
|
-
${linkes}
|
|
22
|
-
${styles}
|
|
23
|
-
<style>
|
|
24
|
-
@media print {
|
|
25
|
-
.noPrint{
|
|
26
|
-
display: none !important;
|
|
27
|
-
}
|
|
28
|
-
body {
|
|
29
|
-
direction: rtl;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
</style>
|
|
33
|
-
</head>
|
|
34
|
-
<body class="${classes}">
|
|
35
|
-
${printContents}
|
|
36
|
-
${scripts}
|
|
37
|
-
</body>
|
|
38
|
-
|
|
39
|
-
</html>`;
|
|
40
|
-
popupWin?.document.open();
|
|
41
|
-
popupWin?.document.write(data);
|
|
42
|
-
popupWin?.document.close();
|
|
43
|
-
popupWin?.focus();
|
|
44
|
-
popupWin?.addEventListener('focus', () => {
|
|
45
|
-
setTimeout(() => {
|
|
46
|
-
if (popupWin.document.hasFocus()) {
|
|
47
|
-
popupWin.print();
|
|
48
|
-
popupWin.close();
|
|
49
|
-
}
|
|
50
|
-
}, 1000);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private getElementTag(tag: keyof HTMLElementTagNameMap): string {
|
|
55
|
-
const html: string[] = [];
|
|
56
|
-
const elements = document.getElementsByTagName(tag);
|
|
57
|
-
for (let index = 0; index < elements.length; index++) {
|
|
58
|
-
html.push(elements[index].outerHTML);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return html.join('\r\n');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
File without changes
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Component, AfterViewInit, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'ipa-share-button',
|
|
5
|
-
templateUrl: './share-button.component.html',
|
|
6
|
-
styleUrls: ['./share-button.component.scss'],
|
|
7
|
-
})
|
|
8
|
-
export class ShareButtonComponent implements AfterViewInit {
|
|
9
|
-
@Input() title = '';
|
|
10
|
-
@Input() description = '';
|
|
11
|
-
@Input() btnLabel = '';
|
|
12
|
-
constructor() {}
|
|
13
|
-
ngAfterViewInit(): void {
|
|
14
|
-
const elements = document.getElementsByClassName('sb-show-icon');
|
|
15
|
-
elements[0].setAttribute('type', 'button');
|
|
16
|
-
elements[0].setAttribute('id', 'IPAShareBtn');
|
|
17
|
-
const label = document.createElement('label');
|
|
18
|
-
label.innerHTML = this.btnLabel;
|
|
19
|
-
label.classList.add('sm-share-title');
|
|
20
|
-
label.classList.add('me-1');
|
|
21
|
-
elements[0].before(label);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { OverlayModule } from '@angular/cdk/overlay';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
FaIconLibrary,
|
|
5
|
-
FontAwesomeModule,
|
|
6
|
-
} from '@fortawesome/angular-fontawesome';
|
|
7
|
-
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
import { ShareIconsModule } from 'ngx-sharebuttons/icons';
|
|
9
|
-
import { ShareButtonsPopupModule } from 'ngx-sharebuttons/popup';
|
|
10
|
-
import { ShareButtonComponent } from './share-button.component';
|
|
11
|
-
|
|
12
|
-
@NgModule({
|
|
13
|
-
declarations: [ShareButtonComponent],
|
|
14
|
-
imports: [
|
|
15
|
-
ShareIconsModule,
|
|
16
|
-
ShareButtonsPopupModule,
|
|
17
|
-
OverlayModule,
|
|
18
|
-
FontAwesomeModule,
|
|
19
|
-
],
|
|
20
|
-
exports: [
|
|
21
|
-
ShareButtonComponent,
|
|
22
|
-
ShareIconsModule,
|
|
23
|
-
ShareButtonsPopupModule,
|
|
24
|
-
OverlayModule,
|
|
25
|
-
FontAwesomeModule,
|
|
26
|
-
]
|
|
27
|
-
})
|
|
28
|
-
export class ShareButtonModule {
|
|
29
|
-
constructor(library: FaIconLibrary) {
|
|
30
|
-
library.addIconPacks(fas);
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/test.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js';
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: {
|
|
12
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
13
|
-
keys(): string[];
|
|
14
|
-
<T>(id: string): T;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting()
|
|
22
|
-
);
|
|
23
|
-
// Then we find all the tests.
|
|
24
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
25
|
-
// And load the modules.
|
|
26
|
-
context.keys().map(context);
|
package/tsconfig.lib.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"target": "es2015",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"types": [],
|
|
11
|
-
"lib": [
|
|
12
|
-
"dom",
|
|
13
|
-
"es2018"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"exclude": [
|
|
17
|
-
"src/test.ts",
|
|
18
|
-
"**/*.spec.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|