tnp-helpers 0.0.67 → 13.0.2
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 +2 -1
- package/browser/README.md +24 -0
- package/browser/esm2020/lib/base-component.mjs +48 -0
- package/browser/esm2020/lib/base-formly-component.mjs +123 -0
- package/browser/esm2020/lib/condition-wait.mjs +54 -0
- package/browser/esm2020/lib/constants.mjs +2 -0
- package/browser/esm2020/lib/dual-component-ctrl.mjs +116 -0
- package/browser/esm2020/lib/helpers-array-obj.mjs +81 -0
- package/browser/esm2020/lib/helpers-environment.mjs +21 -0
- package/browser/esm2020/lib/helpers-messages.mjs +68 -0
- package/browser/esm2020/lib/helpers-strings-regexes.mjs +49 -0
- package/browser/esm2020/lib/helpers-strings.mjs +61 -0
- package/browser/esm2020/lib/helpers.mjs +108 -0
- package/browser/esm2020/lib/index.mjs +11 -0
- package/browser/esm2020/lib/long-press.directive.mjs +106 -0
- package/browser/esm2020/lib/project.mjs +90 -0
- package/browser/esm2020/lib/resize-service.mjs +20 -0
- package/browser/esm2020/public-api.mjs +2 -0
- package/browser/esm2020/tnp-helpers.mjs +5 -0
- package/browser/fesm2015/tnp-helpers.mjs +936 -0
- package/browser/fesm2015/tnp-helpers.mjs.map +1 -0
- package/browser/fesm2020/tnp-helpers.mjs +927 -0
- package/browser/fesm2020/tnp-helpers.mjs.map +1 -0
- package/browser/{base-component.d.ts → lib/base-component.d.ts} +3 -0
- package/browser/{base-formly-component.d.ts → lib/base-formly-component.d.ts} +4 -1
- package/browser/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
- package/browser/{constants.d.ts → lib/constants.d.ts} +0 -0
- package/browser/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
- package/{helpers-array-obj.d.ts → browser/lib/helpers-array-obj.d.ts} +1 -0
- package/browser/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
- package/browser/{helpers-messages.d.ts → lib/helpers-messages.d.ts} +0 -0
- package/browser/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
- package/browser/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
- package/browser/{helpers.d.ts → lib/helpers.d.ts} +1 -2
- package/{client → browser/lib}/index.d.ts +1 -1
- package/{client → browser/lib}/long-press.directive.d.ts +3 -0
- package/browser/{project.d.ts → lib/project.d.ts} +0 -0
- package/{client → browser/lib}/resize-service.d.ts +3 -0
- package/browser/package.json +31 -0
- package/browser/public-api.d.ts +1 -0
- package/browser/tnp-helpers.d.ts +5 -0
- package/client/README.md +24 -0
- package/client/esm2020/lib/base-component.mjs +48 -0
- package/client/esm2020/lib/base-formly-component.mjs +123 -0
- package/client/esm2020/lib/condition-wait.mjs +54 -0
- package/client/esm2020/lib/constants.mjs +2 -0
- package/client/esm2020/lib/dual-component-ctrl.mjs +116 -0
- package/client/esm2020/lib/helpers-array-obj.mjs +81 -0
- package/client/esm2020/lib/helpers-environment.mjs +21 -0
- package/client/esm2020/lib/helpers-messages.mjs +68 -0
- package/client/esm2020/lib/helpers-strings-regexes.mjs +49 -0
- package/client/esm2020/lib/helpers-strings.mjs +61 -0
- package/client/esm2020/lib/helpers.mjs +108 -0
- package/client/esm2020/lib/index.mjs +11 -0
- package/client/esm2020/lib/long-press.directive.mjs +106 -0
- package/client/esm2020/lib/project.mjs +90 -0
- package/client/esm2020/lib/resize-service.mjs +20 -0
- package/client/esm2020/public-api.mjs +2 -0
- package/client/esm2020/tnp-helpers.mjs +5 -0
- package/client/fesm2015/tnp-helpers.mjs +936 -0
- package/client/fesm2015/tnp-helpers.mjs.map +1 -0
- package/client/fesm2020/tnp-helpers.mjs +927 -0
- package/client/fesm2020/tnp-helpers.mjs.map +1 -0
- package/client/{base-component.d.ts → lib/base-component.d.ts} +3 -0
- package/{base-formly-component.d.ts → client/lib/base-formly-component.d.ts} +4 -1
- package/client/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
- package/client/{constants.d.ts → lib/constants.d.ts} +0 -0
- package/client/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
- package/client/{helpers-array-obj.d.ts → lib/helpers-array-obj.d.ts} +1 -0
- package/client/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
- package/client/{helpers-messages.d.ts → lib/helpers-messages.d.ts} +0 -0
- package/client/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
- package/client/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
- package/client/{helpers.d.ts → lib/helpers.d.ts} +1 -2
- package/{browser → client/lib}/index.d.ts +1 -1
- package/{browser → client/lib}/long-press.directive.d.ts +3 -0
- package/client/{project.d.ts → lib/project.d.ts} +0 -0
- package/{resize-service.d.ts → client/lib/resize-service.d.ts} +3 -0
- package/client/package.json +25 -19
- package/client/public-api.d.ts +1 -0
- package/client/tnp-helpers.d.ts +5 -0
- package/index.d.ts +1 -11
- package/index.js +3 -21
- package/index.js.map +1 -1
- package/{base-component.d.ts → lib/base-component.d.ts} +0 -0
- package/{base-component.js → lib/base-component.js} +8 -7
- package/lib/base-component.js.map +1 -0
- package/{client → lib}/base-formly-component.d.ts +1 -1
- package/{base-formly-component.js → lib/base-formly-component.js} +45 -44
- package/lib/base-formly-component.js.map +1 -0
- package/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
- package/{condition-wait.js → lib/condition-wait.js} +10 -9
- package/lib/condition-wait.js.map +1 -0
- package/{constants.d.ts → lib/constants.d.ts} +0 -0
- package/{constants.js → lib/constants.js} +2 -1
- package/lib/constants.js.map +1 -0
- package/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
- package/{dual-component-ctrl.js → lib/dual-component-ctrl.js} +2 -1
- package/lib/dual-component-ctrl.js.map +1 -0
- package/{git-project.d.ts → lib/git-project.d.ts} +4 -3
- package/{git-project.js → lib/git-project.js} +20 -11
- package/lib/git-project.js.map +1 -0
- package/{browser → lib}/helpers-array-obj.d.ts +1 -0
- package/{helpers-array-obj.js → lib/helpers-array-obj.js} +8 -1
- package/lib/helpers-array-obj.js.map +1 -0
- package/{helpers-cli-tool.backend.d.ts → lib/helpers-cli-tool.backend.d.ts} +0 -0
- package/{helpers-cli-tool.backend.js → lib/helpers-cli-tool.backend.js} +5 -4
- package/lib/helpers-cli-tool.backend.js.map +1 -0
- package/{helpers-dependencies.backend.d.ts → lib/helpers-dependencies.backend.d.ts} +0 -0
- package/{helpers-dependencies.backend.js → lib/helpers-dependencies.backend.js} +6 -5
- package/lib/helpers-dependencies.backend.js.map +1 -0
- package/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
- package/{helpers-environment.js → lib/helpers-environment.js} +2 -1
- package/lib/helpers-environment.js.map +1 -0
- package/{helpers-file-folders.backend.d.ts → lib/helpers-file-folders.backend.d.ts} +1 -0
- package/{helpers-file-folders.backend.js → lib/helpers-file-folders.backend.js} +67 -47
- package/lib/helpers-file-folders.backend.js.map +1 -0
- package/{helpers-git.backend.d.ts → lib/helpers-git.backend.d.ts} +3 -1
- package/{helpers-git.backend.js → lib/helpers-git.backend.js} +90 -56
- package/lib/helpers-git.backend.js.map +1 -0
- package/{helpers-json5.backend.d.ts → lib/helpers-json5.backend.d.ts} +0 -0
- package/{helpers-json5.backend.js → lib/helpers-json5.backend.js} +3 -2
- package/lib/helpers-json5.backend.js.map +1 -0
- package/{helpers-messages.d.ts → lib/helpers-messages.d.ts} +0 -0
- package/{helpers-messages.js → lib/helpers-messages.js} +2 -1
- package/lib/helpers-messages.js.map +1 -0
- package/{helpers-morphi-framework.backend.d.ts → lib/helpers-morphi-framework.backend.d.ts} +0 -0
- package/{helpers-morphi-framework.backend.js → lib/helpers-morphi-framework.backend.js} +4 -3
- package/lib/helpers-morphi-framework.backend.js.map +1 -0
- package/{helpers-network.backend.d.ts → lib/helpers-network.backend.d.ts} +0 -0
- package/{helpers-network.backend.js → lib/helpers-network.backend.js} +2 -1
- package/lib/helpers-network.backend.js.map +1 -0
- package/{helpers-npm.backend.d.ts → lib/helpers-npm.backend.d.ts} +0 -0
- package/{helpers-npm.backend.js → lib/helpers-npm.backend.js} +2 -1
- package/lib/helpers-npm.backend.js.map +1 -0
- package/{helpers-path.backend.d.ts → lib/helpers-path.backend.d.ts} +0 -0
- package/{helpers-path.backend.js → lib/helpers-path.backend.js} +4 -3
- package/lib/helpers-path.backend.js.map +1 -0
- package/{helpers-process.backend.d.ts → lib/helpers-process.backend.d.ts} +2 -2
- package/{helpers-process.backend.js → lib/helpers-process.backend.js} +54 -53
- package/lib/helpers-process.backend.js.map +1 -0
- package/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
- package/{helpers-strings-regexes.js → lib/helpers-strings-regexes.js} +2 -1
- package/lib/helpers-strings-regexes.js.map +1 -0
- package/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
- package/{helpers-strings.js → lib/helpers-strings.js} +2 -1
- package/lib/helpers-strings.js.map +1 -0
- package/{helpers-system-terminal.backend.d.ts → lib/helpers-system-terminal.backend.d.ts} +1 -1
- package/{helpers-system-terminal.backend.js → lib/helpers-system-terminal.backend.js} +9 -8
- package/lib/helpers-system-terminal.backend.js.map +1 -0
- package/{helpers.d.ts → lib/helpers.d.ts} +5 -4
- package/{helpers.js → lib/helpers.js} +34 -28
- package/lib/helpers.js.map +1 -0
- package/{client/index.js → lib/index.d.ts} +3 -3
- package/lib/index.js +25 -0
- package/lib/index.js.map +1 -0
- package/{long-press.directive.d.ts → lib/long-press.directive.d.ts} +0 -0
- package/{long-press.directive.js → lib/long-press.directive.js} +40 -39
- package/lib/long-press.directive.js.map +1 -0
- package/{merge-helpers.backend.d.ts → lib/merge-helpers.backend.d.ts} +0 -0
- package/{merge-helpers.backend.js → lib/merge-helpers.backend.js} +7 -6
- package/lib/merge-helpers.backend.js.map +1 -0
- package/{project.d.ts → lib/project.d.ts} +0 -0
- package/{project.js → lib/project.js} +23 -21
- package/lib/project.js.map +1 -0
- package/{browser → lib}/resize-service.d.ts +0 -0
- package/{resize-service.js → lib/resize-service.js} +5 -4
- package/lib/resize-service.js.map +1 -0
- package/{ts-code-modifier → lib/ts-code}/index.d.ts +0 -0
- package/{ts-code-modifier → lib/ts-code}/index.js +3 -2
- package/lib/ts-code/index.js.map +1 -0
- package/lib/ts-code/ts-code-extractor.d.ts +14 -0
- package/lib/ts-code/ts-code-extractor.js +47 -0
- package/lib/ts-code/ts-code-extractor.js.map +1 -0
- package/{ts-code-modifier → lib/ts-code}/ts-code-modifier.backend.d.ts +0 -0
- package/{ts-code-modifier → lib/ts-code}/ts-code-modifier.backend.js +3 -2
- package/lib/ts-code/ts-code-modifier.backend.js.map +1 -0
- package/package.json +10 -18
- package/package.json_devDependencies.json +50 -50
- package/{package.json_tnp.json → package.json_tnp.json5} +12 -8
- package/tmp-environment.json +89 -126
- package/base-component.js.map +0 -1
- package/base-formly-component.js.map +0 -1
- package/browser/base-component.js +0 -48
- package/browser/base-component.js.map +0 -1
- package/browser/base-formly-component.js +0 -149
- package/browser/base-formly-component.js.map +0 -1
- package/browser/condition-wait.js +0 -57
- package/browser/condition-wait.js.map +0 -1
- package/browser/constants.js +0 -2
- package/browser/constants.js.map +0 -1
- package/browser/dual-component-ctrl.js +0 -118
- package/browser/dual-component-ctrl.js.map +0 -1
- package/browser/es5/base-component.js +0 -89
- package/browser/es5/base-formly-component.js +0 -158
- package/browser/es5/condition-wait.js +0 -135
- package/browser/es5/constants.js +0 -7
- package/browser/es5/dual-component-ctrl.js +0 -164
- package/browser/es5/git-project.js +0 -18
- package/browser/es5/helpers-array-obj.js +0 -129
- package/browser/es5/helpers-environment.js +0 -46
- package/browser/es5/helpers-messages.js +0 -105
- package/browser/es5/helpers-strings-regexes.js +0 -74
- package/browser/es5/helpers-strings.js +0 -96
- package/browser/es5/helpers.js +0 -217
- package/browser/es5/index.js +0 -86
- package/browser/es5/long-press.directive.js +0 -133
- package/browser/es5/project.js +0 -146
- package/browser/es5/resize-service.js +0 -45
- package/browser/git-project.d.ts +0 -2
- package/browser/git-project.js +0 -6
- package/browser/git-project.js.map +0 -1
- package/browser/helpers-array-obj.js +0 -75
- package/browser/helpers-array-obj.js.map +0 -1
- package/browser/helpers-environment.js +0 -21
- package/browser/helpers-environment.js.map +0 -1
- package/browser/helpers-messages.js +0 -68
- package/browser/helpers-messages.js.map +0 -1
- package/browser/helpers-strings-regexes.js +0 -49
- package/browser/helpers-strings-regexes.js.map +0 -1
- package/browser/helpers-strings.js +0 -61
- package/browser/helpers-strings.js.map +0 -1
- package/browser/helpers.js +0 -113
- package/browser/helpers.js.map +0 -1
- package/browser/index.js +0 -11
- package/browser/index.js.map +0 -1
- package/browser/long-press.directive.js +0 -125
- package/browser/long-press.directive.js.map +0 -1
- package/browser/project.js +0 -90
- package/browser/project.js.map +0 -1
- package/browser/resize-service.js +0 -20
- package/browser/resize-service.js.map +0 -1
- package/client/base-component.js +0 -48
- package/client/base-component.js.map +0 -1
- package/client/base-formly-component.js +0 -149
- package/client/base-formly-component.js.map +0 -1
- package/client/condition-wait.js +0 -57
- package/client/condition-wait.js.map +0 -1
- package/client/constants.js +0 -2
- package/client/constants.js.map +0 -1
- package/client/dual-component-ctrl.js +0 -118
- package/client/dual-component-ctrl.js.map +0 -1
- package/client/es5/base-component.js +0 -89
- package/client/es5/base-formly-component.js +0 -158
- package/client/es5/condition-wait.js +0 -135
- package/client/es5/constants.js +0 -7
- package/client/es5/dual-component-ctrl.js +0 -164
- package/client/es5/git-project.js +0 -18
- package/client/es5/helpers-array-obj.js +0 -129
- package/client/es5/helpers-environment.js +0 -46
- package/client/es5/helpers-messages.js +0 -105
- package/client/es5/helpers-strings-regexes.js +0 -74
- package/client/es5/helpers-strings.js +0 -96
- package/client/es5/helpers.js +0 -217
- package/client/es5/index.js +0 -86
- package/client/es5/long-press.directive.js +0 -133
- package/client/es5/project.js +0 -146
- package/client/es5/resize-service.js +0 -45
- package/client/git-project.d.ts +0 -2
- package/client/git-project.js +0 -6
- package/client/git-project.js.map +0 -1
- package/client/helpers-array-obj.js +0 -75
- package/client/helpers-array-obj.js.map +0 -1
- package/client/helpers-environment.js +0 -21
- package/client/helpers-environment.js.map +0 -1
- package/client/helpers-messages.js +0 -68
- package/client/helpers-messages.js.map +0 -1
- package/client/helpers-strings-regexes.js +0 -49
- package/client/helpers-strings-regexes.js.map +0 -1
- package/client/helpers-strings.js +0 -61
- package/client/helpers-strings.js.map +0 -1
- package/client/helpers.js +0 -113
- package/client/helpers.js.map +0 -1
- package/client/index.js.map +0 -1
- package/client/long-press.directive.js +0 -125
- package/client/long-press.directive.js.map +0 -1
- package/client/project.js +0 -90
- package/client/project.js.map +0 -1
- package/client/resize-service.js +0 -20
- package/client/resize-service.js.map +0 -1
- package/condition-wait.js.map +0 -1
- package/constants.js.map +0 -1
- package/dual-component-ctrl.js.map +0 -1
- package/git-project.js.map +0 -1
- package/helpers-array-obj.js.map +0 -1
- package/helpers-cli-tool.backend.js.map +0 -1
- package/helpers-dependencies.backend.js.map +0 -1
- package/helpers-environment.js.map +0 -1
- package/helpers-file-folders.backend.js.map +0 -1
- package/helpers-git.backend.js.map +0 -1
- package/helpers-json5.backend.js.map +0 -1
- package/helpers-messages.js.map +0 -1
- package/helpers-morphi-framework.backend.js.map +0 -1
- package/helpers-network.backend.js.map +0 -1
- package/helpers-npm.backend.js.map +0 -1
- package/helpers-path.backend.js.map +0 -1
- package/helpers-process.backend.js.map +0 -1
- package/helpers-strings-regexes.js.map +0 -1
- package/helpers-strings.js.map +0 -1
- package/helpers-system-terminal.backend.js.map +0 -1
- package/helpers.js.map +0 -1
- package/long-press.directive.js.map +0 -1
- package/merge-helpers.backend.js.map +0 -1
- package/project.js.map +0 -1
- package/resize-service.js.map +0 -1
- package/ts-code-modifier/index.js.map +0 -1
- package/ts-code-modifier/ts-code-modifier.backend.js.map +0 -1
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
import { _, CoreHelpers } from 'tnp-core/browser';
|
|
2
|
+
import * as fuzzy from 'fuzzy';
|
|
3
|
+
import { CLASS } from 'typescript-class-helpers/browser';
|
|
4
|
+
import { Morphi } from 'morphi/browser';
|
|
5
|
+
import { config } from 'tnp-config/browser';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { Component, Input, EventEmitter, Output, Injectable, Directive, HostBinding, HostListener } from '@angular/core';
|
|
8
|
+
import { NavigationEnd } from '@angular/router';
|
|
9
|
+
import { FieldType } from '@ngx-formly/core';
|
|
10
|
+
import { Log, Level } from 'ng2-logger/browser';
|
|
11
|
+
import * as elementResizeDetectorMaker from 'element-resize-detector';
|
|
12
|
+
|
|
13
|
+
class HelpersArrayObj {
|
|
14
|
+
from(s) {
|
|
15
|
+
if (_.isArray(s)) {
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
18
|
+
if (_.isString(s)) {
|
|
19
|
+
return s.split(' ');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
second(arr) {
|
|
23
|
+
if (!Array.isArray(arr) || arr.length < 2) {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
return arr[1];
|
|
27
|
+
}
|
|
28
|
+
arrayMoveElementBefore(arr, a, b, prop) {
|
|
29
|
+
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
30
|
+
_.pullAt(arr, indexA);
|
|
31
|
+
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
32
|
+
if (indexB === 0) {
|
|
33
|
+
arr.unshift(a);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
arr.splice(indexB - 1, 0, a);
|
|
37
|
+
}
|
|
38
|
+
return arr;
|
|
39
|
+
}
|
|
40
|
+
arrayMoveElementAfterB(arr, a, b, prop) {
|
|
41
|
+
let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
|
|
42
|
+
_.pullAt(arr, indexA);
|
|
43
|
+
let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
|
|
44
|
+
if (indexB === arr.length - 1) {
|
|
45
|
+
arr.push(a);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
arr.splice(indexB + 1, 0, a);
|
|
49
|
+
}
|
|
50
|
+
return arr;
|
|
51
|
+
}
|
|
52
|
+
uniqArray(array, uniqueProperty) {
|
|
53
|
+
var seen = {};
|
|
54
|
+
return array
|
|
55
|
+
.filter(f => !!f)
|
|
56
|
+
.filter(function (item) {
|
|
57
|
+
return seen.hasOwnProperty(uniqueProperty ? item[uniqueProperty] : item) ? false
|
|
58
|
+
: (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
sortKeys(obj) {
|
|
62
|
+
if (_.isArray(obj)) {
|
|
63
|
+
return obj.map(Helpers.arrays.sortKeys);
|
|
64
|
+
}
|
|
65
|
+
if (_.isObject(obj)) {
|
|
66
|
+
return _.fromPairs(_.keys(obj).sort().map(key => [key, Helpers.arrays.sortKeys(obj[key])]));
|
|
67
|
+
}
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
;
|
|
71
|
+
/**
|
|
72
|
+
* Fuzzy search
|
|
73
|
+
*/
|
|
74
|
+
fuzzy(query, list, valueFn) {
|
|
75
|
+
const resultsFuzzy = fuzzy.filter(query, list.map(k => valueFn ? valueFn(k) : k));
|
|
76
|
+
const resultsFuzzyKebab = fuzzy.filter(_.kebabCase(query), list.map(k => _.kebabCase((valueFn ? valueFn(k) : k))));
|
|
77
|
+
const matches = resultsFuzzy.map((el) => el.string);
|
|
78
|
+
const matchesKebab = resultsFuzzyKebab.map((el) => el.string);
|
|
79
|
+
const results = (resultsFuzzy.length === 0) ? [] : list.filter(k => {
|
|
80
|
+
return matches.includes((valueFn ? valueFn(k) : k));
|
|
81
|
+
});
|
|
82
|
+
if (matches.length === 0 && matchesKebab.length > 0) {
|
|
83
|
+
const m = list.find(k => _.kebabCase((valueFn ? valueFn(k) : k)) === _.first(matchesKebab));
|
|
84
|
+
results.push(m);
|
|
85
|
+
matches.push((valueFn ? valueFn(m) : m));
|
|
86
|
+
}
|
|
87
|
+
return { matches, results };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const KEY = {
|
|
92
|
+
LAST_ERROR: Symbol(),
|
|
93
|
+
LAST_INFO: Symbol(),
|
|
94
|
+
LAST_WARN: Symbol(),
|
|
95
|
+
LAST_LOG: Symbol(),
|
|
96
|
+
};
|
|
97
|
+
// export class Log {
|
|
98
|
+
// private static _instance: Log;
|
|
99
|
+
// public Instance() {
|
|
100
|
+
// if (!Log._instance) {
|
|
101
|
+
// Log._instance = new Log();
|
|
102
|
+
// }
|
|
103
|
+
// return Log._instance;
|
|
104
|
+
// }
|
|
105
|
+
// create(name: string, level?: Level) {
|
|
106
|
+
// if (level === void 0) {
|
|
107
|
+
// level = Level.DATA;
|
|
108
|
+
// }
|
|
109
|
+
// return {
|
|
110
|
+
// d(details: string, debugLevel?: number) {
|
|
111
|
+
// return Helpers.log(`[${name}] ${details}`, debugLevel)
|
|
112
|
+
// },
|
|
113
|
+
// i(details: string) {
|
|
114
|
+
// return Helpers.info(`[${name}] ${details}`)
|
|
115
|
+
// },
|
|
116
|
+
// w(details: string, noExit = false, noTrace = false) {
|
|
117
|
+
// return Helpers.error(`[${name}] ${details}`, noExit, noTrace);
|
|
118
|
+
// },
|
|
119
|
+
// er(details: string, ) {
|
|
120
|
+
// return Helpers.info(`[${name}] ${details}`)
|
|
121
|
+
// },
|
|
122
|
+
// }
|
|
123
|
+
// }
|
|
124
|
+
// }
|
|
125
|
+
class HelpersMessages {
|
|
126
|
+
msgCacheClear() {
|
|
127
|
+
global[KEY.LAST_LOG] = void 0;
|
|
128
|
+
global[KEY.LAST_WARN] = void 0;
|
|
129
|
+
global[KEY.LAST_ERROR] = void 0;
|
|
130
|
+
global[KEY.LAST_INFO] = void 0;
|
|
131
|
+
}
|
|
132
|
+
error(details, noExit = false, noTrace = false) {
|
|
133
|
+
if (Helpers.isBrowser) {
|
|
134
|
+
console.error(details);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
info(details) {
|
|
139
|
+
if (Helpers.isBrowser) {
|
|
140
|
+
console.info(details);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
log(details, debugLevel = 0) {
|
|
145
|
+
if (Helpers.isBrowser) {
|
|
146
|
+
console.log(details);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
warn(details, trace = false) {
|
|
151
|
+
if (Helpers.isBrowser) {
|
|
152
|
+
console.warn(details);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
class HelpersStringsRegexes {
|
|
159
|
+
escapeStringForRegEx(s) {
|
|
160
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
161
|
+
}
|
|
162
|
+
matchExactOnce(s, regex) {
|
|
163
|
+
if (!_.isString(s) || !_.isRegExp(regex)) {
|
|
164
|
+
return void 0;
|
|
165
|
+
}
|
|
166
|
+
const result = s.match(regex);
|
|
167
|
+
if (_.isNil(result)) {
|
|
168
|
+
return void 0;
|
|
169
|
+
}
|
|
170
|
+
return result.length >= 1 ? _.first(result) : void 0;
|
|
171
|
+
}
|
|
172
|
+
get regex() {
|
|
173
|
+
return {
|
|
174
|
+
/**
|
|
175
|
+
* mathes
|
|
176
|
+
* xxx.xxx.xxx.xxx
|
|
177
|
+
* xxx.xxx.xxx.xxx:port
|
|
178
|
+
* http://xxx.xxx.xxx.xxx:port
|
|
179
|
+
* http://xxx.xxx.xxx.xxx
|
|
180
|
+
* https://xxx.xxx.xxx.xxx:port
|
|
181
|
+
* https://xxx.xxx.xxx.xxx *
|
|
182
|
+
*/
|
|
183
|
+
get forStringWithIpHost() {
|
|
184
|
+
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]+)?/;
|
|
185
|
+
return regex;
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* mathes
|
|
189
|
+
* http://domain.com:port
|
|
190
|
+
* http://domain.com
|
|
191
|
+
* http://domain:port
|
|
192
|
+
* http://domain
|
|
193
|
+
* https://domain.com:port
|
|
194
|
+
* https://domain.com
|
|
195
|
+
* https://domain:port
|
|
196
|
+
* https://domain
|
|
197
|
+
*/
|
|
198
|
+
get forStringWithDomainHost() {
|
|
199
|
+
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}))/;
|
|
200
|
+
return regex;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
class HelpersEnvironment {
|
|
207
|
+
environmentName(filename, local_env_name) {
|
|
208
|
+
}
|
|
209
|
+
isValidGitRepuUrl(url) {
|
|
210
|
+
const regex = /^([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+(:\d+)?)(?::|\/)([\d\/\w.-]+?)(\.git)?$/;
|
|
211
|
+
const res = regex.test(url);
|
|
212
|
+
return res;
|
|
213
|
+
}
|
|
214
|
+
isValidIp(ip) {
|
|
215
|
+
if (!_.isString(ip)) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
ip = ip.trim();
|
|
219
|
+
if (ip === 'localhost') {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
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);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
class HelpersStrings {
|
|
227
|
+
/**
|
|
228
|
+
* Example:
|
|
229
|
+
*
|
|
230
|
+
* const result = interpolateString("I'm {age} years old!")
|
|
231
|
+
* .withParameters({ age: 29 });
|
|
232
|
+
*
|
|
233
|
+
* const result = interpolateString("The {a} says {n}, {n}, {n}!")
|
|
234
|
+
* .withParameters({ a: 'cow', n: 'moo' });
|
|
235
|
+
*
|
|
236
|
+
*
|
|
237
|
+
* @param value string to interpolate
|
|
238
|
+
* @param parameters object with parametes
|
|
239
|
+
*/
|
|
240
|
+
interpolateString(value) {
|
|
241
|
+
if (typeof value !== 'string') {
|
|
242
|
+
console.warn('[ss-logic][helper] Value for interpolation is not string: ', value);
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
withParameters(parameters) {
|
|
247
|
+
if (typeof parameters !== 'object') {
|
|
248
|
+
console.warn('[ss-logic][helper] Parameters are not a object: ', parameters);
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
251
|
+
return value.replace(/{([^{}]*)}/g, function (a, b) {
|
|
252
|
+
var r = parameters[b];
|
|
253
|
+
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
numValue(pixelsCss) {
|
|
259
|
+
// tslint:disable-next-line:radix
|
|
260
|
+
return parseInt(pixelsCss.replace('px', ''));
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* examples:
|
|
264
|
+
* 'aa bb bb' => ['aa','bb','cc'],
|
|
265
|
+
* 'aa' => ['aa']
|
|
266
|
+
* ['aa'] => ['aa']
|
|
267
|
+
*/
|
|
268
|
+
splitIfNeed(stringOrArr) {
|
|
269
|
+
let res = [];
|
|
270
|
+
if (_.isArray(stringOrArr)) {
|
|
271
|
+
res = stringOrArr.map(s => {
|
|
272
|
+
return s.trim();
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (_.isString(stringOrArr)) {
|
|
276
|
+
res = stringOrArr.split(/\s*[\s,]\s*/);
|
|
277
|
+
}
|
|
278
|
+
return res.filter(f => !!f && (f.trim() !== ''));
|
|
279
|
+
}
|
|
280
|
+
removeDoubleOrMoreEmptyLines(s) {
|
|
281
|
+
s = s?.split('\n').map(f => f.trimRight()).join('\n');
|
|
282
|
+
return s?.replace(/(\r\n|\r|\n){2,}/g, '$1\n');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async function conditionWait(conditionAndTimeout) {
|
|
287
|
+
await waitFor(conditionAndTimeout);
|
|
288
|
+
}
|
|
289
|
+
function waitFor(arr, messageToShow = void 0) {
|
|
290
|
+
return new Promise(async (resolve, reject) => {
|
|
291
|
+
if (arr.length === 0) {
|
|
292
|
+
resolve(void 0);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
// console.log(arr.length)
|
|
296
|
+
const check = arr.shift();
|
|
297
|
+
if (_.isUndefined(check.timeoutCheck)) {
|
|
298
|
+
check.timeoutCheck = 2000;
|
|
299
|
+
}
|
|
300
|
+
if (_.isUndefined(check.timeoutNext)) {
|
|
301
|
+
check.timeoutNext = 4000;
|
|
302
|
+
}
|
|
303
|
+
const { timeoutCheck, timeoutNext, name } = check;
|
|
304
|
+
// console.log(`timeoutCheck: ${timeoutCheck}`);
|
|
305
|
+
// console.log(`timeoutNext: ${timeoutNext}`);
|
|
306
|
+
// console.log(`Checking: ${name}`)
|
|
307
|
+
const resultTrue = await Helpers.runSyncOrAsync(check.callback, check);
|
|
308
|
+
// console.log(`after: ${name}`)
|
|
309
|
+
if (resultTrue) {
|
|
310
|
+
// console.log(`timeout 1 is set to ${timeoutNext}`)
|
|
311
|
+
setTimeout(async () => {
|
|
312
|
+
// console.log(`timeout 1 is over`)
|
|
313
|
+
await waitFor(arr).then(() => {
|
|
314
|
+
resolve(void 0);
|
|
315
|
+
});
|
|
316
|
+
}, timeoutNext);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
arr.unshift(check);
|
|
320
|
+
if (!messageToShow || check.errorMessage !== messageToShow) {
|
|
321
|
+
Helpers.info(check.errorMessage);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
// console.log(`dont show error message ${check.errorMessage}`)
|
|
325
|
+
}
|
|
326
|
+
// console.log(`timeout 2 is set to ${timeoutCheck}, arr.length is ${arr.length}`)
|
|
327
|
+
setTimeout(async () => {
|
|
328
|
+
// console.log(`timeout 2 ${timeoutCheck} ovef`)
|
|
329
|
+
await waitFor(arr, check.errorMessage).then(() => {
|
|
330
|
+
resolve(void 0);
|
|
331
|
+
});
|
|
332
|
+
}, timeoutCheck);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function applyMixins(derivedCtor, baseCtors) {
|
|
339
|
+
baseCtors.forEach(baseCtor => {
|
|
340
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
341
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
class HelpersTnp extends CoreHelpers {
|
|
347
|
+
constructor(arrays = new HelpersArrayObj(), strings = new HelpersStrings()) {
|
|
348
|
+
super();
|
|
349
|
+
this.arrays = arrays;
|
|
350
|
+
this.strings = strings;
|
|
351
|
+
this.conditionWait = conditionWait;
|
|
352
|
+
this.applyMixins = applyMixins;
|
|
353
|
+
}
|
|
354
|
+
static get Instance() {
|
|
355
|
+
if (!HelpersTnp._instance) {
|
|
356
|
+
HelpersTnp._instance = new HelpersTnp();
|
|
357
|
+
}
|
|
358
|
+
return HelpersTnp._instance;
|
|
359
|
+
}
|
|
360
|
+
CLIWRAP(f, name) {
|
|
361
|
+
CLASS.setName(f, name);
|
|
362
|
+
return f;
|
|
363
|
+
}
|
|
364
|
+
async isElevated() {
|
|
365
|
+
}
|
|
366
|
+
async mesureExectionInMs(description, functionToExecute, ...functionArguments) {
|
|
367
|
+
var start = new Date();
|
|
368
|
+
await Helpers.runSyncOrAsync(functionToExecute, ...functionArguments);
|
|
369
|
+
//@ts-ignore
|
|
370
|
+
var end = new Date() - start;
|
|
371
|
+
if (Morphi.IsBrowser) {
|
|
372
|
+
Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
|
|
373
|
+
}
|
|
374
|
+
return end;
|
|
375
|
+
}
|
|
376
|
+
mesureExectionInMsSync(description, functionToExecute) {
|
|
377
|
+
var start = new Date();
|
|
378
|
+
functionToExecute();
|
|
379
|
+
//@ts-ignore
|
|
380
|
+
var end = new Date() - start;
|
|
381
|
+
if (Morphi.IsBrowser) {
|
|
382
|
+
Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
|
|
383
|
+
}
|
|
384
|
+
return end;
|
|
385
|
+
}
|
|
386
|
+
waitForCondition(conditionFn, howOfftenCheckInMs = 1000) {
|
|
387
|
+
return new Promise(async (resolve, reject) => {
|
|
388
|
+
const result = await Helpers.runSyncOrAsync(conditionFn);
|
|
389
|
+
if (result) {
|
|
390
|
+
resolve(void 0);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
setTimeout(() => {
|
|
394
|
+
Helpers.waitForCondition(conditionFn, howOfftenCheckInMs).then(() => {
|
|
395
|
+
resolve(void 0);
|
|
396
|
+
});
|
|
397
|
+
}, howOfftenCheckInMs);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
getBrowserVerPath(moduleName) {
|
|
402
|
+
}
|
|
403
|
+
getMethodName(obj, method) {
|
|
404
|
+
var methodName = null;
|
|
405
|
+
Object.getOwnPropertyNames(obj).forEach(prop => {
|
|
406
|
+
if (obj[prop] === method) {
|
|
407
|
+
methodName = prop;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
if (methodName !== null) {
|
|
411
|
+
return methodName;
|
|
412
|
+
}
|
|
413
|
+
var proto = Object.getPrototypeOf(obj);
|
|
414
|
+
if (proto) {
|
|
415
|
+
return Helpers.getMethodName(proto, method);
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
fixWebpackEnv(env) {
|
|
420
|
+
_.forIn(env, (v, k) => {
|
|
421
|
+
const value = v;
|
|
422
|
+
if (value === 'true')
|
|
423
|
+
env[k] = true;
|
|
424
|
+
if (value === 'false')
|
|
425
|
+
env[k] = false;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
applyMixins(HelpersTnp, [
|
|
430
|
+
HelpersMessages,
|
|
431
|
+
HelpersStringsRegexes,
|
|
432
|
+
HelpersEnvironment,
|
|
433
|
+
]);
|
|
434
|
+
|
|
435
|
+
const BaselineSiteJoinprefix = '__';
|
|
436
|
+
|
|
437
|
+
const Helpers$1 = HelpersTnp.Instance;
|
|
438
|
+
class Project {
|
|
439
|
+
constructor() {
|
|
440
|
+
this.cache = {};
|
|
441
|
+
this.browser = {};
|
|
442
|
+
}
|
|
443
|
+
static typeFrom(location) {
|
|
444
|
+
return (void 0);
|
|
445
|
+
}
|
|
446
|
+
static unload(project) {
|
|
447
|
+
Project.projects = Project.projects.filter(f => f !== project);
|
|
448
|
+
}
|
|
449
|
+
static From(location) {
|
|
450
|
+
return (void 0);
|
|
451
|
+
}
|
|
452
|
+
static nearestTo(absoluteLocation, options) {
|
|
453
|
+
return (void 0);
|
|
454
|
+
}
|
|
455
|
+
static allProjectFrom(absoluteLocation, stopOnCwd = '/') {
|
|
456
|
+
return (void 0);
|
|
457
|
+
}
|
|
458
|
+
static DefaultPortByType(type) {
|
|
459
|
+
if (type === 'workspace') {
|
|
460
|
+
return 5000;
|
|
461
|
+
}
|
|
462
|
+
if (type === 'angular-client') {
|
|
463
|
+
return 4300;
|
|
464
|
+
}
|
|
465
|
+
if (type === 'angular-lib') {
|
|
466
|
+
return 4250;
|
|
467
|
+
}
|
|
468
|
+
if (type === 'electron-client') {
|
|
469
|
+
return 4350;
|
|
470
|
+
}
|
|
471
|
+
if (type === 'ionic-client') {
|
|
472
|
+
return 8080;
|
|
473
|
+
}
|
|
474
|
+
if (type === 'docker') {
|
|
475
|
+
return 5000;
|
|
476
|
+
}
|
|
477
|
+
if (type === 'isomorphic-lib') {
|
|
478
|
+
return 4000;
|
|
479
|
+
}
|
|
480
|
+
if (type === 'container' || type === 'unknow-npm-project') {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
static get isBundleMode() {
|
|
485
|
+
if (Helpers$1.isBrowser) {
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
static get Current() {
|
|
490
|
+
return (void 0);
|
|
491
|
+
}
|
|
492
|
+
static get Tnp() {
|
|
493
|
+
return (void 0);
|
|
494
|
+
}
|
|
495
|
+
static by(libraryType, version) {
|
|
496
|
+
return (void 0);
|
|
497
|
+
}
|
|
498
|
+
defineProperty(variableName, classFn) {
|
|
499
|
+
return (void 0);
|
|
500
|
+
}
|
|
501
|
+
setType(type) {
|
|
502
|
+
// @ts-ignore
|
|
503
|
+
this._type = type;
|
|
504
|
+
}
|
|
505
|
+
typeIs(...types) {
|
|
506
|
+
return this._type && types.includes(this._type);
|
|
507
|
+
}
|
|
508
|
+
typeIsNot(...types) {
|
|
509
|
+
return !this.typeIs(...types);
|
|
510
|
+
}
|
|
511
|
+
forEmptyStructure() {
|
|
512
|
+
return [
|
|
513
|
+
{ relativePath: config.file.package_json, includeContent: true },
|
|
514
|
+
{ relativePath: config.folder.src },
|
|
515
|
+
];
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
Project.projects = [];
|
|
519
|
+
/**
|
|
520
|
+
* To speed up checking folder I am keeping pathes for alterdy checked folder
|
|
521
|
+
* This may break things that are creating new projects
|
|
522
|
+
*/
|
|
523
|
+
Project.emptyLocations = [];
|
|
524
|
+
|
|
525
|
+
class BaseComponent {
|
|
526
|
+
constructor() {
|
|
527
|
+
// @ts-ignore
|
|
528
|
+
this.model = {};
|
|
529
|
+
this.handlers = [];
|
|
530
|
+
}
|
|
531
|
+
ngOnDestroy() {
|
|
532
|
+
this.handlers.forEach(h => h.unsubscribe());
|
|
533
|
+
this.handlers.length = 0;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
537
|
+
BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: BaseComponent, selector: "app-base-component-meta", inputs: { model: "model" }, ngImport: i0, template: '<div></div>', isInline: true });
|
|
538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseComponent, decorators: [{
|
|
539
|
+
type: Component,
|
|
540
|
+
args: [{
|
|
541
|
+
selector: 'app-base-component-meta',
|
|
542
|
+
template: '<div></div>'
|
|
543
|
+
}]
|
|
544
|
+
}], propDecorators: { model: [{
|
|
545
|
+
type: Input
|
|
546
|
+
}] } });
|
|
547
|
+
const isCalledNgInitAfterInternalRefresh = Symbol();
|
|
548
|
+
class BaseComponentForRouter extends BaseComponent {
|
|
549
|
+
constructor(__router) {
|
|
550
|
+
super();
|
|
551
|
+
this.__router = __router;
|
|
552
|
+
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
553
|
+
}
|
|
554
|
+
isCalledNgInitAfterInternalRefresh() {
|
|
555
|
+
return !!this[isCalledNgInitAfterInternalRefresh];
|
|
556
|
+
}
|
|
557
|
+
reloadNgOninitOnUrlChange() {
|
|
558
|
+
this.handlers.push(this.__router.events.subscribe(event => {
|
|
559
|
+
if (event instanceof NavigationEnd && this['ngOnInit']) {
|
|
560
|
+
this[isCalledNgInitAfterInternalRefresh] = true;
|
|
561
|
+
this['ngOnInit']();
|
|
562
|
+
if (this[isCalledNgInitAfterInternalRefresh]) {
|
|
563
|
+
this[isCalledNgInitAfterInternalRefresh] = false;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const log$2 = Log.create(`DualComponentController`);
|
|
571
|
+
class DualComponentController {
|
|
572
|
+
constructor(cmp, isFormlyMode = false) {
|
|
573
|
+
this.cmp = cmp;
|
|
574
|
+
this.isFormlyMode = isFormlyMode;
|
|
575
|
+
}
|
|
576
|
+
getValTemplateOptions(propertyName) {
|
|
577
|
+
if (this.isFormlyMode) {
|
|
578
|
+
const res = this.cmp.field?.templateOptions[propertyName];
|
|
579
|
+
if (res === void 0 && this.cmp[propertyName]) {
|
|
580
|
+
return this.cmp[propertyName];
|
|
581
|
+
}
|
|
582
|
+
return res;
|
|
583
|
+
}
|
|
584
|
+
return this.cmp[propertyName];
|
|
585
|
+
}
|
|
586
|
+
getValContext(propertyName) {
|
|
587
|
+
if (this.isFormlyMode) {
|
|
588
|
+
const res = this.cmp?.field[propertyName];
|
|
589
|
+
if (res === void 0 && this.cmp[propertyName]) {
|
|
590
|
+
return this.cmp[propertyName];
|
|
591
|
+
}
|
|
592
|
+
return res;
|
|
593
|
+
}
|
|
594
|
+
return this.cmp[propertyName];
|
|
595
|
+
}
|
|
596
|
+
get disabled() {
|
|
597
|
+
return this.getValTemplateOptions('disabled');
|
|
598
|
+
}
|
|
599
|
+
get required() {
|
|
600
|
+
return this.getValTemplateOptions('required');
|
|
601
|
+
}
|
|
602
|
+
get type() {
|
|
603
|
+
if (!this.isFormlyMode) {
|
|
604
|
+
return CLASS.getNameFromObject(this.cmp);
|
|
605
|
+
}
|
|
606
|
+
return this.getValContext('type');
|
|
607
|
+
}
|
|
608
|
+
get label() {
|
|
609
|
+
return this.getValTemplateOptions('label');
|
|
610
|
+
}
|
|
611
|
+
get placeholder() {
|
|
612
|
+
return this.getValTemplateOptions('placeholder');
|
|
613
|
+
}
|
|
614
|
+
get defaultValue() {
|
|
615
|
+
return this.getValContext('defaultValue');
|
|
616
|
+
}
|
|
617
|
+
get formControl() {
|
|
618
|
+
return this.getValContext('formControl');
|
|
619
|
+
}
|
|
620
|
+
get key() {
|
|
621
|
+
return this.getValContext('key');
|
|
622
|
+
}
|
|
623
|
+
get path() {
|
|
624
|
+
return this.getValContext('path');
|
|
625
|
+
}
|
|
626
|
+
get model() {
|
|
627
|
+
if (this.isFormlyMode) {
|
|
628
|
+
return this.getValContext('model');
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
return this.__model;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
set model(v) {
|
|
635
|
+
if (this.isFormlyMode) {
|
|
636
|
+
log$2.w(`[DualComponentController] You can't set model in formly component mode`);
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
this.__model = v;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
get mode() {
|
|
643
|
+
if (this.isFormlyMode) {
|
|
644
|
+
return this.getValContext('mode');
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
return this.__mode;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
set mode(v) {
|
|
651
|
+
if (this.isFormlyMode) {
|
|
652
|
+
// this.cmp.field.mode =
|
|
653
|
+
// log.w(`[DualComponentController] You can't set mode in formly component mode`);
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
this.__mode = v;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
get value() {
|
|
660
|
+
if (this.isFormlyMode) {
|
|
661
|
+
return this.cmp.field.formControl.value;
|
|
662
|
+
}
|
|
663
|
+
if (_.isString(this.path)) {
|
|
664
|
+
return _.get(this.cmp.model, this.path);
|
|
665
|
+
}
|
|
666
|
+
return this.cmp.model;
|
|
667
|
+
}
|
|
668
|
+
set value(v) {
|
|
669
|
+
if (this.isFormlyMode) {
|
|
670
|
+
this.cmp.field.formControl.setValue(v);
|
|
671
|
+
this.cmp.change.next(v);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (_.isString(this.path)) {
|
|
675
|
+
_.set(this.cmp.model, this.path, v);
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
this.cmp.model = v;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const log$1 = Log.create('base formly component', Level.__NOTHING);
|
|
684
|
+
class BaseFormlyComponent extends FieldType {
|
|
685
|
+
constructor() {
|
|
686
|
+
super(...arguments);
|
|
687
|
+
this.DualComponentController = DualComponentController;
|
|
688
|
+
this.ctrl = {};
|
|
689
|
+
this.change = new EventEmitter();
|
|
690
|
+
this.handlers = [];
|
|
691
|
+
this.__field = {
|
|
692
|
+
templateOptions: {}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
// @ts-ignore
|
|
696
|
+
get mode() {
|
|
697
|
+
return this.ctrl.mode;
|
|
698
|
+
}
|
|
699
|
+
// @ts-ignore
|
|
700
|
+
set mode(v) {
|
|
701
|
+
this.ctrl.mode = v;
|
|
702
|
+
}
|
|
703
|
+
// @ts-ignore
|
|
704
|
+
set model(v) {
|
|
705
|
+
this.ctrl.model = v;
|
|
706
|
+
}
|
|
707
|
+
get model() {
|
|
708
|
+
return this.ctrl.model;
|
|
709
|
+
}
|
|
710
|
+
// @ts-ignore
|
|
711
|
+
set key(value) {
|
|
712
|
+
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
this.path = value;
|
|
716
|
+
}
|
|
717
|
+
get key() {
|
|
718
|
+
if (this.ctrl && this.ctrl.isFormlyMode) {
|
|
719
|
+
return this.field.key;
|
|
720
|
+
}
|
|
721
|
+
return this.path;
|
|
722
|
+
}
|
|
723
|
+
ngOnDestroy() {
|
|
724
|
+
this.handlers.forEach(h => h.unsubscribe());
|
|
725
|
+
this.handlers.length = 0;
|
|
726
|
+
}
|
|
727
|
+
ngAfterViewInit() {
|
|
728
|
+
}
|
|
729
|
+
// _model: any;
|
|
730
|
+
ngOnInit() {
|
|
731
|
+
// console.log('model', this.model)
|
|
732
|
+
// console.log('ket', this.key)
|
|
733
|
+
const isFormlyMode = !!this.field;
|
|
734
|
+
log$1.i(`isFormlyMode: ${isFormlyMode}`);
|
|
735
|
+
if (!isFormlyMode) {
|
|
736
|
+
const that = this;
|
|
737
|
+
Object.defineProperty(this, 'field', {
|
|
738
|
+
get: function () {
|
|
739
|
+
return that.__field;
|
|
740
|
+
},
|
|
741
|
+
set: function (v) {
|
|
742
|
+
that.__field = v;
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
const existed = this.ctrl;
|
|
747
|
+
this.ctrl = new this.DualComponentController(this, isFormlyMode);
|
|
748
|
+
// @ts-ignore
|
|
749
|
+
Object.keys(existed).forEach(key => {
|
|
750
|
+
this.ctrl[key] = existed[key];
|
|
751
|
+
});
|
|
752
|
+
// if (!this.formControl) {
|
|
753
|
+
// this.formControl = new FormControl({})
|
|
754
|
+
// Object.defineProperty(this, 'field', {
|
|
755
|
+
// get: () => {
|
|
756
|
+
// return {
|
|
757
|
+
// formControl: this.formControl
|
|
758
|
+
// } as FormlyFieldConfig
|
|
759
|
+
// }
|
|
760
|
+
// })
|
|
761
|
+
// // this.formControl = new FormControl({})
|
|
762
|
+
// }
|
|
763
|
+
this.change.next(this.ctrl.value);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
BaseFormlyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseFormlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
767
|
+
BaseFormlyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", 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", formControl: "formControl" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: `<div></div>`, isInline: true });
|
|
768
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseFormlyComponent, decorators: [{
|
|
769
|
+
type: Component,
|
|
770
|
+
args: [{
|
|
771
|
+
selector: 'app-base-formly-component-meta',
|
|
772
|
+
template: `<div></div>`
|
|
773
|
+
}]
|
|
774
|
+
}], propDecorators: { pizda: [{
|
|
775
|
+
type: Input
|
|
776
|
+
}], mode: [{
|
|
777
|
+
type: Input
|
|
778
|
+
}], disabled: [{
|
|
779
|
+
type: Input
|
|
780
|
+
}], required: [{
|
|
781
|
+
type: Input
|
|
782
|
+
}], label: [{
|
|
783
|
+
type: Input
|
|
784
|
+
}], placeholder: [{
|
|
785
|
+
type: Input
|
|
786
|
+
}], defaultValue: [{
|
|
787
|
+
type: Input
|
|
788
|
+
}], model: [{
|
|
789
|
+
type: Input
|
|
790
|
+
}], path: [{
|
|
791
|
+
type: Input
|
|
792
|
+
}], change: [{
|
|
793
|
+
type: Output
|
|
794
|
+
}], key: [{
|
|
795
|
+
type: Input
|
|
796
|
+
}], formControl: [{
|
|
797
|
+
type: Input
|
|
798
|
+
}] } });
|
|
799
|
+
|
|
800
|
+
class ResizeService {
|
|
801
|
+
constructor() {
|
|
802
|
+
this.resizeDetector = elementResizeDetectorMaker({ strategy: 'scroll' });
|
|
803
|
+
}
|
|
804
|
+
addResizeEventListener(element, handler) {
|
|
805
|
+
this.resizeDetector.listenTo(element, handler);
|
|
806
|
+
}
|
|
807
|
+
removeResizeEventListener(element) {
|
|
808
|
+
this.resizeDetector.uninstall(element);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
ResizeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
812
|
+
ResizeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService });
|
|
813
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService, decorators: [{
|
|
814
|
+
type: Injectable
|
|
815
|
+
}], ctorParameters: function () { return []; } });
|
|
816
|
+
|
|
817
|
+
const log = Log.create(`[tnp-helpers] long-press`, Level.__NOTHING);
|
|
818
|
+
class LongPress {
|
|
819
|
+
constructor() {
|
|
820
|
+
this.pressDuration = 1000;
|
|
821
|
+
this.onLongPress = new EventEmitter();
|
|
822
|
+
this.onLongPressing = new EventEmitter();
|
|
823
|
+
this.onLongPressEnd = new EventEmitter();
|
|
824
|
+
this.mouseX = 0;
|
|
825
|
+
this.mouseY = 0;
|
|
826
|
+
this.allowTrigger = false;
|
|
827
|
+
this.triggerEnd = _.debounce(() => {
|
|
828
|
+
this.endPress();
|
|
829
|
+
}, 500);
|
|
830
|
+
}
|
|
831
|
+
get press() { return this.pressing; }
|
|
832
|
+
get longPress() { return this.longPressing; }
|
|
833
|
+
onMouseDown(event) {
|
|
834
|
+
// don't do right/middle clicks
|
|
835
|
+
log.d(`MOUSE DOWN `);
|
|
836
|
+
if (event.which !== 1)
|
|
837
|
+
return;
|
|
838
|
+
this.allowTrigger = true;
|
|
839
|
+
this.mouseX = event.clientX;
|
|
840
|
+
this.mouseY = event.clientY;
|
|
841
|
+
this.pressing = true;
|
|
842
|
+
this.longPressing = false;
|
|
843
|
+
this.timeout = setTimeout(() => {
|
|
844
|
+
if (this.allowTrigger) {
|
|
845
|
+
this.longPressing = true;
|
|
846
|
+
log.d(`long pressing start pressDuration:${this.pressDuration} `);
|
|
847
|
+
this.onLongPress.emit(event);
|
|
848
|
+
this.loop(event);
|
|
849
|
+
}
|
|
850
|
+
}, this.pressDuration);
|
|
851
|
+
this.loop(event);
|
|
852
|
+
}
|
|
853
|
+
onMouseMove(event) {
|
|
854
|
+
if (this.pressing && !this.longPressing) {
|
|
855
|
+
const xThres = (event.clientX - this.mouseX) > 10;
|
|
856
|
+
const yThres = (event.clientY - this.mouseY) > 10;
|
|
857
|
+
if (xThres || yThres) {
|
|
858
|
+
this.endPress();
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
loop(event) {
|
|
863
|
+
if (this.longPressing) {
|
|
864
|
+
this.timeout = setTimeout(() => {
|
|
865
|
+
log.d(`emil longpressing`);
|
|
866
|
+
this.triggerEnd();
|
|
867
|
+
this.onLongPressing.emit(event);
|
|
868
|
+
this.loop(event);
|
|
869
|
+
}, 50);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
endPress(emit = true) {
|
|
873
|
+
this.allowTrigger = false;
|
|
874
|
+
clearTimeout(this.timeout);
|
|
875
|
+
this.longPressing = false;
|
|
876
|
+
this.pressing = false;
|
|
877
|
+
if (emit) {
|
|
878
|
+
log.d(`EMIT END`);
|
|
879
|
+
this.onLongPressEnd.emit(true);
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
log.d(`NOT EMIT END`);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
onMouseUp() {
|
|
886
|
+
this.endPress(false);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
LongPress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: LongPress, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
890
|
+
LongPress.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", 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 });
|
|
891
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: LongPress, decorators: [{
|
|
892
|
+
type: Directive,
|
|
893
|
+
args: [{ selector: '[long-press]' }]
|
|
894
|
+
}], propDecorators: { pressDuration: [{
|
|
895
|
+
type: Input
|
|
896
|
+
}], onLongPress: [{
|
|
897
|
+
type: Output
|
|
898
|
+
}], onLongPressing: [{
|
|
899
|
+
type: Output
|
|
900
|
+
}], onLongPressEnd: [{
|
|
901
|
+
type: Output
|
|
902
|
+
}], press: [{
|
|
903
|
+
type: HostBinding,
|
|
904
|
+
args: ['class.press']
|
|
905
|
+
}], longPress: [{
|
|
906
|
+
type: HostBinding,
|
|
907
|
+
args: ['class.longpress']
|
|
908
|
+
}], onMouseDown: [{
|
|
909
|
+
type: HostListener,
|
|
910
|
+
args: ['mousedown', ['$event']]
|
|
911
|
+
}], onMouseMove: [{
|
|
912
|
+
type: HostListener,
|
|
913
|
+
args: ['mousemove', ['$event']]
|
|
914
|
+
}], onMouseUp: [{
|
|
915
|
+
type: HostListener,
|
|
916
|
+
args: ['mouseup']
|
|
917
|
+
}] } });
|
|
918
|
+
|
|
919
|
+
// export * from './git-project';
|
|
920
|
+
const Helpers = HelpersTnp.Instance;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Generated bundle index. Do not edit.
|
|
924
|
+
*/
|
|
925
|
+
|
|
926
|
+
export { BaseComponent, BaseComponentForRouter, BaseFormlyComponent, BaselineSiteJoinprefix, DualComponentController, Helpers, LongPress, Project, ResizeService };
|
|
927
|
+
//# sourceMappingURL=tnp-helpers.mjs.map
|