tnp-helpers 13.1.11 → 13.1.13
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/app.js +3 -3
- package/browser/README.md +24 -24
- package/browser/esm2020/lib/base-component.mjs +49 -49
- package/browser/esm2020/lib/base-formly-component.mjs +112 -112
- package/browser/esm2020/lib/condition-wait.mjs +45 -45
- package/browser/esm2020/lib/constants.mjs +7 -7
- package/browser/esm2020/lib/dual-component-ctrl.mjs +118 -118
- package/browser/esm2020/lib/firedev-models.mjs +3 -3
- package/browser/esm2020/lib/helpers-array-obj.mjs +82 -82
- package/browser/esm2020/lib/helpers-environment.mjs +32 -32
- package/browser/esm2020/lib/helpers-numbers.mjs +8 -8
- package/browser/esm2020/lib/helpers-strings-regexes.mjs +50 -50
- package/browser/esm2020/lib/helpers-strings.mjs +252 -252
- package/browser/esm2020/lib/helpers.mjs +280 -280
- package/browser/esm2020/lib/index.mjs +14 -14
- package/browser/esm2020/lib/long-press.directive.mjs +112 -112
- package/browser/esm2020/lib/project.mjs +429 -429
- package/browser/esm2020/lib/resize-service.mjs +21 -21
- package/browser/esm2020/public-api.mjs +1 -1
- package/browser/esm2020/tnp-helpers.mjs +4 -4
- package/browser/fesm2015/tnp-helpers.mjs +1542 -1542
- package/browser/fesm2020/tnp-helpers.mjs +1534 -1534
- package/browser/lib/base-component.d.ts +16 -16
- package/browser/lib/base-formly-component.d.ts +30 -30
- package/browser/lib/condition-wait.d.ts +7 -7
- package/browser/lib/constants.d.ts +5 -5
- package/browser/lib/dual-component-ctrl.d.ts +24 -24
- package/browser/lib/firedev-models.d.ts +12 -12
- package/browser/lib/helpers-array-obj.d.ts +14 -14
- package/browser/lib/helpers-environment.d.ts +4 -4
- package/browser/lib/helpers-numbers.d.ts +2 -2
- package/browser/lib/helpers-strings-regexes.d.ts +27 -27
- package/browser/lib/helpers-strings.d.ts +49 -49
- package/browser/lib/helpers.d.ts +27 -27
- package/browser/lib/index.d.ts +10 -10
- package/browser/lib/long-press.directive.d.ts +24 -24
- package/browser/lib/project.d.ts +94 -94
- package/browser/lib/resize-service.d.ts +8 -8
- package/browser/tnp-helpers.d.ts +4 -4
- package/client/README.md +24 -24
- package/client/esm2020/lib/base-component.mjs +49 -49
- package/client/esm2020/lib/base-formly-component.mjs +112 -112
- package/client/esm2020/lib/condition-wait.mjs +45 -45
- package/client/esm2020/lib/constants.mjs +7 -7
- package/client/esm2020/lib/dual-component-ctrl.mjs +118 -118
- package/client/esm2020/lib/firedev-models.mjs +3 -3
- package/client/esm2020/lib/helpers-array-obj.mjs +82 -82
- package/client/esm2020/lib/helpers-environment.mjs +32 -32
- package/client/esm2020/lib/helpers-numbers.mjs +8 -8
- package/client/esm2020/lib/helpers-strings-regexes.mjs +50 -50
- package/client/esm2020/lib/helpers-strings.mjs +252 -252
- package/client/esm2020/lib/helpers.mjs +280 -280
- package/client/esm2020/lib/index.mjs +14 -14
- package/client/esm2020/lib/long-press.directive.mjs +112 -112
- package/client/esm2020/lib/project.mjs +429 -429
- package/client/esm2020/lib/resize-service.mjs +21 -21
- package/client/esm2020/public-api.mjs +1 -1
- package/client/esm2020/tnp-helpers.mjs +4 -4
- package/client/fesm2015/tnp-helpers.mjs +1542 -1542
- package/client/fesm2020/tnp-helpers.mjs +1534 -1534
- package/client/lib/base-component.d.ts +16 -16
- package/client/lib/base-formly-component.d.ts +30 -30
- package/client/lib/condition-wait.d.ts +7 -7
- package/client/lib/constants.d.ts +5 -5
- package/client/lib/dual-component-ctrl.d.ts +24 -24
- package/client/lib/firedev-models.d.ts +12 -12
- package/client/lib/helpers-array-obj.d.ts +14 -14
- package/client/lib/helpers-environment.d.ts +4 -4
- package/client/lib/helpers-numbers.d.ts +2 -2
- package/client/lib/helpers-strings-regexes.d.ts +27 -27
- package/client/lib/helpers-strings.d.ts +49 -49
- package/client/lib/helpers.d.ts +27 -27
- package/client/lib/index.d.ts +10 -10
- package/client/lib/long-press.directive.d.ts +24 -24
- package/client/lib/project.d.ts +94 -94
- package/client/lib/resize-service.d.ts +8 -8
- package/client/tnp-helpers.d.ts +4 -4
- package/index.d.ts +1 -1
- package/lib/angular.helper.d.ts +22 -22
- package/lib/base-component.d.ts +13 -13
- package/lib/base-component.js +3 -3
- package/lib/base-formly-component.d.ts +27 -27
- package/lib/base-formly-component.js +3 -3
- package/lib/condition-wait.d.ts +8 -8
- package/lib/constants.d.ts +6 -6
- package/lib/dual-component-ctrl.d.ts +24 -24
- package/lib/dual-component-ctrl.js +3 -3
- package/lib/firedev-models.d.ts +13 -13
- package/lib/git-project.d.ts +46 -46
- package/lib/helpers-array-obj.d.ts +15 -15
- package/lib/helpers-cli-tool.backend.d.ts +55 -55
- package/lib/helpers-dependencies.backend.d.ts +11 -11
- package/lib/helpers-environment.d.ts +5 -5
- package/lib/helpers-file-folders.backend.d.ts +83 -83
- package/lib/helpers-git.backend.d.ts +43 -43
- package/lib/helpers-json5.backend.d.ts +16 -16
- package/lib/helpers-morphi-framework.backend.d.ts +4 -4
- package/lib/helpers-network.backend.d.ts +8 -8
- package/lib/helpers-npm.backend.d.ts +3 -3
- package/lib/helpers-numbers.d.ts +3 -3
- package/lib/helpers-path.backend.d.ts +7 -7
- package/lib/helpers-process.backend.d.ts +53 -53
- package/lib/helpers-strings-regexes.d.ts +28 -28
- package/lib/helpers-strings.d.ts +50 -50
- package/lib/helpers-system-terminal.backend.d.ts +5 -5
- package/lib/helpers-vscode.backend.d.ts +5 -5
- package/lib/helpers.d.ts +69 -69
- package/lib/helpers.js +2 -2
- package/lib/index.d.ts +11 -11
- package/lib/long-press.directive.d.ts +22 -22
- package/lib/merge-helpers.backend.d.ts +23 -23
- package/lib/project.d.ts +97 -97
- package/lib/resize-service.d.ts +6 -6
- package/lib/ts-code/index.d.ts +1 -1
- package/lib/ts-code/ts-code-extractor.d.ts +14 -14
- package/lib/ts-code/ts-code-modifier.backend.d.ts +12 -12
- package/package.json +2 -2
- package/package.json_devDependencies.json +222 -222
- package/package.json_tnp.json5 +44 -44
- package/tmp-environment.json +8 -8
- package/websql/README.md +24 -24
- package/websql/esm2020/lib/base-component.mjs +49 -49
- package/websql/esm2020/lib/base-formly-component.mjs +112 -112
- package/websql/esm2020/lib/condition-wait.mjs +45 -45
- package/websql/esm2020/lib/constants.mjs +7 -7
- package/websql/esm2020/lib/dual-component-ctrl.mjs +118 -118
- package/websql/esm2020/lib/firedev-models.mjs +3 -3
- package/websql/esm2020/lib/helpers-array-obj.mjs +82 -82
- package/websql/esm2020/lib/helpers-environment.mjs +32 -32
- package/websql/esm2020/lib/helpers-numbers.mjs +8 -8
- package/websql/esm2020/lib/helpers-strings-regexes.mjs +50 -50
- package/websql/esm2020/lib/helpers-strings.mjs +252 -252
- package/websql/esm2020/lib/helpers.mjs +280 -280
- package/websql/esm2020/lib/index.mjs +14 -14
- package/websql/esm2020/lib/long-press.directive.mjs +112 -112
- package/websql/esm2020/lib/project.mjs +429 -429
- package/websql/esm2020/lib/resize-service.mjs +21 -21
- package/websql/esm2020/public-api.mjs +1 -1
- package/websql/esm2020/tnp-helpers.mjs +4 -4
- package/websql/fesm2015/tnp-helpers.mjs +1542 -1542
- package/websql/fesm2020/tnp-helpers.mjs +1534 -1534
- package/websql/lib/base-component.d.ts +16 -16
- package/websql/lib/base-formly-component.d.ts +30 -30
- package/websql/lib/condition-wait.d.ts +7 -7
- package/websql/lib/constants.d.ts +5 -5
- package/websql/lib/dual-component-ctrl.d.ts +24 -24
- package/websql/lib/firedev-models.d.ts +12 -12
- package/websql/lib/helpers-array-obj.d.ts +14 -14
- package/websql/lib/helpers-environment.d.ts +4 -4
- package/websql/lib/helpers-numbers.d.ts +2 -2
- package/websql/lib/helpers-strings-regexes.d.ts +27 -27
- package/websql/lib/helpers-strings.d.ts +49 -49
- package/websql/lib/helpers.d.ts +27 -27
- package/websql/lib/index.d.ts +10 -10
- package/websql/lib/long-press.directive.d.ts +24 -24
- package/websql/lib/project.d.ts +94 -94
- package/websql/lib/resize-service.d.ts +8 -8
- package/websql/tnp-helpers.d.ts +4 -4
|
@@ -9,1572 +9,1572 @@ import { FieldType } from '@ngx-formly/core';
|
|
|
9
9
|
import { Log, Level } from 'ng2-logger/websql';
|
|
10
10
|
import * as elementResizeDetectorMaker from 'element-resize-detector';
|
|
11
11
|
|
|
12
|
-
class HelpersArrayObj {
|
|
13
|
-
from(s) {
|
|
14
|
-
if (_.isArray(s)) {
|
|
15
|
-
return s;
|
|
16
|
-
}
|
|
17
|
-
if (_.isString(s)) {
|
|
18
|
-
return s.split(' ');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
second(arr) {
|
|
22
|
-
if (!Array.isArray(arr) || arr.length < 2) {
|
|
23
|
-
return void 0;
|
|
24
|
-
}
|
|
25
|
-
return arr[1];
|
|
26
|
-
}
|
|
27
|
-
arrayMoveElementBefore(arr, a, b, prop) {
|
|
28
|
-
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
29
|
-
_.pullAt(arr, indexA);
|
|
30
|
-
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
31
|
-
if (indexB === 0) {
|
|
32
|
-
arr.unshift(a);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
arr.splice(indexB - 1, 0, a);
|
|
36
|
-
}
|
|
37
|
-
return arr;
|
|
38
|
-
}
|
|
39
|
-
arrayMoveElementAfterB(arr, a, b, prop) {
|
|
40
|
-
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
41
|
-
_.pullAt(arr, indexA);
|
|
42
|
-
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
43
|
-
if (indexB === arr.length - 1) {
|
|
44
|
-
arr.push(a);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
arr.splice(indexB + 1, 0, a);
|
|
48
|
-
}
|
|
49
|
-
return arr;
|
|
50
|
-
}
|
|
51
|
-
uniqArray(array, uniqueProperty) {
|
|
52
|
-
var seen = {};
|
|
53
|
-
return array
|
|
54
|
-
.filter(f => !!f)
|
|
55
|
-
.filter(function (item) {
|
|
56
|
-
return seen.hasOwnProperty(uniqueProperty ? item[uniqueProperty] : item) ? false
|
|
57
|
-
: (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
sortKeys(obj) {
|
|
61
|
-
if (_.isArray(obj)) {
|
|
62
|
-
return obj.map(Helpers.arrays.sortKeys);
|
|
63
|
-
}
|
|
64
|
-
if (_.isObject(obj)) {
|
|
65
|
-
return _.fromPairs(_.keys(obj).sort().map(key => [key, Helpers.arrays.sortKeys(obj[key])]));
|
|
66
|
-
}
|
|
67
|
-
return obj;
|
|
68
|
-
}
|
|
69
|
-
;
|
|
70
|
-
/**
|
|
71
|
-
* Fuzzy search
|
|
72
|
-
*/
|
|
73
|
-
fuzzy(query, list, valueFn) {
|
|
74
|
-
const resultsFuzzy = fuzzy.filter(query, list.map(k => valueFn ? valueFn(k) : k));
|
|
75
|
-
const resultsFuzzyKebab = fuzzy.filter(_.kebabCase(query), list.map(k => _.kebabCase((valueFn ? valueFn(k) : k))));
|
|
76
|
-
const matches = resultsFuzzy.map((el) => el.string);
|
|
77
|
-
const matchesKebab = resultsFuzzyKebab.map((el) => el.string);
|
|
78
|
-
const results = (resultsFuzzy.length === 0) ? [] : list.filter(k => {
|
|
79
|
-
return matches.includes((valueFn ? valueFn(k) : k));
|
|
80
|
-
});
|
|
81
|
-
if (matches.length === 0 && matchesKebab.length > 0) {
|
|
82
|
-
const m = list.find(k => _.kebabCase((valueFn ? valueFn(k) : k)) === _.first(matchesKebab));
|
|
83
|
-
results.push(m);
|
|
84
|
-
matches.push((valueFn ? valueFn(m) : m));
|
|
85
|
-
}
|
|
86
|
-
return { matches, results };
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
;
|
|
12
|
+
class HelpersArrayObj {
|
|
13
|
+
from(s) {
|
|
14
|
+
if (_.isArray(s)) {
|
|
15
|
+
return s;
|
|
16
|
+
}
|
|
17
|
+
if (_.isString(s)) {
|
|
18
|
+
return s.split(' ');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
second(arr) {
|
|
22
|
+
if (!Array.isArray(arr) || arr.length < 2) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
return arr[1];
|
|
26
|
+
}
|
|
27
|
+
arrayMoveElementBefore(arr, a, b, prop) {
|
|
28
|
+
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
29
|
+
_.pullAt(arr, indexA);
|
|
30
|
+
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
31
|
+
if (indexB === 0) {
|
|
32
|
+
arr.unshift(a);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
arr.splice(indexB - 1, 0, a);
|
|
36
|
+
}
|
|
37
|
+
return arr;
|
|
38
|
+
}
|
|
39
|
+
arrayMoveElementAfterB(arr, a, b, prop) {
|
|
40
|
+
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
41
|
+
_.pullAt(arr, indexA);
|
|
42
|
+
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
43
|
+
if (indexB === arr.length - 1) {
|
|
44
|
+
arr.push(a);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
arr.splice(indexB + 1, 0, a);
|
|
48
|
+
}
|
|
49
|
+
return arr;
|
|
50
|
+
}
|
|
51
|
+
uniqArray(array, uniqueProperty) {
|
|
52
|
+
var seen = {};
|
|
53
|
+
return array
|
|
54
|
+
.filter(f => !!f)
|
|
55
|
+
.filter(function (item) {
|
|
56
|
+
return seen.hasOwnProperty(uniqueProperty ? item[uniqueProperty] : item) ? false
|
|
57
|
+
: (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
sortKeys(obj) {
|
|
61
|
+
if (_.isArray(obj)) {
|
|
62
|
+
return obj.map(Helpers.arrays.sortKeys);
|
|
63
|
+
}
|
|
64
|
+
if (_.isObject(obj)) {
|
|
65
|
+
return _.fromPairs(_.keys(obj).sort().map(key => [key, Helpers.arrays.sortKeys(obj[key])]));
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
;
|
|
70
|
+
/**
|
|
71
|
+
* Fuzzy search
|
|
72
|
+
*/
|
|
73
|
+
fuzzy(query, list, valueFn) {
|
|
74
|
+
const resultsFuzzy = fuzzy.filter(query, list.map(k => valueFn ? valueFn(k) : k));
|
|
75
|
+
const resultsFuzzyKebab = fuzzy.filter(_.kebabCase(query), list.map(k => _.kebabCase((valueFn ? valueFn(k) : k))));
|
|
76
|
+
const matches = resultsFuzzy.map((el) => el.string);
|
|
77
|
+
const matchesKebab = resultsFuzzyKebab.map((el) => el.string);
|
|
78
|
+
const results = (resultsFuzzy.length === 0) ? [] : list.filter(k => {
|
|
79
|
+
return matches.includes((valueFn ? valueFn(k) : k));
|
|
80
|
+
});
|
|
81
|
+
if (matches.length === 0 && matchesKebab.length > 0) {
|
|
82
|
+
const m = list.find(k => _.kebabCase((valueFn ? valueFn(k) : k)) === _.first(matchesKebab));
|
|
83
|
+
results.push(m);
|
|
84
|
+
matches.push((valueFn ? valueFn(m) : m));
|
|
85
|
+
}
|
|
86
|
+
return { matches, results };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
;
|
|
90
90
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers-array-obj.ts
|
|
91
91
|
|
|
92
|
-
class HelpersStringsRegexes {
|
|
93
|
-
escapeStringForRegEx(s) {
|
|
94
|
-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
95
|
-
}
|
|
96
|
-
matchExactOnce(s, regex) {
|
|
97
|
-
if (!_.isString(s) || !_.isRegExp(regex)) {
|
|
98
|
-
return void 0;
|
|
99
|
-
}
|
|
100
|
-
const result = s.match(regex);
|
|
101
|
-
if (_.isNil(result)) {
|
|
102
|
-
return void 0;
|
|
103
|
-
}
|
|
104
|
-
return result.length >= 1 ? _.first(result) : void 0;
|
|
105
|
-
}
|
|
106
|
-
get regex() {
|
|
107
|
-
return {
|
|
108
|
-
/**
|
|
109
|
-
* mathes
|
|
110
|
-
* xxx.xxx.xxx.xxx
|
|
111
|
-
* xxx.xxx.xxx.xxx:port
|
|
112
|
-
* http://xxx.xxx.xxx.xxx:port
|
|
113
|
-
* http://xxx.xxx.xxx.xxx
|
|
114
|
-
* https://xxx.xxx.xxx.xxx:port
|
|
115
|
-
* https://xxx.xxx.xxx.xxx *
|
|
116
|
-
*/
|
|
117
|
-
get forStringWithIpHost() {
|
|
118
|
-
const regex = /(http(s)?\:\/\/)?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\:[0-9]+)?/;
|
|
119
|
-
return regex;
|
|
120
|
-
},
|
|
121
|
-
/**
|
|
122
|
-
* mathes
|
|
123
|
-
* http://domain.com:port
|
|
124
|
-
* http://domain.com
|
|
125
|
-
* http://domain:port
|
|
126
|
-
* http://domain
|
|
127
|
-
* https://domain.com:port
|
|
128
|
-
* https://domain.com
|
|
129
|
-
* https://domain:port
|
|
130
|
-
* https://domain
|
|
131
|
-
*/
|
|
132
|
-
get forStringWithDomainHost() {
|
|
133
|
-
const regex = /(((http(s)?\:\/\/)?[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+(\:[0-9]+)?)|((http(s)?\:\/\/)[a-zA-Z0-9-]{1,61}))/;
|
|
134
|
-
return regex;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
;
|
|
92
|
+
class HelpersStringsRegexes {
|
|
93
|
+
escapeStringForRegEx(s) {
|
|
94
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
95
|
+
}
|
|
96
|
+
matchExactOnce(s, regex) {
|
|
97
|
+
if (!_.isString(s) || !_.isRegExp(regex)) {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
const result = s.match(regex);
|
|
101
|
+
if (_.isNil(result)) {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
return result.length >= 1 ? _.first(result) : void 0;
|
|
105
|
+
}
|
|
106
|
+
get regex() {
|
|
107
|
+
return {
|
|
108
|
+
/**
|
|
109
|
+
* mathes
|
|
110
|
+
* xxx.xxx.xxx.xxx
|
|
111
|
+
* xxx.xxx.xxx.xxx:port
|
|
112
|
+
* http://xxx.xxx.xxx.xxx:port
|
|
113
|
+
* http://xxx.xxx.xxx.xxx
|
|
114
|
+
* https://xxx.xxx.xxx.xxx:port
|
|
115
|
+
* https://xxx.xxx.xxx.xxx *
|
|
116
|
+
*/
|
|
117
|
+
get forStringWithIpHost() {
|
|
118
|
+
const regex = /(http(s)?\:\/\/)?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\:[0-9]+)?/;
|
|
119
|
+
return regex;
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* mathes
|
|
123
|
+
* http://domain.com:port
|
|
124
|
+
* http://domain.com
|
|
125
|
+
* http://domain:port
|
|
126
|
+
* http://domain
|
|
127
|
+
* https://domain.com:port
|
|
128
|
+
* https://domain.com
|
|
129
|
+
* https://domain:port
|
|
130
|
+
* https://domain
|
|
131
|
+
*/
|
|
132
|
+
get forStringWithDomainHost() {
|
|
133
|
+
const regex = /(((http(s)?\:\/\/)?[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+(\:[0-9]+)?)|((http(s)?\:\/\/)[a-zA-Z0-9-]{1,61}))/;
|
|
134
|
+
return regex;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
;
|
|
140
140
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers-strings-regexes.ts
|
|
141
141
|
|
|
142
|
-
/* */
|
|
143
|
-
/* */
|
|
144
|
-
/* */
|
|
145
|
-
/* */
|
|
146
|
-
class HelpersEnvironment {
|
|
147
|
-
environmentName(filename, local_env_name) {
|
|
148
|
-
/* */
|
|
149
|
-
/* */
|
|
150
|
-
/* */
|
|
151
|
-
/* */
|
|
152
|
-
/* */
|
|
153
|
-
/* */
|
|
154
|
-
}
|
|
155
|
-
isValidGitRepuUrl(url) {
|
|
156
|
-
const regex = /^([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+(:\d+)?)(?::|\/)([\d\/\w.-]+?)(\.git)?$/;
|
|
157
|
-
const res = regex.test(url);
|
|
158
|
-
return res;
|
|
159
|
-
}
|
|
160
|
-
isValidIp(ip) {
|
|
161
|
-
if (!_.isString(ip)) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
ip = ip.trim();
|
|
165
|
-
if (ip === 'localhost') {
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
;
|
|
142
|
+
/* */
|
|
143
|
+
/* */
|
|
144
|
+
/* */
|
|
145
|
+
/* */
|
|
146
|
+
class HelpersEnvironment {
|
|
147
|
+
environmentName(filename, local_env_name) {
|
|
148
|
+
/* */
|
|
149
|
+
/* */
|
|
150
|
+
/* */
|
|
151
|
+
/* */
|
|
152
|
+
/* */
|
|
153
|
+
/* */
|
|
154
|
+
}
|
|
155
|
+
isValidGitRepuUrl(url) {
|
|
156
|
+
const regex = /^([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+(:\d+)?)(?::|\/)([\d\/\w.-]+?)(\.git)?$/;
|
|
157
|
+
const res = regex.test(url);
|
|
158
|
+
return res;
|
|
159
|
+
}
|
|
160
|
+
isValidIp(ip) {
|
|
161
|
+
if (!_.isString(ip)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
ip = ip.trim();
|
|
165
|
+
if (ip === 'localhost') {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
;
|
|
172
172
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers-environment.ts
|
|
173
173
|
|
|
174
|
-
class HelpersStrings {
|
|
175
|
-
/**
|
|
176
|
-
* Example:
|
|
177
|
-
*
|
|
178
|
-
* const result = interpolateString("I'm {age} years old!")
|
|
179
|
-
* .withParameters({ age: 29 });
|
|
180
|
-
*
|
|
181
|
-
* const result = interpolateString("The {a} says {n}, {n}, {n}!")
|
|
182
|
-
* .withParameters({ a: 'cow', n: 'moo' });
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* @param value string to interpolate
|
|
186
|
-
* @param parameters object with parametes
|
|
187
|
-
*/
|
|
188
|
-
interpolateString(value) {
|
|
189
|
-
if (typeof value !== 'string') {
|
|
190
|
-
Helpers.warn('[ss-logic][helper] Value for interpolation is not string: ', value);
|
|
191
|
-
return value;
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
withParameters(parameters) {
|
|
195
|
-
if (typeof parameters !== 'object') {
|
|
196
|
-
Helpers.log(parameters);
|
|
197
|
-
Helpers.warn('[ss-logic][helper] Parameters are not a object: ');
|
|
198
|
-
return value;
|
|
199
|
-
}
|
|
200
|
-
return value.replace(/{([^{}]*)}/g, function (a, b) {
|
|
201
|
-
var r = parameters[b];
|
|
202
|
-
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
numValue(pixelsCss) {
|
|
208
|
-
return parseInt(pixelsCss.replace('px', ''));
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* examples:
|
|
212
|
-
* 'aa bb bb' => ['aa','bb','cc'],
|
|
213
|
-
* 'aa' => ['aa']
|
|
214
|
-
* ['aa'] => ['aa']
|
|
215
|
-
*/
|
|
216
|
-
splitIfNeed(stringOrArr) {
|
|
217
|
-
let res = [];
|
|
218
|
-
if (_.isArray(stringOrArr)) {
|
|
219
|
-
res = stringOrArr.map(s => {
|
|
220
|
-
return s.trim();
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
if (_.isString(stringOrArr)) {
|
|
224
|
-
res = stringOrArr.split(/\s*[\s,]\s*/);
|
|
225
|
-
}
|
|
226
|
-
return res.filter(f => !!f && (f.trim() !== ''));
|
|
227
|
-
}
|
|
228
|
-
removeDoubleOrMoreEmptyLines(s) {
|
|
229
|
-
s = s?.split('\n').map(f => f.trimRight()).join('\n');
|
|
230
|
-
return s?.replace(/(\r\n|\r|\n){2,}/g, '$1\n');
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
*
|
|
234
|
-
* https://stackoverflow.com/a/57129703/1345101
|
|
235
|
-
*
|
|
236
|
-
* Returns the plural of an English word.
|
|
237
|
-
*
|
|
238
|
-
* @export
|
|
239
|
-
* @param {string} word
|
|
240
|
-
* @param {number} [amount]
|
|
241
|
-
* @returns {string}
|
|
242
|
-
*/
|
|
243
|
-
plural(word, amount) {
|
|
244
|
-
if (amount !== undefined && amount === 1) {
|
|
245
|
-
return word;
|
|
246
|
-
}
|
|
247
|
-
const plural = {
|
|
248
|
-
'(quiz)$': "$1zes",
|
|
249
|
-
'^(ox)$': "$1en",
|
|
250
|
-
'([m|l])ouse$': "$1ice",
|
|
251
|
-
'(matr|vert|ind)ix|ex$': "$1ices",
|
|
252
|
-
'(x|ch|ss|sh)$': "$1es",
|
|
253
|
-
'([^aeiouy]|qu)y$': "$1ies",
|
|
254
|
-
'(hive)$': "$1s",
|
|
255
|
-
'(?:([^f])fe|([lr])f)$': "$1$2ves",
|
|
256
|
-
'(shea|lea|loa|thie)f$': "$1ves",
|
|
257
|
-
'sis$': "ses",
|
|
258
|
-
'([ti])um$': "$1a",
|
|
259
|
-
'(tomat|potat|ech|her|vet)o$': "$1oes",
|
|
260
|
-
'(bu)s$': "$1ses",
|
|
261
|
-
'(alias)$': "$1es",
|
|
262
|
-
'(octop)us$': "$1i",
|
|
263
|
-
'(ax|test)is$': "$1es",
|
|
264
|
-
'(us)$': "$1es",
|
|
265
|
-
'([^s]+)$': "$1s"
|
|
266
|
-
};
|
|
267
|
-
const irregular = {
|
|
268
|
-
'move': 'moves',
|
|
269
|
-
'foot': 'feet',
|
|
270
|
-
'goose': 'geese',
|
|
271
|
-
'sex': 'sexes',
|
|
272
|
-
'child': 'children',
|
|
273
|
-
'man': 'men',
|
|
274
|
-
'tooth': 'teeth',
|
|
275
|
-
'person': 'people'
|
|
276
|
-
};
|
|
277
|
-
const uncountable = [
|
|
278
|
-
'sheep',
|
|
279
|
-
'fish',
|
|
280
|
-
'deer',
|
|
281
|
-
'moose',
|
|
282
|
-
'series',
|
|
283
|
-
'species',
|
|
284
|
-
'money',
|
|
285
|
-
'rice',
|
|
286
|
-
'information',
|
|
287
|
-
'equipment',
|
|
288
|
-
'bison',
|
|
289
|
-
'cod',
|
|
290
|
-
'offspring',
|
|
291
|
-
'pike',
|
|
292
|
-
'salmon',
|
|
293
|
-
'shrimp',
|
|
294
|
-
'swine',
|
|
295
|
-
'trout',
|
|
296
|
-
'aircraft',
|
|
297
|
-
'hovercraft',
|
|
298
|
-
'spacecraft',
|
|
299
|
-
'sugar',
|
|
300
|
-
'tuna',
|
|
301
|
-
'you',
|
|
302
|
-
'wood'
|
|
303
|
-
];
|
|
304
|
-
if (uncountable.indexOf(word.toLowerCase()) >= 0) {
|
|
305
|
-
return word;
|
|
306
|
-
}
|
|
307
|
-
for (const w in irregular) {
|
|
308
|
-
const pattern = new RegExp(`${w}$`, 'i');
|
|
309
|
-
const replace = irregular[w];
|
|
310
|
-
if (pattern.test(word)) {
|
|
311
|
-
return word.replace(pattern, replace);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
for (const reg in plural) {
|
|
315
|
-
const pattern = new RegExp(reg, 'i');
|
|
316
|
-
if (pattern.test(word)) {
|
|
317
|
-
return word.replace(pattern, plural[reg]);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return word;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* https://stackoverflow.com/a/57129703/1345101
|
|
324
|
-
*
|
|
325
|
-
* Returns the singular of an English word.
|
|
326
|
-
*
|
|
327
|
-
* @export
|
|
328
|
-
* @param {string} word
|
|
329
|
-
* @param {number} [amount]
|
|
330
|
-
* @returns {string}
|
|
331
|
-
*/
|
|
332
|
-
singular(word, amount) {
|
|
333
|
-
if (amount !== undefined && amount !== 1) {
|
|
334
|
-
return word;
|
|
335
|
-
}
|
|
336
|
-
const singular = {
|
|
337
|
-
'(quiz)zes$': "$1",
|
|
338
|
-
'(matr)ices$': "$1ix",
|
|
339
|
-
'(vert|ind)ices$': "$1ex",
|
|
340
|
-
'^(ox)en$': "$1",
|
|
341
|
-
'(alias)es$': "$1",
|
|
342
|
-
'(octop|vir)i$': "$1us",
|
|
343
|
-
'(cris|ax|test)es$': "$1is",
|
|
344
|
-
'(shoe)s$': "$1",
|
|
345
|
-
'(o)es$': "$1",
|
|
346
|
-
'(bus)es$': "$1",
|
|
347
|
-
'([m|l])ice$': "$1ouse",
|
|
348
|
-
'(x|ch|ss|sh)es$': "$1",
|
|
349
|
-
'(m)ovies$': "$1ovie",
|
|
350
|
-
'(s)eries$': "$1eries",
|
|
351
|
-
'([^aeiouy]|qu)ies$': "$1y",
|
|
352
|
-
'([lr])ves$': "$1f",
|
|
353
|
-
'(tive)s$': "$1",
|
|
354
|
-
'(hive)s$': "$1",
|
|
355
|
-
'(li|wi|kni)ves$': "$1fe",
|
|
356
|
-
'(shea|loa|lea|thie)ves$': "$1f",
|
|
357
|
-
'(^analy)ses$': "$1sis",
|
|
358
|
-
'((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$': "$1$2sis",
|
|
359
|
-
'([ti])a$': "$1um",
|
|
360
|
-
'(n)ews$': "$1ews",
|
|
361
|
-
'(h|bl)ouses$': "$1ouse",
|
|
362
|
-
'(corpse)s$': "$1",
|
|
363
|
-
'(us)es$': "$1",
|
|
364
|
-
's$': ""
|
|
365
|
-
};
|
|
366
|
-
const irregular = {
|
|
367
|
-
'move': 'moves',
|
|
368
|
-
'foot': 'feet',
|
|
369
|
-
'goose': 'geese',
|
|
370
|
-
'sex': 'sexes',
|
|
371
|
-
'child': 'children',
|
|
372
|
-
'man': 'men',
|
|
373
|
-
'tooth': 'teeth',
|
|
374
|
-
'person': 'people'
|
|
375
|
-
};
|
|
376
|
-
const uncountable = [
|
|
377
|
-
'sheep',
|
|
378
|
-
'fish',
|
|
379
|
-
'deer',
|
|
380
|
-
'moose',
|
|
381
|
-
'series',
|
|
382
|
-
'species',
|
|
383
|
-
'money',
|
|
384
|
-
'rice',
|
|
385
|
-
'information',
|
|
386
|
-
'equipment',
|
|
387
|
-
'bison',
|
|
388
|
-
'cod',
|
|
389
|
-
'offspring',
|
|
390
|
-
'pike',
|
|
391
|
-
'salmon',
|
|
392
|
-
'shrimp',
|
|
393
|
-
'swine',
|
|
394
|
-
'trout',
|
|
395
|
-
'aircraft',
|
|
396
|
-
'hovercraft',
|
|
397
|
-
'spacecraft',
|
|
398
|
-
'sugar',
|
|
399
|
-
'tuna',
|
|
400
|
-
'you',
|
|
401
|
-
'wood'
|
|
402
|
-
];
|
|
403
|
-
if (uncountable.indexOf(word.toLowerCase()) >= 0) {
|
|
404
|
-
return word;
|
|
405
|
-
}
|
|
406
|
-
for (const w in irregular) {
|
|
407
|
-
const pattern = new RegExp(`${irregular[w]}$`, 'i');
|
|
408
|
-
const replace = w;
|
|
409
|
-
if (pattern.test(word)) {
|
|
410
|
-
return word.replace(pattern, replace);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
for (const reg in singular) {
|
|
414
|
-
const pattern = new RegExp(reg, 'i');
|
|
415
|
-
if (pattern.test(word)) {
|
|
416
|
-
return word.replace(pattern, singular[reg]);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return word;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
;
|
|
174
|
+
class HelpersStrings {
|
|
175
|
+
/**
|
|
176
|
+
* Example:
|
|
177
|
+
*
|
|
178
|
+
* const result = interpolateString("I'm {age} years old!")
|
|
179
|
+
* .withParameters({ age: 29 });
|
|
180
|
+
*
|
|
181
|
+
* const result = interpolateString("The {a} says {n}, {n}, {n}!")
|
|
182
|
+
* .withParameters({ a: 'cow', n: 'moo' });
|
|
183
|
+
*
|
|
184
|
+
*
|
|
185
|
+
* @param value string to interpolate
|
|
186
|
+
* @param parameters object with parametes
|
|
187
|
+
*/
|
|
188
|
+
interpolateString(value) {
|
|
189
|
+
if (typeof value !== 'string') {
|
|
190
|
+
Helpers.warn('[ss-logic][helper] Value for interpolation is not string: ', value);
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
withParameters(parameters) {
|
|
195
|
+
if (typeof parameters !== 'object') {
|
|
196
|
+
Helpers.log(parameters);
|
|
197
|
+
Helpers.warn('[ss-logic][helper] Parameters are not a object: ');
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
return value.replace(/{([^{}]*)}/g, function (a, b) {
|
|
201
|
+
var r = parameters[b];
|
|
202
|
+
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
numValue(pixelsCss) {
|
|
208
|
+
return parseInt(pixelsCss.replace('px', ''));
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* examples:
|
|
212
|
+
* 'aa bb bb' => ['aa','bb','cc'],
|
|
213
|
+
* 'aa' => ['aa']
|
|
214
|
+
* ['aa'] => ['aa']
|
|
215
|
+
*/
|
|
216
|
+
splitIfNeed(stringOrArr) {
|
|
217
|
+
let res = [];
|
|
218
|
+
if (_.isArray(stringOrArr)) {
|
|
219
|
+
res = stringOrArr.map(s => {
|
|
220
|
+
return s.trim();
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (_.isString(stringOrArr)) {
|
|
224
|
+
res = stringOrArr.split(/\s*[\s,]\s*/);
|
|
225
|
+
}
|
|
226
|
+
return res.filter(f => !!f && (f.trim() !== ''));
|
|
227
|
+
}
|
|
228
|
+
removeDoubleOrMoreEmptyLines(s) {
|
|
229
|
+
s = s?.split('\n').map(f => f.trimRight()).join('\n');
|
|
230
|
+
return s?.replace(/(\r\n|\r|\n){2,}/g, '$1\n');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
*
|
|
234
|
+
* https://stackoverflow.com/a/57129703/1345101
|
|
235
|
+
*
|
|
236
|
+
* Returns the plural of an English word.
|
|
237
|
+
*
|
|
238
|
+
* @export
|
|
239
|
+
* @param {string} word
|
|
240
|
+
* @param {number} [amount]
|
|
241
|
+
* @returns {string}
|
|
242
|
+
*/
|
|
243
|
+
plural(word, amount) {
|
|
244
|
+
if (amount !== undefined && amount === 1) {
|
|
245
|
+
return word;
|
|
246
|
+
}
|
|
247
|
+
const plural = {
|
|
248
|
+
'(quiz)$': "$1zes",
|
|
249
|
+
'^(ox)$': "$1en",
|
|
250
|
+
'([m|l])ouse$': "$1ice",
|
|
251
|
+
'(matr|vert|ind)ix|ex$': "$1ices",
|
|
252
|
+
'(x|ch|ss|sh)$': "$1es",
|
|
253
|
+
'([^aeiouy]|qu)y$': "$1ies",
|
|
254
|
+
'(hive)$': "$1s",
|
|
255
|
+
'(?:([^f])fe|([lr])f)$': "$1$2ves",
|
|
256
|
+
'(shea|lea|loa|thie)f$': "$1ves",
|
|
257
|
+
'sis$': "ses",
|
|
258
|
+
'([ti])um$': "$1a",
|
|
259
|
+
'(tomat|potat|ech|her|vet)o$': "$1oes",
|
|
260
|
+
'(bu)s$': "$1ses",
|
|
261
|
+
'(alias)$': "$1es",
|
|
262
|
+
'(octop)us$': "$1i",
|
|
263
|
+
'(ax|test)is$': "$1es",
|
|
264
|
+
'(us)$': "$1es",
|
|
265
|
+
'([^s]+)$': "$1s"
|
|
266
|
+
};
|
|
267
|
+
const irregular = {
|
|
268
|
+
'move': 'moves',
|
|
269
|
+
'foot': 'feet',
|
|
270
|
+
'goose': 'geese',
|
|
271
|
+
'sex': 'sexes',
|
|
272
|
+
'child': 'children',
|
|
273
|
+
'man': 'men',
|
|
274
|
+
'tooth': 'teeth',
|
|
275
|
+
'person': 'people'
|
|
276
|
+
};
|
|
277
|
+
const uncountable = [
|
|
278
|
+
'sheep',
|
|
279
|
+
'fish',
|
|
280
|
+
'deer',
|
|
281
|
+
'moose',
|
|
282
|
+
'series',
|
|
283
|
+
'species',
|
|
284
|
+
'money',
|
|
285
|
+
'rice',
|
|
286
|
+
'information',
|
|
287
|
+
'equipment',
|
|
288
|
+
'bison',
|
|
289
|
+
'cod',
|
|
290
|
+
'offspring',
|
|
291
|
+
'pike',
|
|
292
|
+
'salmon',
|
|
293
|
+
'shrimp',
|
|
294
|
+
'swine',
|
|
295
|
+
'trout',
|
|
296
|
+
'aircraft',
|
|
297
|
+
'hovercraft',
|
|
298
|
+
'spacecraft',
|
|
299
|
+
'sugar',
|
|
300
|
+
'tuna',
|
|
301
|
+
'you',
|
|
302
|
+
'wood'
|
|
303
|
+
];
|
|
304
|
+
if (uncountable.indexOf(word.toLowerCase()) >= 0) {
|
|
305
|
+
return word;
|
|
306
|
+
}
|
|
307
|
+
for (const w in irregular) {
|
|
308
|
+
const pattern = new RegExp(`${w}$`, 'i');
|
|
309
|
+
const replace = irregular[w];
|
|
310
|
+
if (pattern.test(word)) {
|
|
311
|
+
return word.replace(pattern, replace);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
for (const reg in plural) {
|
|
315
|
+
const pattern = new RegExp(reg, 'i');
|
|
316
|
+
if (pattern.test(word)) {
|
|
317
|
+
return word.replace(pattern, plural[reg]);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return word;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* https://stackoverflow.com/a/57129703/1345101
|
|
324
|
+
*
|
|
325
|
+
* Returns the singular of an English word.
|
|
326
|
+
*
|
|
327
|
+
* @export
|
|
328
|
+
* @param {string} word
|
|
329
|
+
* @param {number} [amount]
|
|
330
|
+
* @returns {string}
|
|
331
|
+
*/
|
|
332
|
+
singular(word, amount) {
|
|
333
|
+
if (amount !== undefined && amount !== 1) {
|
|
334
|
+
return word;
|
|
335
|
+
}
|
|
336
|
+
const singular = {
|
|
337
|
+
'(quiz)zes$': "$1",
|
|
338
|
+
'(matr)ices$': "$1ix",
|
|
339
|
+
'(vert|ind)ices$': "$1ex",
|
|
340
|
+
'^(ox)en$': "$1",
|
|
341
|
+
'(alias)es$': "$1",
|
|
342
|
+
'(octop|vir)i$': "$1us",
|
|
343
|
+
'(cris|ax|test)es$': "$1is",
|
|
344
|
+
'(shoe)s$': "$1",
|
|
345
|
+
'(o)es$': "$1",
|
|
346
|
+
'(bus)es$': "$1",
|
|
347
|
+
'([m|l])ice$': "$1ouse",
|
|
348
|
+
'(x|ch|ss|sh)es$': "$1",
|
|
349
|
+
'(m)ovies$': "$1ovie",
|
|
350
|
+
'(s)eries$': "$1eries",
|
|
351
|
+
'([^aeiouy]|qu)ies$': "$1y",
|
|
352
|
+
'([lr])ves$': "$1f",
|
|
353
|
+
'(tive)s$': "$1",
|
|
354
|
+
'(hive)s$': "$1",
|
|
355
|
+
'(li|wi|kni)ves$': "$1fe",
|
|
356
|
+
'(shea|loa|lea|thie)ves$': "$1f",
|
|
357
|
+
'(^analy)ses$': "$1sis",
|
|
358
|
+
'((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$': "$1$2sis",
|
|
359
|
+
'([ti])a$': "$1um",
|
|
360
|
+
'(n)ews$': "$1ews",
|
|
361
|
+
'(h|bl)ouses$': "$1ouse",
|
|
362
|
+
'(corpse)s$': "$1",
|
|
363
|
+
'(us)es$': "$1",
|
|
364
|
+
's$': ""
|
|
365
|
+
};
|
|
366
|
+
const irregular = {
|
|
367
|
+
'move': 'moves',
|
|
368
|
+
'foot': 'feet',
|
|
369
|
+
'goose': 'geese',
|
|
370
|
+
'sex': 'sexes',
|
|
371
|
+
'child': 'children',
|
|
372
|
+
'man': 'men',
|
|
373
|
+
'tooth': 'teeth',
|
|
374
|
+
'person': 'people'
|
|
375
|
+
};
|
|
376
|
+
const uncountable = [
|
|
377
|
+
'sheep',
|
|
378
|
+
'fish',
|
|
379
|
+
'deer',
|
|
380
|
+
'moose',
|
|
381
|
+
'series',
|
|
382
|
+
'species',
|
|
383
|
+
'money',
|
|
384
|
+
'rice',
|
|
385
|
+
'information',
|
|
386
|
+
'equipment',
|
|
387
|
+
'bison',
|
|
388
|
+
'cod',
|
|
389
|
+
'offspring',
|
|
390
|
+
'pike',
|
|
391
|
+
'salmon',
|
|
392
|
+
'shrimp',
|
|
393
|
+
'swine',
|
|
394
|
+
'trout',
|
|
395
|
+
'aircraft',
|
|
396
|
+
'hovercraft',
|
|
397
|
+
'spacecraft',
|
|
398
|
+
'sugar',
|
|
399
|
+
'tuna',
|
|
400
|
+
'you',
|
|
401
|
+
'wood'
|
|
402
|
+
];
|
|
403
|
+
if (uncountable.indexOf(word.toLowerCase()) >= 0) {
|
|
404
|
+
return word;
|
|
405
|
+
}
|
|
406
|
+
for (const w in irregular) {
|
|
407
|
+
const pattern = new RegExp(`${irregular[w]}$`, 'i');
|
|
408
|
+
const replace = w;
|
|
409
|
+
if (pattern.test(word)) {
|
|
410
|
+
return word.replace(pattern, replace);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
for (const reg in singular) {
|
|
414
|
+
const pattern = new RegExp(reg, 'i');
|
|
415
|
+
if (pattern.test(word)) {
|
|
416
|
+
return word.replace(pattern, singular[reg]);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return word;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
;
|
|
423
423
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers-strings.ts
|
|
424
424
|
|
|
425
|
-
async function conditionWait(conditionAndTimeout) {
|
|
426
|
-
await waitFor(conditionAndTimeout);
|
|
427
|
-
}
|
|
428
|
-
function waitFor(arr, messageToShow = void 0) {
|
|
429
|
-
return new Promise(async (resolve, reject) => {
|
|
430
|
-
if (arr.length === 0) {
|
|
431
|
-
resolve(void 0);
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
const check = arr.shift();
|
|
435
|
-
if (_.isUndefined(check.timeoutCheck)) {
|
|
436
|
-
check.timeoutCheck = 2000;
|
|
437
|
-
}
|
|
438
|
-
if (_.isUndefined(check.timeoutNext)) {
|
|
439
|
-
check.timeoutNext = 4000;
|
|
440
|
-
}
|
|
441
|
-
const { timeoutCheck, timeoutNext, name } = check;
|
|
442
|
-
const resultTrue = await Helpers.runSyncOrAsync(check.callback, check);
|
|
443
|
-
if (resultTrue) {
|
|
444
|
-
setTimeout(async () => {
|
|
445
|
-
await waitFor(arr).then(() => {
|
|
446
|
-
resolve(void 0);
|
|
447
|
-
});
|
|
448
|
-
}, timeoutNext);
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
arr.unshift(check);
|
|
452
|
-
if (!messageToShow || check.errorMessage !== messageToShow) {
|
|
453
|
-
Helpers.info(check.errorMessage);
|
|
454
|
-
}
|
|
455
|
-
else {
|
|
456
|
-
}
|
|
457
|
-
setTimeout(async () => {
|
|
458
|
-
await waitFor(arr, check.errorMessage).then(() => {
|
|
459
|
-
resolve(void 0);
|
|
460
|
-
});
|
|
461
|
-
}, timeoutCheck);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
;
|
|
425
|
+
async function conditionWait(conditionAndTimeout) {
|
|
426
|
+
await waitFor(conditionAndTimeout);
|
|
427
|
+
}
|
|
428
|
+
function waitFor(arr, messageToShow = void 0) {
|
|
429
|
+
return new Promise(async (resolve, reject) => {
|
|
430
|
+
if (arr.length === 0) {
|
|
431
|
+
resolve(void 0);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
const check = arr.shift();
|
|
435
|
+
if (_.isUndefined(check.timeoutCheck)) {
|
|
436
|
+
check.timeoutCheck = 2000;
|
|
437
|
+
}
|
|
438
|
+
if (_.isUndefined(check.timeoutNext)) {
|
|
439
|
+
check.timeoutNext = 4000;
|
|
440
|
+
}
|
|
441
|
+
const { timeoutCheck, timeoutNext, name } = check;
|
|
442
|
+
const resultTrue = await Helpers.runSyncOrAsync(check.callback, check);
|
|
443
|
+
if (resultTrue) {
|
|
444
|
+
setTimeout(async () => {
|
|
445
|
+
await waitFor(arr).then(() => {
|
|
446
|
+
resolve(void 0);
|
|
447
|
+
});
|
|
448
|
+
}, timeoutNext);
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
arr.unshift(check);
|
|
452
|
+
if (!messageToShow || check.errorMessage !== messageToShow) {
|
|
453
|
+
Helpers.info(check.errorMessage);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
}
|
|
457
|
+
setTimeout(async () => {
|
|
458
|
+
await waitFor(arr, check.errorMessage).then(() => {
|
|
459
|
+
resolve(void 0);
|
|
460
|
+
});
|
|
461
|
+
}, timeoutCheck);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
;
|
|
467
467
|
({}); // @--end-of-file-for-module=tnp-helpers lib/condition-wait.ts
|
|
468
468
|
|
|
469
|
-
class HelpersNumber {
|
|
470
|
-
constructor() {
|
|
471
|
-
this.randomInteger = (max, min) => Math.round(Math.random() * (max - min)) + min;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
;
|
|
469
|
+
class HelpersNumber {
|
|
470
|
+
constructor() {
|
|
471
|
+
this.randomInteger = (max, min) => Math.round(Math.random() * (max - min)) + min;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
;
|
|
475
475
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers-numbers.ts
|
|
476
476
|
|
|
477
|
-
function applyMixins(derivedCtor, baseCtors) {
|
|
478
|
-
baseCtors.forEach(baseCtor => {
|
|
479
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
480
|
-
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
// @ts-ignore
|
|
485
|
-
class HelpersTnp extends CoreHelpers {
|
|
486
|
-
constructor(
|
|
487
|
-
/* */
|
|
488
|
-
/* */
|
|
489
|
-
/* */
|
|
490
|
-
/* */
|
|
491
|
-
/* */
|
|
492
|
-
/* */
|
|
493
|
-
/* */
|
|
494
|
-
/* */
|
|
495
|
-
/* */
|
|
496
|
-
/* */
|
|
497
|
-
/* */
|
|
498
|
-
/* */
|
|
499
|
-
/* */
|
|
500
|
-
arrays = new HelpersArrayObj(), strings = new HelpersStrings(), numbers = new HelpersNumber()) {
|
|
501
|
-
super();
|
|
502
|
-
this.arrays = arrays;
|
|
503
|
-
this.strings = strings;
|
|
504
|
-
this.numbers = numbers;
|
|
505
|
-
this.conditionWait = conditionWait;
|
|
506
|
-
/* */
|
|
507
|
-
/* */
|
|
508
|
-
/* */
|
|
509
|
-
/* */
|
|
510
|
-
/* */
|
|
511
|
-
/* */
|
|
512
|
-
/* */
|
|
513
|
-
/* */
|
|
514
|
-
/* */
|
|
515
|
-
/* */
|
|
516
|
-
/* */
|
|
517
|
-
/* */
|
|
518
|
-
/* */
|
|
519
|
-
/* */
|
|
520
|
-
/* */
|
|
521
|
-
/* */
|
|
522
|
-
/* */
|
|
523
|
-
/* */
|
|
524
|
-
/* */
|
|
525
|
-
/* */
|
|
526
|
-
/* */
|
|
527
|
-
/* */
|
|
528
|
-
/* */
|
|
529
|
-
/* */
|
|
530
|
-
/* */
|
|
531
|
-
/* */
|
|
532
|
-
/* */
|
|
533
|
-
/* */
|
|
534
|
-
/* */
|
|
535
|
-
/* */
|
|
536
|
-
/* */
|
|
537
|
-
/* */
|
|
538
|
-
/* */
|
|
539
|
-
/* */
|
|
540
|
-
/* */
|
|
541
|
-
/* */
|
|
542
|
-
/* */
|
|
543
|
-
/* */
|
|
544
|
-
/* */
|
|
545
|
-
/* */
|
|
546
|
-
/* */
|
|
547
|
-
/* */
|
|
548
|
-
/* */
|
|
549
|
-
/* */
|
|
550
|
-
/* */
|
|
551
|
-
/* */
|
|
552
|
-
/* */
|
|
553
|
-
/* */
|
|
554
|
-
/* */
|
|
555
|
-
/* */
|
|
556
|
-
/* */
|
|
557
|
-
/* */
|
|
558
|
-
/* */
|
|
559
|
-
/* */
|
|
560
|
-
/* */
|
|
561
|
-
/* */
|
|
562
|
-
/* */
|
|
563
|
-
/* */
|
|
564
|
-
/* */
|
|
565
|
-
/* */
|
|
566
|
-
/* */
|
|
567
|
-
/* */
|
|
568
|
-
/* */
|
|
569
|
-
/* */
|
|
570
|
-
/* */
|
|
571
|
-
/* */
|
|
572
|
-
/* */
|
|
573
|
-
/* */
|
|
574
|
-
/* */
|
|
575
|
-
/* */
|
|
576
|
-
/* */
|
|
577
|
-
/* */
|
|
578
|
-
/* */
|
|
579
|
-
/* */
|
|
580
|
-
/* */
|
|
581
|
-
/* */
|
|
582
|
-
/* */
|
|
583
|
-
/* */
|
|
584
|
-
this.applyMixins = applyMixins;
|
|
585
|
-
}
|
|
586
|
-
static get Instance() {
|
|
587
|
-
if (!HelpersTnp._instance) {
|
|
588
|
-
HelpersTnp._instance = new HelpersTnp();
|
|
589
|
-
}
|
|
590
|
-
return HelpersTnp._instance;
|
|
591
|
-
}
|
|
592
|
-
CLIWRAP(f, name) {
|
|
593
|
-
CLASS.setName(f, name);
|
|
594
|
-
return f;
|
|
595
|
-
}
|
|
596
|
-
/* */
|
|
597
|
-
/* */
|
|
598
|
-
/* */
|
|
599
|
-
/* */
|
|
600
|
-
/* */
|
|
601
|
-
/* */
|
|
602
|
-
/* */
|
|
603
|
-
/* */
|
|
604
|
-
/* */
|
|
605
|
-
/* */
|
|
606
|
-
/* */
|
|
607
|
-
/* */
|
|
608
|
-
/* */
|
|
609
|
-
/* */
|
|
610
|
-
/* */
|
|
611
|
-
/* */
|
|
612
|
-
/* */
|
|
613
|
-
/* */
|
|
614
|
-
/* */
|
|
615
|
-
/* */
|
|
616
|
-
/* */
|
|
617
|
-
/* */
|
|
618
|
-
/* */
|
|
619
|
-
/* */
|
|
620
|
-
/* */
|
|
621
|
-
/* */
|
|
622
|
-
/* */
|
|
623
|
-
/* */
|
|
624
|
-
/* */
|
|
625
|
-
/* */
|
|
626
|
-
/* */
|
|
627
|
-
/* */
|
|
628
|
-
/* */
|
|
629
|
-
/* */
|
|
630
|
-
/* */
|
|
631
|
-
/* */
|
|
632
|
-
/* */
|
|
633
|
-
/* */
|
|
634
|
-
async isElevated() {
|
|
635
|
-
/* */
|
|
636
|
-
/* */
|
|
637
|
-
/* */
|
|
638
|
-
/* */
|
|
639
|
-
}
|
|
640
|
-
/* */
|
|
641
|
-
/* */
|
|
642
|
-
/* */
|
|
643
|
-
/* */
|
|
644
|
-
/* */
|
|
645
|
-
/* */
|
|
646
|
-
/* */
|
|
647
|
-
/* */
|
|
648
|
-
/* */
|
|
649
|
-
/* */
|
|
650
|
-
/* */
|
|
651
|
-
/* */
|
|
652
|
-
/* */
|
|
653
|
-
/* */
|
|
654
|
-
/* */
|
|
655
|
-
/* */
|
|
656
|
-
/* */
|
|
657
|
-
/* */
|
|
658
|
-
/* */
|
|
659
|
-
/* */
|
|
660
|
-
/* */
|
|
661
|
-
/* */
|
|
662
|
-
/* */
|
|
663
|
-
/* */
|
|
664
|
-
async mesureExectionInMs(description, functionToExecute, ...functionArguments) {
|
|
665
|
-
var start = new Date();
|
|
666
|
-
await Helpers.runSyncOrAsync(functionToExecute, ...functionArguments);
|
|
667
|
-
//@ts-ignore
|
|
668
|
-
var end = new Date() - start;
|
|
669
|
-
if (Morphi.IsBrowser) {
|
|
670
|
-
Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
|
|
671
|
-
}
|
|
672
|
-
/* */
|
|
673
|
-
/* */
|
|
674
|
-
return end;
|
|
675
|
-
}
|
|
676
|
-
mesureExectionInMsSync(description, functionToExecute) {
|
|
677
|
-
var start = new Date();
|
|
678
|
-
functionToExecute();
|
|
679
|
-
//@ts-ignore
|
|
680
|
-
var end = new Date() - start;
|
|
681
|
-
if (Morphi.IsBrowser) {
|
|
682
|
-
Helpers.
|
|
683
|
-
}
|
|
684
|
-
/* */
|
|
685
|
-
/* */
|
|
686
|
-
return end;
|
|
687
|
-
}
|
|
688
|
-
waitForCondition(conditionFn, howOfftenCheckInMs = 1000) {
|
|
689
|
-
return new Promise(async (resolve, reject) => {
|
|
690
|
-
const result = await Helpers.runSyncOrAsync(conditionFn);
|
|
691
|
-
if (result) {
|
|
692
|
-
resolve(void 0);
|
|
693
|
-
}
|
|
694
|
-
else {
|
|
695
|
-
setTimeout(() => {
|
|
696
|
-
Helpers.waitForCondition(conditionFn, howOfftenCheckInMs).then(() => {
|
|
697
|
-
resolve(void 0);
|
|
698
|
-
});
|
|
699
|
-
}, howOfftenCheckInMs);
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
getBrowserVerPath(moduleName, websql = false) {
|
|
704
|
-
/* */
|
|
705
|
-
/* */
|
|
706
|
-
/* */
|
|
707
|
-
/* */
|
|
708
|
-
/* */
|
|
709
|
-
}
|
|
710
|
-
getMethodName(obj, method) {
|
|
711
|
-
var methodName = null;
|
|
712
|
-
Object.getOwnPropertyNames(obj).forEach(prop => {
|
|
713
|
-
if (obj[prop] === method) {
|
|
714
|
-
methodName = prop;
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
if (methodName !== null) {
|
|
718
|
-
return methodName;
|
|
719
|
-
}
|
|
720
|
-
var proto = Object.getPrototypeOf(obj);
|
|
721
|
-
if (proto) {
|
|
722
|
-
return Helpers.getMethodName(proto, method);
|
|
723
|
-
}
|
|
724
|
-
return null;
|
|
725
|
-
}
|
|
726
|
-
fixWebpackEnv(env) {
|
|
727
|
-
_.forIn(env, (v, k) => {
|
|
728
|
-
const value = v;
|
|
729
|
-
if (value === 'true')
|
|
730
|
-
env[k] = true;
|
|
731
|
-
if (value === 'false')
|
|
732
|
-
env[k] = false;
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
applyMixins(HelpersTnp, [
|
|
737
|
-
HelpersStringsRegexes,
|
|
738
|
-
HelpersEnvironment,
|
|
739
|
-
/* */
|
|
740
|
-
/* */
|
|
741
|
-
/* */
|
|
742
|
-
]);
|
|
743
|
-
;
|
|
477
|
+
function applyMixins(derivedCtor, baseCtors) {
|
|
478
|
+
baseCtors.forEach(baseCtor => {
|
|
479
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
480
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
// @ts-ignore
|
|
485
|
+
class HelpersTnp extends CoreHelpers {
|
|
486
|
+
constructor(
|
|
487
|
+
/* */
|
|
488
|
+
/* */
|
|
489
|
+
/* */
|
|
490
|
+
/* */
|
|
491
|
+
/* */
|
|
492
|
+
/* */
|
|
493
|
+
/* */
|
|
494
|
+
/* */
|
|
495
|
+
/* */
|
|
496
|
+
/* */
|
|
497
|
+
/* */
|
|
498
|
+
/* */
|
|
499
|
+
/* */
|
|
500
|
+
arrays = new HelpersArrayObj(), strings = new HelpersStrings(), numbers = new HelpersNumber()) {
|
|
501
|
+
super();
|
|
502
|
+
this.arrays = arrays;
|
|
503
|
+
this.strings = strings;
|
|
504
|
+
this.numbers = numbers;
|
|
505
|
+
this.conditionWait = conditionWait;
|
|
506
|
+
/* */
|
|
507
|
+
/* */
|
|
508
|
+
/* */
|
|
509
|
+
/* */
|
|
510
|
+
/* */
|
|
511
|
+
/* */
|
|
512
|
+
/* */
|
|
513
|
+
/* */
|
|
514
|
+
/* */
|
|
515
|
+
/* */
|
|
516
|
+
/* */
|
|
517
|
+
/* */
|
|
518
|
+
/* */
|
|
519
|
+
/* */
|
|
520
|
+
/* */
|
|
521
|
+
/* */
|
|
522
|
+
/* */
|
|
523
|
+
/* */
|
|
524
|
+
/* */
|
|
525
|
+
/* */
|
|
526
|
+
/* */
|
|
527
|
+
/* */
|
|
528
|
+
/* */
|
|
529
|
+
/* */
|
|
530
|
+
/* */
|
|
531
|
+
/* */
|
|
532
|
+
/* */
|
|
533
|
+
/* */
|
|
534
|
+
/* */
|
|
535
|
+
/* */
|
|
536
|
+
/* */
|
|
537
|
+
/* */
|
|
538
|
+
/* */
|
|
539
|
+
/* */
|
|
540
|
+
/* */
|
|
541
|
+
/* */
|
|
542
|
+
/* */
|
|
543
|
+
/* */
|
|
544
|
+
/* */
|
|
545
|
+
/* */
|
|
546
|
+
/* */
|
|
547
|
+
/* */
|
|
548
|
+
/* */
|
|
549
|
+
/* */
|
|
550
|
+
/* */
|
|
551
|
+
/* */
|
|
552
|
+
/* */
|
|
553
|
+
/* */
|
|
554
|
+
/* */
|
|
555
|
+
/* */
|
|
556
|
+
/* */
|
|
557
|
+
/* */
|
|
558
|
+
/* */
|
|
559
|
+
/* */
|
|
560
|
+
/* */
|
|
561
|
+
/* */
|
|
562
|
+
/* */
|
|
563
|
+
/* */
|
|
564
|
+
/* */
|
|
565
|
+
/* */
|
|
566
|
+
/* */
|
|
567
|
+
/* */
|
|
568
|
+
/* */
|
|
569
|
+
/* */
|
|
570
|
+
/* */
|
|
571
|
+
/* */
|
|
572
|
+
/* */
|
|
573
|
+
/* */
|
|
574
|
+
/* */
|
|
575
|
+
/* */
|
|
576
|
+
/* */
|
|
577
|
+
/* */
|
|
578
|
+
/* */
|
|
579
|
+
/* */
|
|
580
|
+
/* */
|
|
581
|
+
/* */
|
|
582
|
+
/* */
|
|
583
|
+
/* */
|
|
584
|
+
this.applyMixins = applyMixins;
|
|
585
|
+
}
|
|
586
|
+
static get Instance() {
|
|
587
|
+
if (!HelpersTnp._instance) {
|
|
588
|
+
HelpersTnp._instance = new HelpersTnp();
|
|
589
|
+
}
|
|
590
|
+
return HelpersTnp._instance;
|
|
591
|
+
}
|
|
592
|
+
CLIWRAP(f, name) {
|
|
593
|
+
CLASS.setName(f, name);
|
|
594
|
+
return f;
|
|
595
|
+
}
|
|
596
|
+
/* */
|
|
597
|
+
/* */
|
|
598
|
+
/* */
|
|
599
|
+
/* */
|
|
600
|
+
/* */
|
|
601
|
+
/* */
|
|
602
|
+
/* */
|
|
603
|
+
/* */
|
|
604
|
+
/* */
|
|
605
|
+
/* */
|
|
606
|
+
/* */
|
|
607
|
+
/* */
|
|
608
|
+
/* */
|
|
609
|
+
/* */
|
|
610
|
+
/* */
|
|
611
|
+
/* */
|
|
612
|
+
/* */
|
|
613
|
+
/* */
|
|
614
|
+
/* */
|
|
615
|
+
/* */
|
|
616
|
+
/* */
|
|
617
|
+
/* */
|
|
618
|
+
/* */
|
|
619
|
+
/* */
|
|
620
|
+
/* */
|
|
621
|
+
/* */
|
|
622
|
+
/* */
|
|
623
|
+
/* */
|
|
624
|
+
/* */
|
|
625
|
+
/* */
|
|
626
|
+
/* */
|
|
627
|
+
/* */
|
|
628
|
+
/* */
|
|
629
|
+
/* */
|
|
630
|
+
/* */
|
|
631
|
+
/* */
|
|
632
|
+
/* */
|
|
633
|
+
/* */
|
|
634
|
+
async isElevated() {
|
|
635
|
+
/* */
|
|
636
|
+
/* */
|
|
637
|
+
/* */
|
|
638
|
+
/* */
|
|
639
|
+
}
|
|
640
|
+
/* */
|
|
641
|
+
/* */
|
|
642
|
+
/* */
|
|
643
|
+
/* */
|
|
644
|
+
/* */
|
|
645
|
+
/* */
|
|
646
|
+
/* */
|
|
647
|
+
/* */
|
|
648
|
+
/* */
|
|
649
|
+
/* */
|
|
650
|
+
/* */
|
|
651
|
+
/* */
|
|
652
|
+
/* */
|
|
653
|
+
/* */
|
|
654
|
+
/* */
|
|
655
|
+
/* */
|
|
656
|
+
/* */
|
|
657
|
+
/* */
|
|
658
|
+
/* */
|
|
659
|
+
/* */
|
|
660
|
+
/* */
|
|
661
|
+
/* */
|
|
662
|
+
/* */
|
|
663
|
+
/* */
|
|
664
|
+
async mesureExectionInMs(description, functionToExecute, ...functionArguments) {
|
|
665
|
+
var start = new Date();
|
|
666
|
+
await Helpers.runSyncOrAsync(functionToExecute, ...functionArguments);
|
|
667
|
+
//@ts-ignore
|
|
668
|
+
var end = new Date() - start;
|
|
669
|
+
if (Morphi.IsBrowser) {
|
|
670
|
+
Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
|
|
671
|
+
}
|
|
672
|
+
/* */
|
|
673
|
+
/* */
|
|
674
|
+
return end;
|
|
675
|
+
}
|
|
676
|
+
mesureExectionInMsSync(description, functionToExecute) {
|
|
677
|
+
var start = new Date();
|
|
678
|
+
functionToExecute();
|
|
679
|
+
//@ts-ignore
|
|
680
|
+
var end = new Date() - start;
|
|
681
|
+
if (Morphi.IsBrowser) {
|
|
682
|
+
Helpers.log(`Execution time: ${end.toString()}ms for "${description}"`);
|
|
683
|
+
}
|
|
684
|
+
/* */
|
|
685
|
+
/* */
|
|
686
|
+
return end;
|
|
687
|
+
}
|
|
688
|
+
waitForCondition(conditionFn, howOfftenCheckInMs = 1000) {
|
|
689
|
+
return new Promise(async (resolve, reject) => {
|
|
690
|
+
const result = await Helpers.runSyncOrAsync(conditionFn);
|
|
691
|
+
if (result) {
|
|
692
|
+
resolve(void 0);
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
setTimeout(() => {
|
|
696
|
+
Helpers.waitForCondition(conditionFn, howOfftenCheckInMs).then(() => {
|
|
697
|
+
resolve(void 0);
|
|
698
|
+
});
|
|
699
|
+
}, howOfftenCheckInMs);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
getBrowserVerPath(moduleName, websql = false) {
|
|
704
|
+
/* */
|
|
705
|
+
/* */
|
|
706
|
+
/* */
|
|
707
|
+
/* */
|
|
708
|
+
/* */
|
|
709
|
+
}
|
|
710
|
+
getMethodName(obj, method) {
|
|
711
|
+
var methodName = null;
|
|
712
|
+
Object.getOwnPropertyNames(obj).forEach(prop => {
|
|
713
|
+
if (obj[prop] === method) {
|
|
714
|
+
methodName = prop;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
if (methodName !== null) {
|
|
718
|
+
return methodName;
|
|
719
|
+
}
|
|
720
|
+
var proto = Object.getPrototypeOf(obj);
|
|
721
|
+
if (proto) {
|
|
722
|
+
return Helpers.getMethodName(proto, method);
|
|
723
|
+
}
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
fixWebpackEnv(env) {
|
|
727
|
+
_.forIn(env, (v, k) => {
|
|
728
|
+
const value = v;
|
|
729
|
+
if (value === 'true')
|
|
730
|
+
env[k] = true;
|
|
731
|
+
if (value === 'false')
|
|
732
|
+
env[k] = false;
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
applyMixins(HelpersTnp, [
|
|
737
|
+
HelpersStringsRegexes,
|
|
738
|
+
HelpersEnvironment,
|
|
739
|
+
/* */
|
|
740
|
+
/* */
|
|
741
|
+
/* */
|
|
742
|
+
]);
|
|
743
|
+
;
|
|
744
744
|
({}); // @--end-of-file-for-module=tnp-helpers lib/helpers.ts
|
|
745
745
|
|
|
746
|
-
const BaselineSiteJoinprefix = '__';
|
|
747
|
-
const PREFIXES = {
|
|
748
|
-
BASELINE: BaselineSiteJoinprefix,
|
|
749
|
-
DELETED: '____DELETED____',
|
|
750
|
-
ORIGINAL: '____ORIGINAL____',
|
|
751
|
-
};
|
|
746
|
+
const BaselineSiteJoinprefix = '__';
|
|
747
|
+
const PREFIXES = {
|
|
748
|
+
BASELINE: BaselineSiteJoinprefix,
|
|
749
|
+
DELETED: '____DELETED____',
|
|
750
|
+
ORIGINAL: '____ORIGINAL____',
|
|
751
|
+
};
|
|
752
752
|
({}); // @--end-of-file-for-module=tnp-helpers lib/constants.ts
|
|
753
753
|
|
|
754
|
-
/* */
|
|
755
|
-
const Helpers$1 = HelpersTnp.Instance;
|
|
756
|
-
class Project {
|
|
757
|
-
constructor() {
|
|
758
|
-
/* */
|
|
759
|
-
/* */
|
|
760
|
-
this.cache = {};
|
|
761
|
-
this.browser = {};
|
|
762
|
-
}
|
|
763
|
-
static typeFrom(location) {
|
|
764
|
-
/* */
|
|
765
|
-
/* */
|
|
766
|
-
/* */
|
|
767
|
-
/* */
|
|
768
|
-
/* */
|
|
769
|
-
/* */
|
|
770
|
-
/* */
|
|
771
|
-
/* */
|
|
772
|
-
/* */
|
|
773
|
-
/* */
|
|
774
|
-
/* */
|
|
775
|
-
/* */
|
|
776
|
-
return (void 0);
|
|
777
|
-
}
|
|
778
|
-
static unload(project) {
|
|
779
|
-
Project.projects = Project.projects.filter(f => f !== project);
|
|
780
|
-
}
|
|
781
|
-
static From(locationOfProj) {
|
|
782
|
-
/* */
|
|
783
|
-
/* */
|
|
784
|
-
/* */
|
|
785
|
-
/* */
|
|
786
|
-
/* */
|
|
787
|
-
/* */
|
|
788
|
-
/* */
|
|
789
|
-
/* */
|
|
790
|
-
/* */
|
|
791
|
-
/* */
|
|
792
|
-
/* */
|
|
793
|
-
/* */
|
|
794
|
-
/* */
|
|
795
|
-
/* */
|
|
796
|
-
/* */
|
|
797
|
-
/* */
|
|
798
|
-
/* */
|
|
799
|
-
/* */
|
|
800
|
-
/* */
|
|
801
|
-
/* */
|
|
802
|
-
/* */
|
|
803
|
-
/* */
|
|
804
|
-
/* */
|
|
805
|
-
/* */
|
|
806
|
-
/* */
|
|
807
|
-
/* */
|
|
808
|
-
/* */
|
|
809
|
-
/* */
|
|
810
|
-
/* */
|
|
811
|
-
/* */
|
|
812
|
-
/* */
|
|
813
|
-
/* */
|
|
814
|
-
/* */
|
|
815
|
-
/* */
|
|
816
|
-
/* */
|
|
817
|
-
/* */
|
|
818
|
-
/* */
|
|
819
|
-
/* */
|
|
820
|
-
/* */
|
|
821
|
-
/* */
|
|
822
|
-
/* */
|
|
823
|
-
/* */
|
|
824
|
-
/* */
|
|
825
|
-
/* */
|
|
826
|
-
/* */
|
|
827
|
-
/* */
|
|
828
|
-
/* */
|
|
829
|
-
/* */
|
|
830
|
-
/* */
|
|
831
|
-
/* */
|
|
832
|
-
/* */
|
|
833
|
-
/* */
|
|
834
|
-
/* */
|
|
835
|
-
/* */
|
|
836
|
-
/* */
|
|
837
|
-
/* */
|
|
838
|
-
/* */
|
|
839
|
-
/* */
|
|
840
|
-
/* */
|
|
841
|
-
/* */
|
|
842
|
-
/* */
|
|
843
|
-
/* */
|
|
844
|
-
/* */
|
|
845
|
-
/* */
|
|
846
|
-
/* */
|
|
847
|
-
/* */
|
|
848
|
-
/* */
|
|
849
|
-
/* */
|
|
850
|
-
/* */
|
|
851
|
-
/* */
|
|
852
|
-
/* */
|
|
853
|
-
/* */
|
|
854
|
-
/* */
|
|
855
|
-
/* */
|
|
856
|
-
/* */
|
|
857
|
-
/* */
|
|
858
|
-
/* */
|
|
859
|
-
/* */
|
|
860
|
-
/* */
|
|
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
|
-
/* */
|
|
894
|
-
/* */
|
|
895
|
-
/* */
|
|
896
|
-
/* */
|
|
897
|
-
/* */
|
|
898
|
-
/* */
|
|
899
|
-
return (void 0);
|
|
900
|
-
}
|
|
901
|
-
static nearestTo(absoluteLocation, options) {
|
|
902
|
-
/* */
|
|
903
|
-
/* */
|
|
904
|
-
/* */
|
|
905
|
-
/* */
|
|
906
|
-
/* */
|
|
907
|
-
/* */
|
|
908
|
-
/* */
|
|
909
|
-
/* */
|
|
910
|
-
/* */
|
|
911
|
-
/* */
|
|
912
|
-
/* */
|
|
913
|
-
/* */
|
|
914
|
-
/* */
|
|
915
|
-
/* */
|
|
916
|
-
/* */
|
|
917
|
-
/* */
|
|
918
|
-
/* */
|
|
919
|
-
/* */
|
|
920
|
-
/* */
|
|
921
|
-
/* */
|
|
922
|
-
/* */
|
|
923
|
-
/* */
|
|
924
|
-
/* */
|
|
925
|
-
/* */
|
|
926
|
-
/* */
|
|
927
|
-
/* */
|
|
928
|
-
/* */
|
|
929
|
-
/* */
|
|
930
|
-
/* */
|
|
931
|
-
/* */
|
|
932
|
-
/* */
|
|
933
|
-
/* */
|
|
934
|
-
/* */
|
|
935
|
-
/* */
|
|
936
|
-
/* */
|
|
937
|
-
/* */
|
|
938
|
-
/* */
|
|
939
|
-
/* */
|
|
940
|
-
/* */
|
|
941
|
-
/* */
|
|
942
|
-
/* */
|
|
943
|
-
/* */
|
|
944
|
-
/* */
|
|
945
|
-
/* */
|
|
946
|
-
/* */
|
|
947
|
-
/* */
|
|
948
|
-
/* */
|
|
949
|
-
/* */
|
|
950
|
-
/* */
|
|
951
|
-
/* */
|
|
952
|
-
/* */
|
|
953
|
-
/* */
|
|
954
|
-
/* */
|
|
955
|
-
/* */
|
|
956
|
-
/* */
|
|
957
|
-
/* */
|
|
958
|
-
/* */
|
|
959
|
-
/* */
|
|
960
|
-
return (void 0);
|
|
961
|
-
}
|
|
962
|
-
static allProjectFrom(absoluteLocation, stopOnCwd = '/') {
|
|
963
|
-
/* */
|
|
964
|
-
/* */
|
|
965
|
-
/* */
|
|
966
|
-
/* */
|
|
967
|
-
/* */
|
|
968
|
-
/* */
|
|
969
|
-
/* */
|
|
970
|
-
/* */
|
|
971
|
-
/* */
|
|
972
|
-
/* */
|
|
973
|
-
/* */
|
|
974
|
-
/* */
|
|
975
|
-
/* */
|
|
976
|
-
/* */
|
|
977
|
-
/* */
|
|
978
|
-
/* */
|
|
979
|
-
/* */
|
|
980
|
-
/* */
|
|
981
|
-
/* */
|
|
982
|
-
/* */
|
|
983
|
-
/* */
|
|
984
|
-
/* */
|
|
985
|
-
return (void 0);
|
|
986
|
-
}
|
|
987
|
-
static DefaultPortByType(type) {
|
|
988
|
-
if (type === 'workspace') {
|
|
989
|
-
return 5000;
|
|
990
|
-
}
|
|
991
|
-
if (type === 'angular-client') {
|
|
992
|
-
return 4300;
|
|
993
|
-
}
|
|
994
|
-
if (type === 'angular-lib') {
|
|
995
|
-
return 4250;
|
|
996
|
-
}
|
|
997
|
-
if (type === 'electron-client') {
|
|
998
|
-
return 4350;
|
|
999
|
-
}
|
|
1000
|
-
if (type === 'ionic-client') {
|
|
1001
|
-
return 8080;
|
|
1002
|
-
}
|
|
1003
|
-
if (type === 'docker') {
|
|
1004
|
-
return 5000;
|
|
1005
|
-
}
|
|
1006
|
-
if (type === 'isomorphic-lib') {
|
|
1007
|
-
return 4000;
|
|
1008
|
-
}
|
|
1009
|
-
if (type === 'container' || type === 'unknow-npm-project') {
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
static get isBundleMode() {
|
|
1014
|
-
if (Helpers$1.isBrowser) {
|
|
1015
|
-
return true;
|
|
1016
|
-
}
|
|
1017
|
-
/* */
|
|
1018
|
-
/* */
|
|
1019
|
-
}
|
|
1020
|
-
static get Current() {
|
|
1021
|
-
/* */
|
|
1022
|
-
/* */
|
|
1023
|
-
/* */
|
|
1024
|
-
/* */
|
|
1025
|
-
/* */
|
|
1026
|
-
/* */
|
|
1027
|
-
/* */
|
|
1028
|
-
/* */
|
|
1029
|
-
/* */
|
|
1030
|
-
/* */
|
|
1031
|
-
/* */
|
|
1032
|
-
return (void 0);
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* @deprecated
|
|
1036
|
-
*/
|
|
1037
|
-
static get Tnp() {
|
|
1038
|
-
/* */
|
|
1039
|
-
/* */
|
|
1040
|
-
/* */
|
|
1041
|
-
/* */
|
|
1042
|
-
/* */
|
|
1043
|
-
/* */
|
|
1044
|
-
/* */
|
|
1045
|
-
return (void 0);
|
|
1046
|
-
}
|
|
1047
|
-
static by(libraryType, version
|
|
1048
|
-
/* */
|
|
1049
|
-
/* */
|
|
1050
|
-
) {
|
|
1051
|
-
/* */
|
|
1052
|
-
/* */
|
|
1053
|
-
/* */
|
|
1054
|
-
/* */
|
|
1055
|
-
/* */
|
|
1056
|
-
/* */
|
|
1057
|
-
/* */
|
|
1058
|
-
/* */
|
|
1059
|
-
/* */
|
|
1060
|
-
/* */
|
|
1061
|
-
/* */
|
|
1062
|
-
/* */
|
|
1063
|
-
/* */
|
|
1064
|
-
/* */
|
|
1065
|
-
/* */
|
|
1066
|
-
/* */
|
|
1067
|
-
/* */
|
|
1068
|
-
/* */
|
|
1069
|
-
/* */
|
|
1070
|
-
/* */
|
|
1071
|
-
/* */
|
|
1072
|
-
/* */
|
|
1073
|
-
/* */
|
|
1074
|
-
/* */
|
|
1075
|
-
/* */
|
|
1076
|
-
/* */
|
|
1077
|
-
/* */
|
|
1078
|
-
return (void 0);
|
|
1079
|
-
}
|
|
1080
|
-
defineProperty(variableName, classFn) {
|
|
1081
|
-
/* */
|
|
1082
|
-
/* */
|
|
1083
|
-
/* */
|
|
1084
|
-
/* */
|
|
1085
|
-
/* */
|
|
1086
|
-
/* */
|
|
1087
|
-
/* */
|
|
1088
|
-
/* */
|
|
1089
|
-
/* */
|
|
1090
|
-
/* */
|
|
1091
|
-
/* */
|
|
1092
|
-
/* */
|
|
1093
|
-
/* */
|
|
1094
|
-
/* */
|
|
1095
|
-
/* */
|
|
1096
|
-
/* */
|
|
1097
|
-
/* */
|
|
1098
|
-
/* */
|
|
1099
|
-
/* */
|
|
1100
|
-
/* */
|
|
1101
|
-
/* */
|
|
1102
|
-
/* */
|
|
1103
|
-
/* */
|
|
1104
|
-
/* */
|
|
1105
|
-
return (void 0);
|
|
1106
|
-
}
|
|
1107
|
-
setType(type) {
|
|
1108
|
-
// @ts-ignore
|
|
1109
|
-
this._type = type;
|
|
1110
|
-
}
|
|
1111
|
-
typeIs(...types) {
|
|
1112
|
-
return this._type && types.includes(this._type);
|
|
1113
|
-
}
|
|
1114
|
-
typeIsNot(...types) {
|
|
1115
|
-
return !this.typeIs(...types);
|
|
1116
|
-
}
|
|
1117
|
-
forEmptyStructure() {
|
|
1118
|
-
/* */
|
|
1119
|
-
/* */
|
|
1120
|
-
/* */
|
|
1121
|
-
/* */
|
|
1122
|
-
/* */
|
|
1123
|
-
return (void 0);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
Project.projects = [];
|
|
1127
|
-
/**
|
|
1128
|
-
* To speed up checking folder I am keeping pathes for alterdy checked folder
|
|
1129
|
-
* This may break things that are creating new projects
|
|
1130
|
-
*/
|
|
1131
|
-
Project.emptyLocations = [];
|
|
1132
|
-
/* */
|
|
1133
|
-
/* */
|
|
1134
|
-
/* */
|
|
1135
|
-
/* */
|
|
1136
|
-
/* */
|
|
1137
|
-
/* */
|
|
1138
|
-
/* */
|
|
1139
|
-
/* */
|
|
1140
|
-
/* */
|
|
1141
|
-
/* */
|
|
1142
|
-
/* */
|
|
1143
|
-
/* */
|
|
1144
|
-
/* */
|
|
1145
|
-
/* */
|
|
1146
|
-
/* */
|
|
1147
|
-
/* */
|
|
1148
|
-
/* */
|
|
1149
|
-
/* */
|
|
1150
|
-
/* */
|
|
1151
|
-
/* */
|
|
1152
|
-
/* */
|
|
1153
|
-
/* */
|
|
1154
|
-
/* */
|
|
1155
|
-
/* */
|
|
1156
|
-
/* */
|
|
1157
|
-
/* */
|
|
1158
|
-
/* */
|
|
1159
|
-
/* */
|
|
1160
|
-
/* */
|
|
1161
|
-
/* */
|
|
1162
|
-
/* */
|
|
1163
|
-
/* */
|
|
1164
|
-
/* */
|
|
1165
|
-
/* */
|
|
1166
|
-
/* */
|
|
1167
|
-
/* */
|
|
1168
|
-
/* */
|
|
1169
|
-
/* */
|
|
1170
|
-
/* */
|
|
1171
|
-
/* */
|
|
1172
|
-
/* */
|
|
1173
|
-
/* */
|
|
1174
|
-
/* */
|
|
1175
|
-
/* */
|
|
1176
|
-
;
|
|
754
|
+
/* */
|
|
755
|
+
const Helpers$1 = HelpersTnp.Instance;
|
|
756
|
+
class Project {
|
|
757
|
+
constructor() {
|
|
758
|
+
/* */
|
|
759
|
+
/* */
|
|
760
|
+
this.cache = {};
|
|
761
|
+
this.browser = {};
|
|
762
|
+
}
|
|
763
|
+
static typeFrom(location) {
|
|
764
|
+
/* */
|
|
765
|
+
/* */
|
|
766
|
+
/* */
|
|
767
|
+
/* */
|
|
768
|
+
/* */
|
|
769
|
+
/* */
|
|
770
|
+
/* */
|
|
771
|
+
/* */
|
|
772
|
+
/* */
|
|
773
|
+
/* */
|
|
774
|
+
/* */
|
|
775
|
+
/* */
|
|
776
|
+
return (void 0);
|
|
777
|
+
}
|
|
778
|
+
static unload(project) {
|
|
779
|
+
Project.projects = Project.projects.filter(f => f !== project);
|
|
780
|
+
}
|
|
781
|
+
static From(locationOfProj) {
|
|
782
|
+
/* */
|
|
783
|
+
/* */
|
|
784
|
+
/* */
|
|
785
|
+
/* */
|
|
786
|
+
/* */
|
|
787
|
+
/* */
|
|
788
|
+
/* */
|
|
789
|
+
/* */
|
|
790
|
+
/* */
|
|
791
|
+
/* */
|
|
792
|
+
/* */
|
|
793
|
+
/* */
|
|
794
|
+
/* */
|
|
795
|
+
/* */
|
|
796
|
+
/* */
|
|
797
|
+
/* */
|
|
798
|
+
/* */
|
|
799
|
+
/* */
|
|
800
|
+
/* */
|
|
801
|
+
/* */
|
|
802
|
+
/* */
|
|
803
|
+
/* */
|
|
804
|
+
/* */
|
|
805
|
+
/* */
|
|
806
|
+
/* */
|
|
807
|
+
/* */
|
|
808
|
+
/* */
|
|
809
|
+
/* */
|
|
810
|
+
/* */
|
|
811
|
+
/* */
|
|
812
|
+
/* */
|
|
813
|
+
/* */
|
|
814
|
+
/* */
|
|
815
|
+
/* */
|
|
816
|
+
/* */
|
|
817
|
+
/* */
|
|
818
|
+
/* */
|
|
819
|
+
/* */
|
|
820
|
+
/* */
|
|
821
|
+
/* */
|
|
822
|
+
/* */
|
|
823
|
+
/* */
|
|
824
|
+
/* */
|
|
825
|
+
/* */
|
|
826
|
+
/* */
|
|
827
|
+
/* */
|
|
828
|
+
/* */
|
|
829
|
+
/* */
|
|
830
|
+
/* */
|
|
831
|
+
/* */
|
|
832
|
+
/* */
|
|
833
|
+
/* */
|
|
834
|
+
/* */
|
|
835
|
+
/* */
|
|
836
|
+
/* */
|
|
837
|
+
/* */
|
|
838
|
+
/* */
|
|
839
|
+
/* */
|
|
840
|
+
/* */
|
|
841
|
+
/* */
|
|
842
|
+
/* */
|
|
843
|
+
/* */
|
|
844
|
+
/* */
|
|
845
|
+
/* */
|
|
846
|
+
/* */
|
|
847
|
+
/* */
|
|
848
|
+
/* */
|
|
849
|
+
/* */
|
|
850
|
+
/* */
|
|
851
|
+
/* */
|
|
852
|
+
/* */
|
|
853
|
+
/* */
|
|
854
|
+
/* */
|
|
855
|
+
/* */
|
|
856
|
+
/* */
|
|
857
|
+
/* */
|
|
858
|
+
/* */
|
|
859
|
+
/* */
|
|
860
|
+
/* */
|
|
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
|
+
/* */
|
|
894
|
+
/* */
|
|
895
|
+
/* */
|
|
896
|
+
/* */
|
|
897
|
+
/* */
|
|
898
|
+
/* */
|
|
899
|
+
return (void 0);
|
|
900
|
+
}
|
|
901
|
+
static nearestTo(absoluteLocation, options) {
|
|
902
|
+
/* */
|
|
903
|
+
/* */
|
|
904
|
+
/* */
|
|
905
|
+
/* */
|
|
906
|
+
/* */
|
|
907
|
+
/* */
|
|
908
|
+
/* */
|
|
909
|
+
/* */
|
|
910
|
+
/* */
|
|
911
|
+
/* */
|
|
912
|
+
/* */
|
|
913
|
+
/* */
|
|
914
|
+
/* */
|
|
915
|
+
/* */
|
|
916
|
+
/* */
|
|
917
|
+
/* */
|
|
918
|
+
/* */
|
|
919
|
+
/* */
|
|
920
|
+
/* */
|
|
921
|
+
/* */
|
|
922
|
+
/* */
|
|
923
|
+
/* */
|
|
924
|
+
/* */
|
|
925
|
+
/* */
|
|
926
|
+
/* */
|
|
927
|
+
/* */
|
|
928
|
+
/* */
|
|
929
|
+
/* */
|
|
930
|
+
/* */
|
|
931
|
+
/* */
|
|
932
|
+
/* */
|
|
933
|
+
/* */
|
|
934
|
+
/* */
|
|
935
|
+
/* */
|
|
936
|
+
/* */
|
|
937
|
+
/* */
|
|
938
|
+
/* */
|
|
939
|
+
/* */
|
|
940
|
+
/* */
|
|
941
|
+
/* */
|
|
942
|
+
/* */
|
|
943
|
+
/* */
|
|
944
|
+
/* */
|
|
945
|
+
/* */
|
|
946
|
+
/* */
|
|
947
|
+
/* */
|
|
948
|
+
/* */
|
|
949
|
+
/* */
|
|
950
|
+
/* */
|
|
951
|
+
/* */
|
|
952
|
+
/* */
|
|
953
|
+
/* */
|
|
954
|
+
/* */
|
|
955
|
+
/* */
|
|
956
|
+
/* */
|
|
957
|
+
/* */
|
|
958
|
+
/* */
|
|
959
|
+
/* */
|
|
960
|
+
return (void 0);
|
|
961
|
+
}
|
|
962
|
+
static allProjectFrom(absoluteLocation, stopOnCwd = '/') {
|
|
963
|
+
/* */
|
|
964
|
+
/* */
|
|
965
|
+
/* */
|
|
966
|
+
/* */
|
|
967
|
+
/* */
|
|
968
|
+
/* */
|
|
969
|
+
/* */
|
|
970
|
+
/* */
|
|
971
|
+
/* */
|
|
972
|
+
/* */
|
|
973
|
+
/* */
|
|
974
|
+
/* */
|
|
975
|
+
/* */
|
|
976
|
+
/* */
|
|
977
|
+
/* */
|
|
978
|
+
/* */
|
|
979
|
+
/* */
|
|
980
|
+
/* */
|
|
981
|
+
/* */
|
|
982
|
+
/* */
|
|
983
|
+
/* */
|
|
984
|
+
/* */
|
|
985
|
+
return (void 0);
|
|
986
|
+
}
|
|
987
|
+
static DefaultPortByType(type) {
|
|
988
|
+
if (type === 'workspace') {
|
|
989
|
+
return 5000;
|
|
990
|
+
}
|
|
991
|
+
if (type === 'angular-client') {
|
|
992
|
+
return 4300;
|
|
993
|
+
}
|
|
994
|
+
if (type === 'angular-lib') {
|
|
995
|
+
return 4250;
|
|
996
|
+
}
|
|
997
|
+
if (type === 'electron-client') {
|
|
998
|
+
return 4350;
|
|
999
|
+
}
|
|
1000
|
+
if (type === 'ionic-client') {
|
|
1001
|
+
return 8080;
|
|
1002
|
+
}
|
|
1003
|
+
if (type === 'docker') {
|
|
1004
|
+
return 5000;
|
|
1005
|
+
}
|
|
1006
|
+
if (type === 'isomorphic-lib') {
|
|
1007
|
+
return 4000;
|
|
1008
|
+
}
|
|
1009
|
+
if (type === 'container' || type === 'unknow-npm-project') {
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
static get isBundleMode() {
|
|
1014
|
+
if (Helpers$1.isBrowser) {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
/* */
|
|
1018
|
+
/* */
|
|
1019
|
+
}
|
|
1020
|
+
static get Current() {
|
|
1021
|
+
/* */
|
|
1022
|
+
/* */
|
|
1023
|
+
/* */
|
|
1024
|
+
/* */
|
|
1025
|
+
/* */
|
|
1026
|
+
/* */
|
|
1027
|
+
/* */
|
|
1028
|
+
/* */
|
|
1029
|
+
/* */
|
|
1030
|
+
/* */
|
|
1031
|
+
/* */
|
|
1032
|
+
return (void 0);
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* @deprecated
|
|
1036
|
+
*/
|
|
1037
|
+
static get Tnp() {
|
|
1038
|
+
/* */
|
|
1039
|
+
/* */
|
|
1040
|
+
/* */
|
|
1041
|
+
/* */
|
|
1042
|
+
/* */
|
|
1043
|
+
/* */
|
|
1044
|
+
/* */
|
|
1045
|
+
return (void 0);
|
|
1046
|
+
}
|
|
1047
|
+
static by(libraryType, version
|
|
1048
|
+
/* */
|
|
1049
|
+
/* */
|
|
1050
|
+
) {
|
|
1051
|
+
/* */
|
|
1052
|
+
/* */
|
|
1053
|
+
/* */
|
|
1054
|
+
/* */
|
|
1055
|
+
/* */
|
|
1056
|
+
/* */
|
|
1057
|
+
/* */
|
|
1058
|
+
/* */
|
|
1059
|
+
/* */
|
|
1060
|
+
/* */
|
|
1061
|
+
/* */
|
|
1062
|
+
/* */
|
|
1063
|
+
/* */
|
|
1064
|
+
/* */
|
|
1065
|
+
/* */
|
|
1066
|
+
/* */
|
|
1067
|
+
/* */
|
|
1068
|
+
/* */
|
|
1069
|
+
/* */
|
|
1070
|
+
/* */
|
|
1071
|
+
/* */
|
|
1072
|
+
/* */
|
|
1073
|
+
/* */
|
|
1074
|
+
/* */
|
|
1075
|
+
/* */
|
|
1076
|
+
/* */
|
|
1077
|
+
/* */
|
|
1078
|
+
return (void 0);
|
|
1079
|
+
}
|
|
1080
|
+
defineProperty(variableName, classFn) {
|
|
1081
|
+
/* */
|
|
1082
|
+
/* */
|
|
1083
|
+
/* */
|
|
1084
|
+
/* */
|
|
1085
|
+
/* */
|
|
1086
|
+
/* */
|
|
1087
|
+
/* */
|
|
1088
|
+
/* */
|
|
1089
|
+
/* */
|
|
1090
|
+
/* */
|
|
1091
|
+
/* */
|
|
1092
|
+
/* */
|
|
1093
|
+
/* */
|
|
1094
|
+
/* */
|
|
1095
|
+
/* */
|
|
1096
|
+
/* */
|
|
1097
|
+
/* */
|
|
1098
|
+
/* */
|
|
1099
|
+
/* */
|
|
1100
|
+
/* */
|
|
1101
|
+
/* */
|
|
1102
|
+
/* */
|
|
1103
|
+
/* */
|
|
1104
|
+
/* */
|
|
1105
|
+
return (void 0);
|
|
1106
|
+
}
|
|
1107
|
+
setType(type) {
|
|
1108
|
+
// @ts-ignore
|
|
1109
|
+
this._type = type;
|
|
1110
|
+
}
|
|
1111
|
+
typeIs(...types) {
|
|
1112
|
+
return this._type && types.includes(this._type);
|
|
1113
|
+
}
|
|
1114
|
+
typeIsNot(...types) {
|
|
1115
|
+
return !this.typeIs(...types);
|
|
1116
|
+
}
|
|
1117
|
+
forEmptyStructure() {
|
|
1118
|
+
/* */
|
|
1119
|
+
/* */
|
|
1120
|
+
/* */
|
|
1121
|
+
/* */
|
|
1122
|
+
/* */
|
|
1123
|
+
return (void 0);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
Project.projects = [];
|
|
1127
|
+
/**
|
|
1128
|
+
* To speed up checking folder I am keeping pathes for alterdy checked folder
|
|
1129
|
+
* This may break things that are creating new projects
|
|
1130
|
+
*/
|
|
1131
|
+
Project.emptyLocations = [];
|
|
1132
|
+
/* */
|
|
1133
|
+
/* */
|
|
1134
|
+
/* */
|
|
1135
|
+
/* */
|
|
1136
|
+
/* */
|
|
1137
|
+
/* */
|
|
1138
|
+
/* */
|
|
1139
|
+
/* */
|
|
1140
|
+
/* */
|
|
1141
|
+
/* */
|
|
1142
|
+
/* */
|
|
1143
|
+
/* */
|
|
1144
|
+
/* */
|
|
1145
|
+
/* */
|
|
1146
|
+
/* */
|
|
1147
|
+
/* */
|
|
1148
|
+
/* */
|
|
1149
|
+
/* */
|
|
1150
|
+
/* */
|
|
1151
|
+
/* */
|
|
1152
|
+
/* */
|
|
1153
|
+
/* */
|
|
1154
|
+
/* */
|
|
1155
|
+
/* */
|
|
1156
|
+
/* */
|
|
1157
|
+
/* */
|
|
1158
|
+
/* */
|
|
1159
|
+
/* */
|
|
1160
|
+
/* */
|
|
1161
|
+
/* */
|
|
1162
|
+
/* */
|
|
1163
|
+
/* */
|
|
1164
|
+
/* */
|
|
1165
|
+
/* */
|
|
1166
|
+
/* */
|
|
1167
|
+
/* */
|
|
1168
|
+
/* */
|
|
1169
|
+
/* */
|
|
1170
|
+
/* */
|
|
1171
|
+
/* */
|
|
1172
|
+
/* */
|
|
1173
|
+
/* */
|
|
1174
|
+
/* */
|
|
1175
|
+
/* */
|
|
1176
|
+
;
|
|
1177
1177
|
({}); // @--end-of-file-for-module=tnp-helpers lib/project.ts
|
|
1178
1178
|
|
|
1179
|
-
;
|
|
1179
|
+
;
|
|
1180
1180
|
({}); // @--end-of-file-for-module=tnp-helpers lib/firedev-models.ts
|
|
1181
1181
|
|
|
1182
|
-
class BaseComponent {
|
|
1183
|
-
constructor() {
|
|
1184
|
-
// @ts-ignore
|
|
1185
|
-
this.model = {};
|
|
1186
|
-
this.handlers = [];
|
|
1187
|
-
}
|
|
1188
|
-
ngOnDestroy() {
|
|
1189
|
-
this.handlers.forEach(h => h.unsubscribe());
|
|
1190
|
-
this.handlers.length = 0;
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1194
|
-
BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: BaseComponent, selector: "app-base-component-meta", inputs: { model: "model" }, ngImport: i0, template: '<div></div>', isInline: true });
|
|
1195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseComponent, decorators: [{
|
|
1196
|
-
type: Component,
|
|
1197
|
-
args: [{
|
|
1198
|
-
selector: 'app-base-component-meta',
|
|
1199
|
-
template: '<div></div>'
|
|
1200
|
-
}]
|
|
1201
|
-
}], propDecorators: { model: [{
|
|
1202
|
-
type: Input
|
|
1203
|
-
}] } });
|
|
1204
|
-
const isCalledNgInitAfterInternalRefresh = Symbol();
|
|
1205
|
-
class BaseComponentForRouter extends BaseComponent {
|
|
1206
|
-
constructor(__router) {
|
|
1207
|
-
super();
|
|
1208
|
-
this.__router = __router;
|
|
1209
|
-
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
1210
|
-
}
|
|
1211
|
-
isCalledNgInitAfterInternalRefresh() {
|
|
1212
|
-
return !!this[isCalledNgInitAfterInternalRefresh];
|
|
1213
|
-
}
|
|
1214
|
-
reloadNgOninitOnUrlChange() {
|
|
1215
|
-
this.handlers.push(this.__router.events.subscribe(event => {
|
|
1216
|
-
if (event instanceof NavigationEnd && this['ngOnInit']) {
|
|
1217
|
-
this[isCalledNgInitAfterInternalRefresh] = true;
|
|
1218
|
-
this['ngOnInit']();
|
|
1219
|
-
if (this[isCalledNgInitAfterInternalRefresh]) {
|
|
1220
|
-
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
}));
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
;
|
|
1182
|
+
class BaseComponent {
|
|
1183
|
+
constructor() {
|
|
1184
|
+
// @ts-ignore
|
|
1185
|
+
this.model = {};
|
|
1186
|
+
this.handlers = [];
|
|
1187
|
+
}
|
|
1188
|
+
ngOnDestroy() {
|
|
1189
|
+
this.handlers.forEach(h => h.unsubscribe());
|
|
1190
|
+
this.handlers.length = 0;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1194
|
+
BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: BaseComponent, selector: "app-base-component-meta", inputs: { model: "model" }, ngImport: i0, template: '<div></div>', isInline: true });
|
|
1195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseComponent, decorators: [{
|
|
1196
|
+
type: Component,
|
|
1197
|
+
args: [{
|
|
1198
|
+
selector: 'app-base-component-meta',
|
|
1199
|
+
template: '<div></div>'
|
|
1200
|
+
}]
|
|
1201
|
+
}], propDecorators: { model: [{
|
|
1202
|
+
type: Input
|
|
1203
|
+
}] } });
|
|
1204
|
+
const isCalledNgInitAfterInternalRefresh = Symbol();
|
|
1205
|
+
class BaseComponentForRouter extends BaseComponent {
|
|
1206
|
+
constructor(__router) {
|
|
1207
|
+
super();
|
|
1208
|
+
this.__router = __router;
|
|
1209
|
+
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
1210
|
+
}
|
|
1211
|
+
isCalledNgInitAfterInternalRefresh() {
|
|
1212
|
+
return !!this[isCalledNgInitAfterInternalRefresh];
|
|
1213
|
+
}
|
|
1214
|
+
reloadNgOninitOnUrlChange() {
|
|
1215
|
+
this.handlers.push(this.__router.events.subscribe(event => {
|
|
1216
|
+
if (event instanceof NavigationEnd && this['ngOnInit']) {
|
|
1217
|
+
this[isCalledNgInitAfterInternalRefresh] = true;
|
|
1218
|
+
this['ngOnInit']();
|
|
1219
|
+
if (this[isCalledNgInitAfterInternalRefresh]) {
|
|
1220
|
+
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}));
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
;
|
|
1227
1227
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base-component.ts
|
|
1228
1228
|
|
|
1229
|
-
const log$2 = Log.create(`DualComponentController`);
|
|
1230
|
-
class DualComponentController {
|
|
1231
|
-
constructor(cmp, isFormlyMode = false) {
|
|
1232
|
-
this.cmp = cmp;
|
|
1233
|
-
this.isFormlyMode = isFormlyMode;
|
|
1234
|
-
}
|
|
1235
|
-
getValTemplateOptions(propertyName) {
|
|
1236
|
-
if (this.isFormlyMode) {
|
|
1237
|
-
const res = this.cmp.field?.templateOptions[propertyName];
|
|
1238
|
-
if (res === void 0 && this.cmp[propertyName]) {
|
|
1239
|
-
return this.cmp[propertyName];
|
|
1240
|
-
}
|
|
1241
|
-
return res;
|
|
1242
|
-
}
|
|
1243
|
-
return this.cmp[propertyName];
|
|
1244
|
-
}
|
|
1245
|
-
getValContext(propertyName) {
|
|
1246
|
-
if (this.isFormlyMode) {
|
|
1247
|
-
const res = this.cmp?.field[propertyName];
|
|
1248
|
-
if (res === void 0 && this.cmp[propertyName]) {
|
|
1249
|
-
return this.cmp[propertyName];
|
|
1250
|
-
}
|
|
1251
|
-
return res;
|
|
1252
|
-
}
|
|
1253
|
-
return this.cmp[propertyName];
|
|
1254
|
-
}
|
|
1255
|
-
get disabled() {
|
|
1256
|
-
return this.getValTemplateOptions('disabled');
|
|
1257
|
-
}
|
|
1258
|
-
get required() {
|
|
1259
|
-
return this.getValTemplateOptions('required');
|
|
1260
|
-
}
|
|
1261
|
-
get type() {
|
|
1262
|
-
if (!this.isFormlyMode) {
|
|
1263
|
-
return CLASS.getNameFromObject(this.cmp);
|
|
1264
|
-
}
|
|
1265
|
-
return this.getValContext('type');
|
|
1266
|
-
}
|
|
1267
|
-
get label() {
|
|
1268
|
-
return this.getValTemplateOptions('label');
|
|
1269
|
-
}
|
|
1270
|
-
get placeholder() {
|
|
1271
|
-
return this.getValTemplateOptions('placeholder');
|
|
1272
|
-
}
|
|
1273
|
-
get defaultValue() {
|
|
1274
|
-
return this.getValContext('defaultValue');
|
|
1275
|
-
}
|
|
1276
|
-
get formControl() {
|
|
1277
|
-
return this.getValContext('formControl');
|
|
1278
|
-
}
|
|
1279
|
-
get key() {
|
|
1280
|
-
return this.getValContext('key');
|
|
1281
|
-
}
|
|
1282
|
-
get path() {
|
|
1283
|
-
return this.getValContext('path');
|
|
1284
|
-
}
|
|
1285
|
-
get model() {
|
|
1286
|
-
if (this.isFormlyMode) {
|
|
1287
|
-
return this.getValContext('model');
|
|
1288
|
-
}
|
|
1289
|
-
else {
|
|
1290
|
-
return this.__model;
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
set model(v) {
|
|
1294
|
-
if (this.isFormlyMode) {
|
|
1295
|
-
log$2.w(`[DualComponentController] You can't set model in formly component mode`);
|
|
1296
|
-
}
|
|
1297
|
-
else {
|
|
1298
|
-
this.__model = v;
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
get mode() {
|
|
1302
|
-
if (this.isFormlyMode) {
|
|
1303
|
-
return this.getValContext('mode');
|
|
1304
|
-
}
|
|
1305
|
-
else {
|
|
1306
|
-
return this.__mode;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
set mode(v) {
|
|
1310
|
-
if (this.isFormlyMode) {
|
|
1311
|
-
}
|
|
1312
|
-
else {
|
|
1313
|
-
this.__mode = v;
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
get value() {
|
|
1317
|
-
if (this.isFormlyMode) {
|
|
1318
|
-
return this.cmp.field.formControl.value;
|
|
1319
|
-
}
|
|
1320
|
-
if (_.isString(this.path)) {
|
|
1321
|
-
return _.get(this.cmp.model, this.path);
|
|
1322
|
-
}
|
|
1323
|
-
return this.cmp.model;
|
|
1324
|
-
}
|
|
1325
|
-
set value(v) {
|
|
1326
|
-
if (this.isFormlyMode) {
|
|
1327
|
-
this.cmp.field.formControl.setValue(v);
|
|
1328
|
-
// @ts-ignore
|
|
1329
|
-
this.cmp.change.next(v);
|
|
1330
|
-
return;
|
|
1331
|
-
}
|
|
1332
|
-
if (_.isString(this.path)) {
|
|
1333
|
-
_.set(this.cmp.model, this.path, v);
|
|
1334
|
-
}
|
|
1335
|
-
else {
|
|
1336
|
-
this.cmp.model = v;
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
;
|
|
1229
|
+
const log$2 = Log.create(`DualComponentController`);
|
|
1230
|
+
class DualComponentController {
|
|
1231
|
+
constructor(cmp, isFormlyMode = false) {
|
|
1232
|
+
this.cmp = cmp;
|
|
1233
|
+
this.isFormlyMode = isFormlyMode;
|
|
1234
|
+
}
|
|
1235
|
+
getValTemplateOptions(propertyName) {
|
|
1236
|
+
if (this.isFormlyMode) {
|
|
1237
|
+
const res = this.cmp.field?.templateOptions[propertyName];
|
|
1238
|
+
if (res === void 0 && this.cmp[propertyName]) {
|
|
1239
|
+
return this.cmp[propertyName];
|
|
1240
|
+
}
|
|
1241
|
+
return res;
|
|
1242
|
+
}
|
|
1243
|
+
return this.cmp[propertyName];
|
|
1244
|
+
}
|
|
1245
|
+
getValContext(propertyName) {
|
|
1246
|
+
if (this.isFormlyMode) {
|
|
1247
|
+
const res = this.cmp?.field[propertyName];
|
|
1248
|
+
if (res === void 0 && this.cmp[propertyName]) {
|
|
1249
|
+
return this.cmp[propertyName];
|
|
1250
|
+
}
|
|
1251
|
+
return res;
|
|
1252
|
+
}
|
|
1253
|
+
return this.cmp[propertyName];
|
|
1254
|
+
}
|
|
1255
|
+
get disabled() {
|
|
1256
|
+
return this.getValTemplateOptions('disabled');
|
|
1257
|
+
}
|
|
1258
|
+
get required() {
|
|
1259
|
+
return this.getValTemplateOptions('required');
|
|
1260
|
+
}
|
|
1261
|
+
get type() {
|
|
1262
|
+
if (!this.isFormlyMode) {
|
|
1263
|
+
return CLASS.getNameFromObject(this.cmp);
|
|
1264
|
+
}
|
|
1265
|
+
return this.getValContext('type');
|
|
1266
|
+
}
|
|
1267
|
+
get label() {
|
|
1268
|
+
return this.getValTemplateOptions('label');
|
|
1269
|
+
}
|
|
1270
|
+
get placeholder() {
|
|
1271
|
+
return this.getValTemplateOptions('placeholder');
|
|
1272
|
+
}
|
|
1273
|
+
get defaultValue() {
|
|
1274
|
+
return this.getValContext('defaultValue');
|
|
1275
|
+
}
|
|
1276
|
+
get formControl() {
|
|
1277
|
+
return this.getValContext('formControl');
|
|
1278
|
+
}
|
|
1279
|
+
get key() {
|
|
1280
|
+
return this.getValContext('key');
|
|
1281
|
+
}
|
|
1282
|
+
get path() {
|
|
1283
|
+
return this.getValContext('path');
|
|
1284
|
+
}
|
|
1285
|
+
get model() {
|
|
1286
|
+
if (this.isFormlyMode) {
|
|
1287
|
+
return this.getValContext('model');
|
|
1288
|
+
}
|
|
1289
|
+
else {
|
|
1290
|
+
return this.__model;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
set model(v) {
|
|
1294
|
+
if (this.isFormlyMode) {
|
|
1295
|
+
log$2.w(`[DualComponentController] You can't set model in formly component mode`);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
this.__model = v;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
get mode() {
|
|
1302
|
+
if (this.isFormlyMode) {
|
|
1303
|
+
return this.getValContext('mode');
|
|
1304
|
+
}
|
|
1305
|
+
else {
|
|
1306
|
+
return this.__mode;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
set mode(v) {
|
|
1310
|
+
if (this.isFormlyMode) {
|
|
1311
|
+
}
|
|
1312
|
+
else {
|
|
1313
|
+
this.__mode = v;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
get value() {
|
|
1317
|
+
if (this.isFormlyMode) {
|
|
1318
|
+
return this.cmp.field.formControl.value;
|
|
1319
|
+
}
|
|
1320
|
+
if (_.isString(this.path)) {
|
|
1321
|
+
return _.get(this.cmp.model, this.path);
|
|
1322
|
+
}
|
|
1323
|
+
return this.cmp.model;
|
|
1324
|
+
}
|
|
1325
|
+
set value(v) {
|
|
1326
|
+
if (this.isFormlyMode) {
|
|
1327
|
+
this.cmp.field.formControl.setValue(v);
|
|
1328
|
+
// @ts-ignore
|
|
1329
|
+
this.cmp.change.next(v);
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
if (_.isString(this.path)) {
|
|
1333
|
+
_.set(this.cmp.model, this.path, v);
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
this.cmp.model = v;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
;
|
|
1341
1341
|
({}); // @--end-of-file-for-module=tnp-helpers lib/dual-component-ctrl.ts
|
|
1342
1342
|
|
|
1343
|
-
const log$1 = Log.create('base formly component', Level.__NOTHING);
|
|
1344
|
-
class BaseFormlyComponent extends FieldType {
|
|
1345
|
-
constructor() {
|
|
1346
|
-
super(...arguments);
|
|
1347
|
-
this.DualComponentController = DualComponentController;
|
|
1348
|
-
this.ctrl = {};
|
|
1349
|
-
this.change = new EventEmitter();
|
|
1350
|
-
// @ts-ignore
|
|
1351
|
-
this.handlers = [];
|
|
1352
|
-
this.__field = {
|
|
1353
|
-
templateOptions: {}
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
// @ts-ignore
|
|
1357
|
-
get mode() {
|
|
1358
|
-
return this.ctrl.mode;
|
|
1359
|
-
}
|
|
1360
|
-
// @ts-ignore
|
|
1361
|
-
set mode(v) {
|
|
1362
|
-
this.ctrl.mode = v;
|
|
1363
|
-
}
|
|
1364
|
-
// @ts-ignore
|
|
1365
|
-
set model(v) {
|
|
1366
|
-
this.ctrl.model = v;
|
|
1367
|
-
}
|
|
1368
|
-
get model() {
|
|
1369
|
-
return this.ctrl.model;
|
|
1370
|
-
}
|
|
1371
|
-
// @ts-ignore
|
|
1372
|
-
set key(value) {
|
|
1373
|
-
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
1374
|
-
return;
|
|
1375
|
-
}
|
|
1376
|
-
this.path = value;
|
|
1377
|
-
}
|
|
1378
|
-
get key() {
|
|
1379
|
-
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
1380
|
-
return this.field.key;
|
|
1381
|
-
}
|
|
1382
|
-
return this.path;
|
|
1383
|
-
}
|
|
1384
|
-
ngOnDestroy() {
|
|
1385
|
-
this.handlers.forEach(h => h.unsubscribe());
|
|
1386
|
-
this.handlers.length = 0;
|
|
1387
|
-
}
|
|
1388
|
-
ngAfterViewInit() {
|
|
1389
|
-
}
|
|
1390
|
-
ngOnInit() {
|
|
1391
|
-
const isFormlyMode = !!this.field;
|
|
1392
|
-
log$1.i(`isFormlyMode: ${isFormlyMode}`);
|
|
1393
|
-
if (!isFormlyMode) {
|
|
1394
|
-
const that = this;
|
|
1395
|
-
Object.defineProperty(this, 'field', {
|
|
1396
|
-
get: function () {
|
|
1397
|
-
return that.__field;
|
|
1398
|
-
},
|
|
1399
|
-
set: function (v) {
|
|
1400
|
-
that.__field = v;
|
|
1401
|
-
}
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
const existed = this.ctrl;
|
|
1405
|
-
this.ctrl = new this.DualComponentController(this, isFormlyMode);
|
|
1406
|
-
// @ts-ignore
|
|
1407
|
-
Object.keys(existed).forEach(key => {
|
|
1408
|
-
this.ctrl[key] = existed[key];
|
|
1409
|
-
});
|
|
1410
|
-
// @ts-ignore
|
|
1411
|
-
this.change.next(this.ctrl.value);
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
BaseFormlyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseFormlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1415
|
-
BaseFormlyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: BaseFormlyComponent, selector: "app-base-formly-component-meta", inputs: { pizda: "pizda", mode: "mode", disabled: "disabled", required: "required", label: "label", placeholder: "placeholder", defaultValue: "defaultValue", model: "model", path: "path", key: "key" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: `<div></div>`, isInline: true });
|
|
1416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseFormlyComponent, decorators: [{
|
|
1417
|
-
type: Component,
|
|
1418
|
-
args: [{
|
|
1419
|
-
selector: 'app-base-formly-component-meta',
|
|
1420
|
-
template: `<div></div>`
|
|
1421
|
-
}]
|
|
1422
|
-
}], propDecorators: { pizda: [{
|
|
1423
|
-
type: Input
|
|
1424
|
-
}], mode: [{
|
|
1425
|
-
type: Input
|
|
1426
|
-
}], disabled: [{
|
|
1427
|
-
type: Input
|
|
1428
|
-
}], required: [{
|
|
1429
|
-
type: Input
|
|
1430
|
-
}], label: [{
|
|
1431
|
-
type: Input
|
|
1432
|
-
}], placeholder: [{
|
|
1433
|
-
type: Input
|
|
1434
|
-
}], defaultValue: [{
|
|
1435
|
-
type: Input
|
|
1436
|
-
}], model: [{
|
|
1437
|
-
type: Input
|
|
1438
|
-
}], path: [{
|
|
1439
|
-
type: Input
|
|
1440
|
-
}], change: [{
|
|
1441
|
-
type: Output
|
|
1442
|
-
}], key: [{
|
|
1443
|
-
type: Input
|
|
1444
|
-
}] } });
|
|
1445
|
-
;
|
|
1343
|
+
const log$1 = Log.create('base formly component', Level.__NOTHING);
|
|
1344
|
+
class BaseFormlyComponent extends FieldType {
|
|
1345
|
+
constructor() {
|
|
1346
|
+
super(...arguments);
|
|
1347
|
+
this.DualComponentController = DualComponentController;
|
|
1348
|
+
this.ctrl = {};
|
|
1349
|
+
this.change = new EventEmitter();
|
|
1350
|
+
// @ts-ignore
|
|
1351
|
+
this.handlers = [];
|
|
1352
|
+
this.__field = {
|
|
1353
|
+
templateOptions: {}
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
// @ts-ignore
|
|
1357
|
+
get mode() {
|
|
1358
|
+
return this.ctrl.mode;
|
|
1359
|
+
}
|
|
1360
|
+
// @ts-ignore
|
|
1361
|
+
set mode(v) {
|
|
1362
|
+
this.ctrl.mode = v;
|
|
1363
|
+
}
|
|
1364
|
+
// @ts-ignore
|
|
1365
|
+
set model(v) {
|
|
1366
|
+
this.ctrl.model = v;
|
|
1367
|
+
}
|
|
1368
|
+
get model() {
|
|
1369
|
+
return this.ctrl.model;
|
|
1370
|
+
}
|
|
1371
|
+
// @ts-ignore
|
|
1372
|
+
set key(value) {
|
|
1373
|
+
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
this.path = value;
|
|
1377
|
+
}
|
|
1378
|
+
get key() {
|
|
1379
|
+
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
1380
|
+
return this.field.key;
|
|
1381
|
+
}
|
|
1382
|
+
return this.path;
|
|
1383
|
+
}
|
|
1384
|
+
ngOnDestroy() {
|
|
1385
|
+
this.handlers.forEach(h => h.unsubscribe());
|
|
1386
|
+
this.handlers.length = 0;
|
|
1387
|
+
}
|
|
1388
|
+
ngAfterViewInit() {
|
|
1389
|
+
}
|
|
1390
|
+
ngOnInit() {
|
|
1391
|
+
const isFormlyMode = !!this.field;
|
|
1392
|
+
log$1.i(`isFormlyMode: ${isFormlyMode}`);
|
|
1393
|
+
if (!isFormlyMode) {
|
|
1394
|
+
const that = this;
|
|
1395
|
+
Object.defineProperty(this, 'field', {
|
|
1396
|
+
get: function () {
|
|
1397
|
+
return that.__field;
|
|
1398
|
+
},
|
|
1399
|
+
set: function (v) {
|
|
1400
|
+
that.__field = v;
|
|
1401
|
+
}
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
const existed = this.ctrl;
|
|
1405
|
+
this.ctrl = new this.DualComponentController(this, isFormlyMode);
|
|
1406
|
+
// @ts-ignore
|
|
1407
|
+
Object.keys(existed).forEach(key => {
|
|
1408
|
+
this.ctrl[key] = existed[key];
|
|
1409
|
+
});
|
|
1410
|
+
// @ts-ignore
|
|
1411
|
+
this.change.next(this.ctrl.value);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
BaseFormlyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseFormlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1415
|
+
BaseFormlyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: BaseFormlyComponent, selector: "app-base-formly-component-meta", inputs: { pizda: "pizda", mode: "mode", disabled: "disabled", required: "required", label: "label", placeholder: "placeholder", defaultValue: "defaultValue", model: "model", path: "path", key: "key" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: `<div></div>`, isInline: true });
|
|
1416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: BaseFormlyComponent, decorators: [{
|
|
1417
|
+
type: Component,
|
|
1418
|
+
args: [{
|
|
1419
|
+
selector: 'app-base-formly-component-meta',
|
|
1420
|
+
template: `<div></div>`
|
|
1421
|
+
}]
|
|
1422
|
+
}], propDecorators: { pizda: [{
|
|
1423
|
+
type: Input
|
|
1424
|
+
}], mode: [{
|
|
1425
|
+
type: Input
|
|
1426
|
+
}], disabled: [{
|
|
1427
|
+
type: Input
|
|
1428
|
+
}], required: [{
|
|
1429
|
+
type: Input
|
|
1430
|
+
}], label: [{
|
|
1431
|
+
type: Input
|
|
1432
|
+
}], placeholder: [{
|
|
1433
|
+
type: Input
|
|
1434
|
+
}], defaultValue: [{
|
|
1435
|
+
type: Input
|
|
1436
|
+
}], model: [{
|
|
1437
|
+
type: Input
|
|
1438
|
+
}], path: [{
|
|
1439
|
+
type: Input
|
|
1440
|
+
}], change: [{
|
|
1441
|
+
type: Output
|
|
1442
|
+
}], key: [{
|
|
1443
|
+
type: Input
|
|
1444
|
+
}] } });
|
|
1445
|
+
;
|
|
1446
1446
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base-formly-component.ts
|
|
1447
1447
|
|
|
1448
|
-
class ResizeService {
|
|
1449
|
-
constructor() {
|
|
1450
|
-
this.resizeDetector = elementResizeDetectorMaker({ strategy: 'scroll' });
|
|
1451
|
-
}
|
|
1452
|
-
addResizeEventListener(element, handler) {
|
|
1453
|
-
this.resizeDetector.listenTo(element, handler);
|
|
1454
|
-
}
|
|
1455
|
-
removeResizeEventListener(element) {
|
|
1456
|
-
this.resizeDetector.uninstall(element);
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
ResizeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1460
|
-
ResizeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService });
|
|
1461
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService, decorators: [{
|
|
1462
|
-
type: Injectable
|
|
1463
|
-
}], ctorParameters: function () { return []; } });
|
|
1464
|
-
;
|
|
1448
|
+
class ResizeService {
|
|
1449
|
+
constructor() {
|
|
1450
|
+
this.resizeDetector = elementResizeDetectorMaker({ strategy: 'scroll' });
|
|
1451
|
+
}
|
|
1452
|
+
addResizeEventListener(element, handler) {
|
|
1453
|
+
this.resizeDetector.listenTo(element, handler);
|
|
1454
|
+
}
|
|
1455
|
+
removeResizeEventListener(element) {
|
|
1456
|
+
this.resizeDetector.uninstall(element);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
ResizeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1460
|
+
ResizeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService });
|
|
1461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ResizeService, decorators: [{
|
|
1462
|
+
type: Injectable
|
|
1463
|
+
}], ctorParameters: function () { return []; } });
|
|
1464
|
+
;
|
|
1465
1465
|
({}); // @--end-of-file-for-module=tnp-helpers lib/resize-service.ts
|
|
1466
1466
|
|
|
1467
|
-
const log = Log.create(`[firedev-helpers] long-press`, Level.__NOTHING);
|
|
1468
|
-
class LongPress {
|
|
1469
|
-
constructor() {
|
|
1470
|
-
this.pressDuration = 1000;
|
|
1471
|
-
this.onLongPress = new EventEmitter();
|
|
1472
|
-
this.onLongPressing = new EventEmitter();
|
|
1473
|
-
this.onLongPressEnd = new EventEmitter();
|
|
1474
|
-
this.mouseX = 0;
|
|
1475
|
-
this.mouseY = 0;
|
|
1476
|
-
this.allowTrigger = false;
|
|
1477
|
-
this.triggerEnd = _.debounce(() => {
|
|
1478
|
-
this.endPress();
|
|
1479
|
-
}, 500);
|
|
1480
|
-
}
|
|
1481
|
-
get press() { return this.pressing; }
|
|
1482
|
-
get longPress() { return this.longPressing; }
|
|
1483
|
-
onMouseDown(event) {
|
|
1484
|
-
log.d(`MOUSE DOWN `);
|
|
1485
|
-
if (event.which !== 1)
|
|
1486
|
-
return;
|
|
1487
|
-
this.allowTrigger = true;
|
|
1488
|
-
this.mouseX = event.clientX;
|
|
1489
|
-
this.mouseY = event.clientY;
|
|
1490
|
-
this.pressing = true;
|
|
1491
|
-
this.longPressing = false;
|
|
1492
|
-
this.timeout = setTimeout(() => {
|
|
1493
|
-
if (this.allowTrigger) {
|
|
1494
|
-
this.longPressing = true;
|
|
1495
|
-
log.d(`long pressing start pressDuration:${this.pressDuration} `);
|
|
1496
|
-
this.onLongPress.emit(event);
|
|
1497
|
-
this.loop(event);
|
|
1498
|
-
}
|
|
1499
|
-
}, this.pressDuration);
|
|
1500
|
-
this.loop(event);
|
|
1501
|
-
}
|
|
1502
|
-
onMouseMove(event) {
|
|
1503
|
-
if (this.pressing && !this.longPressing) {
|
|
1504
|
-
const xThres = (event.clientX - this.mouseX) > 10;
|
|
1505
|
-
const yThres = (event.clientY - this.mouseY) > 10;
|
|
1506
|
-
if (xThres || yThres) {
|
|
1507
|
-
this.endPress();
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
loop(event) {
|
|
1512
|
-
if (this.longPressing) {
|
|
1513
|
-
this.timeout = setTimeout(() => {
|
|
1514
|
-
log.d(`emil longpressing`);
|
|
1515
|
-
this.triggerEnd();
|
|
1516
|
-
this.onLongPressing.emit(event);
|
|
1517
|
-
this.loop(event);
|
|
1518
|
-
}, 50);
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
endPress(emit = true) {
|
|
1522
|
-
this.allowTrigger = false;
|
|
1523
|
-
clearTimeout(this.timeout);
|
|
1524
|
-
this.longPressing = false;
|
|
1525
|
-
this.pressing = false;
|
|
1526
|
-
if (emit) {
|
|
1527
|
-
log.d(`EMIT END`);
|
|
1528
|
-
this.onLongPressEnd.emit(true);
|
|
1529
|
-
}
|
|
1530
|
-
else {
|
|
1531
|
-
log.d(`NOT EMIT END`);
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
onMouseUp() {
|
|
1535
|
-
this.endPress(false);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
LongPress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LongPress, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1539
|
-
LongPress.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LongPress, selector: "[long-press]", inputs: { pressDuration: "pressDuration" }, outputs: { onLongPress: "onLongPress", onLongPressing: "onLongPressing", onLongPressEnd: "onLongPressEnd" }, host: { listeners: { "mousedown": "onMouseDown($event)", "mousemove": "onMouseMove($event)", "mouseup": "onMouseUp()" }, properties: { "class.press": "this.press", "class.longpress": "this.longPress" } }, ngImport: i0 });
|
|
1540
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LongPress, decorators: [{
|
|
1541
|
-
type: Directive,
|
|
1542
|
-
args: [{ selector: '[long-press]' }]
|
|
1543
|
-
}], propDecorators: { pressDuration: [{
|
|
1544
|
-
type: Input
|
|
1545
|
-
}], onLongPress: [{
|
|
1546
|
-
type: Output
|
|
1547
|
-
}], onLongPressing: [{
|
|
1548
|
-
type: Output
|
|
1549
|
-
}], onLongPressEnd: [{
|
|
1550
|
-
type: Output
|
|
1551
|
-
}], press: [{
|
|
1552
|
-
type: HostBinding,
|
|
1553
|
-
args: ['class.press']
|
|
1554
|
-
}], longPress: [{
|
|
1555
|
-
type: HostBinding,
|
|
1556
|
-
args: ['class.longpress']
|
|
1557
|
-
}], onMouseDown: [{
|
|
1558
|
-
type: HostListener,
|
|
1559
|
-
args: ['mousedown', ['$event']]
|
|
1560
|
-
}], onMouseMove: [{
|
|
1561
|
-
type: HostListener,
|
|
1562
|
-
args: ['mousemove', ['$event']]
|
|
1563
|
-
}], onMouseUp: [{
|
|
1564
|
-
type: HostListener,
|
|
1565
|
-
args: ['mouseup']
|
|
1566
|
-
}] } });
|
|
1567
|
-
;
|
|
1467
|
+
const log = Log.create(`[firedev-helpers] long-press`, Level.__NOTHING);
|
|
1468
|
+
class LongPress {
|
|
1469
|
+
constructor() {
|
|
1470
|
+
this.pressDuration = 1000;
|
|
1471
|
+
this.onLongPress = new EventEmitter();
|
|
1472
|
+
this.onLongPressing = new EventEmitter();
|
|
1473
|
+
this.onLongPressEnd = new EventEmitter();
|
|
1474
|
+
this.mouseX = 0;
|
|
1475
|
+
this.mouseY = 0;
|
|
1476
|
+
this.allowTrigger = false;
|
|
1477
|
+
this.triggerEnd = _.debounce(() => {
|
|
1478
|
+
this.endPress();
|
|
1479
|
+
}, 500);
|
|
1480
|
+
}
|
|
1481
|
+
get press() { return this.pressing; }
|
|
1482
|
+
get longPress() { return this.longPressing; }
|
|
1483
|
+
onMouseDown(event) {
|
|
1484
|
+
log.d(`MOUSE DOWN `);
|
|
1485
|
+
if (event.which !== 1)
|
|
1486
|
+
return;
|
|
1487
|
+
this.allowTrigger = true;
|
|
1488
|
+
this.mouseX = event.clientX;
|
|
1489
|
+
this.mouseY = event.clientY;
|
|
1490
|
+
this.pressing = true;
|
|
1491
|
+
this.longPressing = false;
|
|
1492
|
+
this.timeout = setTimeout(() => {
|
|
1493
|
+
if (this.allowTrigger) {
|
|
1494
|
+
this.longPressing = true;
|
|
1495
|
+
log.d(`long pressing start pressDuration:${this.pressDuration} `);
|
|
1496
|
+
this.onLongPress.emit(event);
|
|
1497
|
+
this.loop(event);
|
|
1498
|
+
}
|
|
1499
|
+
}, this.pressDuration);
|
|
1500
|
+
this.loop(event);
|
|
1501
|
+
}
|
|
1502
|
+
onMouseMove(event) {
|
|
1503
|
+
if (this.pressing && !this.longPressing) {
|
|
1504
|
+
const xThres = (event.clientX - this.mouseX) > 10;
|
|
1505
|
+
const yThres = (event.clientY - this.mouseY) > 10;
|
|
1506
|
+
if (xThres || yThres) {
|
|
1507
|
+
this.endPress();
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
loop(event) {
|
|
1512
|
+
if (this.longPressing) {
|
|
1513
|
+
this.timeout = setTimeout(() => {
|
|
1514
|
+
log.d(`emil longpressing`);
|
|
1515
|
+
this.triggerEnd();
|
|
1516
|
+
this.onLongPressing.emit(event);
|
|
1517
|
+
this.loop(event);
|
|
1518
|
+
}, 50);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
endPress(emit = true) {
|
|
1522
|
+
this.allowTrigger = false;
|
|
1523
|
+
clearTimeout(this.timeout);
|
|
1524
|
+
this.longPressing = false;
|
|
1525
|
+
this.pressing = false;
|
|
1526
|
+
if (emit) {
|
|
1527
|
+
log.d(`EMIT END`);
|
|
1528
|
+
this.onLongPressEnd.emit(true);
|
|
1529
|
+
}
|
|
1530
|
+
else {
|
|
1531
|
+
log.d(`NOT EMIT END`);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
onMouseUp() {
|
|
1535
|
+
this.endPress(false);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
LongPress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LongPress, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1539
|
+
LongPress.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: LongPress, selector: "[long-press]", inputs: { pressDuration: "pressDuration" }, outputs: { onLongPress: "onLongPress", onLongPressing: "onLongPressing", onLongPressEnd: "onLongPressEnd" }, host: { listeners: { "mousedown": "onMouseDown($event)", "mousemove": "onMouseMove($event)", "mouseup": "onMouseUp()" }, properties: { "class.press": "this.press", "class.longpress": "this.longPress" } }, ngImport: i0 });
|
|
1540
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: LongPress, decorators: [{
|
|
1541
|
+
type: Directive,
|
|
1542
|
+
args: [{ selector: '[long-press]' }]
|
|
1543
|
+
}], propDecorators: { pressDuration: [{
|
|
1544
|
+
type: Input
|
|
1545
|
+
}], onLongPress: [{
|
|
1546
|
+
type: Output
|
|
1547
|
+
}], onLongPressing: [{
|
|
1548
|
+
type: Output
|
|
1549
|
+
}], onLongPressEnd: [{
|
|
1550
|
+
type: Output
|
|
1551
|
+
}], press: [{
|
|
1552
|
+
type: HostBinding,
|
|
1553
|
+
args: ['class.press']
|
|
1554
|
+
}], longPress: [{
|
|
1555
|
+
type: HostBinding,
|
|
1556
|
+
args: ['class.longpress']
|
|
1557
|
+
}], onMouseDown: [{
|
|
1558
|
+
type: HostListener,
|
|
1559
|
+
args: ['mousedown', ['$event']]
|
|
1560
|
+
}], onMouseMove: [{
|
|
1561
|
+
type: HostListener,
|
|
1562
|
+
args: ['mousemove', ['$event']]
|
|
1563
|
+
}], onMouseUp: [{
|
|
1564
|
+
type: HostListener,
|
|
1565
|
+
args: ['mouseup']
|
|
1566
|
+
}] } });
|
|
1567
|
+
;
|
|
1568
1568
|
({}); // @--end-of-file-for-module=tnp-helpers lib/long-press.directive.ts
|
|
1569
1569
|
|
|
1570
|
-
/* */
|
|
1571
|
-
/* */
|
|
1572
|
-
const Helpers = HelpersTnp.Instance;
|
|
1573
|
-
;
|
|
1570
|
+
/* */
|
|
1571
|
+
/* */
|
|
1572
|
+
const Helpers = HelpersTnp.Instance;
|
|
1573
|
+
;
|
|
1574
1574
|
({}); // @--end-of-file-for-module=tnp-helpers lib/index.ts
|
|
1575
1575
|
|
|
1576
|
-
/**
|
|
1577
|
-
* Generated bundle index. Do not edit.
|
|
1576
|
+
/**
|
|
1577
|
+
* Generated bundle index. Do not edit.
|
|
1578
1578
|
*/
|
|
1579
1579
|
|
|
1580
1580
|
export { BaseComponent, BaseComponentForRouter, BaseFormlyComponent, BaselineSiteJoinprefix, DualComponentController, Helpers, LongPress, PREFIXES, Project, ResizeService };
|