@osovitny/anatoly 2.0.27 → 2.0.29

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.
@@ -847,7 +847,9 @@
847
847
  }
848
848
  });
849
849
  var LocalizationSettingsModule = /** @class */ (function () {
850
- function LocalizationSettingsModule() {
850
+ function LocalizationSettingsModule(injector) {
851
+ this.injector = injector;
852
+ exports.LocalizationInjectorInstance = this.injector;
851
853
  }
852
854
  return LocalizationSettingsModule;
853
855
  }());
@@ -866,7 +868,10 @@
866
868
  ],
867
869
  exports: []
868
870
  },] }
869
- ];
871
+ ];
872
+ LocalizationSettingsModule.ctorParameters = function () { return [
873
+ { type: i0.Injector }
874
+ ]; };
870
875
 
871
876
  /*
872
877
  <file>
@@ -954,7 +959,7 @@
954
959
  Anatoly Osovitny
955
960
 
956
961
  Created:
957
- 13 Nov 2017
962
+ 2 July 2020
958
963
 
959
964
  Version:
960
965
  1.0
@@ -962,124 +967,165 @@
962
967
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
963
968
  </file>
964
969
  */
965
- var BaseApiService = /** @class */ (function () {
966
- function BaseApiService(http) {
967
- this.http = http;
968
- this.baseUrl = '';
970
+ var L10nUtils = /** @class */ (function () {
971
+ function L10nUtils() {
969
972
  }
970
- BaseApiService.prototype.serializeParams = function (data) {
971
- return data ? '?' + $.param(data) : '';
972
- };
973
- // api
974
- BaseApiService.prototype.get = function (action, data, responseType) {
975
- if (!responseType) {
976
- responseType = 'json';
977
- }
978
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
979
- return this.http
980
- .get(url, { responseType: responseType })
981
- .pipe(operators.map(function (res) { return res; }));
982
- };
983
- BaseApiService.prototype.post = function (action, data, responseType) {
984
- if (!responseType) {
985
- responseType = 'text';
986
- }
987
- var url = this.baseUrl + "/" + action;
988
- return this.http.post(url, data, { responseType: responseType });
989
- };
990
- BaseApiService.prototype.postQS = function (action, data, responseType) {
991
- if (!responseType) {
992
- responseType = 'text';
973
+ Object.defineProperty(L10nUtils, "localizationService", {
974
+ // @dynamic
975
+ get: function () {
976
+ var ns = exports.LocalizationInjectorInstance.get(LocalizationService);
977
+ return ns;
978
+ },
979
+ enumerable: false,
980
+ configurable: true
981
+ });
982
+ L10nUtils.getLocalizedValue = function (key, params, defaultKey) {
983
+ // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
984
+ // defaultKey definition:
985
+ // if key is empty and defaultKey is defined => get localization for defaultKey
986
+ // Example: cancel()
987
+ if (!key && defaultKey) {
988
+ return this.localizationService.getLocalizedValue(defaultKey);
993
989
  }
994
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
995
- return this.http.post(url, null, { responseType: responseType });
996
- };
997
- BaseApiService.prototype.delete = function (action, data, responseType) {
998
- if (!responseType) {
999
- responseType = 'text';
990
+ // VadimOS:
991
+ // if key is not empty value MUST be in localization table, othewise we will return key
992
+ if (key) {
993
+ var value = this.localizationService.getLocalizedValue(key, params);
994
+ return value;
1000
995
  }
1001
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
1002
- return this.http.delete(url, { responseType: responseType });
996
+ return key;
1003
997
  };
1004
- // gets
1005
- BaseApiService.prototype.getById = function (id) {
1006
- return this.get('getById', { id: id });
998
+ return L10nUtils;
999
+ }());
1000
+
1001
+ /*
1002
+ <file>
1003
+ Project:
1004
+ @osovitny/anatoly
1005
+
1006
+ Authors:
1007
+ Vadim Osovitny
1008
+ Anatoly Osovitny
1009
+
1010
+ Created:
1011
+ 3 March 2020
1012
+
1013
+ Version:
1014
+ 1.0
1015
+
1016
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1017
+ </file>
1018
+ */
1019
+ var Alerts = /** @class */ (function () {
1020
+ function Alerts() {
1021
+ }
1022
+ Alerts.success = function (text, params, title, successAction) {
1023
+ text = L10nUtils.getLocalizedValue(text, params, 'OperationSuccessFull');
1024
+ title = L10nUtils.getLocalizedValue(title, null, 'Success');
1025
+ Swal.fire({
1026
+ text: text,
1027
+ title: title,
1028
+ icon: 'success',
1029
+ confirmButtonText: L10nUtils.getLocalizedValue('Ok')
1030
+ })
1031
+ .then(function () {
1032
+ if (successAction) {
1033
+ successAction();
1034
+ }
1035
+ });
1007
1036
  };
1008
- BaseApiService.prototype.getAll = function (data) {
1009
- return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
1037
+ Alerts.info = function (text, params, title) {
1038
+ text = L10nUtils.getLocalizedValue(text, params);
1039
+ title = L10nUtils.getLocalizedValue(title, null, 'Info');
1040
+ Swal.fire({
1041
+ text: text,
1042
+ title: title,
1043
+ icon: 'info',
1044
+ confirmButtonText: L10nUtils.getLocalizedValue('Ok')
1045
+ });
1010
1046
  };
1011
- BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
1012
- if (!jsonUrl) {
1013
- jsonUrl = '/dist/jsons';
1014
- }
1015
- if (!jsonVersion) {
1016
- jsonVersion = '1.0';
1017
- }
1018
- var url = jsonUrl + '/' + fileName + '?' + jsonVersion;
1019
- return this.http.get(url).pipe(operators.map(function (res) { return res; }));
1047
+ Alerts.warning = function (text, params, title) {
1048
+ text = L10nUtils.getLocalizedValue(text, params);
1049
+ title = L10nUtils.getLocalizedValue(title, null, 'Warning');
1050
+ Swal.fire({
1051
+ text: text,
1052
+ title: title,
1053
+ icon: 'warning',
1054
+ confirmButtonText: L10nUtils.getLocalizedValue('Ok')
1055
+ });
1020
1056
  };
1021
- return BaseApiService;
1022
- }());
1023
- BaseApiService.decorators = [
1024
- { type: i0.Injectable }
1025
- ];
1026
- BaseApiService.ctorParameters = function () { return [
1027
- { type: i1.HttpClient }
1028
- ]; };
1029
-
1030
- var AppContextService = /** @class */ (function (_super) {
1031
- __extends(AppContextService, _super);
1032
- function AppContextService(http) {
1033
- var _this = _super.call(this, http) || this;
1034
- _this.http = http;
1035
- _this.current = null;
1036
- _this.successes = [];
1037
- _this.subscription = null;
1038
- _this.baseUrl = '/api/appContext';
1039
- return _this;
1040
- }
1041
- AppContextService.prototype.getCurrent = function (success) {
1042
- var _this = this;
1043
- if (typeof success == 'undefined') {
1044
- return;
1045
- }
1046
- if (this.current != null) {
1047
- success(this.current);
1048
- return;
1049
- }
1050
- this.successes.push(success);
1051
- if (this.subscription != null) {
1052
- return;
1053
- }
1054
- this.subscription = this.get('GetCurrentContext', null).subscribe(function (data) {
1055
- _this.dataReceived(data);
1056
- }, function (e) { });
1057
+ Alerts.error = function (text, params, title) {
1058
+ text = L10nUtils.getLocalizedValue(text, params, 'ErrorOccured');
1059
+ title = L10nUtils.getLocalizedValue(title, null, 'Error');
1060
+ Swal.fire({
1061
+ text: text,
1062
+ title: title,
1063
+ icon: 'error',
1064
+ confirmButtonText: L10nUtils.getLocalizedValue('Ok')
1065
+ });
1057
1066
  };
1058
- AppContextService.prototype.dataReceived = function (data) {
1059
- this.current = data;
1060
- for (var i = 0; i < this.successes.length; i++) {
1061
- var success = this.successes[i];
1062
- success(data);
1063
- }
1064
- this.successes = [];
1065
- this.subscription.unsubscribe();
1066
- this.subscription = null;
1067
- this.current = null;
1067
+ Alerts.cancel = function (text, params, title) {
1068
+ text = L10nUtils.getLocalizedValue(text, params, 'OperationCancelled');
1069
+ title = L10nUtils.getLocalizedValue(title, null, 'Cancelled');
1070
+ Swal.fire({
1071
+ text: text,
1072
+ title: title,
1073
+ icon: 'info'
1074
+ });
1068
1075
  };
1069
- AppContextService.prototype.isUserSignedIn = function () {
1070
- return ContextInitState.isUserSignedIn;
1076
+ Alerts.notImplemented = function () {
1077
+ this.warning('Not Implemented Yet');
1071
1078
  };
1072
- AppContextService.prototype.isUserAdmin = function () {
1073
- return ContextInitState.isUserAdmin;
1079
+ ;
1080
+ Alerts.areYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
1081
+ text = L10nUtils.getLocalizedValue(text);
1082
+ title = L10nUtils.getLocalizedValue(title, null, 'AreYouSure');
1083
+ confirmButtonText = L10nUtils.getLocalizedValue(confirmButtonText, null, 'AreYouSure-ConfirmButtonText');
1084
+ cancelButtonText = L10nUtils.getLocalizedValue(cancelButtonText, null, 'AreYouSure-CancelButtonText');
1085
+ Swal.fire({
1086
+ text: text,
1087
+ title: title,
1088
+ icon: 'warning',
1089
+ confirmButtonText: confirmButtonText,
1090
+ cancelButtonText: cancelButtonText,
1091
+ showCancelButton: true
1092
+ })
1093
+ .then(function (result) {
1094
+ if (result.value) {
1095
+ if (successAction) {
1096
+ successAction();
1097
+ }
1098
+ }
1099
+ // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
1100
+ else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
1101
+ if (cancelAction) {
1102
+ cancelAction();
1103
+ }
1104
+ }
1105
+ });
1074
1106
  };
1075
- return AppContextService;
1076
- }(BaseApiService));
1077
- AppContextService.decorators = [
1078
- { type: i0.Injectable }
1079
- ];
1080
- AppContextService.ctorParameters = function () { return [
1081
- { type: i1.HttpClient }
1082
- ]; };
1107
+ ;
1108
+ return Alerts;
1109
+ }());
1110
+
1111
+ /*
1112
+ <file>
1113
+ Project:
1114
+ @osovitny/anatoly
1115
+
1116
+ Authors:
1117
+ Vadim Osovitny
1118
+ Anatoly Osovitny
1119
+
1120
+ Created:
1121
+ 2 Jun 2020
1122
+
1123
+ Version:
1124
+ 1.0
1125
+
1126
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1127
+ </file>
1128
+ */
1083
1129
 
1084
1130
  /*
1085
1131
  <file>
@@ -1242,8 +1288,8 @@
1242
1288
  };
1243
1289
  NotificationService.prototype.success = function (text, params, title, createSessionNotification) {
1244
1290
  if (createSessionNotification === void 0) { createSessionNotification = true; }
1245
- text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
1246
- title = Utils.getLocalizedValue(title);
1291
+ text = L10nUtils.getLocalizedValue(text, params, 'OperationSuccessFull');
1292
+ title = L10nUtils.getLocalizedValue(title);
1247
1293
  this.toastrService.success(text, title, {
1248
1294
  timeOut: 3000,
1249
1295
  progressBar: true
@@ -1253,16 +1299,16 @@
1253
1299
  }
1254
1300
  };
1255
1301
  NotificationService.prototype.info = function (text, params, title) {
1256
- text = Utils.getLocalizedValue(text, params);
1257
- title = Utils.getLocalizedValue(title);
1302
+ text = L10nUtils.getLocalizedValue(text, params);
1303
+ title = L10nUtils.getLocalizedValue(title);
1258
1304
  this.toastrService.info(text, title, {
1259
1305
  timeOut: 3000,
1260
1306
  progressBar: true
1261
1307
  });
1262
1308
  };
1263
1309
  NotificationService.prototype.warning = function (text, params, title) {
1264
- text = Utils.getLocalizedValue(text, params);
1265
- title = Utils.getLocalizedValue(title);
1310
+ text = L10nUtils.getLocalizedValue(text, params);
1311
+ title = L10nUtils.getLocalizedValue(title);
1266
1312
  this.toastrService.warning(text, title, {
1267
1313
  timeOut: 3000,
1268
1314
  progressBar: true
@@ -1270,8 +1316,8 @@
1270
1316
  };
1271
1317
  NotificationService.prototype.error = function (text, params, title, createSessionNotification) {
1272
1318
  if (createSessionNotification === void 0) { createSessionNotification = true; }
1273
- text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
1274
- title = Utils.getLocalizedValue(title);
1319
+ text = L10nUtils.getLocalizedValue(text, params, 'ErrorOccured');
1320
+ title = L10nUtils.getLocalizedValue(title);
1275
1321
  this.toastrService.error(text, title, {
1276
1322
  timeOut: 3000,
1277
1323
  progressBar: true
@@ -1281,8 +1327,8 @@
1281
1327
  }
1282
1328
  };
1283
1329
  NotificationService.prototype.cancel = function (text, params, title) {
1284
- text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
1285
- title = Utils.getLocalizedValue(title);
1330
+ text = L10nUtils.getLocalizedValue(text, params, 'OperationCancelled');
1331
+ title = L10nUtils.getLocalizedValue(title);
1286
1332
  this.toastrService.info(text, title, {
1287
1333
  timeOut: 3000,
1288
1334
  progressBar: true
@@ -1320,31 +1366,6 @@
1320
1366
  { type: i1$2.ToastrService }
1321
1367
  ]; };
1322
1368
 
1323
- var AnatolyCoreModule = /** @class */ (function () {
1324
- function AnatolyCoreModule(injector, parentModule) {
1325
- this.injector = injector;
1326
- throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1327
- exports.InjectorInstance = this.injector;
1328
- }
1329
- return AnatolyCoreModule;
1330
- }());
1331
- AnatolyCoreModule.decorators = [
1332
- { type: i0.NgModule, args: [{
1333
- imports: [common.CommonModule],
1334
- exports: [],
1335
- providers: [
1336
- LoggingService,
1337
- NotificationService,
1338
- AppContextService,
1339
- LoadingService
1340
- ],
1341
- },] }
1342
- ];
1343
- AnatolyCoreModule.ctorParameters = function () { return [
1344
- { type: i0.Injector },
1345
- { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1346
- ]; };
1347
-
1348
1369
  /*
1349
1370
  <file>
1350
1371
  Project:
@@ -1355,7 +1376,7 @@
1355
1376
  Anatoly Osovitny
1356
1377
 
1357
1378
  Created:
1358
- 19 March 2020
1379
+ 13 Nov 2017
1359
1380
 
1360
1381
  Version:
1361
1382
  1.0
@@ -1363,204 +1384,120 @@
1363
1384
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1364
1385
  </file>
1365
1386
  */
1366
- var Utils = /** @class */ (function () {
1367
- function Utils() {
1387
+ var BaseApiService = /** @class */ (function () {
1388
+ function BaseApiService(http) {
1389
+ this.http = http;
1390
+ this.baseUrl = '';
1368
1391
  }
1369
- Utils.getValueByNameInQS = function (name) {
1370
- return Utils.getValueByName(location.search, name);
1371
- };
1372
- Utils.getValueByName = function (url, name) {
1373
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1374
- // tslint:disable-next-line:one-variable-per-declaration
1375
- var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1376
- return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1377
- };
1378
- Utils.copyToClipBoard = function (event, val) {
1379
- event.preventDefault();
1380
- var selBox = document.createElement('textarea');
1381
- selBox.style.position = 'fixed';
1382
- selBox.style.left = '0';
1383
- selBox.style.top = '0';
1384
- selBox.style.opacity = '0';
1385
- selBox.value = val;
1386
- document.body.appendChild(selBox);
1387
- selBox.focus();
1388
- selBox.select();
1389
- document.execCommand('copy');
1390
- document.body.removeChild(selBox);
1391
- };
1392
- Utils.downloadFile = function (name, url) {
1393
- var link = document.createElement('a');
1394
- link.download = name;
1395
- link.href = url;
1396
- link.click();
1392
+ BaseApiService.prototype.serializeParams = function (data) {
1393
+ return data ? '?' + $.param(data) : '';
1397
1394
  };
1398
- Object.defineProperty(Utils, "localizationService", {
1399
- // Localization
1400
- // @dynamic
1401
- get: function () {
1402
- var ns = exports.InjectorInstance.get(LocalizationService);
1403
- return ns;
1404
- },
1405
- enumerable: false,
1406
- configurable: true
1407
- });
1408
- Utils.getLocalizedValue = function (key, params, defaultKey) {
1409
- // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
1410
- // defaultKey definition:
1411
- // if key is empty and defaultKey is defined => get localization for defaultKey
1412
- // Example: cancel()
1413
- if (!key && defaultKey) {
1414
- return this.localizationService.getLocalizedValue(defaultKey);
1395
+ // api
1396
+ BaseApiService.prototype.get = function (action, data, responseType) {
1397
+ if (!responseType) {
1398
+ responseType = 'json';
1415
1399
  }
1416
- // VadimOS:
1417
- // if key is not empty value MUST be in localization table, othewise we will return key
1418
- if (key) {
1419
- var value = this.localizationService.getLocalizedValue(key, params);
1420
- return value;
1400
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
1401
+ return this.http
1402
+ .get(url, { responseType: responseType })
1403
+ .pipe(operators.map(function (res) { return res; }));
1404
+ };
1405
+ BaseApiService.prototype.post = function (action, data, responseType) {
1406
+ if (!responseType) {
1407
+ responseType = 'text';
1421
1408
  }
1422
- return key;
1409
+ var url = this.baseUrl + "/" + action;
1410
+ return this.http.post(url, data, { responseType: responseType });
1423
1411
  };
1424
- Utils.downloadBlobFile = function (value, fileName) {
1425
- if (window.navigator.msSaveOrOpenBlob) {
1426
- window.navigator.msSaveOrOpenBlob(value, fileName);
1412
+ BaseApiService.prototype.postQS = function (action, data, responseType) {
1413
+ if (!responseType) {
1414
+ responseType = 'text';
1427
1415
  }
1428
- else {
1429
- var downloadURL = window.URL.createObjectURL(value);
1430
- Utils.downloadFile(fileName, downloadURL);
1416
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
1417
+ return this.http.post(url, null, { responseType: responseType });
1418
+ };
1419
+ BaseApiService.prototype.delete = function (action, data, responseType) {
1420
+ if (!responseType) {
1421
+ responseType = 'text';
1431
1422
  }
1423
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
1424
+ return this.http.delete(url, { responseType: responseType });
1432
1425
  };
1433
- return Utils;
1434
- }());
1435
-
1436
- /*
1437
- <file>
1438
- Project:
1439
- @osovitny/anatoly
1440
-
1441
- Authors:
1442
- Vadim Osovitny
1443
- Anatoly Osovitny
1444
-
1445
- Created:
1446
- 3 March 2020
1447
-
1448
- Version:
1449
- 1.0
1450
-
1451
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1452
- </file>
1453
- */
1454
- var Alerts = /** @class */ (function () {
1455
- function Alerts() {
1456
- }
1457
- Alerts.success = function (text, params, title, successAction) {
1458
- text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
1459
- title = Utils.getLocalizedValue(title, null, 'Success');
1460
- Swal.fire({
1461
- text: text,
1462
- title: title,
1463
- icon: 'success',
1464
- confirmButtonText: Utils.getLocalizedValue('Ok')
1465
- })
1466
- .then(function () {
1467
- if (successAction) {
1468
- successAction();
1469
- }
1470
- });
1426
+ // gets
1427
+ BaseApiService.prototype.getById = function (id) {
1428
+ return this.get('getById', { id: id });
1471
1429
  };
1472
- Alerts.info = function (text, params, title) {
1473
- text = Utils.getLocalizedValue(text, params);
1474
- title = Utils.getLocalizedValue(title, null, 'Info');
1475
- Swal.fire({
1476
- text: text,
1477
- title: title,
1478
- icon: 'info',
1479
- confirmButtonText: Utils.getLocalizedValue('Ok')
1480
- });
1430
+ BaseApiService.prototype.getAll = function (data) {
1431
+ return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
1481
1432
  };
1482
- Alerts.warning = function (text, params, title) {
1483
- text = Utils.getLocalizedValue(text, params);
1484
- title = Utils.getLocalizedValue(title, null, 'Warning');
1485
- Swal.fire({
1486
- text: text,
1487
- title: title,
1488
- icon: 'warning',
1489
- confirmButtonText: Utils.getLocalizedValue('Ok')
1490
- });
1433
+ BaseApiService.prototype.getJsonFile = function (fileName) {
1434
+ var jsonsUrl = AppCoreSettings.jsonsUrl;
1435
+ var jsonVersion = AppCoreSettings.jsonVersion;
1436
+ var url = jsonsUrl + '/' + fileName + '?' + jsonVersion;
1437
+ return this.http.get(url).pipe(operators.map(function (res) { return res; }));
1491
1438
  };
1492
- Alerts.error = function (text, params, title) {
1493
- text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
1494
- title = Utils.getLocalizedValue(title, null, 'Error');
1495
- Swal.fire({
1496
- text: text,
1497
- title: title,
1498
- icon: 'error',
1499
- confirmButtonText: Utils.getLocalizedValue('Ok')
1500
- });
1439
+ return BaseApiService;
1440
+ }());
1441
+ BaseApiService.decorators = [
1442
+ { type: i0.Injectable }
1443
+ ];
1444
+ BaseApiService.ctorParameters = function () { return [
1445
+ { type: i1.HttpClient }
1446
+ ]; };
1447
+
1448
+ var AppContextService = /** @class */ (function (_super) {
1449
+ __extends(AppContextService, _super);
1450
+ function AppContextService(http) {
1451
+ var _this = _super.call(this, http) || this;
1452
+ _this.http = http;
1453
+ _this.current = null;
1454
+ _this.successes = [];
1455
+ _this.subscription = null;
1456
+ _this.baseUrl = '/api/appContext';
1457
+ return _this;
1458
+ }
1459
+ AppContextService.prototype.getCurrent = function (success) {
1460
+ var _this = this;
1461
+ if (typeof success == 'undefined') {
1462
+ return;
1463
+ }
1464
+ if (this.current != null) {
1465
+ success(this.current);
1466
+ return;
1467
+ }
1468
+ this.successes.push(success);
1469
+ if (this.subscription != null) {
1470
+ return;
1471
+ }
1472
+ this.subscription = this.get('GetCurrentContext', null).subscribe(function (data) {
1473
+ _this.dataReceived(data);
1474
+ }, function (e) { });
1501
1475
  };
1502
- Alerts.cancel = function (text, params, title) {
1503
- text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
1504
- title = Utils.getLocalizedValue(title, null, 'Cancelled');
1505
- Swal.fire({
1506
- text: text,
1507
- title: title,
1508
- icon: 'info'
1509
- });
1476
+ AppContextService.prototype.dataReceived = function (data) {
1477
+ this.current = data;
1478
+ for (var i = 0; i < this.successes.length; i++) {
1479
+ var success = this.successes[i];
1480
+ success(data);
1481
+ }
1482
+ this.successes = [];
1483
+ this.subscription.unsubscribe();
1484
+ this.subscription = null;
1485
+ this.current = null;
1510
1486
  };
1511
- Alerts.notImplemented = function () {
1512
- this.warning('Not Implemented Yet');
1487
+ AppContextService.prototype.isUserSignedIn = function () {
1488
+ return ContextInitState.isUserSignedIn;
1513
1489
  };
1514
- ;
1515
- Alerts.areYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
1516
- text = Utils.getLocalizedValue(text);
1517
- title = Utils.getLocalizedValue(title, null, 'AreYouSure');
1518
- confirmButtonText = Utils.getLocalizedValue(confirmButtonText, null, 'AreYouSure-ConfirmButtonText');
1519
- cancelButtonText = Utils.getLocalizedValue(cancelButtonText, null, 'AreYouSure-CancelButtonText');
1520
- Swal.fire({
1521
- text: text,
1522
- title: title,
1523
- icon: 'warning',
1524
- confirmButtonText: confirmButtonText,
1525
- cancelButtonText: cancelButtonText,
1526
- showCancelButton: true
1527
- })
1528
- .then(function (result) {
1529
- if (result.value) {
1530
- if (successAction) {
1531
- successAction();
1532
- }
1533
- }
1534
- // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
1535
- else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
1536
- if (cancelAction) {
1537
- cancelAction();
1538
- }
1539
- }
1540
- });
1490
+ AppContextService.prototype.isUserAdmin = function () {
1491
+ return ContextInitState.isUserAdmin;
1541
1492
  };
1542
- ;
1543
- return Alerts;
1544
- }());
1545
-
1546
- /*
1547
- <file>
1548
- Project:
1549
- @osovitny/anatoly
1550
-
1551
- Authors:
1552
- Vadim Osovitny
1553
- Anatoly Osovitny
1554
-
1555
- Created:
1556
- 2 Jun 2020
1557
-
1558
- Version:
1559
- 1.0
1560
-
1561
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1562
- </file>
1563
- */
1493
+ return AppContextService;
1494
+ }(BaseApiService));
1495
+ AppContextService.decorators = [
1496
+ { type: i0.Injectable }
1497
+ ];
1498
+ AppContextService.ctorParameters = function () { return [
1499
+ { type: i1.HttpClient }
1500
+ ]; };
1564
1501
 
1565
1502
  /*
1566
1503
  <file>
@@ -1674,6 +1611,31 @@
1674
1611
  ];
1675
1612
  SessionStorageService.ctorParameters = function () { return []; };
1676
1613
 
1614
+ var AnatolyCoreModule = /** @class */ (function () {
1615
+ function AnatolyCoreModule(injector, parentModule) {
1616
+ this.injector = injector;
1617
+ throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1618
+ exports.InjectorInstance = this.injector;
1619
+ }
1620
+ return AnatolyCoreModule;
1621
+ }());
1622
+ AnatolyCoreModule.decorators = [
1623
+ { type: i0.NgModule, args: [{
1624
+ imports: [common.CommonModule],
1625
+ exports: [],
1626
+ providers: [
1627
+ LoggingService,
1628
+ NotificationService,
1629
+ AppContextService,
1630
+ LoadingService
1631
+ ],
1632
+ },] }
1633
+ ];
1634
+ AnatolyCoreModule.ctorParameters = function () { return [
1635
+ { type: i0.Injector },
1636
+ { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1637
+ ]; };
1638
+
1677
1639
  /*
1678
1640
  <file>
1679
1641
  Project:
@@ -1717,6 +1679,68 @@
1717
1679
  return Subs;
1718
1680
  }());
1719
1681
 
1682
+ /*
1683
+ <file>
1684
+ Project:
1685
+ @osovitny/anatoly
1686
+
1687
+ Authors:
1688
+ Vadim Osovitny
1689
+ Anatoly Osovitny
1690
+
1691
+ Created:
1692
+ 19 March 2020
1693
+
1694
+ Version:
1695
+ 1.0
1696
+
1697
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1698
+ </file>
1699
+ */
1700
+ var Utils = /** @class */ (function () {
1701
+ function Utils() {
1702
+ }
1703
+ Utils.getValueByNameInQS = function (name) {
1704
+ return Utils.getValueByName(location.search, name);
1705
+ };
1706
+ Utils.getValueByName = function (url, name) {
1707
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1708
+ // tslint:disable-next-line:one-variable-per-declaration
1709
+ var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1710
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1711
+ };
1712
+ Utils.copyToClipBoard = function (event, val) {
1713
+ event.preventDefault();
1714
+ var selBox = document.createElement('textarea');
1715
+ selBox.style.position = 'fixed';
1716
+ selBox.style.left = '0';
1717
+ selBox.style.top = '0';
1718
+ selBox.style.opacity = '0';
1719
+ selBox.value = val;
1720
+ document.body.appendChild(selBox);
1721
+ selBox.focus();
1722
+ selBox.select();
1723
+ document.execCommand('copy');
1724
+ document.body.removeChild(selBox);
1725
+ };
1726
+ Utils.downloadFile = function (name, url) {
1727
+ var link = document.createElement('a');
1728
+ link.download = name;
1729
+ link.href = url;
1730
+ link.click();
1731
+ };
1732
+ Utils.downloadBlobFile = function (value, fileName) {
1733
+ if (window.navigator.msSaveOrOpenBlob) {
1734
+ window.navigator.msSaveOrOpenBlob(value, fileName);
1735
+ }
1736
+ else {
1737
+ var downloadURL = window.URL.createObjectURL(value);
1738
+ Utils.downloadFile(fileName, downloadURL);
1739
+ }
1740
+ };
1741
+ return Utils;
1742
+ }());
1743
+
1720
1744
  var BaseGridReadService = /** @class */ (function (_super) {
1721
1745
  __extends(BaseGridReadService, _super);
1722
1746
  function BaseGridReadService(http) {