ng-ipa-library 6.1.10 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,13 +21,13 @@ export * from '@ng-select/ng-select';
21
21
  import * as i4 from '@angular/cdk/overlay';
22
22
  import { OverlayModule } from '@angular/cdk/overlay';
23
23
  import { BehaviorSubject, Observable, throwError } from 'rxjs';
24
- import * as i1$2 from '@fortawesome/angular-fontawesome';
24
+ import * as i1$1 from '@fortawesome/angular-fontawesome';
25
25
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
26
26
  import { fas } from '@fortawesome/free-solid-svg-icons';
27
27
  import { ShareIconsModule } from 'ngx-sharebuttons/icons';
28
- import * as i1$1 from 'ngx-sharebuttons/popup';
28
+ import * as i2$4 from 'ngx-sharebuttons/popup';
29
29
  import { ShareButtonsPopupModule } from 'ngx-sharebuttons/popup';
30
- import * as i2$4 from '@angular/common/http';
30
+ import * as i2$5 from '@angular/common/http';
31
31
  import { HttpResponse } from '@angular/common/http';
32
32
  import { catchError } from 'rxjs/operators';
33
33
 
@@ -1245,46 +1245,126 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1245
1245
  ], standalone: false, template: "<div class=\"form-floating input-group {{containerClasses}}\">\r\n <input id=\"{{id}}\"\r\n [ngClass]=\"{'is-invalid is-invalid:focus': (controlDir.control?.invalid && (controlDir.control?.dirty || controlDir.control?.touched)) && errorMsg,'is-valid is-valid:focus': (controlDir.control?.valid && (controlDir.control?.dirty || controlDir.control?.touched) && (errorMsg || controlDir.value))}\"\r\n class=\"form-control {{classes}}\" [formControl]=\"formControl\" [firstDayOfWeek]=\"7\" ngbDatepicker #d=\"ngbDatepicker\"\r\n [maxDate]=\"maxDate\" [minDate]=\"minDate\" [footerTemplate]=\"footerTemplate\" [required]=\"required\"\r\n style=\"outline: unset; z-index: unset !important;\" autocomplete=\"off\" (blur)=\"onTouched()\" placeholder=\"{{label}}\">\r\n <label for=\"{{id}}\"><span *ngIf=\"required\" class=\"text-danger\">*</span> {{label}} </label>\r\n <span class=\"input-group-text calenderBtn\" (click)=\"openDatepicker($event)\">\r\n <i class=\"far fa-calendar-alt fa-lg\"></i>\r\n </span>\r\n <div class=\"invalid-feedback\" *ngIf=\"errorMessage !== null\">\r\n {{errorMsg}}\r\n </div>\r\n <ng-template #footerTemplate style=\"text-align: center;\">\r\n <hr>\r\n <button type=\"button\" class=\"btn btn-primary btn-sm m-2 \" style=\"width: auto; float: right;\"\r\n (click)=\"formControl.patchValue(today);d.navigateTo(today);d.close()\">\u0627\u0644\u064A\u0648\u0645</button>\r\n <button type=\"button\" class=\"btn btn-secondary btn-sm m-2\" style=\"width: auto; float: left;\"\r\n (click)=\"formControl.patchValue(null);d.close()\">\u0645\u0633\u062D</button>\r\n </ng-template>\r\n</div>\r\n", styles: [".calenderBtn{cursor:pointer;background-color:transparent;color:#6c757d;border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.calenderBtn:hover{color:#fff;background-color:#6c757d;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
1246
1246
  }] });
1247
1247
 
1248
+ class CommonService {
1249
+ constructor(toastrService) {
1250
+ this.toastrService = toastrService;
1251
+ }
1252
+ copyToClipboard(copyText, message) {
1253
+ navigator.clipboard.writeText(copyText.toString());
1254
+ this.toastrService.success(message, '', {
1255
+ positionClass: 'toast-bottom-right',
1256
+ });
1257
+ }
1258
+ print(element, title, classes) {
1259
+ const styles = this.getElementTag('style');
1260
+ const links = this.getElementTag('link');
1261
+ const scripts = this.getElementTag('script');
1262
+ const printContents = document.getElementById(element)?.innerHTML;
1263
+ const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
1264
+ const data = `
1265
+ <!DOCTYPE html>
1266
+ <head>
1267
+ <title> ${title} </title>
1268
+ <meta charset="utf-8">
1269
+ ${links}
1270
+ ${styles}
1271
+ <style>
1272
+ @media print {
1273
+ .noPrint{
1274
+ display: none !important;
1275
+ }
1276
+ body {
1277
+ direction: rtl;
1278
+ }
1279
+ }
1280
+ </style>
1281
+ </head>
1282
+ <body class="${classes}">
1283
+ ${printContents}
1284
+ ${scripts}
1285
+ </body>
1286
+
1287
+ </html>`;
1288
+ popupWin?.document.open();
1289
+ popupWin?.document.write(data);
1290
+ popupWin?.document.close();
1291
+ popupWin?.focus();
1292
+ popupWin?.addEventListener('focus', () => {
1293
+ setTimeout(() => {
1294
+ if (popupWin.document.hasFocus()) {
1295
+ popupWin.print();
1296
+ popupWin.close();
1297
+ }
1298
+ }, 1000);
1299
+ });
1300
+ }
1301
+ getElementTag(tag) {
1302
+ const html = [];
1303
+ const elements = document.getElementsByTagName(tag);
1304
+ for (let index = 0; index < elements.length; index++) {
1305
+ html.push(elements[index].outerHTML);
1306
+ }
1307
+ return html.join('\r\n');
1308
+ }
1309
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1310
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, providedIn: 'root' }); }
1311
+ }
1312
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, decorators: [{
1313
+ type: Injectable,
1314
+ args: [{
1315
+ providedIn: 'root',
1316
+ }]
1317
+ }], ctorParameters: () => [{ type: i1.ToastrService }] });
1318
+
1248
1319
  class ShareButtonComponent {
1249
- constructor() {
1320
+ constructor(commonService) {
1321
+ this.commonService = commonService;
1250
1322
  this.title = '';
1323
+ this.containerClasses = '';
1251
1324
  this.description = '';
1252
1325
  this.btnLabel = '';
1253
1326
  this.isPlatformCodeDesignSystem = false;
1254
1327
  }
1328
+ ngOnInit() {
1329
+ this.addShareStyleAndScript();
1330
+ }
1331
+ ngAfterViewChecked() {
1332
+ Shareon.init();
1333
+ }
1255
1334
  ngAfterViewInit() {
1256
1335
  const button = document.getElementsByClassName('sb-show-icon')[0];
1257
1336
  if (!button.getAttribute('id')) {
1258
- if (this.isPlatformCodeDesignSystem) {
1259
- button.setAttribute('type', 'button');
1260
- button.innerHTML = this.btnLabel;
1261
- button.classList.add('mb-2', 'tp-link');
1262
- const img = document.createElement('img');
1263
- img.src =
1264
- '/_catalogs/masterpage/ar-sa/CPS/assets/img/internal/share-08.svg';
1265
- img.classList.add('link-text-icon');
1266
- button.appendChild(img);
1267
- button.classList.remove('sb-show-icon', 'sb-wrapper');
1268
- button.removeAttribute('_ngcontent-ng-c3896670994');
1269
- }
1270
- else {
1271
- button.setAttribute('type', 'button');
1272
- button.setAttribute('id', 'IPAShareBtn');
1273
- const label = document.createElement('label');
1274
- label.innerHTML = this.btnLabel;
1275
- label.classList.add('sm-share-title');
1276
- label.classList.add('me-1');
1277
- button.before(label);
1278
- }
1337
+ button.setAttribute('type', 'button');
1338
+ button.setAttribute('id', 'IPAShareBtn');
1339
+ const label = document.createElement('label');
1340
+ label.innerHTML = this.btnLabel;
1341
+ label.classList.add('sm-share-title');
1342
+ label.classList.add('me-1');
1343
+ button.before(label);
1279
1344
  }
1280
1345
  }
1281
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1282
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: ShareButtonComponent, isStandalone: false, selector: "ipa-share-button", inputs: { title: "title", description: "description", btnLabel: "btnLabel", isPlatformCodeDesignSystem: "isPlatformCodeDesignSystem" }, ngImport: i0, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>", styles: [""], dependencies: [{ kind: "component", type: i1$1.SharePopupComponent, selector: "share-popup-button", inputs: ["theme", "icon", "text", "include", "exclude", "closeIcon", "url", "title", "description", "image", "tags", "autoSetMeta", "show", "showIcon", "showText", "disabled", "hasBackdrop", "backdropClass"], outputs: ["opened", "closed", "popupClosed"] }] }); }
1346
+ copyToClipboard() {
1347
+ this.commonService.copyToClipboard(window.location.href, 'تم نسخ الرابط إلى الحافظة');
1348
+ }
1349
+ addShareStyleAndScript() {
1350
+ const style = document.createElement('link');
1351
+ style.rel = 'stylesheet';
1352
+ style.href = 'https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.min.css';
1353
+ document.head.appendChild(style);
1354
+ const script = document.createElement('script');
1355
+ script.type = 'text/javascript';
1356
+ script.src = 'https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.iife.js';
1357
+ document.head.appendChild(script);
1358
+ }
1359
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonComponent, deps: [{ token: CommonService }], target: i0.ɵɵFactoryTarget.Component }); }
1360
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: ShareButtonComponent, isStandalone: false, selector: "ipa-share-button", inputs: { title: "title", containerClasses: "containerClasses", description: "description", btnLabel: "btnLabel", isPlatformCodeDesignSystem: "isPlatformCodeDesignSystem" }, ngImport: i0, template: "@if (!isPlatformCodeDesignSystem) {\r\n<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>\r\n}@else{\r\n<div class=\"dropdown {{containerClasses}}\">\r\n <button class=\"tp-link \" type=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\" [title]=\"title\">\r\n {{btnLabel}}\r\n <img src=\"/_catalogs/masterpage/ar-sa/CPS/assets/img/internal/share-08.svg\">\r\n </button>\r\n <div id=\"share\" class=\"dropdown-menu shareon\" style=\"width: max-content\">\r\n <a class=\"twitter\"></a>\r\n <a class=\"whatsapp\"></a>\r\n <a class=\"facebook\"></a>\r\n <a class=\"linkedin\"></a>\r\n <a class=\"telegram\"></a>\r\n <a class=\"copy\" (click)=\"copyToClipboard()\"></a>\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "component", type: i2$4.SharePopupComponent, selector: "share-popup-button", inputs: ["theme", "icon", "text", "include", "exclude", "closeIcon", "url", "title", "description", "image", "tags", "autoSetMeta", "show", "showIcon", "showText", "disabled", "hasBackdrop", "backdropClass"], outputs: ["opened", "closed", "popupClosed"] }] }); }
1283
1361
  }
1284
1362
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonComponent, decorators: [{
1285
1363
  type: Component,
1286
- args: [{ selector: 'ipa-share-button', standalone: false, template: "<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>" }]
1287
- }], ctorParameters: () => [], propDecorators: { title: [{
1364
+ args: [{ selector: 'ipa-share-button', standalone: false, template: "@if (!isPlatformCodeDesignSystem) {\r\n<share-popup-button [title]=\"title\" [description]=\"description\" [icon]=\"'share-alt'\"\r\n [include]=\"['facebook','twitter','linkedin','telegram','whatsapp','copy']\">\r\n</share-popup-button>\r\n}@else{\r\n<div class=\"dropdown {{containerClasses}}\">\r\n <button class=\"tp-link \" type=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\" [title]=\"title\">\r\n {{btnLabel}}\r\n <img src=\"/_catalogs/masterpage/ar-sa/CPS/assets/img/internal/share-08.svg\">\r\n </button>\r\n <div id=\"share\" class=\"dropdown-menu shareon\" style=\"width: max-content\">\r\n <a class=\"twitter\"></a>\r\n <a class=\"whatsapp\"></a>\r\n <a class=\"facebook\"></a>\r\n <a class=\"linkedin\"></a>\r\n <a class=\"telegram\"></a>\r\n <a class=\"copy\" (click)=\"copyToClipboard()\"></a>\r\n </div>\r\n</div>\r\n}" }]
1365
+ }], ctorParameters: () => [{ type: CommonService }], propDecorators: { title: [{
1366
+ type: Input
1367
+ }], containerClasses: [{
1288
1368
  type: Input
1289
1369
  }], description: [{
1290
1370
  type: Input
@@ -1298,7 +1378,7 @@ class ShareButtonModule {
1298
1378
  constructor(library) {
1299
1379
  library.addIconPacks(fas);
1300
1380
  }
1301
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonModule, deps: [{ token: i1$2.FaIconLibrary }], target: i0.ɵɵFactoryTarget.NgModule }); }
1381
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonModule, deps: [{ token: i1$1.FaIconLibrary }], target: i0.ɵɵFactoryTarget.NgModule }); }
1302
1382
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: ShareButtonModule, declarations: [ShareButtonComponent], imports: [ShareIconsModule,
1303
1383
  ShareButtonsPopupModule,
1304
1384
  OverlayModule,
@@ -1333,7 +1413,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1333
1413
  FontAwesomeModule,
1334
1414
  ]
1335
1415
  }]
1336
- }], ctorParameters: () => [{ type: i1$2.FaIconLibrary }] });
1416
+ }], ctorParameters: () => [{ type: i1$1.FaIconLibrary }] });
1337
1417
 
1338
1418
  class NgIPALibraryModule {
1339
1419
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgIPALibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -1474,77 +1554,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1474
1554
  type: Injectable
1475
1555
  }], ctorParameters: () => [{ type: LoaderService }] });
1476
1556
 
1477
- class CommonService {
1478
- constructor(toastrService) {
1479
- this.toastrService = toastrService;
1480
- }
1481
- copyToClipboard(copyText, message) {
1482
- navigator.clipboard.writeText(copyText.toString());
1483
- this.toastrService.success(message, '', {
1484
- positionClass: 'toast-bottom-right',
1485
- });
1486
- }
1487
- print(element, title, classes) {
1488
- const styles = this.getElementTag('style');
1489
- const links = this.getElementTag('link');
1490
- const scripts = this.getElementTag('script');
1491
- const printContents = document.getElementById(element)?.innerHTML;
1492
- const popupWin = window.open('', '', 'top=0,left=0,height=100%,width=auto');
1493
- const data = `
1494
- <!DOCTYPE html>
1495
- <head>
1496
- <title> ${title} </title>
1497
- <meta charset="utf-8">
1498
- ${links}
1499
- ${styles}
1500
- <style>
1501
- @media print {
1502
- .noPrint{
1503
- display: none !important;
1504
- }
1505
- body {
1506
- direction: rtl;
1507
- }
1508
- }
1509
- </style>
1510
- </head>
1511
- <body class="${classes}">
1512
- ${printContents}
1513
- ${scripts}
1514
- </body>
1515
-
1516
- </html>`;
1517
- popupWin?.document.open();
1518
- popupWin?.document.write(data);
1519
- popupWin?.document.close();
1520
- popupWin?.focus();
1521
- popupWin?.addEventListener('focus', () => {
1522
- setTimeout(() => {
1523
- if (popupWin.document.hasFocus()) {
1524
- popupWin.print();
1525
- popupWin.close();
1526
- }
1527
- }, 1000);
1528
- });
1529
- }
1530
- getElementTag(tag) {
1531
- const html = [];
1532
- const elements = document.getElementsByTagName(tag);
1533
- for (let index = 0; index < elements.length; index++) {
1534
- html.push(elements[index].outerHTML);
1535
- }
1536
- return html.join('\r\n');
1537
- }
1538
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, deps: [{ token: i1.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1539
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, providedIn: 'root' }); }
1540
- }
1541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: CommonService, decorators: [{
1542
- type: Injectable,
1543
- args: [{
1544
- providedIn: 'root',
1545
- }]
1546
- }], ctorParameters: () => [{ type: i1.ToastrService }] });
1547
-
1548
1557
  class ErrorService {
1549
1558
  constructor(toastrService, commonService) {
1550
1559
  this.toastrService = toastrService;
@@ -1795,12 +1804,12 @@ class TokenInterceptor {
1795
1804
  }
1796
1805
  return false;
1797
1806
  }
1798
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$4.HttpClient }, { token: LoaderService }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1807
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TokenInterceptor, deps: [{ token: AuthService }, { token: i2$5.HttpClient }, { token: LoaderService }, { token: TokenService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1799
1808
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TokenInterceptor }); }
1800
1809
  }
1801
1810
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TokenInterceptor, decorators: [{
1802
1811
  type: Injectable
1803
- }], ctorParameters: () => [{ type: AuthService }, { type: i2$4.HttpClient }, { type: LoaderService }, { type: TokenService }] });
1812
+ }], ctorParameters: () => [{ type: AuthService }, { type: i2$5.HttpClient }, { type: LoaderService }, { type: TokenService }] });
1804
1813
 
1805
1814
  class myIPATokenInterceptor {
1806
1815
  constructor(authService, tokenService) {