@osovitny/anatoly 2.16.5 → 2.16.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/esm2022/lib/core/core.module.mjs +17 -15
- package/esm2022/lib/core/index.mjs +6 -3
- package/esm2022/lib/core/models/appcontext.service.mjs +17 -0
- package/esm2022/lib/core/services/appcontext.service.mjs +6 -2
- package/esm2022/lib/core/services/starter.service.mjs +76 -0
- package/fesm2022/osovitny-anatoly.mjs +273 -184
- package/fesm2022/osovitny-anatoly.mjs.map +1 -1
- package/lib/core/index.d.ts +4 -2
- package/lib/core/models/appcontext.service.d.ts +6 -0
- package/lib/core/services/appcontext.service.d.ts +1 -0
- package/lib/core/services/starter.service.d.ts +11 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, Rout
|
|
|
6
6
|
import * as i1$3 from '@angular/common/http';
|
|
7
7
|
import { HttpResponse, HttpClient } from '@angular/common/http';
|
|
8
8
|
import { tap, map } from 'rxjs/operators';
|
|
9
|
-
import { BehaviorSubject, Subject, timer, merge, fromEvent } from 'rxjs';
|
|
9
|
+
import { BehaviorSubject, Subject, timer, merge, fromEvent, of, forkJoin } from 'rxjs';
|
|
10
10
|
import { isValid, format, formatDistance, formatDistanceToNow } from 'date-fns';
|
|
11
11
|
import { utcToZonedTime } from 'date-fns-tz';
|
|
12
12
|
import enUS from 'date-fns/locale/en-US';
|
|
@@ -889,6 +889,22 @@ class GlobalErrorHandler {
|
|
|
889
889
|
type: Injectable
|
|
890
890
|
}], function () { return [{ type: i0.Injector }]; }, null); })();
|
|
891
891
|
|
|
892
|
+
/*
|
|
893
|
+
<file>
|
|
894
|
+
Project:
|
|
895
|
+
@osovitny/anatoly
|
|
896
|
+
|
|
897
|
+
Authors:
|
|
898
|
+
Vadim Osovitny vadim@osovitny.com
|
|
899
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
900
|
+
|
|
901
|
+
Created:
|
|
902
|
+
11 Nov 2023
|
|
903
|
+
|
|
904
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
905
|
+
</file>
|
|
906
|
+
*/
|
|
907
|
+
|
|
892
908
|
/*
|
|
893
909
|
<file>
|
|
894
910
|
Project:
|
|
@@ -1534,7 +1550,7 @@ class AppContextService extends BaseApiService {
|
|
|
1534
1550
|
this.http = http;
|
|
1535
1551
|
this.localStorage = localStorage;
|
|
1536
1552
|
this.sessionStorage = sessionStorage;
|
|
1537
|
-
this.baseUrl =
|
|
1553
|
+
this.baseUrl = `${AppCoreSettings.apiUrl}/appContext`;
|
|
1538
1554
|
}
|
|
1539
1555
|
//Session
|
|
1540
1556
|
getCurrentFromSession() {
|
|
@@ -1606,6 +1622,9 @@ class AppContextService extends BaseApiService {
|
|
|
1606
1622
|
});
|
|
1607
1623
|
}
|
|
1608
1624
|
//Public
|
|
1625
|
+
init(context) {
|
|
1626
|
+
this.current = context;
|
|
1627
|
+
}
|
|
1609
1628
|
getLatestCurrent(success = null) {
|
|
1610
1629
|
this.getCurrentPrivate(success, false);
|
|
1611
1630
|
}
|
|
@@ -1646,84 +1665,6 @@ class AppContextService extends BaseApiService {
|
|
|
1646
1665
|
type: Injectable
|
|
1647
1666
|
}], function () { return [{ type: i1$3.HttpClient }, { type: LocalStorageService }, { type: SessionStorageService }]; }, null); })();
|
|
1648
1667
|
|
|
1649
|
-
/*
|
|
1650
|
-
<file>
|
|
1651
|
-
Project:
|
|
1652
|
-
@osovitny/anatoly
|
|
1653
|
-
|
|
1654
|
-
Authors:
|
|
1655
|
-
Vadim Osovitny vadim@osovitny.com
|
|
1656
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
1657
|
-
|
|
1658
|
-
Created:
|
|
1659
|
-
26 Jun 2020
|
|
1660
|
-
|
|
1661
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
1662
|
-
</file>
|
|
1663
|
-
*/
|
|
1664
|
-
//Node
|
|
1665
|
-
class IdleService {
|
|
1666
|
-
idle$;
|
|
1667
|
-
timer$;
|
|
1668
|
-
idleSubscription;
|
|
1669
|
-
//Dates/Timeouts
|
|
1670
|
-
startDate;
|
|
1671
|
-
timeOutSeconds;
|
|
1672
|
-
timeOutMilliSeconds;
|
|
1673
|
-
expired$ = new Subject();
|
|
1674
|
-
//Private
|
|
1675
|
-
resetTimeCounters(timeOutSeconds) {
|
|
1676
|
-
this.timeOutSeconds = timeOutSeconds;
|
|
1677
|
-
this.timeOutMilliSeconds = timeOutSeconds * 1000;
|
|
1678
|
-
this.startDate = new Date();
|
|
1679
|
-
}
|
|
1680
|
-
startTimer() {
|
|
1681
|
-
this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe({
|
|
1682
|
-
next: (data) => {
|
|
1683
|
-
let nowDate = new Date();
|
|
1684
|
-
let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
|
|
1685
|
-
if (nowDate.getTime() >= exiredDate.getTime()) {
|
|
1686
|
-
//console.log("nowDate: " + nowDate);
|
|
1687
|
-
//console.log("exiredDate: " + exiredDate);
|
|
1688
|
-
this.expired$.next(true);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
}
|
|
1693
|
-
resetTimer() {
|
|
1694
|
-
this.startDate = new Date();
|
|
1695
|
-
}
|
|
1696
|
-
//Public
|
|
1697
|
-
startWatching(timeOutSeconds) {
|
|
1698
|
-
this.idle$ = merge(fromEvent(document, 'mousemove'), fromEvent(document, 'click'), fromEvent(document, 'mousedown'), fromEvent(document, 'keypress'), fromEvent(document, 'DOMMouseScroll'), fromEvent(document, 'mousewheel'), fromEvent(document, 'touchmove'), fromEvent(document, 'MSPointerMove'), fromEvent(window, 'mousemove'), fromEvent(window, 'resize'));
|
|
1699
|
-
this.resetTimeCounters(timeOutSeconds);
|
|
1700
|
-
this.idleSubscription = this.idle$.subscribe({
|
|
1701
|
-
next: (data) => {
|
|
1702
|
-
this.resetTimer();
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
this.startTimer();
|
|
1706
|
-
return this.expired$;
|
|
1707
|
-
}
|
|
1708
|
-
stopWatching() {
|
|
1709
|
-
this.timer$.unsubscribe();
|
|
1710
|
-
this.idleSubscription.unsubscribe();
|
|
1711
|
-
}
|
|
1712
|
-
restartIdleTimer(timeOutSeconds) {
|
|
1713
|
-
this.timer$.unsubscribe();
|
|
1714
|
-
this.resetTimeCounters(timeOutSeconds);
|
|
1715
|
-
this.startTimer();
|
|
1716
|
-
}
|
|
1717
|
-
static ɵfac = function IdleService_Factory(t) { return new (t || IdleService)(); };
|
|
1718
|
-
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IdleService, factory: IdleService.ɵfac, providedIn: 'root' });
|
|
1719
|
-
}
|
|
1720
|
-
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IdleService, [{
|
|
1721
|
-
type: Injectable,
|
|
1722
|
-
args: [{
|
|
1723
|
-
providedIn: 'root'
|
|
1724
|
-
}]
|
|
1725
|
-
}], null, null); })();
|
|
1726
|
-
|
|
1727
1668
|
/*
|
|
1728
1669
|
<file>
|
|
1729
1670
|
Project:
|
|
@@ -1843,6 +1784,247 @@ class GoogleAnalyticsService {
|
|
|
1843
1784
|
type: Injectable
|
|
1844
1785
|
}], function () { return [{ type: i1.Router }]; }, null); })();
|
|
1845
1786
|
|
|
1787
|
+
/*
|
|
1788
|
+
<file>
|
|
1789
|
+
Project:
|
|
1790
|
+
@osovitny/anatoly
|
|
1791
|
+
|
|
1792
|
+
Authors:
|
|
1793
|
+
Vadim Osovitny vadim@osovitny.com
|
|
1794
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
1795
|
+
|
|
1796
|
+
Created:
|
|
1797
|
+
26 Jun 2020
|
|
1798
|
+
|
|
1799
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
1800
|
+
</file>
|
|
1801
|
+
*/
|
|
1802
|
+
//Node
|
|
1803
|
+
class IdleService {
|
|
1804
|
+
idle$;
|
|
1805
|
+
timer$;
|
|
1806
|
+
idleSubscription;
|
|
1807
|
+
//Dates/Timeouts
|
|
1808
|
+
startDate;
|
|
1809
|
+
timeOutSeconds;
|
|
1810
|
+
timeOutMilliSeconds;
|
|
1811
|
+
expired$ = new Subject();
|
|
1812
|
+
//Private
|
|
1813
|
+
resetTimeCounters(timeOutSeconds) {
|
|
1814
|
+
this.timeOutSeconds = timeOutSeconds;
|
|
1815
|
+
this.timeOutMilliSeconds = timeOutSeconds * 1000;
|
|
1816
|
+
this.startDate = new Date();
|
|
1817
|
+
}
|
|
1818
|
+
startTimer() {
|
|
1819
|
+
this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe({
|
|
1820
|
+
next: (data) => {
|
|
1821
|
+
let nowDate = new Date();
|
|
1822
|
+
let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
|
|
1823
|
+
if (nowDate.getTime() >= exiredDate.getTime()) {
|
|
1824
|
+
//console.log("nowDate: " + nowDate);
|
|
1825
|
+
//console.log("exiredDate: " + exiredDate);
|
|
1826
|
+
this.expired$.next(true);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
resetTimer() {
|
|
1832
|
+
this.startDate = new Date();
|
|
1833
|
+
}
|
|
1834
|
+
//Public
|
|
1835
|
+
startWatching(timeOutSeconds) {
|
|
1836
|
+
this.idle$ = merge(fromEvent(document, 'mousemove'), fromEvent(document, 'click'), fromEvent(document, 'mousedown'), fromEvent(document, 'keypress'), fromEvent(document, 'DOMMouseScroll'), fromEvent(document, 'mousewheel'), fromEvent(document, 'touchmove'), fromEvent(document, 'MSPointerMove'), fromEvent(window, 'mousemove'), fromEvent(window, 'resize'));
|
|
1837
|
+
this.resetTimeCounters(timeOutSeconds);
|
|
1838
|
+
this.idleSubscription = this.idle$.subscribe({
|
|
1839
|
+
next: (data) => {
|
|
1840
|
+
this.resetTimer();
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
this.startTimer();
|
|
1844
|
+
return this.expired$;
|
|
1845
|
+
}
|
|
1846
|
+
stopWatching() {
|
|
1847
|
+
this.timer$.unsubscribe();
|
|
1848
|
+
this.idleSubscription.unsubscribe();
|
|
1849
|
+
}
|
|
1850
|
+
restartIdleTimer(timeOutSeconds) {
|
|
1851
|
+
this.timer$.unsubscribe();
|
|
1852
|
+
this.resetTimeCounters(timeOutSeconds);
|
|
1853
|
+
this.startTimer();
|
|
1854
|
+
}
|
|
1855
|
+
static ɵfac = function IdleService_Factory(t) { return new (t || IdleService)(); };
|
|
1856
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IdleService, factory: IdleService.ɵfac, providedIn: 'root' });
|
|
1857
|
+
}
|
|
1858
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IdleService, [{
|
|
1859
|
+
type: Injectable,
|
|
1860
|
+
args: [{
|
|
1861
|
+
providedIn: 'root'
|
|
1862
|
+
}]
|
|
1863
|
+
}], null, null); })();
|
|
1864
|
+
|
|
1865
|
+
/*
|
|
1866
|
+
<file>
|
|
1867
|
+
Project:
|
|
1868
|
+
@osovitny/anatoly
|
|
1869
|
+
|
|
1870
|
+
Authors:
|
|
1871
|
+
Vadim Osovitny vadim@osovitny.com
|
|
1872
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
1873
|
+
|
|
1874
|
+
Created:
|
|
1875
|
+
19 March 2020
|
|
1876
|
+
|
|
1877
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
1878
|
+
</file>
|
|
1879
|
+
*/
|
|
1880
|
+
class Utils {
|
|
1881
|
+
static idExistsInQS() {
|
|
1882
|
+
let id = Utils.getValueByNameInQS("id");
|
|
1883
|
+
if (id)
|
|
1884
|
+
return true;
|
|
1885
|
+
return false;
|
|
1886
|
+
}
|
|
1887
|
+
static getValueByNameInQS(name) {
|
|
1888
|
+
return Utils.getValueByName(location.search, name);
|
|
1889
|
+
}
|
|
1890
|
+
static getValueByName(url, name) {
|
|
1891
|
+
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
1892
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
|
1893
|
+
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
|
|
1894
|
+
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
1895
|
+
}
|
|
1896
|
+
static copyToClipBoard(event, val) {
|
|
1897
|
+
event.preventDefault();
|
|
1898
|
+
const selBox = document.createElement('textarea');
|
|
1899
|
+
selBox.style.position = 'fixed';
|
|
1900
|
+
selBox.style.left = '0';
|
|
1901
|
+
selBox.style.top = '0';
|
|
1902
|
+
selBox.style.opacity = '0';
|
|
1903
|
+
selBox.value = val;
|
|
1904
|
+
document.body.appendChild(selBox);
|
|
1905
|
+
selBox.focus();
|
|
1906
|
+
selBox.select();
|
|
1907
|
+
document.execCommand('copy');
|
|
1908
|
+
document.body.removeChild(selBox);
|
|
1909
|
+
}
|
|
1910
|
+
static downloadFile(name, url) {
|
|
1911
|
+
const link = document.createElement('a');
|
|
1912
|
+
link.download = name;
|
|
1913
|
+
link.href = url;
|
|
1914
|
+
link.click();
|
|
1915
|
+
}
|
|
1916
|
+
static downloadBlobFile(value, fileName) {
|
|
1917
|
+
const nav = window.navigator;
|
|
1918
|
+
if (nav.msSaveOrOpenBlob) {
|
|
1919
|
+
nav.msSaveOrOpenBlob(value, fileName);
|
|
1920
|
+
}
|
|
1921
|
+
else {
|
|
1922
|
+
const downloadURL = window.URL.createObjectURL(value);
|
|
1923
|
+
Utils.downloadFile(fileName, downloadURL);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
/*
|
|
1927
|
+
Author:
|
|
1928
|
+
https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
|
|
1929
|
+
*/
|
|
1930
|
+
static slugify(text, prefix = '', postfix = '') {
|
|
1931
|
+
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
|
|
1932
|
+
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
|
|
1933
|
+
const p = new RegExp(a.split('').join('|'), 'g');
|
|
1934
|
+
/*
|
|
1935
|
+
https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
|
|
1936
|
+
https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
|
|
1937
|
+
*/
|
|
1938
|
+
text = text.replace(/(<([^>]+)>)/gi, '');
|
|
1939
|
+
let result = text
|
|
1940
|
+
.toString()
|
|
1941
|
+
.toLowerCase()
|
|
1942
|
+
.replace(/\s+/g, '-') // Replace spaces with -
|
|
1943
|
+
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
|
|
1944
|
+
.replace(/&/g, '-and-') // Replace & with 'and'
|
|
1945
|
+
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
|
|
1946
|
+
.replace(/\-\-+/g, '-') // Replace multiple - with single -
|
|
1947
|
+
.replace(/^-+/, '') // Trim - from start of text
|
|
1948
|
+
.replace(/-+$/, ''); // Trim - from end of text
|
|
1949
|
+
return prefix + result + postfix;
|
|
1950
|
+
}
|
|
1951
|
+
static generateRandom(start, end) {
|
|
1952
|
+
return Math.floor(Math.random() * (end - start + 1)) + start;
|
|
1953
|
+
}
|
|
1954
|
+
static isObjectNullOrEmpty(obj) {
|
|
1955
|
+
return !obj || Object.keys(obj).length == 0;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
/*
|
|
1960
|
+
<file>
|
|
1961
|
+
Project:
|
|
1962
|
+
@osovitny/anatoly
|
|
1963
|
+
|
|
1964
|
+
Authors:
|
|
1965
|
+
Vadim Osovitny vadim@osovitny.com
|
|
1966
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
1967
|
+
|
|
1968
|
+
Created:
|
|
1969
|
+
15 Nov 2023
|
|
1970
|
+
|
|
1971
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
1972
|
+
</file>
|
|
1973
|
+
*/
|
|
1974
|
+
class StarterService extends BaseApiService {
|
|
1975
|
+
http;
|
|
1976
|
+
appContext;
|
|
1977
|
+
constructor(http, appContext) {
|
|
1978
|
+
super(http);
|
|
1979
|
+
this.http = http;
|
|
1980
|
+
this.appContext = appContext;
|
|
1981
|
+
}
|
|
1982
|
+
applicationStarting() {
|
|
1983
|
+
let context = this.appContext.current;
|
|
1984
|
+
if (!Utils.isObjectNullOrEmpty(context)) {
|
|
1985
|
+
this.appContext.init(context);
|
|
1986
|
+
return of(context);
|
|
1987
|
+
}
|
|
1988
|
+
//Log
|
|
1989
|
+
let stopwatch = new Stopwatch("applicationStarting");
|
|
1990
|
+
stopwatch.start();
|
|
1991
|
+
this.baseUrl = `${AppCoreSettings.apiUrl}/appContext`;
|
|
1992
|
+
return this.get('applicationStarting').pipe(map(data => {
|
|
1993
|
+
//Log
|
|
1994
|
+
stopwatch.stop();
|
|
1995
|
+
stopwatch.printElapsedAsMilliseconds();
|
|
1996
|
+
this.appContext.init(data);
|
|
1997
|
+
}));
|
|
1998
|
+
}
|
|
1999
|
+
ensureApplicationStarted() {
|
|
2000
|
+
//1. Application Starting
|
|
2001
|
+
let applicationStarting$ = this.applicationStarting();
|
|
2002
|
+
//2. Load json files
|
|
2003
|
+
let jsonFiles$ = this.appContext.loadRequiredJsonFiles();
|
|
2004
|
+
//3. Load required items, like settings
|
|
2005
|
+
let requiredItems$ = this.appContext.loadRequiredItems();
|
|
2006
|
+
//Tasks to execute
|
|
2007
|
+
let parallelTasks = [];
|
|
2008
|
+
if (jsonFiles$)
|
|
2009
|
+
parallelTasks.push(jsonFiles$);
|
|
2010
|
+
if (requiredItems$)
|
|
2011
|
+
parallelTasks.push(requiredItems$);
|
|
2012
|
+
let parallelTasks$ = merge(...parallelTasks);
|
|
2013
|
+
let tasks$ = forkJoin([applicationStarting$, parallelTasks$]);
|
|
2014
|
+
//VadimOS:
|
|
2015
|
+
//concat is NOT wokring here, no idea why. Just executing first task
|
|
2016
|
+
//let tasks$ = concat(applicationStarting$, parallelTasks$);
|
|
2017
|
+
//Log
|
|
2018
|
+
let stopwatch = new Stopwatch("ensureApplicationStarted");
|
|
2019
|
+
stopwatch.start();
|
|
2020
|
+
return tasks$.pipe(map(() => {
|
|
2021
|
+
//Log
|
|
2022
|
+
stopwatch.stop();
|
|
2023
|
+
stopwatch.printElapsedAsMilliseconds();
|
|
2024
|
+
}));
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
|
|
1846
2028
|
/*
|
|
1847
2029
|
<file>
|
|
1848
2030
|
Project:
|
|
@@ -2050,100 +2232,6 @@ class Subs {
|
|
|
2050
2232
|
}
|
|
2051
2233
|
}
|
|
2052
2234
|
|
|
2053
|
-
/*
|
|
2054
|
-
<file>
|
|
2055
|
-
Project:
|
|
2056
|
-
@osovitny/anatoly
|
|
2057
|
-
|
|
2058
|
-
Authors:
|
|
2059
|
-
Vadim Osovitny vadim@osovitny.com
|
|
2060
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
2061
|
-
|
|
2062
|
-
Created:
|
|
2063
|
-
19 March 2020
|
|
2064
|
-
|
|
2065
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2066
|
-
</file>
|
|
2067
|
-
*/
|
|
2068
|
-
class Utils {
|
|
2069
|
-
static idExistsInQS() {
|
|
2070
|
-
let id = Utils.getValueByNameInQS("id");
|
|
2071
|
-
if (id)
|
|
2072
|
-
return true;
|
|
2073
|
-
return false;
|
|
2074
|
-
}
|
|
2075
|
-
static getValueByNameInQS(name) {
|
|
2076
|
-
return Utils.getValueByName(location.search, name);
|
|
2077
|
-
}
|
|
2078
|
-
static getValueByName(url, name) {
|
|
2079
|
-
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
2080
|
-
// tslint:disable-next-line:one-variable-per-declaration
|
|
2081
|
-
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
|
|
2082
|
-
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
2083
|
-
}
|
|
2084
|
-
static copyToClipBoard(event, val) {
|
|
2085
|
-
event.preventDefault();
|
|
2086
|
-
const selBox = document.createElement('textarea');
|
|
2087
|
-
selBox.style.position = 'fixed';
|
|
2088
|
-
selBox.style.left = '0';
|
|
2089
|
-
selBox.style.top = '0';
|
|
2090
|
-
selBox.style.opacity = '0';
|
|
2091
|
-
selBox.value = val;
|
|
2092
|
-
document.body.appendChild(selBox);
|
|
2093
|
-
selBox.focus();
|
|
2094
|
-
selBox.select();
|
|
2095
|
-
document.execCommand('copy');
|
|
2096
|
-
document.body.removeChild(selBox);
|
|
2097
|
-
}
|
|
2098
|
-
static downloadFile(name, url) {
|
|
2099
|
-
const link = document.createElement('a');
|
|
2100
|
-
link.download = name;
|
|
2101
|
-
link.href = url;
|
|
2102
|
-
link.click();
|
|
2103
|
-
}
|
|
2104
|
-
static downloadBlobFile(value, fileName) {
|
|
2105
|
-
const nav = window.navigator;
|
|
2106
|
-
if (nav.msSaveOrOpenBlob) {
|
|
2107
|
-
nav.msSaveOrOpenBlob(value, fileName);
|
|
2108
|
-
}
|
|
2109
|
-
else {
|
|
2110
|
-
const downloadURL = window.URL.createObjectURL(value);
|
|
2111
|
-
Utils.downloadFile(fileName, downloadURL);
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
/*
|
|
2115
|
-
Author:
|
|
2116
|
-
https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
|
|
2117
|
-
*/
|
|
2118
|
-
static slugify(text, prefix = '', postfix = '') {
|
|
2119
|
-
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
|
|
2120
|
-
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
|
|
2121
|
-
const p = new RegExp(a.split('').join('|'), 'g');
|
|
2122
|
-
/*
|
|
2123
|
-
https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
|
|
2124
|
-
https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
|
|
2125
|
-
*/
|
|
2126
|
-
text = text.replace(/(<([^>]+)>)/gi, '');
|
|
2127
|
-
let result = text
|
|
2128
|
-
.toString()
|
|
2129
|
-
.toLowerCase()
|
|
2130
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
2131
|
-
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
|
|
2132
|
-
.replace(/&/g, '-and-') // Replace & with 'and'
|
|
2133
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
|
|
2134
|
-
.replace(/\-\-+/g, '-') // Replace multiple - with single -
|
|
2135
|
-
.replace(/^-+/, '') // Trim - from start of text
|
|
2136
|
-
.replace(/-+$/, ''); // Trim - from end of text
|
|
2137
|
-
return prefix + result + postfix;
|
|
2138
|
-
}
|
|
2139
|
-
static generateRandom(start, end) {
|
|
2140
|
-
return Math.floor(Math.random() * (end - start + 1)) + start;
|
|
2141
|
-
}
|
|
2142
|
-
static isObjectNullOrEmpty(obj) {
|
|
2143
|
-
return !obj || Object.keys(obj).length == 0;
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
2235
|
/*
|
|
2148
2236
|
<file>
|
|
2149
2237
|
Project:
|
|
@@ -5451,6 +5539,7 @@ class SafeHtmlPipe {
|
|
|
5451
5539
|
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
5452
5540
|
</file>
|
|
5453
5541
|
*/
|
|
5542
|
+
//Node
|
|
5454
5543
|
let InjectorInstance;
|
|
5455
5544
|
class AnatolyCoreModule {
|
|
5456
5545
|
injector;
|
|
@@ -5461,14 +5550,14 @@ class AnatolyCoreModule {
|
|
|
5461
5550
|
static ɵfac = function AnatolyCoreModule_Factory(t) { return new (t || AnatolyCoreModule)(i0.ɵɵinject(i0.Injector), i0.ɵɵinject(AnatolyCoreModule, 12)); };
|
|
5462
5551
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyCoreModule });
|
|
5463
5552
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
|
|
5464
|
-
LoggingService,
|
|
5465
|
-
NotificationService,
|
|
5466
5553
|
AppContextService,
|
|
5467
|
-
LoadingService,
|
|
5468
5554
|
DigitalMarketingService,
|
|
5469
5555
|
GoogleAnalyticsService,
|
|
5556
|
+
LoadingService,
|
|
5470
5557
|
LocalStorageService,
|
|
5471
|
-
SessionStorageService
|
|
5558
|
+
SessionStorageService,
|
|
5559
|
+
LoggingService,
|
|
5560
|
+
NotificationService
|
|
5472
5561
|
], imports: [CommonModule,
|
|
5473
5562
|
ToastrModule.forRoot(),
|
|
5474
5563
|
LocalizationSettingsModule,
|
|
@@ -5489,15 +5578,15 @@ class AnatolyCoreModule {
|
|
|
5489
5578
|
LocalizationModule,
|
|
5490
5579
|
],
|
|
5491
5580
|
providers: [
|
|
5492
|
-
LoggingService,
|
|
5493
|
-
NotificationService,
|
|
5494
5581
|
AppContextService,
|
|
5495
|
-
LoadingService,
|
|
5496
5582
|
DigitalMarketingService,
|
|
5497
5583
|
GoogleAnalyticsService,
|
|
5584
|
+
LoadingService,
|
|
5498
5585
|
LocalStorageService,
|
|
5499
|
-
SessionStorageService
|
|
5500
|
-
|
|
5586
|
+
SessionStorageService,
|
|
5587
|
+
LoggingService,
|
|
5588
|
+
NotificationService
|
|
5589
|
+
]
|
|
5501
5590
|
}]
|
|
5502
5591
|
}], function () { return [{ type: i0.Injector }, { type: AnatolyCoreModule, decorators: [{
|
|
5503
5592
|
type: Optional
|
|
@@ -5892,5 +5981,5 @@ class AnatolyModule {
|
|
|
5892
5981
|
* Generated bundle index. Do not edit.
|
|
5893
5982
|
*/
|
|
5894
5983
|
|
|
5895
|
-
export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyModule, AnatolyUIModule, AppContextService, AppCoreSettings, AppName, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, Guid, HoveringDirective, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, NotificationsApiService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, TranslateModuleAtRoot, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, XmlFormatter, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
|
|
5984
|
+
export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyModule, AnatolyUIModule, AppContextService, AppCoreSettings, AppName, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, Browser, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, GoogleAnalyticsService, Guid, HoveringDirective, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, NotificationsApiService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, StarterService, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, TranslateModuleAtRoot, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, XmlFormatter, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
|
|
5896
5985
|
//# sourceMappingURL=osovitny-anatoly.mjs.map
|