@lenne.tech/ng-base 0.3.3 → 0.3.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/lenne.tech-ng-base-src-lib-base.umd.js +711 -736
- package/bundles/lenne.tech-ng-base-src-lib-base.umd.js.map +1 -1
- package/bundles/lenne.tech-ng-base.umd.js +711 -736
- package/bundles/lenne.tech-ng-base.umd.js.map +1 -1
- package/esm2015/lib/base/classes/helper.class.js +19 -1
- package/esm2015/lib/base/directives/match-height.directive.js +19 -14
- package/esm2015/lib/base/services/graphql.service.js +2 -2
- package/esm2015/lib/base/services/image.service.js +24 -38
- package/esm2015/lib/base/services/scroll.service.js +9 -30
- package/esm2015/src/lib/base/classes/helper.class.js +19 -1
- package/esm2015/src/lib/base/directives/match-height.directive.js +19 -14
- package/esm2015/src/lib/base/services/graphql.service.js +2 -2
- package/esm2015/src/lib/base/services/image.service.js +24 -38
- package/esm2015/src/lib/base/services/scroll.service.js +9 -30
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js +542 -555
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js.map +1 -1
- package/fesm2015/lenne.tech-ng-base.js +542 -555
- package/fesm2015/lenne.tech-ng-base.js.map +1 -1
- package/lib/base/classes/helper.class.d.ts +7 -0
- package/lib/base/directives/match-height.directive.d.ts +7 -7
- package/lib/base/services/image.service.d.ts +1 -2
- package/lib/base/services/scroll.service.d.ts +1 -2
- package/package.json +1 -1
- package/src/lib/base/classes/helper.class.d.ts +7 -0
- package/src/lib/base/directives/match-height.directive.d.ts +7 -7
- package/src/lib/base/lenne.tech-ng-base-src-lib-base.metadata.json +1 -1
- package/src/lib/base/services/image.service.d.ts +1 -2
- package/src/lib/base/services/scroll.service.d.ts +1 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('apollo-angular'), require('apollo-angular/http'), require('@angular/core'), require('rxjs'), require('@apollo/client/core'), require('@apollo/client/cache'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@angular/platform-browser'), require('@angular/router'), require('graphql'), require('rxjs/operators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@lenne.tech/ng-base/src/lib/base', ['exports', 'apollo-angular', 'apollo-angular/http', '@angular/core', 'rxjs', '@apollo/client/core', '@apollo/client/cache', '@apollo/client/link/ws', '@apollo/client/utilities', '@angular/platform-browser', '@angular/router', 'graphql', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lenne = global.lenne || {}, global.lenne.tech = global.lenne.tech || {}, global.lenne.tech["ng-base"] = global.lenne.tech["ng-base"] || {}, global.lenne.tech["ng-base"].src = global.lenne.tech["ng-base"].src || {}, global.lenne.tech["ng-base"].src.lib = global.lenne.tech["ng-base"].src.lib || {}, global.lenne.tech["ng-base"].src.lib.base = {}), global.i1$1, global.http, global.ng.core, global.rxjs, global.core, global.cache, global.ws, global.utilities, global.ng.platformBrowser, global.ng.router, global.graphql, global.rxjs.operators));
|
|
5
|
-
})(this, (function (exports, i1$1, http, i0, rxjs, core, cache, ws, utilities, i1, i1$2, graphql, operators) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('apollo-angular'), require('apollo-angular/http'), require('@angular/core'), require('rxjs'), require('@apollo/client/core'), require('@apollo/client/cache'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/router'), require('graphql'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@lenne.tech/ng-base/src/lib/base', ['exports', 'apollo-angular', 'apollo-angular/http', '@angular/core', 'rxjs', '@apollo/client/core', '@apollo/client/cache', '@apollo/client/link/ws', '@apollo/client/utilities', '@angular/common', '@angular/platform-browser', '@angular/router', 'graphql', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lenne = global.lenne || {}, global.lenne.tech = global.lenne.tech || {}, global.lenne.tech["ng-base"] = global.lenne.tech["ng-base"] || {}, global.lenne.tech["ng-base"].src = global.lenne.tech["ng-base"].src || {}, global.lenne.tech["ng-base"].src.lib = global.lenne.tech["ng-base"].src.lib || {}, global.lenne.tech["ng-base"].src.lib.base = {}), global.i1$1, global.http, global.ng.core, global.rxjs, global.core, global.cache, global.ws, global.utilities, global.ng.common, global.ng.platformBrowser, global.ng.router, global.graphql, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i1$1, http, i0, rxjs, core, cache, ws, utilities, common, i1, i1$2, graphql, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -787,804 +787,801 @@
|
|
|
787
787
|
};
|
|
788
788
|
|
|
789
789
|
/**
|
|
790
|
-
*
|
|
790
|
+
* Helper class
|
|
791
791
|
*/
|
|
792
|
-
var
|
|
793
|
-
function
|
|
792
|
+
var Helper = /** @class */ (function () {
|
|
793
|
+
function Helper() {
|
|
794
794
|
}
|
|
795
795
|
/**
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
* @param options
|
|
799
|
-
* @protected
|
|
796
|
+
* Simple filter function for plain objects
|
|
800
797
|
*/
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
var config = Object.assign({ doneFunnction: undefined, elements: document, regExp: undefined, timeout: undefined }, options);
|
|
805
|
-
return new Promise(function (resolve) {
|
|
806
|
-
var e_1, _b;
|
|
807
|
-
var _a;
|
|
808
|
-
// Init variables
|
|
809
|
-
var resolved = false;
|
|
810
|
-
var timeoutId;
|
|
811
|
-
// HTMLCollection to array
|
|
812
|
-
if (config.elements instanceof HTMLCollection) {
|
|
813
|
-
config.elements = Array.from(config.elements);
|
|
814
|
-
}
|
|
815
|
-
// Single element to array
|
|
816
|
-
if (!Array.isArray(config.elements)) {
|
|
817
|
-
config.elements = [config.elements];
|
|
818
|
-
}
|
|
819
|
-
// Init loading
|
|
820
|
-
var promises = [];
|
|
821
|
-
// Get all images
|
|
822
|
-
var images = [];
|
|
823
|
-
config.elements.forEach(function (element) {
|
|
824
|
-
images = images.concat(Array.from(element.getElementsByTagName('img')));
|
|
825
|
-
});
|
|
826
|
-
var _loop_1 = function (image) {
|
|
827
|
-
var src = image.getAttribute('src');
|
|
828
|
-
// Check if changes are necessary and possible
|
|
829
|
-
if ((image.complete && image.naturalHeight !== 0) || // already laoded
|
|
830
|
-
image.getAttribute('loading') !== 'lazy' || // loading attribute !== lazy
|
|
831
|
-
!src || // Image has no src
|
|
832
|
-
((_a = config.regExp) === null || _a === void 0 ? void 0 : _a.test(src)) // Test if src matches regular expression
|
|
833
|
-
) {
|
|
834
|
-
return "continue";
|
|
835
|
-
}
|
|
836
|
-
// Replace lazy loading image with immediately loading image
|
|
837
|
-
var newImage = document.createElement('img');
|
|
838
|
-
Array.from(image.attributes).forEach(function (attr) {
|
|
839
|
-
if (attr.name !== 'loading' && attr.name !== 'src') {
|
|
840
|
-
newImage.setAttribute(attr.name, attr.value);
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
image.replaceWith(newImage);
|
|
844
|
-
// Wait for laoding
|
|
845
|
-
promises.push(_this.loadImage(newImage, src));
|
|
846
|
-
};
|
|
798
|
+
Helper.filter = function (objects, filter) {
|
|
799
|
+
return ((objects === null || objects === void 0 ? void 0 : objects.filter(function (element) {
|
|
800
|
+
var e_1, _d, e_2, _e;
|
|
847
801
|
try {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
802
|
+
for (var _f = __values(Object.entries(filter)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
803
|
+
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
804
|
+
if (Array.isArray(element[key])) {
|
|
805
|
+
try {
|
|
806
|
+
for (var _j = (e_2 = void 0, __values(element[key])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
807
|
+
var item = _k.value;
|
|
808
|
+
if (!element[key].includs(value)) {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
814
|
+
finally {
|
|
815
|
+
try {
|
|
816
|
+
if (_k && !_k.done && (_e = _j.return)) _e.call(_j);
|
|
817
|
+
}
|
|
818
|
+
finally { if (e_2) throw e_2.error; }
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
else if (element[key] !== value) {
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
852
824
|
}
|
|
853
825
|
}
|
|
854
826
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
855
827
|
finally {
|
|
856
828
|
try {
|
|
857
|
-
if (
|
|
829
|
+
if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
|
|
858
830
|
}
|
|
859
831
|
finally { if (e_1) throw e_1.error; }
|
|
860
832
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
833
|
+
return true;
|
|
834
|
+
})) || []);
|
|
835
|
+
};
|
|
836
|
+
/**
|
|
837
|
+
* Convert to a url/uri conform string
|
|
838
|
+
* Only:
|
|
839
|
+
* - lower case
|
|
840
|
+
* - chars, numbers and hyphens
|
|
841
|
+
*/
|
|
842
|
+
Helper.urlString = function (str, options) {
|
|
843
|
+
if (options === void 0) { options = {}; }
|
|
844
|
+
// Config
|
|
845
|
+
var config = Object.assign({ allowAll: false }, options);
|
|
846
|
+
// To string
|
|
847
|
+
str = str + '';
|
|
848
|
+
// Trim
|
|
849
|
+
str = str.trim();
|
|
850
|
+
// Lower case
|
|
851
|
+
str = str.toLowerCase();
|
|
852
|
+
if (!config.allowAll) {
|
|
853
|
+
// Replace spaces
|
|
854
|
+
str = str.trim().replace(/\s+/g, '-');
|
|
855
|
+
// Replace some special chars
|
|
856
|
+
str = str.replace('ä', 'ae');
|
|
857
|
+
str = str.replace('ö', 'oe');
|
|
858
|
+
str = str.replace('ü', 'ue');
|
|
859
|
+
str = str.replace('ß', 'ss');
|
|
860
|
+
// Remove other special chars
|
|
861
|
+
str = str.replace(/[^a-zA-Z0-9-]/g, '');
|
|
862
|
+
}
|
|
863
|
+
// Return url conform string
|
|
864
|
+
return encodeURI(str);
|
|
865
|
+
};
|
|
866
|
+
/**
|
|
867
|
+
* Simple map function
|
|
868
|
+
*/
|
|
869
|
+
Helper.map = function (source, target, options) {
|
|
870
|
+
var e_3, _d;
|
|
871
|
+
if (options === void 0) { options = {}; }
|
|
872
|
+
// Set config
|
|
873
|
+
var config = Object.assign({ funcAllowed: false, dateStringToDate: true }, options);
|
|
874
|
+
// Check source
|
|
875
|
+
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
876
|
+
return target;
|
|
877
|
+
}
|
|
878
|
+
try {
|
|
879
|
+
// Update properties
|
|
880
|
+
for (var _e = __values(Object.keys(target)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
881
|
+
var key = _f.value;
|
|
882
|
+
if (source[key] !== undefined && (config.funcAllowed || typeof (source[key] !== 'function'))) {
|
|
883
|
+
if (typeof source[key] === 'string' && config.dateStringToDate) {
|
|
884
|
+
if (Array.isArray(config.dateStringToDate)) {
|
|
885
|
+
if (config.dateStringToDate.includes(key)) {
|
|
886
|
+
target[key] = Helper.parseDate(source[key]);
|
|
894
887
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
_b.label = 2;
|
|
900
|
-
case 2:
|
|
901
|
-
resolve(result);
|
|
902
|
-
return [2 /*return*/];
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
target[key] = Helper.parseDate(source[key]);
|
|
891
|
+
}
|
|
903
892
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
893
|
+
else {
|
|
894
|
+
target[key] = source[key];
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
900
|
+
finally {
|
|
901
|
+
try {
|
|
902
|
+
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
903
|
+
}
|
|
904
|
+
finally { if (e_3) throw e_3.error; }
|
|
905
|
+
}
|
|
906
|
+
// Return target
|
|
907
|
+
return target;
|
|
907
908
|
};
|
|
908
909
|
/**
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
* @param imageElement
|
|
912
|
-
* @param src
|
|
913
|
-
* @protected
|
|
910
|
+
* Create Object or Objects of specified type with specified data
|
|
914
911
|
*/
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
912
|
+
Helper.maps = function (data, targetClass) {
|
|
913
|
+
// Check data
|
|
914
|
+
if (!data || typeof data !== 'object') {
|
|
915
|
+
return undefined;
|
|
916
|
+
}
|
|
917
|
+
// Check array
|
|
918
|
+
if (!Array.isArray(data)) {
|
|
919
|
+
data = [data];
|
|
920
|
+
}
|
|
921
|
+
// Map
|
|
922
|
+
return data.map(function (item) {
|
|
923
|
+
return targetClass.map(item);
|
|
925
924
|
});
|
|
926
925
|
};
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Set same height (maximum) to different elements
|
|
938
|
-
*/
|
|
939
|
-
var MatchHeightDirective = /** @class */ (function () {
|
|
940
|
-
function MatchHeightDirective(el, imageService, zone) {
|
|
941
|
-
this.el = el;
|
|
942
|
-
this.imageService = imageService;
|
|
943
|
-
this.zone = zone;
|
|
944
|
-
this.loadLazyImages = true;
|
|
945
|
-
}
|
|
946
|
-
MatchHeightDirective.prototype.onResize = function () {
|
|
947
|
-
this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
|
|
926
|
+
/**
|
|
927
|
+
* Get plain parameter
|
|
928
|
+
*/
|
|
929
|
+
Helper.getPlainParameter = function (parameter) {
|
|
930
|
+
var _a, _b, _c;
|
|
931
|
+
if (!parameter) {
|
|
932
|
+
return parameter;
|
|
933
|
+
}
|
|
934
|
+
return (_c = (_b = (_a = parameter === null || parameter === void 0 ? void 0 : parameter.split('?')) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.split('#')) === null || _c === void 0 ? void 0 : _c.shift();
|
|
948
935
|
};
|
|
949
|
-
|
|
950
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Get ID of an url parameter
|
|
938
|
+
*/
|
|
939
|
+
Helper.getParameterId = function (parameter) {
|
|
940
|
+
var _a;
|
|
941
|
+
if (!parameter) {
|
|
942
|
+
return parameter;
|
|
943
|
+
}
|
|
944
|
+
return (_a = Helper.getPlainParameter(parameter)) === null || _a === void 0 ? void 0 : _a.split('-').pop();
|
|
951
945
|
};
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
var e_1, _a;
|
|
959
|
-
return __generator(this, function (_b) {
|
|
960
|
-
switch (_b.label) {
|
|
961
|
-
case 0:
|
|
962
|
-
if (!parent) {
|
|
963
|
-
return [2 /*return*/];
|
|
964
|
-
}
|
|
965
|
-
if (!Array.isArray(target)) {
|
|
966
|
-
classNames = [target];
|
|
967
|
-
}
|
|
968
|
-
else {
|
|
969
|
-
classNames = target;
|
|
970
|
-
}
|
|
971
|
-
_loop_1 = function (className) {
|
|
972
|
-
var children, itemHeights, maxHeight;
|
|
973
|
-
return __generator(this, function (_c) {
|
|
974
|
-
switch (_c.label) {
|
|
975
|
-
case 0:
|
|
976
|
-
children = parent.getElementsByClassName(className);
|
|
977
|
-
if (!children || children.length < 2) {
|
|
978
|
-
return [2 /*return*/, "continue"];
|
|
979
|
-
}
|
|
980
|
-
if (!this_1.loadLazyImages) return [3 /*break*/, 2];
|
|
981
|
-
return [4 /*yield*/, this_1.imageService.preLoadImages({ elements: children })];
|
|
982
|
-
case 1:
|
|
983
|
-
_c.sent();
|
|
984
|
-
_c.label = 2;
|
|
985
|
-
case 2:
|
|
986
|
-
// reset all children height
|
|
987
|
-
Array.from(children).forEach(function (element) {
|
|
988
|
-
element.style.height = 'initial';
|
|
989
|
-
});
|
|
990
|
-
itemHeights = Array.from(children).map(function (x) { return x.getBoundingClientRect().height; });
|
|
991
|
-
maxHeight = itemHeights.reduce(function (prev, curr) { return (curr > prev ? curr : prev); }, 0);
|
|
992
|
-
// update the child structureElements height to the tallest one
|
|
993
|
-
Array.from(children).forEach(function (element) { return (element.style.height = maxHeight + "px"); });
|
|
994
|
-
return [2 /*return*/];
|
|
995
|
-
}
|
|
996
|
-
});
|
|
997
|
-
};
|
|
998
|
-
this_1 = this;
|
|
999
|
-
_b.label = 1;
|
|
1000
|
-
case 1:
|
|
1001
|
-
_b.trys.push([1, 6, 7, 8]);
|
|
1002
|
-
classNames_1 = __values(classNames), classNames_1_1 = classNames_1.next();
|
|
1003
|
-
_b.label = 2;
|
|
1004
|
-
case 2:
|
|
1005
|
-
if (!!classNames_1_1.done) return [3 /*break*/, 5];
|
|
1006
|
-
className = classNames_1_1.value;
|
|
1007
|
-
return [5 /*yield**/, _loop_1(className)];
|
|
1008
|
-
case 3:
|
|
1009
|
-
_b.sent();
|
|
1010
|
-
_b.label = 4;
|
|
1011
|
-
case 4:
|
|
1012
|
-
classNames_1_1 = classNames_1.next();
|
|
1013
|
-
return [3 /*break*/, 2];
|
|
1014
|
-
case 5: return [3 /*break*/, 8];
|
|
1015
|
-
case 6:
|
|
1016
|
-
e_1_1 = _b.sent();
|
|
1017
|
-
e_1 = { error: e_1_1 };
|
|
1018
|
-
return [3 /*break*/, 8];
|
|
1019
|
-
case 7:
|
|
1020
|
-
try {
|
|
1021
|
-
if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
|
|
1022
|
-
}
|
|
1023
|
-
finally { if (e_1) throw e_1.error; }
|
|
1024
|
-
return [7 /*endfinally*/];
|
|
1025
|
-
case 8: return [2 /*return*/];
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
}); }, 1);
|
|
1029
|
-
};
|
|
1030
|
-
return MatchHeightDirective;
|
|
1031
|
-
}());
|
|
1032
|
-
MatchHeightDirective.decorators = [
|
|
1033
|
-
{ type: i0.Directive, args: [{
|
|
1034
|
-
selector: '[ltMatchHeight]',
|
|
1035
|
-
},] }
|
|
1036
|
-
];
|
|
1037
|
-
MatchHeightDirective.ctorParameters = function () { return [
|
|
1038
|
-
{ type: i0.ElementRef },
|
|
1039
|
-
{ type: ImageService },
|
|
1040
|
-
{ type: i0.NgZone }
|
|
1041
|
-
]; };
|
|
1042
|
-
MatchHeightDirective.propDecorators = {
|
|
1043
|
-
ltMatchHeight: [{ type: i0.Input }],
|
|
1044
|
-
loadLazyImages: [{ type: i0.Input }],
|
|
1045
|
-
onResize: [{ type: i0.HostListener, args: ['window:resize',] }]
|
|
1046
|
-
};
|
|
1047
|
-
|
|
1048
|
-
/**
|
|
1049
|
-
* Reszise detection
|
|
1050
|
-
* (inpsired by: https://stackblitz.com/edit/angular-resizable)
|
|
1051
|
-
*/
|
|
1052
|
-
var ResizableDirective = /** @class */ (function () {
|
|
1053
|
-
function ResizableDirective(el) {
|
|
1054
|
-
this.el = el;
|
|
1055
|
-
this.resizableGrabWidth = 8;
|
|
1056
|
-
this.resizableMinWidth = 10;
|
|
1057
|
-
this.dragging = false;
|
|
1058
|
-
}
|
|
1059
|
-
ResizableDirective.prototype.ngOnInit = function () {
|
|
1060
|
-
this.addListenerToDocument();
|
|
1061
|
-
this.addListenerToElement();
|
|
1062
|
-
};
|
|
1063
|
-
ResizableDirective.prototype.mouseMoveG = function (evt) {
|
|
1064
|
-
if (!this.dragging) {
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
this.newWidth(evt.clientX - this.el.nativeElement.offsetLeft);
|
|
1068
|
-
evt.stopPropagation();
|
|
1069
|
-
};
|
|
1070
|
-
ResizableDirective.prototype.newWidth = function (wid) {
|
|
1071
|
-
var result = Math.max(this.resizableMinWidth, wid);
|
|
1072
|
-
this.el.nativeElement.style.width = result + 'px';
|
|
1073
|
-
};
|
|
1074
|
-
ResizableDirective.prototype.mouseDown = function (evt) {
|
|
1075
|
-
if (this.inDragRegion(evt)) {
|
|
1076
|
-
this.dragging = true;
|
|
1077
|
-
this.preventGlobalMouseEvents();
|
|
1078
|
-
evt.stopPropagation();
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
ResizableDirective.prototype.restoreGlobalMouseEvents = function () {
|
|
1082
|
-
document.body.style['pointer-events'] = 'auto';
|
|
946
|
+
/**
|
|
947
|
+
* Delay
|
|
948
|
+
*/
|
|
949
|
+
Helper.delay = function (ms) {
|
|
950
|
+
var promise = new Promise(function (resolve) { return setTimeout(resolve, ms); });
|
|
951
|
+
return promise;
|
|
1083
952
|
};
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
953
|
+
/**
|
|
954
|
+
* Deep freeze
|
|
955
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze#What_is_shallow_freeze
|
|
956
|
+
*/
|
|
957
|
+
Helper.deepFreeze = function (object, preparedObjects) {
|
|
958
|
+
var e_4, _d;
|
|
959
|
+
if (preparedObjects === void 0) { preparedObjects = []; }
|
|
960
|
+
// Prevent infinit regress
|
|
961
|
+
if (preparedObjects.includes(object)) {
|
|
962
|
+
return object;
|
|
1087
963
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
964
|
+
preparedObjects.push(object);
|
|
965
|
+
// Retrieve the property names defined on object
|
|
966
|
+
var propNames = Object.getOwnPropertyNames(object);
|
|
967
|
+
try {
|
|
968
|
+
// Freeze properties before freezing self
|
|
969
|
+
for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
|
|
970
|
+
var name = propNames_1_1.value;
|
|
971
|
+
var value = object[name];
|
|
972
|
+
if (value && typeof value === 'object') {
|
|
973
|
+
Helper.deepFreeze(value, preparedObjects);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
1095
976
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
977
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
978
|
+
finally {
|
|
979
|
+
try {
|
|
980
|
+
if (propNames_1_1 && !propNames_1_1.done && (_d = propNames_1.return)) _d.call(propNames_1);
|
|
981
|
+
}
|
|
982
|
+
finally { if (e_4) throw e_4.error; }
|
|
1098
983
|
}
|
|
984
|
+
return Object.freeze(object);
|
|
1099
985
|
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
}, true);
|
|
1114
|
-
};
|
|
1115
|
-
ResizableDirective.prototype.addListenerToElement = function () {
|
|
1116
|
-
var _this = this;
|
|
1117
|
-
this.el.nativeElement.addEventListener('mousedown', function (e) {
|
|
1118
|
-
_this.mouseDown(e);
|
|
1119
|
-
}, true);
|
|
1120
|
-
this.el.nativeElement.addEventListener('mousemove', function (e) {
|
|
1121
|
-
_this.mouseMove(e);
|
|
1122
|
-
}, true);
|
|
986
|
+
/**
|
|
987
|
+
* Generates an unique identifier with 24 characters
|
|
988
|
+
*/
|
|
989
|
+
Helper.getUID = function () {
|
|
990
|
+
var dt = new Date().getTime();
|
|
991
|
+
var uuid = 'xxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
992
|
+
// eslint-disable-next-line no-bitwise
|
|
993
|
+
var r = (dt + Math.random() * 16) % 16 | 0;
|
|
994
|
+
dt = Math.floor(dt / 16);
|
|
995
|
+
// eslint-disable-next-line no-bitwise
|
|
996
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
997
|
+
});
|
|
998
|
+
return uuid;
|
|
1123
999
|
};
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
* Truncate string with ellipses
|
|
1141
|
-
*/
|
|
1142
|
-
var EllipsesPipe = /** @class */ (function () {
|
|
1143
|
-
function EllipsesPipe() {
|
|
1144
|
-
}
|
|
1145
|
-
EllipsesPipe.prototype.transform = function (value, limit) {
|
|
1146
|
-
if (!value) {
|
|
1147
|
-
return null;
|
|
1000
|
+
/**
|
|
1001
|
+
* Parse date string to date object
|
|
1002
|
+
*/
|
|
1003
|
+
Helper.parseDate = function (dateString) {
|
|
1004
|
+
var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
|
|
1005
|
+
var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/;
|
|
1006
|
+
if (typeof dateString === 'string') {
|
|
1007
|
+
var isoExec = reISO.exec(dateString);
|
|
1008
|
+
if (isoExec) {
|
|
1009
|
+
return new Date(dateString);
|
|
1010
|
+
}
|
|
1011
|
+
var msAjaxExec = reMsAjax.exec(dateString);
|
|
1012
|
+
if (msAjaxExec) {
|
|
1013
|
+
var cleaned = msAjaxExec[1].split(/[-+,.]/);
|
|
1014
|
+
return new Date(cleaned[0] ? +cleaned[0] : 0 - +cleaned[1]);
|
|
1015
|
+
}
|
|
1148
1016
|
}
|
|
1149
|
-
return
|
|
1150
|
-
};
|
|
1151
|
-
return EllipsesPipe;
|
|
1152
|
-
}());
|
|
1153
|
-
EllipsesPipe.decorators = [
|
|
1154
|
-
{ type: i0.Pipe, args: [{
|
|
1155
|
-
name: 'ltEllipses',
|
|
1156
|
-
},] }
|
|
1157
|
-
];
|
|
1158
|
-
|
|
1159
|
-
/**
|
|
1160
|
-
* Declarate html as safe
|
|
1161
|
-
*/
|
|
1162
|
-
var SafeHtmlPipe = /** @class */ (function () {
|
|
1163
|
-
function SafeHtmlPipe(sanitized) {
|
|
1164
|
-
this.sanitized = sanitized;
|
|
1165
|
-
}
|
|
1166
|
-
SafeHtmlPipe.prototype.transform = function (value) {
|
|
1167
|
-
return this.sanitized.bypassSecurityTrustHtml(value);
|
|
1017
|
+
return dateString;
|
|
1168
1018
|
};
|
|
1169
|
-
return SafeHtmlPipe;
|
|
1170
|
-
}());
|
|
1171
|
-
SafeHtmlPipe.decorators = [
|
|
1172
|
-
{ type: i0.Pipe, args: [{ name: 'ltSafeHtml' },] }
|
|
1173
|
-
];
|
|
1174
|
-
SafeHtmlPipe.ctorParameters = function () { return [
|
|
1175
|
-
{ type: i1.DomSanitizer }
|
|
1176
|
-
]; };
|
|
1177
|
-
|
|
1178
|
-
// Imported and exported elements
|
|
1179
|
-
var elements = [
|
|
1180
|
-
// Directives
|
|
1181
|
-
ContextMenuDirective,
|
|
1182
|
-
LazyLoadDirective,
|
|
1183
|
-
MatchHeightDirective,
|
|
1184
|
-
ResizableDirective,
|
|
1185
|
-
// Pipes
|
|
1186
|
-
EllipsesPipe,
|
|
1187
|
-
SafeHtmlPipe,
|
|
1188
|
-
];
|
|
1189
|
-
/**
|
|
1190
|
-
* Base module
|
|
1191
|
-
*/
|
|
1192
|
-
var BaseModule = /** @class */ (function () {
|
|
1193
|
-
function BaseModule() {
|
|
1194
|
-
}
|
|
1195
1019
|
/**
|
|
1196
|
-
*
|
|
1020
|
+
* Get browser name and version
|
|
1197
1021
|
*/
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
var
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
{
|
|
1205
|
-
provide: BASE_MODULE_CONFIG,
|
|
1206
|
-
useValue: baseModuleConfig,
|
|
1207
|
-
},
|
|
1208
|
-
];
|
|
1209
|
-
// Add apollo features if API URL is set
|
|
1210
|
-
if (baseModuleConfig.apiUrl) {
|
|
1211
|
-
providers.push({
|
|
1212
|
-
provide: i1$1.APOLLO_OPTIONS,
|
|
1213
|
-
useFactory: apolloOptionsFactory,
|
|
1214
|
-
deps: [BASE_MODULE_CONFIG, http.HttpLink, AuthService],
|
|
1215
|
-
});
|
|
1022
|
+
Helper.getBrowser = function () {
|
|
1023
|
+
var userAgent = navigator.userAgent;
|
|
1024
|
+
var data = userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
1025
|
+
var version;
|
|
1026
|
+
if (/trident/i.test(data[1])) {
|
|
1027
|
+
version = /\brv[ :]+(\d+)/g.exec(userAgent) || [];
|
|
1028
|
+
return { name: 'IE', version: version[1] || '' };
|
|
1216
1029
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1030
|
+
if (data[1] === 'Chrome') {
|
|
1031
|
+
version = userAgent.match(/\bOPR|Edge\/(\d+)/);
|
|
1032
|
+
if (version != null) {
|
|
1033
|
+
return { name: 'Opera', version: version[1] };
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
data = data[2] ? [data[1], data[2]] : [navigator.appName, navigator.appVersion, '-?'];
|
|
1037
|
+
version = userAgent.match(/version\/(\d+)/i);
|
|
1038
|
+
if (version !== null) {
|
|
1039
|
+
data.splice(1, 1, version[1]);
|
|
1219
1040
|
}
|
|
1220
|
-
// Return root module
|
|
1221
1041
|
return {
|
|
1222
|
-
|
|
1223
|
-
|
|
1042
|
+
name: data[0],
|
|
1043
|
+
version: data[1],
|
|
1224
1044
|
};
|
|
1225
1045
|
};
|
|
1226
|
-
return BaseModule;
|
|
1227
|
-
}());
|
|
1228
|
-
BaseModule.decorators = [
|
|
1229
|
-
{ type: i0.NgModule, args: [{
|
|
1230
|
-
declarations: elements,
|
|
1231
|
-
exports: elements,
|
|
1232
|
-
},] }
|
|
1233
|
-
];
|
|
1234
|
-
|
|
1235
|
-
/**
|
|
1236
|
-
* Helper class
|
|
1237
|
-
*/
|
|
1238
|
-
var Helper = /** @class */ (function () {
|
|
1239
|
-
function Helper() {
|
|
1240
|
-
}
|
|
1241
1046
|
/**
|
|
1242
|
-
*
|
|
1047
|
+
* Whether first parameter is a deep subset of second parameter
|
|
1048
|
+
* Hint: functions will be ignored
|
|
1243
1049
|
*/
|
|
1244
|
-
Helper.
|
|
1245
|
-
|
|
1246
|
-
|
|
1050
|
+
Helper.isSubset = function (a, b) {
|
|
1051
|
+
var e_5, _d, e_6, _e;
|
|
1052
|
+
// Equal
|
|
1053
|
+
if (a === b) {
|
|
1054
|
+
return true;
|
|
1055
|
+
}
|
|
1056
|
+
// Different type
|
|
1057
|
+
if (typeof a !== typeof b) {
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
// Process array
|
|
1061
|
+
if (Array.isArray(a)) {
|
|
1247
1062
|
try {
|
|
1248
|
-
for (var _f = __values(Object.entries(
|
|
1063
|
+
for (var _f = __values(Object.entries(a)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1249
1064
|
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
1250
|
-
if (
|
|
1251
|
-
try {
|
|
1252
|
-
for (var _j = (e_2 = void 0, __values(element[key])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1253
|
-
var item = _k.value;
|
|
1254
|
-
if (!element[key].includs(value)) {
|
|
1255
|
-
return false;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1260
|
-
finally {
|
|
1261
|
-
try {
|
|
1262
|
-
if (_k && !_k.done && (_e = _j.return)) _e.call(_j);
|
|
1263
|
-
}
|
|
1264
|
-
finally { if (e_2) throw e_2.error; }
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
else if (element[key] !== value) {
|
|
1065
|
+
if (Helper.isSubset(value, b[key])) {
|
|
1268
1066
|
return false;
|
|
1269
1067
|
}
|
|
1270
1068
|
}
|
|
1271
1069
|
}
|
|
1272
|
-
catch (
|
|
1070
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1273
1071
|
finally {
|
|
1274
1072
|
try {
|
|
1275
1073
|
if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
|
|
1276
1074
|
}
|
|
1277
|
-
finally { if (
|
|
1075
|
+
finally { if (e_5) throw e_5.error; }
|
|
1278
1076
|
}
|
|
1279
1077
|
return true;
|
|
1280
|
-
}
|
|
1078
|
+
}
|
|
1079
|
+
// Process object
|
|
1080
|
+
if (typeof a === 'object') {
|
|
1081
|
+
var plain = JSON.parse(JSON.stringify(a));
|
|
1082
|
+
try {
|
|
1083
|
+
for (var _j = __values(Object.entries(plain)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1084
|
+
var _l = __read(_k.value, 2), key = _l[0], value = _l[1];
|
|
1085
|
+
if (Helper.isSubset(value, b[key])) {
|
|
1086
|
+
return false;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1091
|
+
finally {
|
|
1092
|
+
try {
|
|
1093
|
+
if (_k && !_k.done && (_e = _j.return)) _e.call(_j);
|
|
1094
|
+
}
|
|
1095
|
+
finally { if (e_6) throw e_6.error; }
|
|
1096
|
+
}
|
|
1097
|
+
return true;
|
|
1098
|
+
}
|
|
1099
|
+
// Else
|
|
1100
|
+
return true;
|
|
1281
1101
|
};
|
|
1282
1102
|
/**
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
* - lower case
|
|
1286
|
-
* - chars, numbers and hyphens
|
|
1103
|
+
* Whether parameters are equal (have equal properties)
|
|
1104
|
+
* Hint: functions will be ignored
|
|
1287
1105
|
*/
|
|
1288
|
-
Helper.
|
|
1289
|
-
|
|
1290
|
-
// Config
|
|
1291
|
-
var config = Object.assign({ allowAll: false }, options);
|
|
1292
|
-
// To string
|
|
1293
|
-
str = str + '';
|
|
1294
|
-
// Trim
|
|
1295
|
-
str = str.trim();
|
|
1296
|
-
// Lower case
|
|
1297
|
-
str = str.toLowerCase();
|
|
1298
|
-
if (!config.allowAll) {
|
|
1299
|
-
// Replace spaces
|
|
1300
|
-
str = str.trim().replace(/\s+/g, '-');
|
|
1301
|
-
// Replace some special chars
|
|
1302
|
-
str = str.replace('ä', 'ae');
|
|
1303
|
-
str = str.replace('ö', 'oe');
|
|
1304
|
-
str = str.replace('ü', 'ue');
|
|
1305
|
-
str = str.replace('ß', 'ss');
|
|
1306
|
-
// Remove other special chars
|
|
1307
|
-
str = str.replace(/[^a-zA-Z0-9-]/g, '');
|
|
1308
|
-
}
|
|
1309
|
-
// Return url conform string
|
|
1310
|
-
return encodeURI(str);
|
|
1106
|
+
Helper.isEqual = function (a, b) {
|
|
1107
|
+
return Helper.isSubset(a, b) && Helper.isSubset(b, a);
|
|
1311
1108
|
};
|
|
1312
1109
|
/**
|
|
1313
|
-
*
|
|
1110
|
+
* First level difference of two objects
|
|
1111
|
+
* Hint: functions will be ignored and when an array or an object is different the hole array or object will used as property value
|
|
1112
|
+
*
|
|
1113
|
+
* @returns Record<string, any> Object with properties from first object
|
|
1314
1114
|
*/
|
|
1315
|
-
Helper.
|
|
1316
|
-
var
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
1319
|
-
var
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
return target;
|
|
1115
|
+
Helper.getDiff = function (a, b, clone) {
|
|
1116
|
+
var e_7, _d;
|
|
1117
|
+
if (clone === void 0) { clone = true; }
|
|
1118
|
+
var result = {};
|
|
1119
|
+
var firstObject = a;
|
|
1120
|
+
if (clone) {
|
|
1121
|
+
firstObject = JSON.parse(JSON.stringify(a));
|
|
1323
1122
|
}
|
|
1324
1123
|
try {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
if (typeof source[key] === 'string' && config.dateStringToDate) {
|
|
1330
|
-
if (Array.isArray(config.dateStringToDate)) {
|
|
1331
|
-
if (config.dateStringToDate.includes(key)) {
|
|
1332
|
-
target[key] = Helper.parseDate(source[key]);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
else {
|
|
1336
|
-
target[key] = Helper.parseDate(source[key]);
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
else {
|
|
1340
|
-
target[key] = source[key];
|
|
1341
|
-
}
|
|
1124
|
+
for (var _e = __values(Object.entries(firstObject)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1125
|
+
var _g = __read(_f.value, 2), key = _g[0], value = _g[1];
|
|
1126
|
+
if (!Helper.isSubset(value, b[key])) {
|
|
1127
|
+
result[key] = value;
|
|
1342
1128
|
}
|
|
1343
1129
|
}
|
|
1344
1130
|
}
|
|
1345
|
-
catch (
|
|
1131
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1346
1132
|
finally {
|
|
1347
1133
|
try {
|
|
1348
1134
|
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
1349
1135
|
}
|
|
1350
|
-
finally { if (
|
|
1136
|
+
finally { if (e_7) throw e_7.error; }
|
|
1351
1137
|
}
|
|
1352
|
-
|
|
1353
|
-
return target;
|
|
1138
|
+
return result;
|
|
1354
1139
|
};
|
|
1355
1140
|
/**
|
|
1356
|
-
*
|
|
1141
|
+
* Check if propertie is type of HTMLCollection or NodeList
|
|
1142
|
+
* See https://stackoverflow.com/a/7238344
|
|
1143
|
+
*
|
|
1144
|
+
* @param nodes
|
|
1357
1145
|
*/
|
|
1358
|
-
Helper.
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
return
|
|
1146
|
+
Helper.isNodeList = function (nodes) {
|
|
1147
|
+
try {
|
|
1148
|
+
var stringRepr = Object.prototype.toString.call(nodes);
|
|
1149
|
+
return (typeof nodes === 'object' &&
|
|
1150
|
+
/^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
|
|
1151
|
+
typeof nodes.length === 'number' &&
|
|
1152
|
+
(nodes.length === 0 || (typeof nodes[0] === 'object' && nodes[0].nodeType > 0)));
|
|
1362
1153
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
data = [data];
|
|
1154
|
+
catch (e) {
|
|
1155
|
+
return false;
|
|
1366
1156
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1157
|
+
};
|
|
1158
|
+
return Helper;
|
|
1159
|
+
}());
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Image service
|
|
1163
|
+
*/
|
|
1164
|
+
var ImageService = /** @class */ (function () {
|
|
1165
|
+
function ImageService() {
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Preaload images (for lazy handling)
|
|
1169
|
+
*
|
|
1170
|
+
* @param options
|
|
1171
|
+
* @protected
|
|
1172
|
+
*/
|
|
1173
|
+
ImageService.prototype.preLoadImages = function (options) {
|
|
1174
|
+
var _this = this;
|
|
1175
|
+
// Init configuration
|
|
1176
|
+
var config = Object.assign({ doneFunnction: undefined, elements: document, regExp: undefined }, options);
|
|
1177
|
+
return new Promise(function (resolve) {
|
|
1178
|
+
var e_1, _b;
|
|
1179
|
+
var _a;
|
|
1180
|
+
// Convert element(s) into array
|
|
1181
|
+
if (!Array.isArray(config.elements)) {
|
|
1182
|
+
// NodeList or HTMLCollection
|
|
1183
|
+
if (Helper.isNodeList(config.elements)) {
|
|
1184
|
+
config.elements = Array.from(config.elements);
|
|
1185
|
+
}
|
|
1186
|
+
// Single element
|
|
1187
|
+
else {
|
|
1188
|
+
config.elements = [config.elements];
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
// Init loading
|
|
1192
|
+
var promises = [];
|
|
1193
|
+
// Get all images
|
|
1194
|
+
var images = [];
|
|
1195
|
+
config.elements.forEach(function (element) {
|
|
1196
|
+
images = images.concat(Array.from(element.getElementsByTagName('img')));
|
|
1197
|
+
});
|
|
1198
|
+
var _loop_1 = function (image) {
|
|
1199
|
+
var src = image.getAttribute('src');
|
|
1200
|
+
// Check if changes are necessary and possible
|
|
1201
|
+
if ((image.complete && image.naturalHeight !== 0) || // already laoded
|
|
1202
|
+
!src || // Image has no src
|
|
1203
|
+
((_a = config.regExp) === null || _a === void 0 ? void 0 : _a.test(src)) // Test if src matches regular expression
|
|
1204
|
+
) {
|
|
1205
|
+
return "continue";
|
|
1206
|
+
}
|
|
1207
|
+
// Replace lazy loading image with immediately loading image
|
|
1208
|
+
if (image.getAttribute('loading') === 'lazy') {
|
|
1209
|
+
var newImage_1 = document.createElement('img');
|
|
1210
|
+
Array.from(image.attributes).forEach(function (attr) {
|
|
1211
|
+
if (attr.name !== 'loading' && attr.name !== 'src') {
|
|
1212
|
+
newImage_1.setAttribute(attr.name, attr.value);
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
image.replaceWith(newImage_1);
|
|
1216
|
+
image = newImage_1;
|
|
1217
|
+
}
|
|
1218
|
+
// Wait for laoding
|
|
1219
|
+
promises.push(_this.loadImage(image, src));
|
|
1220
|
+
};
|
|
1221
|
+
try {
|
|
1222
|
+
// Prepare images
|
|
1223
|
+
for (var images_1 = __values(images), images_1_1 = images_1.next(); !images_1_1.done; images_1_1 = images_1.next()) {
|
|
1224
|
+
var image = images_1_1.value;
|
|
1225
|
+
_loop_1(image);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1229
|
+
finally {
|
|
1230
|
+
try {
|
|
1231
|
+
if (images_1_1 && !images_1_1.done && (_b = images_1.return)) _b.call(images_1);
|
|
1232
|
+
}
|
|
1233
|
+
finally { if (e_1) throw e_1.error; }
|
|
1234
|
+
}
|
|
1235
|
+
// Wait until all images loaded
|
|
1236
|
+
Promise.all(promises)
|
|
1237
|
+
.catch(function (e) { return console.error('Error during image loading', e); })
|
|
1238
|
+
.finally(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1239
|
+
var result;
|
|
1240
|
+
return __generator(this, function (_b) {
|
|
1241
|
+
switch (_b.label) {
|
|
1242
|
+
case 0:
|
|
1243
|
+
if (!config.doneFunnction) return [3 /*break*/, 2];
|
|
1244
|
+
return [4 /*yield*/, config.doneFunction()];
|
|
1245
|
+
case 1:
|
|
1246
|
+
result = _b.sent();
|
|
1247
|
+
_b.label = 2;
|
|
1248
|
+
case 2:
|
|
1249
|
+
resolve(result);
|
|
1250
|
+
return [2 /*return*/];
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
}); });
|
|
1370
1254
|
});
|
|
1371
1255
|
};
|
|
1372
1256
|
/**
|
|
1373
|
-
*
|
|
1257
|
+
* Load image for image element
|
|
1258
|
+
*
|
|
1259
|
+
* @param imageElement
|
|
1260
|
+
* @param src
|
|
1261
|
+
* @protected
|
|
1374
1262
|
*/
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1263
|
+
ImageService.prototype.loadImage = function (imageElement, src) {
|
|
1264
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1265
|
+
return __generator(this, function (_b) {
|
|
1266
|
+
src = src || imageElement.src;
|
|
1267
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
1268
|
+
imageElement.onload = function () { return resolve(imageElement); };
|
|
1269
|
+
imageElement.onerror = reject;
|
|
1270
|
+
imageElement.src = src;
|
|
1271
|
+
})];
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1381
1274
|
};
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1275
|
+
return ImageService;
|
|
1276
|
+
}());
|
|
1277
|
+
ImageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ImageService_Factory() { return new ImageService(); }, token: ImageService, providedIn: "root" });
|
|
1278
|
+
ImageService.decorators = [
|
|
1279
|
+
{ type: i0.Injectable, args: [{
|
|
1280
|
+
providedIn: 'root',
|
|
1281
|
+
},] }
|
|
1282
|
+
];
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Set same height (maximum) to different elements
|
|
1286
|
+
*/
|
|
1287
|
+
var MatchHeightDirective = /** @class */ (function () {
|
|
1288
|
+
function MatchHeightDirective(el, imageService, platformId) {
|
|
1289
|
+
this.el = el;
|
|
1290
|
+
this.imageService = imageService;
|
|
1291
|
+
// Replace lazy loading images with immediate loading images
|
|
1292
|
+
this.loadImages = true;
|
|
1293
|
+
this.isBrowser = common.isPlatformBrowser(platformId);
|
|
1294
|
+
}
|
|
1295
|
+
MatchHeightDirective.prototype.onResize = function () {
|
|
1296
|
+
this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
|
|
1391
1297
|
};
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
*/
|
|
1395
|
-
Helper.delay = function (ms) {
|
|
1396
|
-
var promise = new Promise(function (resolve) { return setTimeout(resolve, ms); });
|
|
1397
|
-
return promise;
|
|
1298
|
+
MatchHeightDirective.prototype.ngOnInit = function () {
|
|
1299
|
+
this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
|
|
1398
1300
|
};
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1301
|
+
MatchHeightDirective.prototype.matchHeight = function (parent, target) {
|
|
1302
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1303
|
+
var classNames, _loop_1, this_1, classNames_1, classNames_1_1, className, e_1_1;
|
|
1304
|
+
var e_1, _a;
|
|
1305
|
+
return __generator(this, function (_b) {
|
|
1306
|
+
switch (_b.label) {
|
|
1307
|
+
case 0:
|
|
1308
|
+
if (!parent) {
|
|
1309
|
+
return [2 /*return*/];
|
|
1310
|
+
}
|
|
1311
|
+
if (!Array.isArray(target)) {
|
|
1312
|
+
classNames = [target];
|
|
1313
|
+
}
|
|
1314
|
+
else {
|
|
1315
|
+
classNames = target;
|
|
1316
|
+
}
|
|
1317
|
+
_loop_1 = function (className) {
|
|
1318
|
+
var children, itemHeights, maxHeight;
|
|
1319
|
+
return __generator(this, function (_c) {
|
|
1320
|
+
switch (_c.label) {
|
|
1321
|
+
case 0:
|
|
1322
|
+
children = parent.getElementsByClassName(className);
|
|
1323
|
+
if (!children || children.length < 2) {
|
|
1324
|
+
return [2 /*return*/, "continue"];
|
|
1325
|
+
}
|
|
1326
|
+
if (!this_1.loadImages) return [3 /*break*/, 2];
|
|
1327
|
+
return [4 /*yield*/, this_1.imageService.preLoadImages({ elements: children })];
|
|
1328
|
+
case 1:
|
|
1329
|
+
_c.sent();
|
|
1330
|
+
_c.label = 2;
|
|
1331
|
+
case 2:
|
|
1332
|
+
// reset all children height
|
|
1333
|
+
Array.from(children).forEach(function (element) {
|
|
1334
|
+
element.style.height = 'initial';
|
|
1335
|
+
});
|
|
1336
|
+
itemHeights = Array.from(children).map(function (element) {
|
|
1337
|
+
if (element.getBoundingClientRect) {
|
|
1338
|
+
return element.getBoundingClientRect().height;
|
|
1339
|
+
}
|
|
1340
|
+
return 0;
|
|
1341
|
+
});
|
|
1342
|
+
maxHeight = itemHeights.reduce(function (prev, curr) { return (curr > prev ? curr : prev); }, 0);
|
|
1343
|
+
// update the child structureElements height to the tallest one
|
|
1344
|
+
Array.from(children).forEach(function (element) { return (element.style.height = maxHeight + "px"); });
|
|
1345
|
+
return [2 /*return*/];
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
};
|
|
1349
|
+
this_1 = this;
|
|
1350
|
+
_b.label = 1;
|
|
1351
|
+
case 1:
|
|
1352
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
1353
|
+
classNames_1 = __values(classNames), classNames_1_1 = classNames_1.next();
|
|
1354
|
+
_b.label = 2;
|
|
1355
|
+
case 2:
|
|
1356
|
+
if (!!classNames_1_1.done) return [3 /*break*/, 5];
|
|
1357
|
+
className = classNames_1_1.value;
|
|
1358
|
+
return [5 /*yield**/, _loop_1(className)];
|
|
1359
|
+
case 3:
|
|
1360
|
+
_b.sent();
|
|
1361
|
+
_b.label = 4;
|
|
1362
|
+
case 4:
|
|
1363
|
+
classNames_1_1 = classNames_1.next();
|
|
1364
|
+
return [3 /*break*/, 2];
|
|
1365
|
+
case 5: return [3 /*break*/, 8];
|
|
1366
|
+
case 6:
|
|
1367
|
+
e_1_1 = _b.sent();
|
|
1368
|
+
e_1 = { error: e_1_1 };
|
|
1369
|
+
return [3 /*break*/, 8];
|
|
1370
|
+
case 7:
|
|
1371
|
+
try {
|
|
1372
|
+
if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
|
|
1373
|
+
}
|
|
1374
|
+
finally { if (e_1) throw e_1.error; }
|
|
1375
|
+
return [7 /*endfinally*/];
|
|
1376
|
+
case 8: return [2 /*return*/];
|
|
1420
1377
|
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1424
|
-
finally {
|
|
1425
|
-
try {
|
|
1426
|
-
if (propNames_1_1 && !propNames_1_1.done && (_d = propNames_1.return)) _d.call(propNames_1);
|
|
1427
|
-
}
|
|
1428
|
-
finally { if (e_4) throw e_4.error; }
|
|
1429
|
-
}
|
|
1430
|
-
return Object.freeze(object);
|
|
1431
|
-
};
|
|
1432
|
-
/**
|
|
1433
|
-
* Generates an unique identifier with 24 characters
|
|
1434
|
-
*/
|
|
1435
|
-
Helper.getUID = function () {
|
|
1436
|
-
var dt = new Date().getTime();
|
|
1437
|
-
var uuid = 'xxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
1438
|
-
// eslint-disable-next-line no-bitwise
|
|
1439
|
-
var r = (dt + Math.random() * 16) % 16 | 0;
|
|
1440
|
-
dt = Math.floor(dt / 16);
|
|
1441
|
-
// eslint-disable-next-line no-bitwise
|
|
1442
|
-
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
1378
|
+
});
|
|
1443
1379
|
});
|
|
1444
|
-
return uuid;
|
|
1445
1380
|
};
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1381
|
+
return MatchHeightDirective;
|
|
1382
|
+
}());
|
|
1383
|
+
MatchHeightDirective.decorators = [
|
|
1384
|
+
{ type: i0.Directive, args: [{
|
|
1385
|
+
selector: '[ltMatchHeight]',
|
|
1386
|
+
},] }
|
|
1387
|
+
];
|
|
1388
|
+
MatchHeightDirective.ctorParameters = function () { return [
|
|
1389
|
+
{ type: i0.ElementRef },
|
|
1390
|
+
{ type: ImageService },
|
|
1391
|
+
{ type: String, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] }
|
|
1392
|
+
]; };
|
|
1393
|
+
MatchHeightDirective.propDecorators = {
|
|
1394
|
+
ltMatchHeight: [{ type: i0.Input }],
|
|
1395
|
+
loadImages: [{ type: i0.Input }],
|
|
1396
|
+
onResize: [{ type: i0.HostListener, args: ['window:resize',] }]
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Reszise detection
|
|
1401
|
+
* (inpsired by: https://stackblitz.com/edit/angular-resizable)
|
|
1402
|
+
*/
|
|
1403
|
+
var ResizableDirective = /** @class */ (function () {
|
|
1404
|
+
function ResizableDirective(el) {
|
|
1405
|
+
this.el = el;
|
|
1406
|
+
this.resizableGrabWidth = 8;
|
|
1407
|
+
this.resizableMinWidth = 10;
|
|
1408
|
+
this.dragging = false;
|
|
1409
|
+
}
|
|
1410
|
+
ResizableDirective.prototype.ngOnInit = function () {
|
|
1411
|
+
this.addListenerToDocument();
|
|
1412
|
+
this.addListenerToElement();
|
|
1464
1413
|
};
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
Helper.getBrowser = function () {
|
|
1469
|
-
var userAgent = navigator.userAgent;
|
|
1470
|
-
var data = userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
1471
|
-
var version;
|
|
1472
|
-
if (/trident/i.test(data[1])) {
|
|
1473
|
-
version = /\brv[ :]+(\d+)/g.exec(userAgent) || [];
|
|
1474
|
-
return { name: 'IE', version: version[1] || '' };
|
|
1475
|
-
}
|
|
1476
|
-
if (data[1] === 'Chrome') {
|
|
1477
|
-
version = userAgent.match(/\bOPR|Edge\/(\d+)/);
|
|
1478
|
-
if (version != null) {
|
|
1479
|
-
return { name: 'Opera', version: version[1] };
|
|
1480
|
-
}
|
|
1414
|
+
ResizableDirective.prototype.mouseMoveG = function (evt) {
|
|
1415
|
+
if (!this.dragging) {
|
|
1416
|
+
return;
|
|
1481
1417
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1418
|
+
this.newWidth(evt.clientX - this.el.nativeElement.offsetLeft);
|
|
1419
|
+
evt.stopPropagation();
|
|
1420
|
+
};
|
|
1421
|
+
ResizableDirective.prototype.newWidth = function (wid) {
|
|
1422
|
+
var result = Math.max(this.resizableMinWidth, wid);
|
|
1423
|
+
this.el.nativeElement.style.width = result + 'px';
|
|
1424
|
+
};
|
|
1425
|
+
ResizableDirective.prototype.mouseDown = function (evt) {
|
|
1426
|
+
if (this.inDragRegion(evt)) {
|
|
1427
|
+
this.dragging = true;
|
|
1428
|
+
this.preventGlobalMouseEvents();
|
|
1429
|
+
evt.stopPropagation();
|
|
1486
1430
|
}
|
|
1487
|
-
return {
|
|
1488
|
-
name: data[0],
|
|
1489
|
-
version: data[1],
|
|
1490
|
-
};
|
|
1491
1431
|
};
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
// Equal
|
|
1499
|
-
if (a === b) {
|
|
1500
|
-
return true;
|
|
1432
|
+
ResizableDirective.prototype.restoreGlobalMouseEvents = function () {
|
|
1433
|
+
document.body.style['pointer-events'] = 'auto';
|
|
1434
|
+
};
|
|
1435
|
+
ResizableDirective.prototype.mouseUpG = function (evt) {
|
|
1436
|
+
if (!this.dragging) {
|
|
1437
|
+
return;
|
|
1501
1438
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1439
|
+
this.restoreGlobalMouseEvents();
|
|
1440
|
+
this.dragging = false;
|
|
1441
|
+
evt.stopPropagation();
|
|
1442
|
+
};
|
|
1443
|
+
ResizableDirective.prototype.mouseMove = function (evt) {
|
|
1444
|
+
if (this.inDragRegion(evt) || this.dragging) {
|
|
1445
|
+
this.el.nativeElement.style.cursor = 'col-resize';
|
|
1505
1446
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
try {
|
|
1509
|
-
for (var _f = __values(Object.entries(a)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1510
|
-
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
1511
|
-
if (Helper.isSubset(value, b[key])) {
|
|
1512
|
-
return false;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1517
|
-
finally {
|
|
1518
|
-
try {
|
|
1519
|
-
if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
|
|
1520
|
-
}
|
|
1521
|
-
finally { if (e_5) throw e_5.error; }
|
|
1522
|
-
}
|
|
1523
|
-
return true;
|
|
1447
|
+
else {
|
|
1448
|
+
this.el.nativeElement.style.cursor = 'default';
|
|
1524
1449
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1450
|
+
};
|
|
1451
|
+
ResizableDirective.prototype.preventGlobalMouseEvents = function () {
|
|
1452
|
+
document.body.style['pointer-events'] = 'none';
|
|
1453
|
+
};
|
|
1454
|
+
ResizableDirective.prototype.inDragRegion = function (evt) {
|
|
1455
|
+
return this.el.nativeElement.clientWidth - evt.clientX + this.el.nativeElement.offsetLeft < this.resizableGrabWidth;
|
|
1456
|
+
};
|
|
1457
|
+
ResizableDirective.prototype.addListenerToDocument = function () {
|
|
1458
|
+
var _this = this;
|
|
1459
|
+
document.addEventListener('mousemove', function (e) {
|
|
1460
|
+
_this.mouseMoveG(e);
|
|
1461
|
+
}, true);
|
|
1462
|
+
document.addEventListener('mouseup', function (e) {
|
|
1463
|
+
_this.mouseUpG(e);
|
|
1464
|
+
}, true);
|
|
1465
|
+
};
|
|
1466
|
+
ResizableDirective.prototype.addListenerToElement = function () {
|
|
1467
|
+
var _this = this;
|
|
1468
|
+
this.el.nativeElement.addEventListener('mousedown', function (e) {
|
|
1469
|
+
_this.mouseDown(e);
|
|
1470
|
+
}, true);
|
|
1471
|
+
this.el.nativeElement.addEventListener('mousemove', function (e) {
|
|
1472
|
+
_this.mouseMove(e);
|
|
1473
|
+
}, true);
|
|
1474
|
+
};
|
|
1475
|
+
return ResizableDirective;
|
|
1476
|
+
}());
|
|
1477
|
+
ResizableDirective.decorators = [
|
|
1478
|
+
{ type: i0.Directive, args: [{
|
|
1479
|
+
selector: '[ltResizable]',
|
|
1480
|
+
},] }
|
|
1481
|
+
];
|
|
1482
|
+
ResizableDirective.ctorParameters = function () { return [
|
|
1483
|
+
{ type: i0.ElementRef }
|
|
1484
|
+
]; };
|
|
1485
|
+
ResizableDirective.propDecorators = {
|
|
1486
|
+
resizableGrabWidth: [{ type: i0.Input }],
|
|
1487
|
+
resizableMinWidth: [{ type: i0.Input }]
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* Truncate string with ellipses
|
|
1492
|
+
*/
|
|
1493
|
+
var EllipsesPipe = /** @class */ (function () {
|
|
1494
|
+
function EllipsesPipe() {
|
|
1495
|
+
}
|
|
1496
|
+
EllipsesPipe.prototype.transform = function (value, limit) {
|
|
1497
|
+
if (!value) {
|
|
1498
|
+
return null;
|
|
1544
1499
|
}
|
|
1545
|
-
|
|
1546
|
-
return true;
|
|
1500
|
+
return value.length > limit ? value.substring(0, limit) + '...' : value;
|
|
1547
1501
|
};
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1502
|
+
return EllipsesPipe;
|
|
1503
|
+
}());
|
|
1504
|
+
EllipsesPipe.decorators = [
|
|
1505
|
+
{ type: i0.Pipe, args: [{
|
|
1506
|
+
name: 'ltEllipses',
|
|
1507
|
+
},] }
|
|
1508
|
+
];
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Declarate html as safe
|
|
1512
|
+
*/
|
|
1513
|
+
var SafeHtmlPipe = /** @class */ (function () {
|
|
1514
|
+
function SafeHtmlPipe(sanitized) {
|
|
1515
|
+
this.sanitized = sanitized;
|
|
1516
|
+
}
|
|
1517
|
+
SafeHtmlPipe.prototype.transform = function (value) {
|
|
1518
|
+
return this.sanitized.bypassSecurityTrustHtml(value);
|
|
1554
1519
|
};
|
|
1520
|
+
return SafeHtmlPipe;
|
|
1521
|
+
}());
|
|
1522
|
+
SafeHtmlPipe.decorators = [
|
|
1523
|
+
{ type: i0.Pipe, args: [{ name: 'ltSafeHtml' },] }
|
|
1524
|
+
];
|
|
1525
|
+
SafeHtmlPipe.ctorParameters = function () { return [
|
|
1526
|
+
{ type: i1.DomSanitizer }
|
|
1527
|
+
]; };
|
|
1528
|
+
|
|
1529
|
+
// Imported and exported elements
|
|
1530
|
+
var elements = [
|
|
1531
|
+
// Directives
|
|
1532
|
+
ContextMenuDirective,
|
|
1533
|
+
LazyLoadDirective,
|
|
1534
|
+
MatchHeightDirective,
|
|
1535
|
+
ResizableDirective,
|
|
1536
|
+
// Pipes
|
|
1537
|
+
EllipsesPipe,
|
|
1538
|
+
SafeHtmlPipe,
|
|
1539
|
+
];
|
|
1540
|
+
/**
|
|
1541
|
+
* Base module
|
|
1542
|
+
*/
|
|
1543
|
+
var BaseModule = /** @class */ (function () {
|
|
1544
|
+
function BaseModule() {
|
|
1545
|
+
}
|
|
1555
1546
|
/**
|
|
1556
|
-
*
|
|
1557
|
-
* Hint: functions will be ignored and when an array or an object is different the hole array or object will used as property value
|
|
1558
|
-
*
|
|
1559
|
-
* @returns Record<string, any> Object with properties from first object
|
|
1547
|
+
* Set configuration of base module in root module of the app
|
|
1560
1548
|
*/
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
var
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1549
|
+
BaseModule.forRoot = function (baseModuleConfig) {
|
|
1550
|
+
if (baseModuleConfig === void 0) { baseModuleConfig = {}; }
|
|
1551
|
+
// Default config
|
|
1552
|
+
var config = Object.assign({ apiUrl: 'localhost:3000', authGuardRedirectUrl: '/auth', logging: false, version: null, prefix: null, scrollDetectionOffset: 200, scrollOffset: 100, storageType: 'local' }, baseModuleConfig);
|
|
1553
|
+
// Prepare providers
|
|
1554
|
+
var providers = [
|
|
1555
|
+
{
|
|
1556
|
+
provide: BASE_MODULE_CONFIG,
|
|
1557
|
+
useValue: baseModuleConfig,
|
|
1558
|
+
},
|
|
1559
|
+
];
|
|
1560
|
+
// Add apollo features if API URL is set
|
|
1561
|
+
if (baseModuleConfig.apiUrl) {
|
|
1562
|
+
providers.push({
|
|
1563
|
+
provide: i1$1.APOLLO_OPTIONS,
|
|
1564
|
+
useFactory: apolloOptionsFactory,
|
|
1565
|
+
deps: [BASE_MODULE_CONFIG, http.HttpLink, AuthService],
|
|
1566
|
+
});
|
|
1576
1567
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
try {
|
|
1580
|
-
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
1581
|
-
}
|
|
1582
|
-
finally { if (e_7) throw e_7.error; }
|
|
1568
|
+
else if (config.logging) {
|
|
1569
|
+
console.log('apiUrl is missing, ApolloLink is not initialized');
|
|
1583
1570
|
}
|
|
1584
|
-
|
|
1571
|
+
// Return root module
|
|
1572
|
+
return {
|
|
1573
|
+
ngModule: BaseModule,
|
|
1574
|
+
providers: providers,
|
|
1575
|
+
};
|
|
1585
1576
|
};
|
|
1586
|
-
return
|
|
1577
|
+
return BaseModule;
|
|
1587
1578
|
}());
|
|
1579
|
+
BaseModule.decorators = [
|
|
1580
|
+
{ type: i0.NgModule, args: [{
|
|
1581
|
+
declarations: elements,
|
|
1582
|
+
exports: elements,
|
|
1583
|
+
},] }
|
|
1584
|
+
];
|
|
1588
1585
|
|
|
1589
1586
|
/**
|
|
1590
1587
|
* Standard class
|
|
@@ -2472,7 +2469,7 @@
|
|
|
2472
2469
|
return "continue";
|
|
2473
2470
|
}
|
|
2474
2471
|
// Skip value if not exists
|
|
2475
|
-
if (value === undefined
|
|
2472
|
+
if (value === undefined || value === null) {
|
|
2476
2473
|
return "continue";
|
|
2477
2474
|
}
|
|
2478
2475
|
// Add current key to metadata
|
|
@@ -2836,7 +2833,7 @@
|
|
|
2836
2833
|
return __generator(this, function (_a) {
|
|
2837
2834
|
switch (_a.label) {
|
|
2838
2835
|
case 0:
|
|
2839
|
-
config = Object.assign({ checkUrl:
|
|
2836
|
+
config = Object.assign({ checkUrl: false, loadImagesBefore: true, resetStyles: false, setOverflow: true, stopPropagation: true }, options);
|
|
2840
2837
|
if (!(config.checkUrl && this.router.url !== '/' && !this.router.url.startsWith('/#'))) return [3 /*break*/, 2];
|
|
2841
2838
|
return [4 /*yield*/, this.router.navigate(['/'], { fragment: id })];
|
|
2842
2839
|
case 1:
|
|
@@ -2918,48 +2915,26 @@
|
|
|
2918
2915
|
* Scroll done promise
|
|
2919
2916
|
*/
|
|
2920
2917
|
ScrollService.prototype.scrollDone = function (options) {
|
|
2921
|
-
var _this = this;
|
|
2922
2918
|
if (options === void 0) { options = {}; }
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
// Return promise for scroll done
|
|
2926
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
2927
|
-
var rejected, timeoutId, result;
|
|
2919
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2920
|
+
var config;
|
|
2928
2921
|
return __generator(this, function (_a) {
|
|
2929
2922
|
switch (_a.label) {
|
|
2930
2923
|
case 0:
|
|
2931
|
-
|
|
2932
|
-
// Set timeout handling if necessary
|
|
2933
|
-
if (config.timeout) {
|
|
2934
|
-
timeoutId = window.setTimeout(function () {
|
|
2935
|
-
rejected = true;
|
|
2936
|
-
reject(new Error('Timeout for scrollDone after:' + config.timeout));
|
|
2937
|
-
}, config.timeout);
|
|
2938
|
-
}
|
|
2924
|
+
config = Object.assign({ doneFunction: undefined }, options);
|
|
2939
2925
|
// Wait for scroll done
|
|
2940
2926
|
return [4 /*yield*/, this.scrollDoneDetection()];
|
|
2941
2927
|
case 1:
|
|
2942
2928
|
// Wait for scroll done
|
|
2943
2929
|
_a.sent();
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
window.clearTimeout(timeoutId);
|
|
2930
|
+
// Get result
|
|
2931
|
+
if (config.doneFunction) {
|
|
2932
|
+
return [2 /*return*/, config.doneFunction()];
|
|
2948
2933
|
}
|
|
2949
|
-
|
|
2950
|
-
if (!config.doneFunction) return [3 /*break*/, 3];
|
|
2951
|
-
return [4 /*yield*/, config.doneFunction()];
|
|
2952
|
-
case 2:
|
|
2953
|
-
result = _a.sent();
|
|
2954
|
-
_a.label = 3;
|
|
2955
|
-
case 3:
|
|
2956
|
-
// Scroll done
|
|
2957
|
-
resolve(result);
|
|
2958
|
-
_a.label = 4;
|
|
2959
|
-
case 4: return [2 /*return*/];
|
|
2934
|
+
return [2 /*return*/];
|
|
2960
2935
|
}
|
|
2961
2936
|
});
|
|
2962
|
-
});
|
|
2937
|
+
});
|
|
2963
2938
|
};
|
|
2964
2939
|
/**
|
|
2965
2940
|
* Scroll done detecton
|