@lenne.tech/ng-base 0.3.3 → 0.3.4
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 +739 -702
- package/bundles/lenne.tech-ng-base-src-lib-base.umd.js.map +1 -1
- package/bundles/lenne.tech-ng-base.umd.js +739 -702
- 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 +27 -10
- package/esm2015/lib/base/services/image.service.js +11 -7
- package/esm2015/src/lib/base/classes/helper.class.js +19 -1
- package/esm2015/src/lib/base/directives/match-height.directive.js +27 -10
- package/esm2015/src/lib/base/services/image.service.js +11 -7
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js +548 -510
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js.map +1 -1
- package/fesm2015/lenne.tech-ng-base.js +548 -510
- 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 +4 -3
- package/lib/base/services/image.service.d.ts +1 -1
- 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 +4 -3
- 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 -1
|
@@ -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', ['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.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', ['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.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,841 @@
|
|
|
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
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
var
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
957
|
-
var classNames, _loop_1, this_1, classNames_1, classNames_1_1, className, e_1_1;
|
|
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();
|
|
936
|
+
/**
|
|
937
|
+
* Get ID of an url parameter
|
|
938
|
+
*/
|
|
939
|
+
Helper.getParameterId = function (parameter) {
|
|
940
|
+
var _a;
|
|
941
|
+
if (!parameter) {
|
|
942
|
+
return parameter;
|
|
1079
943
|
}
|
|
944
|
+
return (_a = Helper.getPlainParameter(parameter)) === null || _a === void 0 ? void 0 : _a.split('-').pop();
|
|
1080
945
|
};
|
|
1081
|
-
|
|
1082
|
-
|
|
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, timeout: undefined }, options);
|
|
1177
|
+
return new Promise(function (resolve) {
|
|
1178
|
+
var e_1, _b;
|
|
1179
|
+
var _a;
|
|
1180
|
+
// Init variables
|
|
1181
|
+
var resolved = false;
|
|
1182
|
+
var timeoutId;
|
|
1183
|
+
// Convert element(s) into array
|
|
1184
|
+
if (!Array.isArray(config.elements)) {
|
|
1185
|
+
// NodeList or HTMLCollection
|
|
1186
|
+
if (Helper.isNodeList(config.elements)) {
|
|
1187
|
+
config.elements = Array.from(config.elements);
|
|
1188
|
+
}
|
|
1189
|
+
// Single element
|
|
1190
|
+
else {
|
|
1191
|
+
config.elements = [config.elements];
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
// Init loading
|
|
1195
|
+
var promises = [];
|
|
1196
|
+
// Get all images
|
|
1197
|
+
var images = [];
|
|
1198
|
+
config.elements.forEach(function (element) {
|
|
1199
|
+
images = images.concat(Array.from(element.getElementsByTagName('img')));
|
|
1200
|
+
});
|
|
1201
|
+
var _loop_1 = function (image) {
|
|
1202
|
+
var src = image.getAttribute('src');
|
|
1203
|
+
// Check if changes are necessary and possible
|
|
1204
|
+
if ((image.complete && image.naturalHeight !== 0) || // already laoded
|
|
1205
|
+
image.getAttribute('loading') !== 'lazy' || // loading attribute !== lazy
|
|
1206
|
+
!src || // Image has no src
|
|
1207
|
+
((_a = config.regExp) === null || _a === void 0 ? void 0 : _a.test(src)) // Test if src matches regular expression
|
|
1208
|
+
) {
|
|
1209
|
+
return "continue";
|
|
1210
|
+
}
|
|
1211
|
+
// Replace lazy loading image with immediately loading image
|
|
1212
|
+
var newImage = document.createElement('img');
|
|
1213
|
+
Array.from(image.attributes).forEach(function (attr) {
|
|
1214
|
+
if (attr.name !== 'loading' && attr.name !== 'src') {
|
|
1215
|
+
newImage.setAttribute(attr.name, attr.value);
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
image.replaceWith(newImage);
|
|
1219
|
+
// Wait for laoding
|
|
1220
|
+
promises.push(_this.loadImage(newImage, src));
|
|
1221
|
+
};
|
|
1222
|
+
try {
|
|
1223
|
+
// Prepare images
|
|
1224
|
+
for (var images_1 = __values(images), images_1_1 = images_1.next(); !images_1_1.done; images_1_1 = images_1.next()) {
|
|
1225
|
+
var image = images_1_1.value;
|
|
1226
|
+
_loop_1(image);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1230
|
+
finally {
|
|
1231
|
+
try {
|
|
1232
|
+
if (images_1_1 && !images_1_1.done && (_b = images_1.return)) _b.call(images_1);
|
|
1233
|
+
}
|
|
1234
|
+
finally { if (e_1) throw e_1.error; }
|
|
1235
|
+
}
|
|
1236
|
+
if (config.timeout) {
|
|
1237
|
+
timeoutId = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1238
|
+
return __generator(this, function (_b) {
|
|
1239
|
+
switch (_b.label) {
|
|
1240
|
+
case 0:
|
|
1241
|
+
resolved = true;
|
|
1242
|
+
if (!config.doneFunnction) return [3 /*break*/, 2];
|
|
1243
|
+
return [4 /*yield*/, config.doneFunction()];
|
|
1244
|
+
case 1:
|
|
1245
|
+
_b.sent();
|
|
1246
|
+
_b.label = 2;
|
|
1247
|
+
case 2:
|
|
1248
|
+
resolve(undefined);
|
|
1249
|
+
return [2 /*return*/];
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
}); });
|
|
1253
|
+
}
|
|
1254
|
+
// Wait until all images loaded
|
|
1255
|
+
Promise.all(promises)
|
|
1256
|
+
.catch(function (e) { return console.error('Error during image loading', e); })
|
|
1257
|
+
.finally(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1258
|
+
var result;
|
|
1259
|
+
return __generator(this, function (_b) {
|
|
1260
|
+
switch (_b.label) {
|
|
1261
|
+
case 0:
|
|
1262
|
+
// Check if already resolved
|
|
1263
|
+
if (resolved) {
|
|
1264
|
+
return [2 /*return*/];
|
|
1265
|
+
}
|
|
1266
|
+
// Stop timeout
|
|
1267
|
+
if (timeoutId) {
|
|
1268
|
+
clearTimeout(timeoutId);
|
|
1269
|
+
}
|
|
1270
|
+
if (!config.doneFunnction) return [3 /*break*/, 2];
|
|
1271
|
+
return [4 /*yield*/, config.doneFunction()];
|
|
1272
|
+
case 1:
|
|
1273
|
+
result = _b.sent();
|
|
1274
|
+
_b.label = 2;
|
|
1275
|
+
case 2:
|
|
1276
|
+
resolve(result);
|
|
1277
|
+
return [2 /*return*/];
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}); });
|
|
1370
1281
|
});
|
|
1371
1282
|
};
|
|
1372
1283
|
/**
|
|
1373
|
-
*
|
|
1284
|
+
* Load image for image element
|
|
1285
|
+
*
|
|
1286
|
+
* @param imageElement
|
|
1287
|
+
* @param src
|
|
1288
|
+
* @protected
|
|
1374
1289
|
*/
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1290
|
+
ImageService.prototype.loadImage = function (imageElement, src) {
|
|
1291
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1292
|
+
return __generator(this, function (_b) {
|
|
1293
|
+
src = src || imageElement.src;
|
|
1294
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
1295
|
+
imageElement.onload = function () { return resolve(imageElement); };
|
|
1296
|
+
imageElement.onerror = reject;
|
|
1297
|
+
imageElement.src = src;
|
|
1298
|
+
})];
|
|
1299
|
+
});
|
|
1300
|
+
});
|
|
1381
1301
|
};
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1302
|
+
return ImageService;
|
|
1303
|
+
}());
|
|
1304
|
+
ImageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ImageService_Factory() { return new ImageService(); }, token: ImageService, providedIn: "root" });
|
|
1305
|
+
ImageService.decorators = [
|
|
1306
|
+
{ type: i0.Injectable, args: [{
|
|
1307
|
+
providedIn: 'root',
|
|
1308
|
+
},] }
|
|
1309
|
+
];
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Set same height (maximum) to different elements
|
|
1313
|
+
*/
|
|
1314
|
+
var MatchHeightDirective = /** @class */ (function () {
|
|
1315
|
+
function MatchHeightDirective(el, imageService, platformId) {
|
|
1316
|
+
this.el = el;
|
|
1317
|
+
this.imageService = imageService;
|
|
1318
|
+
// Replace lazy loading images with immediate loading images
|
|
1319
|
+
this.loadLazyImages = true;
|
|
1320
|
+
this.isBrowser = common.isPlatformBrowser(platformId);
|
|
1321
|
+
}
|
|
1322
|
+
MatchHeightDirective.prototype.onResize = function () {
|
|
1323
|
+
this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
|
|
1391
1324
|
};
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
*/
|
|
1395
|
-
Helper.delay = function (ms) {
|
|
1396
|
-
var promise = new Promise(function (resolve) { return setTimeout(resolve, ms); });
|
|
1397
|
-
return promise;
|
|
1325
|
+
MatchHeightDirective.prototype.ngAfterViewChecked = function () {
|
|
1326
|
+
this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
|
|
1398
1327
|
};
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
if (preparedObjects.includes(object)) {
|
|
1408
|
-
return object;
|
|
1409
|
-
}
|
|
1410
|
-
preparedObjects.push(object);
|
|
1411
|
-
// Retrieve the property names defined on object
|
|
1412
|
-
var propNames = Object.getOwnPropertyNames(object);
|
|
1413
|
-
try {
|
|
1414
|
-
// Freeze properties before freezing self
|
|
1415
|
-
for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
|
|
1416
|
-
var name = propNames_1_1.value;
|
|
1417
|
-
var value = object[name];
|
|
1418
|
-
if (value && typeof value === 'object') {
|
|
1419
|
-
Helper.deepFreeze(value, preparedObjects);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1328
|
+
MatchHeightDirective.prototype.matchHeight = function (parent, target) {
|
|
1329
|
+
var _this = this;
|
|
1330
|
+
if (this.isBrowser) {
|
|
1331
|
+
// Timeout is set to force Angular to wait for all actions and only continue once the process has run through.
|
|
1332
|
+
// Otherwise, an infinite loop will occur.
|
|
1333
|
+
setTimeout(function () {
|
|
1334
|
+
_this.matchHeightHelper(parent, target);
|
|
1335
|
+
}, 1);
|
|
1422
1336
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
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; }
|
|
1337
|
+
else {
|
|
1338
|
+
this.matchHeightHelper(parent, target);
|
|
1429
1339
|
}
|
|
1430
|
-
return Object.freeze(object);
|
|
1431
1340
|
};
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1341
|
+
MatchHeightDirective.prototype.matchHeightHelper = function (parent, target) {
|
|
1342
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1343
|
+
var classNames, _loop_1, this_1, classNames_1, classNames_1_1, className, e_1_1;
|
|
1344
|
+
var e_1, _a;
|
|
1345
|
+
return __generator(this, function (_b) {
|
|
1346
|
+
switch (_b.label) {
|
|
1347
|
+
case 0:
|
|
1348
|
+
if (!parent) {
|
|
1349
|
+
return [2 /*return*/];
|
|
1350
|
+
}
|
|
1351
|
+
if (!Array.isArray(target)) {
|
|
1352
|
+
classNames = [target];
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
classNames = target;
|
|
1356
|
+
}
|
|
1357
|
+
_loop_1 = function (className) {
|
|
1358
|
+
var children, itemHeights, maxHeight;
|
|
1359
|
+
return __generator(this, function (_c) {
|
|
1360
|
+
switch (_c.label) {
|
|
1361
|
+
case 0:
|
|
1362
|
+
children = parent.getElementsByClassName(className);
|
|
1363
|
+
if (!children || children.length < 2) {
|
|
1364
|
+
return [2 /*return*/, "continue"];
|
|
1365
|
+
}
|
|
1366
|
+
if (!this_1.loadLazyImages) return [3 /*break*/, 2];
|
|
1367
|
+
return [4 /*yield*/, this_1.imageService.preLoadImages({ elements: children })];
|
|
1368
|
+
case 1:
|
|
1369
|
+
_c.sent();
|
|
1370
|
+
_c.label = 2;
|
|
1371
|
+
case 2:
|
|
1372
|
+
// reset all children height
|
|
1373
|
+
Array.from(children).forEach(function (element) {
|
|
1374
|
+
element.style.height = 'initial';
|
|
1375
|
+
});
|
|
1376
|
+
itemHeights = Array.from(children).map(function (element) {
|
|
1377
|
+
if (element.getBoundingClientRect) {
|
|
1378
|
+
return element.getBoundingClientRect().height;
|
|
1379
|
+
}
|
|
1380
|
+
return 0;
|
|
1381
|
+
});
|
|
1382
|
+
maxHeight = itemHeights.reduce(function (prev, curr) { return (curr > prev ? curr : prev); }, 0);
|
|
1383
|
+
// update the child structureElements height to the tallest one
|
|
1384
|
+
Array.from(children).forEach(function (element) { return (element.style.height = maxHeight + "px"); });
|
|
1385
|
+
return [2 /*return*/];
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
};
|
|
1389
|
+
this_1 = this;
|
|
1390
|
+
_b.label = 1;
|
|
1391
|
+
case 1:
|
|
1392
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
1393
|
+
classNames_1 = __values(classNames), classNames_1_1 = classNames_1.next();
|
|
1394
|
+
_b.label = 2;
|
|
1395
|
+
case 2:
|
|
1396
|
+
if (!!classNames_1_1.done) return [3 /*break*/, 5];
|
|
1397
|
+
className = classNames_1_1.value;
|
|
1398
|
+
return [5 /*yield**/, _loop_1(className)];
|
|
1399
|
+
case 3:
|
|
1400
|
+
_b.sent();
|
|
1401
|
+
_b.label = 4;
|
|
1402
|
+
case 4:
|
|
1403
|
+
classNames_1_1 = classNames_1.next();
|
|
1404
|
+
return [3 /*break*/, 2];
|
|
1405
|
+
case 5: return [3 /*break*/, 8];
|
|
1406
|
+
case 6:
|
|
1407
|
+
e_1_1 = _b.sent();
|
|
1408
|
+
e_1 = { error: e_1_1 };
|
|
1409
|
+
return [3 /*break*/, 8];
|
|
1410
|
+
case 7:
|
|
1411
|
+
try {
|
|
1412
|
+
if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
|
|
1413
|
+
}
|
|
1414
|
+
finally { if (e_1) throw e_1.error; }
|
|
1415
|
+
return [7 /*endfinally*/];
|
|
1416
|
+
case 8: return [2 /*return*/];
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1443
1419
|
});
|
|
1444
|
-
return uuid;
|
|
1445
|
-
};
|
|
1446
|
-
/**
|
|
1447
|
-
* Parse date string to date object
|
|
1448
|
-
*/
|
|
1449
|
-
Helper.parseDate = function (dateString) {
|
|
1450
|
-
var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
|
|
1451
|
-
var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/;
|
|
1452
|
-
if (typeof dateString === 'string') {
|
|
1453
|
-
var isoExec = reISO.exec(dateString);
|
|
1454
|
-
if (isoExec) {
|
|
1455
|
-
return new Date(dateString);
|
|
1456
|
-
}
|
|
1457
|
-
var msAjaxExec = reMsAjax.exec(dateString);
|
|
1458
|
-
if (msAjaxExec) {
|
|
1459
|
-
var cleaned = msAjaxExec[1].split(/[-+,.]/);
|
|
1460
|
-
return new Date(cleaned[0] ? +cleaned[0] : 0 - +cleaned[1]);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
return dateString;
|
|
1464
1420
|
};
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1421
|
+
return MatchHeightDirective;
|
|
1422
|
+
}());
|
|
1423
|
+
MatchHeightDirective.decorators = [
|
|
1424
|
+
{ type: i0.Directive, args: [{
|
|
1425
|
+
selector: '[ltMatchHeight]',
|
|
1426
|
+
},] }
|
|
1427
|
+
];
|
|
1428
|
+
MatchHeightDirective.ctorParameters = function () { return [
|
|
1429
|
+
{ type: i0.ElementRef },
|
|
1430
|
+
{ type: ImageService },
|
|
1431
|
+
{ type: String, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] }
|
|
1432
|
+
]; };
|
|
1433
|
+
MatchHeightDirective.propDecorators = {
|
|
1434
|
+
ltMatchHeight: [{ type: i0.Input }],
|
|
1435
|
+
loadLazyImages: [{ type: i0.Input }],
|
|
1436
|
+
onResize: [{ type: i0.HostListener, args: ['window:resize',] }]
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Reszise detection
|
|
1441
|
+
* (inpsired by: https://stackblitz.com/edit/angular-resizable)
|
|
1442
|
+
*/
|
|
1443
|
+
var ResizableDirective = /** @class */ (function () {
|
|
1444
|
+
function ResizableDirective(el) {
|
|
1445
|
+
this.el = el;
|
|
1446
|
+
this.resizableGrabWidth = 8;
|
|
1447
|
+
this.resizableMinWidth = 10;
|
|
1448
|
+
this.dragging = false;
|
|
1449
|
+
}
|
|
1450
|
+
ResizableDirective.prototype.ngOnInit = function () {
|
|
1451
|
+
this.addListenerToDocument();
|
|
1452
|
+
this.addListenerToElement();
|
|
1453
|
+
};
|
|
1454
|
+
ResizableDirective.prototype.mouseMoveG = function (evt) {
|
|
1455
|
+
if (!this.dragging) {
|
|
1456
|
+
return;
|
|
1481
1457
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1458
|
+
this.newWidth(evt.clientX - this.el.nativeElement.offsetLeft);
|
|
1459
|
+
evt.stopPropagation();
|
|
1460
|
+
};
|
|
1461
|
+
ResizableDirective.prototype.newWidth = function (wid) {
|
|
1462
|
+
var result = Math.max(this.resizableMinWidth, wid);
|
|
1463
|
+
this.el.nativeElement.style.width = result + 'px';
|
|
1464
|
+
};
|
|
1465
|
+
ResizableDirective.prototype.mouseDown = function (evt) {
|
|
1466
|
+
if (this.inDragRegion(evt)) {
|
|
1467
|
+
this.dragging = true;
|
|
1468
|
+
this.preventGlobalMouseEvents();
|
|
1469
|
+
evt.stopPropagation();
|
|
1486
1470
|
}
|
|
1487
|
-
return {
|
|
1488
|
-
name: data[0],
|
|
1489
|
-
version: data[1],
|
|
1490
|
-
};
|
|
1491
1471
|
};
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
// Equal
|
|
1499
|
-
if (a === b) {
|
|
1500
|
-
return true;
|
|
1472
|
+
ResizableDirective.prototype.restoreGlobalMouseEvents = function () {
|
|
1473
|
+
document.body.style['pointer-events'] = 'auto';
|
|
1474
|
+
};
|
|
1475
|
+
ResizableDirective.prototype.mouseUpG = function (evt) {
|
|
1476
|
+
if (!this.dragging) {
|
|
1477
|
+
return;
|
|
1501
1478
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1479
|
+
this.restoreGlobalMouseEvents();
|
|
1480
|
+
this.dragging = false;
|
|
1481
|
+
evt.stopPropagation();
|
|
1482
|
+
};
|
|
1483
|
+
ResizableDirective.prototype.mouseMove = function (evt) {
|
|
1484
|
+
if (this.inDragRegion(evt) || this.dragging) {
|
|
1485
|
+
this.el.nativeElement.style.cursor = 'col-resize';
|
|
1505
1486
|
}
|
|
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;
|
|
1487
|
+
else {
|
|
1488
|
+
this.el.nativeElement.style.cursor = 'default';
|
|
1524
1489
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1490
|
+
};
|
|
1491
|
+
ResizableDirective.prototype.preventGlobalMouseEvents = function () {
|
|
1492
|
+
document.body.style['pointer-events'] = 'none';
|
|
1493
|
+
};
|
|
1494
|
+
ResizableDirective.prototype.inDragRegion = function (evt) {
|
|
1495
|
+
return this.el.nativeElement.clientWidth - evt.clientX + this.el.nativeElement.offsetLeft < this.resizableGrabWidth;
|
|
1496
|
+
};
|
|
1497
|
+
ResizableDirective.prototype.addListenerToDocument = function () {
|
|
1498
|
+
var _this = this;
|
|
1499
|
+
document.addEventListener('mousemove', function (e) {
|
|
1500
|
+
_this.mouseMoveG(e);
|
|
1501
|
+
}, true);
|
|
1502
|
+
document.addEventListener('mouseup', function (e) {
|
|
1503
|
+
_this.mouseUpG(e);
|
|
1504
|
+
}, true);
|
|
1505
|
+
};
|
|
1506
|
+
ResizableDirective.prototype.addListenerToElement = function () {
|
|
1507
|
+
var _this = this;
|
|
1508
|
+
this.el.nativeElement.addEventListener('mousedown', function (e) {
|
|
1509
|
+
_this.mouseDown(e);
|
|
1510
|
+
}, true);
|
|
1511
|
+
this.el.nativeElement.addEventListener('mousemove', function (e) {
|
|
1512
|
+
_this.mouseMove(e);
|
|
1513
|
+
}, true);
|
|
1514
|
+
};
|
|
1515
|
+
return ResizableDirective;
|
|
1516
|
+
}());
|
|
1517
|
+
ResizableDirective.decorators = [
|
|
1518
|
+
{ type: i0.Directive, args: [{
|
|
1519
|
+
selector: '[ltResizable]',
|
|
1520
|
+
},] }
|
|
1521
|
+
];
|
|
1522
|
+
ResizableDirective.ctorParameters = function () { return [
|
|
1523
|
+
{ type: i0.ElementRef }
|
|
1524
|
+
]; };
|
|
1525
|
+
ResizableDirective.propDecorators = {
|
|
1526
|
+
resizableGrabWidth: [{ type: i0.Input }],
|
|
1527
|
+
resizableMinWidth: [{ type: i0.Input }]
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Truncate string with ellipses
|
|
1532
|
+
*/
|
|
1533
|
+
var EllipsesPipe = /** @class */ (function () {
|
|
1534
|
+
function EllipsesPipe() {
|
|
1535
|
+
}
|
|
1536
|
+
EllipsesPipe.prototype.transform = function (value, limit) {
|
|
1537
|
+
if (!value) {
|
|
1538
|
+
return null;
|
|
1544
1539
|
}
|
|
1545
|
-
|
|
1546
|
-
return true;
|
|
1540
|
+
return value.length > limit ? value.substring(0, limit) + '...' : value;
|
|
1547
1541
|
};
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1542
|
+
return EllipsesPipe;
|
|
1543
|
+
}());
|
|
1544
|
+
EllipsesPipe.decorators = [
|
|
1545
|
+
{ type: i0.Pipe, args: [{
|
|
1546
|
+
name: 'ltEllipses',
|
|
1547
|
+
},] }
|
|
1548
|
+
];
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Declarate html as safe
|
|
1552
|
+
*/
|
|
1553
|
+
var SafeHtmlPipe = /** @class */ (function () {
|
|
1554
|
+
function SafeHtmlPipe(sanitized) {
|
|
1555
|
+
this.sanitized = sanitized;
|
|
1556
|
+
}
|
|
1557
|
+
SafeHtmlPipe.prototype.transform = function (value) {
|
|
1558
|
+
return this.sanitized.bypassSecurityTrustHtml(value);
|
|
1554
1559
|
};
|
|
1560
|
+
return SafeHtmlPipe;
|
|
1561
|
+
}());
|
|
1562
|
+
SafeHtmlPipe.decorators = [
|
|
1563
|
+
{ type: i0.Pipe, args: [{ name: 'ltSafeHtml' },] }
|
|
1564
|
+
];
|
|
1565
|
+
SafeHtmlPipe.ctorParameters = function () { return [
|
|
1566
|
+
{ type: i1.DomSanitizer }
|
|
1567
|
+
]; };
|
|
1568
|
+
|
|
1569
|
+
// Imported and exported elements
|
|
1570
|
+
var elements = [
|
|
1571
|
+
// Directives
|
|
1572
|
+
ContextMenuDirective,
|
|
1573
|
+
LazyLoadDirective,
|
|
1574
|
+
MatchHeightDirective,
|
|
1575
|
+
ResizableDirective,
|
|
1576
|
+
// Pipes
|
|
1577
|
+
EllipsesPipe,
|
|
1578
|
+
SafeHtmlPipe,
|
|
1579
|
+
];
|
|
1580
|
+
/**
|
|
1581
|
+
* Base module
|
|
1582
|
+
*/
|
|
1583
|
+
var BaseModule = /** @class */ (function () {
|
|
1584
|
+
function BaseModule() {
|
|
1585
|
+
}
|
|
1555
1586
|
/**
|
|
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
|
|
1587
|
+
* Set configuration of base module in root module of the app
|
|
1560
1588
|
*/
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
var
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1589
|
+
BaseModule.forRoot = function (baseModuleConfig) {
|
|
1590
|
+
if (baseModuleConfig === void 0) { baseModuleConfig = {}; }
|
|
1591
|
+
// Default config
|
|
1592
|
+
var config = Object.assign({ apiUrl: 'localhost:3000', authGuardRedirectUrl: '/auth', logging: false, version: null, prefix: null, scrollDetectionOffset: 200, scrollOffset: 100, storageType: 'local' }, baseModuleConfig);
|
|
1593
|
+
// Prepare providers
|
|
1594
|
+
var providers = [
|
|
1595
|
+
{
|
|
1596
|
+
provide: BASE_MODULE_CONFIG,
|
|
1597
|
+
useValue: baseModuleConfig,
|
|
1598
|
+
},
|
|
1599
|
+
];
|
|
1600
|
+
// Add apollo features if API URL is set
|
|
1601
|
+
if (baseModuleConfig.apiUrl) {
|
|
1602
|
+
providers.push({
|
|
1603
|
+
provide: i1$1.APOLLO_OPTIONS,
|
|
1604
|
+
useFactory: apolloOptionsFactory,
|
|
1605
|
+
deps: [BASE_MODULE_CONFIG, http.HttpLink, AuthService],
|
|
1606
|
+
});
|
|
1576
1607
|
}
|
|
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; }
|
|
1608
|
+
else if (config.logging) {
|
|
1609
|
+
console.log('apiUrl is missing, ApolloLink is not initialized');
|
|
1583
1610
|
}
|
|
1584
|
-
|
|
1611
|
+
// Return root module
|
|
1612
|
+
return {
|
|
1613
|
+
ngModule: BaseModule,
|
|
1614
|
+
providers: providers,
|
|
1615
|
+
};
|
|
1585
1616
|
};
|
|
1586
|
-
return
|
|
1617
|
+
return BaseModule;
|
|
1587
1618
|
}());
|
|
1619
|
+
BaseModule.decorators = [
|
|
1620
|
+
{ type: i0.NgModule, args: [{
|
|
1621
|
+
declarations: elements,
|
|
1622
|
+
exports: elements,
|
|
1623
|
+
},] }
|
|
1624
|
+
];
|
|
1588
1625
|
|
|
1589
1626
|
/**
|
|
1590
1627
|
* Standard class
|