dom-render 1.0.74 → 1.0.77
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/Config.d.ts +38 -36
- package/Config.js +2 -2
- package/DomRender.d.ts +28 -27
- package/DomRender.js +90 -88
- package/DomRenderProxy.d.ts +29 -29
- package/DomRenderProxy.js +342 -327
- package/README.MD +638 -567
- package/RawSet.d.ts +140 -118
- package/RawSet.js +771 -905
- package/components/ComponentSet.d.ts +7 -0
- package/components/ComponentSet.js +14 -0
- package/dist/bundle.js +3789 -3214
- package/events/EventManager.d.ts +48 -47
- package/events/EventManager.js +530 -499
- package/iterators/Range.d.ts +22 -22
- package/iterators/Range.js +65 -65
- package/lifecycle/OnBeforeReturnGet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnGet.js +2 -2
- package/lifecycle/OnBeforeReturnSet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnSet.js +2 -2
- package/lifecycle/OnCreateRender.d.ts +3 -3
- package/lifecycle/OnCreateRender.js +2 -2
- package/lifecycle/OnDestroyRender.d.ts +4 -4
- package/lifecycle/OnDestroyRender.js +2 -2
- package/lifecycle/OnInitRender.d.ts +7 -7
- package/lifecycle/OnInitRender.js +2 -2
- package/lifecycle/OnProxyDomRender.d.ts +4 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/managers/RenderManager.d.ts +3 -3
- package/managers/RenderManager.js +18 -18
- package/messenger/DefaultMessenger.d.ts +3 -0
- package/messenger/DefaultMessenger.js +27 -0
- package/messenger/Messenger.d.ts +78 -0
- package/messenger/Messenger.js +201 -0
- package/operators/Appender.d.ts +7 -12
- package/operators/Appender.js +32 -39
- package/operators/AttrExpresion.d.ts +0 -0
- package/operators/AttrExpresion.js +44 -0
- package/operators/Dr.d.ts +4 -0
- package/operators/Dr.js +62 -0
- package/operators/DrAppender.d.ts +4 -0
- package/operators/DrAppender.js +65 -0
- package/operators/DrFor.d.ts +4 -0
- package/operators/DrFor.js +62 -0
- package/operators/DrForOf.d.ts +4 -0
- package/operators/DrForOf.js +65 -0
- package/operators/DrForm.d.ts +4 -0
- package/operators/DrForm.js +100 -0
- package/operators/DrIf.d.ts +4 -0
- package/operators/DrIf.js +72 -0
- package/operators/DrInnerHTML.d.ts +4 -0
- package/operators/DrInnerHTML.js +60 -0
- package/operators/DrInnerText.d.ts +4 -0
- package/operators/DrInnerText.js +58 -0
- package/operators/DrPre.d.ts +4 -0
- package/operators/DrPre.js +30 -0
- package/operators/DrRepeat.d.ts +4 -0
- package/operators/DrRepeat.js +63 -0
- package/operators/DrTargetAttr.d.ts +4 -0
- package/operators/DrTargetAttr.js +55 -0
- package/operators/DrTargetElement.d.ts +4 -0
- package/operators/DrTargetElement.js +65 -0
- package/operators/DrThis.d.ts +4 -0
- package/operators/DrThis.js +59 -0
- package/operators/OperatorRender.d.ts +41 -0
- package/operators/OperatorRender.js +21 -0
- package/package.json +94 -94
- package/routers/HashRouter.d.ts +9 -9
- package/routers/HashRouter.js +53 -53
- package/routers/PathRouter.d.ts +9 -9
- package/routers/PathRouter.js +52 -52
- package/routers/Router.d.ts +25 -25
- package/routers/Router.js +116 -116
- package/types/Types.d.ts +14 -14
- package/types/Types.js +36 -36
- package/utils/clipboard/ClipBoardUtils.d.ts +6 -6
- package/utils/clipboard/ClipBoardUtils.js +25 -25
- package/utils/dom/DomUtils.d.ts +13 -13
- package/utils/dom/DomUtils.js +47 -47
- package/utils/location/LocationUtils.d.ts +16 -16
- package/utils/location/LocationUtils.js +57 -57
- package/utils/node/NodeUtils.d.ts +10 -10
- package/utils/node/NodeUtils.js +27 -27
- package/utils/random/RandomUtils.d.ts +7 -7
- package/utils/random/RandomUtils.js +47 -47
- package/utils/script/ScriptUtils.d.ts +14 -14
- package/utils/script/ScriptUtils.js +89 -89
- package/utils/storage/StorageUtils.d.ts +9 -9
- package/utils/storage/StorageUtils.js +48 -48
- package/utils/string/StringUtils.d.ts +5 -5
- package/utils/string/StringUtils.js +41 -41
- package/utils/valid/ValidUtils.d.ts +10 -10
- package/utils/valid/ValidUtils.js +78 -78
- package/validators/AllCheckedValidatorArray.d.ts +6 -6
- package/validators/AllCheckedValidatorArray.js +32 -32
- package/validators/AllUnCheckedValidatorArray.d.ts +6 -6
- package/validators/AllUnCheckedValidatorArray.js +32 -32
- package/validators/CheckedValidator.d.ts +5 -5
- package/validators/CheckedValidator.js +32 -32
- package/validators/CountEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountUnCheckedValidatorArray.js +34 -34
- package/validators/EmptyValidator.d.ts +5 -5
- package/validators/EmptyValidator.js +33 -33
- package/validators/ExcludeCheckedValidatorArray.d.ts +8 -8
- package/validators/ExcludeCheckedValidatorArray.js +41 -41
- package/validators/FormValidator.d.ts +7 -7
- package/validators/FormValidator.js +37 -37
- package/validators/IncludeCheckedValidatorArray.d.ts +8 -8
- package/validators/IncludeCheckedValidatorArray.js +41 -41
- package/validators/MultipleValidator.d.ts +8 -8
- package/validators/MultipleValidator.js +48 -48
- package/validators/NonPassValidator.d.ts +5 -5
- package/validators/NonPassValidator.js +31 -31
- package/validators/NotEmptyValidator.d.ts +5 -5
- package/validators/NotEmptyValidator.js +34 -34
- package/validators/NotRegExpTestValidator.d.ts +6 -6
- package/validators/NotRegExpTestValidator.js +42 -42
- package/validators/PassValidator.d.ts +5 -5
- package/validators/PassValidator.js +31 -31
- package/validators/RegExpTestValidator.d.ts +6 -6
- package/validators/RegExpTestValidator.js +43 -43
- package/validators/RequiredValidator.d.ts +5 -5
- package/validators/RequiredValidator.js +33 -33
- package/validators/UnCheckedValidator.d.ts +5 -5
- package/validators/UnCheckedValidator.js +32 -32
- package/validators/ValidMultipleValidator.d.ts +9 -9
- package/validators/ValidMultipleValidator.js +34 -34
- package/validators/ValidValidator.d.ts +6 -6
- package/validators/ValidValidator.js +33 -33
- package/validators/ValidValidatorArray.d.ts +7 -7
- package/validators/ValidValidatorArray.js +33 -33
- package/validators/Validator.d.ts +57 -57
- package/validators/Validator.js +242 -242
- package/validators/ValidatorArray.d.ts +17 -17
- package/validators/ValidatorArray.js +99 -99
- package/validators/ValueEqualsValidator.d.ts +6 -6
- package/validators/ValueEqualsValidator.js +33 -33
- package/validators/ValueNotEqualsValidator.d.ts +6 -6
- package/validators/ValueNotEqualsValidator.js +33 -33
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocationUtils = void 0;
|
|
4
|
-
var LocationUtils = /** @class */ (function () {
|
|
5
|
-
function LocationUtils() {
|
|
6
|
-
}
|
|
7
|
-
LocationUtils.hash = function (window) {
|
|
8
|
-
return window.location.hash.replace('#', '');
|
|
9
|
-
};
|
|
10
|
-
LocationUtils.hashPath = function (window) {
|
|
11
|
-
return window.location.hash.replace('#', '').split('?')[0];
|
|
12
|
-
};
|
|
13
|
-
LocationUtils.hashSearch = function (window) {
|
|
14
|
-
return window.location.hash.replace('#', '').split('?')[1];
|
|
15
|
-
};
|
|
16
|
-
LocationUtils.hashQueryParams = function (window) {
|
|
17
|
-
var s = window.location.hash.replace('#', '').split('?')[1] || '';
|
|
18
|
-
return this.queryStringToMap(s);
|
|
19
|
-
};
|
|
20
|
-
LocationUtils.path = function (window) {
|
|
21
|
-
return window.location.pathname;
|
|
22
|
-
};
|
|
23
|
-
LocationUtils.pathQueryParamsObject = function (window) {
|
|
24
|
-
return this.queryStringToObject(window.location.search.substring(1));
|
|
25
|
-
};
|
|
26
|
-
LocationUtils.hashQueryParamsObject = function (window) {
|
|
27
|
-
var _a;
|
|
28
|
-
return this.queryStringToObject((_a = window.location.hash.split('?').pop()) !== null && _a !== void 0 ? _a : '');
|
|
29
|
-
};
|
|
30
|
-
LocationUtils.pathQueryParams = function (window) {
|
|
31
|
-
return this.queryStringToMap(window.location.search.substring(1));
|
|
32
|
-
};
|
|
33
|
-
LocationUtils.queryStringToMap = function (s) {
|
|
34
|
-
var params = new Map();
|
|
35
|
-
var vars = s.split('&') || [];
|
|
36
|
-
vars.forEach(function (it) {
|
|
37
|
-
var kv = it.split('=') || [];
|
|
38
|
-
if (kv[0] && kv[0].length > 0) {
|
|
39
|
-
params.set(kv[0], kv[1]);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return params;
|
|
43
|
-
};
|
|
44
|
-
LocationUtils.queryStringToObject = function (s) {
|
|
45
|
-
var params = {};
|
|
46
|
-
var vars = s.split('&') || [];
|
|
47
|
-
vars.forEach(function (it) {
|
|
48
|
-
var kv = it.split('=') || [];
|
|
49
|
-
if (kv[0] && kv[0].length > 0) {
|
|
50
|
-
params[kv[0]] = kv[1];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return params;
|
|
54
|
-
};
|
|
55
|
-
return LocationUtils;
|
|
56
|
-
}());
|
|
57
|
-
exports.LocationUtils = LocationUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocationUtils = void 0;
|
|
4
|
+
var LocationUtils = /** @class */ (function () {
|
|
5
|
+
function LocationUtils() {
|
|
6
|
+
}
|
|
7
|
+
LocationUtils.hash = function (window) {
|
|
8
|
+
return window.location.hash.replace('#', '');
|
|
9
|
+
};
|
|
10
|
+
LocationUtils.hashPath = function (window) {
|
|
11
|
+
return window.location.hash.replace('#', '').split('?')[0];
|
|
12
|
+
};
|
|
13
|
+
LocationUtils.hashSearch = function (window) {
|
|
14
|
+
return window.location.hash.replace('#', '').split('?')[1];
|
|
15
|
+
};
|
|
16
|
+
LocationUtils.hashQueryParams = function (window) {
|
|
17
|
+
var s = window.location.hash.replace('#', '').split('?')[1] || '';
|
|
18
|
+
return this.queryStringToMap(s);
|
|
19
|
+
};
|
|
20
|
+
LocationUtils.path = function (window) {
|
|
21
|
+
return window.location.pathname;
|
|
22
|
+
};
|
|
23
|
+
LocationUtils.pathQueryParamsObject = function (window) {
|
|
24
|
+
return this.queryStringToObject(window.location.search.substring(1));
|
|
25
|
+
};
|
|
26
|
+
LocationUtils.hashQueryParamsObject = function (window) {
|
|
27
|
+
var _a;
|
|
28
|
+
return this.queryStringToObject((_a = window.location.hash.split('?').pop()) !== null && _a !== void 0 ? _a : '');
|
|
29
|
+
};
|
|
30
|
+
LocationUtils.pathQueryParams = function (window) {
|
|
31
|
+
return this.queryStringToMap(window.location.search.substring(1));
|
|
32
|
+
};
|
|
33
|
+
LocationUtils.queryStringToMap = function (s) {
|
|
34
|
+
var params = new Map();
|
|
35
|
+
var vars = s.split('&') || [];
|
|
36
|
+
vars.forEach(function (it) {
|
|
37
|
+
var kv = it.split('=') || [];
|
|
38
|
+
if (kv[0] && kv[0].length > 0) {
|
|
39
|
+
params.set(kv[0], kv[1]);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return params;
|
|
43
|
+
};
|
|
44
|
+
LocationUtils.queryStringToObject = function (s) {
|
|
45
|
+
var params = {};
|
|
46
|
+
var vars = s.split('&') || [];
|
|
47
|
+
vars.forEach(function (it) {
|
|
48
|
+
var kv = it.split('=') || [];
|
|
49
|
+
if (kv[0] && kv[0].length > 0) {
|
|
50
|
+
params[kv[0]] = kv[1];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return params;
|
|
54
|
+
};
|
|
55
|
+
return LocationUtils;
|
|
56
|
+
}());
|
|
57
|
+
exports.LocationUtils = LocationUtils;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare type Attr = {
|
|
2
|
-
name: string;
|
|
3
|
-
value: any;
|
|
4
|
-
};
|
|
5
|
-
export declare class NodeUtils {
|
|
6
|
-
static removeAllChildNode(node: Node): void;
|
|
7
|
-
static appendChild(parentNode: Node, childNode: Node): Node;
|
|
8
|
-
static replaceNode(targetNode: Node, newNode: Node): Node | undefined;
|
|
9
|
-
static addNode(targetNode: Node, newNode: Node): Node | undefined;
|
|
10
|
-
}
|
|
1
|
+
export declare type Attr = {
|
|
2
|
+
name: string;
|
|
3
|
+
value: any;
|
|
4
|
+
};
|
|
5
|
+
export declare class NodeUtils {
|
|
6
|
+
static removeAllChildNode(node: Node): void;
|
|
7
|
+
static appendChild(parentNode: Node, childNode: Node): Node;
|
|
8
|
+
static replaceNode(targetNode: Node, newNode: Node): Node | undefined;
|
|
9
|
+
static addNode(targetNode: Node, newNode: Node): Node | undefined;
|
|
10
|
+
}
|
package/utils/node/NodeUtils.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeUtils = void 0;
|
|
4
|
-
var NodeUtils = /** @class */ (function () {
|
|
5
|
-
function NodeUtils() {
|
|
6
|
-
}
|
|
7
|
-
// https://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript
|
|
8
|
-
NodeUtils.removeAllChildNode = function (node) {
|
|
9
|
-
while (node === null || node === void 0 ? void 0 : node.firstChild) {
|
|
10
|
-
node.firstChild.remove();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
NodeUtils.appendChild = function (parentNode, childNode) {
|
|
14
|
-
return parentNode.appendChild(childNode);
|
|
15
|
-
};
|
|
16
|
-
NodeUtils.replaceNode = function (targetNode, newNode) {
|
|
17
|
-
var _a;
|
|
18
|
-
// console.log('repalceNode', targetNode, newNode, targetNode.parentNode)
|
|
19
|
-
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, targetNode);
|
|
20
|
-
};
|
|
21
|
-
NodeUtils.addNode = function (targetNode, newNode) {
|
|
22
|
-
var _a;
|
|
23
|
-
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(newNode, targetNode.nextSibling);
|
|
24
|
-
};
|
|
25
|
-
return NodeUtils;
|
|
26
|
-
}());
|
|
27
|
-
exports.NodeUtils = NodeUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeUtils = void 0;
|
|
4
|
+
var NodeUtils = /** @class */ (function () {
|
|
5
|
+
function NodeUtils() {
|
|
6
|
+
}
|
|
7
|
+
// https://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript
|
|
8
|
+
NodeUtils.removeAllChildNode = function (node) {
|
|
9
|
+
while (node === null || node === void 0 ? void 0 : node.firstChild) {
|
|
10
|
+
node.firstChild.remove();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
NodeUtils.appendChild = function (parentNode, childNode) {
|
|
14
|
+
return parentNode.appendChild(childNode);
|
|
15
|
+
};
|
|
16
|
+
NodeUtils.replaceNode = function (targetNode, newNode) {
|
|
17
|
+
var _a;
|
|
18
|
+
// console.log('repalceNode', targetNode, newNode, targetNode.parentNode)
|
|
19
|
+
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, targetNode);
|
|
20
|
+
};
|
|
21
|
+
NodeUtils.addNode = function (targetNode, newNode) {
|
|
22
|
+
var _a;
|
|
23
|
+
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(newNode, targetNode.nextSibling);
|
|
24
|
+
};
|
|
25
|
+
return NodeUtils;
|
|
26
|
+
}());
|
|
27
|
+
exports.NodeUtils = NodeUtils;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare class RandomUtils {
|
|
2
|
-
static readonly d = "";
|
|
3
|
-
static random(min?: number, max?: number): number;
|
|
4
|
-
static uuid(format?: string): string;
|
|
5
|
-
static getRandomColor(): string;
|
|
6
|
-
static getRandomString(len: number): string;
|
|
7
|
-
}
|
|
1
|
+
export declare class RandomUtils {
|
|
2
|
+
static readonly d = "";
|
|
3
|
+
static random(min?: number, max?: number): number;
|
|
4
|
+
static uuid(format?: string): string;
|
|
5
|
+
static getRandomColor(): string;
|
|
6
|
+
static getRandomString(len: number): string;
|
|
7
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RandomUtils = void 0;
|
|
4
|
-
var ValidUtils_1 = require("../valid/ValidUtils");
|
|
5
|
-
var RandomUtils = /** @class */ (function () {
|
|
6
|
-
function RandomUtils() {
|
|
7
|
-
}
|
|
8
|
-
RandomUtils.random = function (min, max) {
|
|
9
|
-
if (ValidUtils_1.ValidUtils.isNullOrUndefined(min)) {
|
|
10
|
-
return Math.random();
|
|
11
|
-
}
|
|
12
|
-
else if (!ValidUtils_1.ValidUtils.isNullOrUndefined(min) && ValidUtils_1.ValidUtils.isNullOrUndefined(max)) {
|
|
13
|
-
return Math.random() * (min || 0);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return Math.random() * ((max || 0) - (min || 0)) + (min || 0);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
RandomUtils.uuid = function (format) {
|
|
20
|
-
if (format === void 0) { format = 'xxxx-xxxx-xxxx-xxxx'; }
|
|
21
|
-
return format.replace(/[xy]/g, function (c) {
|
|
22
|
-
var r = Math.random() * 16 | 0;
|
|
23
|
-
var v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
24
|
-
return v.toString(16);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
RandomUtils.getRandomColor = function () {
|
|
28
|
-
var letters = '0123456789ABCDEF'.split('');
|
|
29
|
-
var color = '#';
|
|
30
|
-
for (var i = 0; i < 6; i++) {
|
|
31
|
-
color += letters[Math.floor(Math.random() * 16)];
|
|
32
|
-
}
|
|
33
|
-
return color;
|
|
34
|
-
};
|
|
35
|
-
// (Math.random().toString(36)+'00000000000000000').slice(2, 10) + Date.now()
|
|
36
|
-
RandomUtils.getRandomString = function (len) {
|
|
37
|
-
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
|
|
38
|
-
var color = '';
|
|
39
|
-
for (var i = 0; i < len; i++) {
|
|
40
|
-
color += letters[Math.floor(Math.random() * letters.length)];
|
|
41
|
-
}
|
|
42
|
-
return color;
|
|
43
|
-
};
|
|
44
|
-
RandomUtils.d = '';
|
|
45
|
-
return RandomUtils;
|
|
46
|
-
}());
|
|
47
|
-
exports.RandomUtils = RandomUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RandomUtils = void 0;
|
|
4
|
+
var ValidUtils_1 = require("../valid/ValidUtils");
|
|
5
|
+
var RandomUtils = /** @class */ (function () {
|
|
6
|
+
function RandomUtils() {
|
|
7
|
+
}
|
|
8
|
+
RandomUtils.random = function (min, max) {
|
|
9
|
+
if (ValidUtils_1.ValidUtils.isNullOrUndefined(min)) {
|
|
10
|
+
return Math.random();
|
|
11
|
+
}
|
|
12
|
+
else if (!ValidUtils_1.ValidUtils.isNullOrUndefined(min) && ValidUtils_1.ValidUtils.isNullOrUndefined(max)) {
|
|
13
|
+
return Math.random() * (min || 0);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return Math.random() * ((max || 0) - (min || 0)) + (min || 0);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
RandomUtils.uuid = function (format) {
|
|
20
|
+
if (format === void 0) { format = 'xxxx-xxxx-xxxx-xxxx'; }
|
|
21
|
+
return format.replace(/[xy]/g, function (c) {
|
|
22
|
+
var r = Math.random() * 16 | 0;
|
|
23
|
+
var v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
24
|
+
return v.toString(16);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
RandomUtils.getRandomColor = function () {
|
|
28
|
+
var letters = '0123456789ABCDEF'.split('');
|
|
29
|
+
var color = '#';
|
|
30
|
+
for (var i = 0; i < 6; i++) {
|
|
31
|
+
color += letters[Math.floor(Math.random() * 16)];
|
|
32
|
+
}
|
|
33
|
+
return color;
|
|
34
|
+
};
|
|
35
|
+
// (Math.random().toString(36)+'00000000000000000').slice(2, 10) + Date.now()
|
|
36
|
+
RandomUtils.getRandomString = function (len) {
|
|
37
|
+
var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
|
|
38
|
+
var color = '';
|
|
39
|
+
for (var i = 0; i < len; i++) {
|
|
40
|
+
color += letters[Math.floor(Math.random() * letters.length)];
|
|
41
|
+
}
|
|
42
|
+
return color;
|
|
43
|
+
};
|
|
44
|
+
RandomUtils.d = '';
|
|
45
|
+
return RandomUtils;
|
|
46
|
+
}());
|
|
47
|
+
exports.RandomUtils = RandomUtils;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare class ScriptUtils {
|
|
2
|
-
static getVariablePaths(script: string): Set<string>;
|
|
3
|
-
static evalReturn(script: string, thisTarget: any): any;
|
|
4
|
-
static eval(script: string, thisTarget: any): any;
|
|
5
|
-
static loadElement(name: string, attribute: {
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
}, document: Document): Promise<unknown>;
|
|
8
|
-
static loadStyleSheet(href: string, attribute: {
|
|
9
|
-
[key: string]: string;
|
|
10
|
-
} | undefined, document: Document): Promise<unknown>;
|
|
11
|
-
static loadScript(src: string, attribute: {
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
} | undefined, document: Document): Promise<unknown>;
|
|
14
|
-
}
|
|
1
|
+
export declare class ScriptUtils {
|
|
2
|
+
static getVariablePaths(script: string): Set<string>;
|
|
3
|
+
static evalReturn(script: string, thisTarget: any): any;
|
|
4
|
+
static eval(script: string, thisTarget: any): any;
|
|
5
|
+
static loadElement(name: string, attribute: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}, document: Document): Promise<unknown>;
|
|
8
|
+
static loadStyleSheet(href: string, attribute: {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
} | undefined, document: Document): Promise<unknown>;
|
|
11
|
+
static loadScript(src: string, attribute: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
} | undefined, document: Document): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScriptUtils = void 0;
|
|
4
|
-
var ScriptUtils = /** @class */ (function () {
|
|
5
|
-
function ScriptUtils() {
|
|
6
|
-
}
|
|
7
|
-
ScriptUtils.getVariablePaths = function (script) {
|
|
8
|
-
var usingVars = new Set();
|
|
9
|
-
var GetDetectProxy = /** @class */ (function () {
|
|
10
|
-
function GetDetectProxy(prefix) {
|
|
11
|
-
this.prefix = prefix;
|
|
12
|
-
this.usingVars = usingVars;
|
|
13
|
-
}
|
|
14
|
-
GetDetectProxy.prototype.set = function (target, p, value, receiver) {
|
|
15
|
-
return true;
|
|
16
|
-
};
|
|
17
|
-
GetDetectProxy.prototype.get = function (target, p, receiver) {
|
|
18
|
-
var items;
|
|
19
|
-
if (typeof p === 'string' && isNaN(Number(p))) {
|
|
20
|
-
items = this.prefix ? this.prefix + '.' + p : p;
|
|
21
|
-
this.usingVars.add(items);
|
|
22
|
-
}
|
|
23
|
-
else if (typeof p === 'string' && !isNaN(Number(p))) {
|
|
24
|
-
items = this.prefix ? this.prefix + '[' + p + ']' : p;
|
|
25
|
-
this.usingVars.add(items);
|
|
26
|
-
}
|
|
27
|
-
return new Proxy(function () {
|
|
28
|
-
}, new GetDetectProxy(items));
|
|
29
|
-
};
|
|
30
|
-
return GetDetectProxy;
|
|
31
|
-
}());
|
|
32
|
-
var destUser = new Proxy(function () {
|
|
33
|
-
}, new GetDetectProxy());
|
|
34
|
-
try {
|
|
35
|
-
// eslint-disable-next-line no-new-func,no-unused-expressions
|
|
36
|
-
Function("\"use strict\"; ".concat(script, "; ")).bind(destUser)();
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
console.error(e);
|
|
40
|
-
}
|
|
41
|
-
// console.log('------->', usingVars);
|
|
42
|
-
return usingVars;
|
|
43
|
-
};
|
|
44
|
-
ScriptUtils.evalReturn = function (script, thisTarget) {
|
|
45
|
-
// if (!script.startsWith('this.')) {
|
|
46
|
-
// script = 'this.' + script;
|
|
47
|
-
// }
|
|
48
|
-
return this.eval('return ' + script + ';', thisTarget);
|
|
49
|
-
};
|
|
50
|
-
ScriptUtils.eval = function (script, thisTarget) {
|
|
51
|
-
// eslint-disable-next-line no-new-func,no-unused-expressions
|
|
52
|
-
return Function("\"use strict\"; ".concat(script, " ")).bind(thisTarget)();
|
|
53
|
-
};
|
|
54
|
-
ScriptUtils.loadElement = function (name, attribute, document) {
|
|
55
|
-
return new Promise(function (resolve, reject) {
|
|
56
|
-
var tag = document.createElement(name);
|
|
57
|
-
tag.onload = resolve;
|
|
58
|
-
tag.onerror = reject;
|
|
59
|
-
for (var _i = 0, _a = Object.entries(attribute); _i < _a.length; _i++) {
|
|
60
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
61
|
-
tag.setAttribute(key, value);
|
|
62
|
-
}
|
|
63
|
-
document.head.append(tag);
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
ScriptUtils.loadStyleSheet = function (href, attribute, document) {
|
|
67
|
-
if (attribute === void 0) { attribute = {}; }
|
|
68
|
-
// const tag = document.createElement('link');
|
|
69
|
-
// tag.type = 'text/css';
|
|
70
|
-
// tag.setAttribute('rel', 'stylesheet');
|
|
71
|
-
// tag.href = href;
|
|
72
|
-
// for (const [key, value] of Object.entries(attribute)) {
|
|
73
|
-
// tag.setAttribute(key, value);
|
|
74
|
-
// }
|
|
75
|
-
// target.append(tag)
|
|
76
|
-
attribute.type = 'text/css';
|
|
77
|
-
attribute.rel = 'stylesheet';
|
|
78
|
-
attribute.href = href;
|
|
79
|
-
return ScriptUtils.loadElement('link', attribute, document);
|
|
80
|
-
};
|
|
81
|
-
ScriptUtils.loadScript = function (src, attribute, document) {
|
|
82
|
-
if (attribute === void 0) { attribute = {}; }
|
|
83
|
-
attribute.type = 'text/javascript';
|
|
84
|
-
attribute.src = src;
|
|
85
|
-
return ScriptUtils.loadElement('script', attribute, document);
|
|
86
|
-
};
|
|
87
|
-
return ScriptUtils;
|
|
88
|
-
}());
|
|
89
|
-
exports.ScriptUtils = ScriptUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScriptUtils = void 0;
|
|
4
|
+
var ScriptUtils = /** @class */ (function () {
|
|
5
|
+
function ScriptUtils() {
|
|
6
|
+
}
|
|
7
|
+
ScriptUtils.getVariablePaths = function (script) {
|
|
8
|
+
var usingVars = new Set();
|
|
9
|
+
var GetDetectProxy = /** @class */ (function () {
|
|
10
|
+
function GetDetectProxy(prefix) {
|
|
11
|
+
this.prefix = prefix;
|
|
12
|
+
this.usingVars = usingVars;
|
|
13
|
+
}
|
|
14
|
+
GetDetectProxy.prototype.set = function (target, p, value, receiver) {
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
GetDetectProxy.prototype.get = function (target, p, receiver) {
|
|
18
|
+
var items;
|
|
19
|
+
if (typeof p === 'string' && isNaN(Number(p))) {
|
|
20
|
+
items = this.prefix ? this.prefix + '.' + p : p;
|
|
21
|
+
this.usingVars.add(items);
|
|
22
|
+
}
|
|
23
|
+
else if (typeof p === 'string' && !isNaN(Number(p))) {
|
|
24
|
+
items = this.prefix ? this.prefix + '[' + p + ']' : p;
|
|
25
|
+
this.usingVars.add(items);
|
|
26
|
+
}
|
|
27
|
+
return new Proxy(function () {
|
|
28
|
+
}, new GetDetectProxy(items));
|
|
29
|
+
};
|
|
30
|
+
return GetDetectProxy;
|
|
31
|
+
}());
|
|
32
|
+
var destUser = new Proxy(function () {
|
|
33
|
+
}, new GetDetectProxy());
|
|
34
|
+
try {
|
|
35
|
+
// eslint-disable-next-line no-new-func,no-unused-expressions
|
|
36
|
+
Function("\"use strict\"; ".concat(script, "; ")).bind(destUser)();
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error(e);
|
|
40
|
+
}
|
|
41
|
+
// console.log('------->', usingVars);
|
|
42
|
+
return usingVars;
|
|
43
|
+
};
|
|
44
|
+
ScriptUtils.evalReturn = function (script, thisTarget) {
|
|
45
|
+
// if (!script.startsWith('this.')) {
|
|
46
|
+
// script = 'this.' + script;
|
|
47
|
+
// }
|
|
48
|
+
return this.eval('return ' + script + ';', thisTarget);
|
|
49
|
+
};
|
|
50
|
+
ScriptUtils.eval = function (script, thisTarget) {
|
|
51
|
+
// eslint-disable-next-line no-new-func,no-unused-expressions
|
|
52
|
+
return Function("\"use strict\"; ".concat(script, " ")).bind(thisTarget)();
|
|
53
|
+
};
|
|
54
|
+
ScriptUtils.loadElement = function (name, attribute, document) {
|
|
55
|
+
return new Promise(function (resolve, reject) {
|
|
56
|
+
var tag = document.createElement(name);
|
|
57
|
+
tag.onload = resolve;
|
|
58
|
+
tag.onerror = reject;
|
|
59
|
+
for (var _i = 0, _a = Object.entries(attribute); _i < _a.length; _i++) {
|
|
60
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
61
|
+
tag.setAttribute(key, value);
|
|
62
|
+
}
|
|
63
|
+
document.head.append(tag);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
ScriptUtils.loadStyleSheet = function (href, attribute, document) {
|
|
67
|
+
if (attribute === void 0) { attribute = {}; }
|
|
68
|
+
// const tag = document.createElement('link');
|
|
69
|
+
// tag.type = 'text/css';
|
|
70
|
+
// tag.setAttribute('rel', 'stylesheet');
|
|
71
|
+
// tag.href = href;
|
|
72
|
+
// for (const [key, value] of Object.entries(attribute)) {
|
|
73
|
+
// tag.setAttribute(key, value);
|
|
74
|
+
// }
|
|
75
|
+
// target.append(tag)
|
|
76
|
+
attribute.type = 'text/css';
|
|
77
|
+
attribute.rel = 'stylesheet';
|
|
78
|
+
attribute.href = href;
|
|
79
|
+
return ScriptUtils.loadElement('link', attribute, document);
|
|
80
|
+
};
|
|
81
|
+
ScriptUtils.loadScript = function (src, attribute, document) {
|
|
82
|
+
if (attribute === void 0) { attribute = {}; }
|
|
83
|
+
attribute.type = 'text/javascript';
|
|
84
|
+
attribute.src = src;
|
|
85
|
+
return ScriptUtils.loadElement('script', attribute, document);
|
|
86
|
+
};
|
|
87
|
+
return ScriptUtils;
|
|
88
|
+
}());
|
|
89
|
+
exports.ScriptUtils = ScriptUtils;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare class StorageUtils {
|
|
2
|
-
static setLocalStorageItem(k: string, v: string | any, window: Window): void;
|
|
3
|
-
static getLocalStorageItem(k: string, window: Window): string | null;
|
|
4
|
-
static cutLocalStorageItem(k: string, window: Window): string | null;
|
|
5
|
-
static removeLocalStorageItem(k: string, window: Window): void;
|
|
6
|
-
static getLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
|
|
7
|
-
static cutLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
|
|
8
|
-
static clearLocalStorage(window: Window): void;
|
|
9
|
-
}
|
|
1
|
+
export declare class StorageUtils {
|
|
2
|
+
static setLocalStorageItem(k: string, v: string | any, window: Window): void;
|
|
3
|
+
static getLocalStorageItem(k: string, window: Window): string | null;
|
|
4
|
+
static cutLocalStorageItem(k: string, window: Window): string | null;
|
|
5
|
+
static removeLocalStorageItem(k: string, window: Window): void;
|
|
6
|
+
static getLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
|
|
7
|
+
static cutLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
|
|
8
|
+
static clearLocalStorage(window: Window): void;
|
|
9
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StorageUtils = void 0;
|
|
4
|
-
var StorageUtils = /** @class */ (function () {
|
|
5
|
-
function StorageUtils() {
|
|
6
|
-
}
|
|
7
|
-
StorageUtils.setLocalStorageItem = function (k, v, window) {
|
|
8
|
-
if (typeof v === 'object') {
|
|
9
|
-
v = JSON.stringify(v);
|
|
10
|
-
}
|
|
11
|
-
window.localStorage.setItem(k, v);
|
|
12
|
-
};
|
|
13
|
-
StorageUtils.getLocalStorageItem = function (k, window) {
|
|
14
|
-
return window.localStorage.getItem(k);
|
|
15
|
-
};
|
|
16
|
-
StorageUtils.cutLocalStorageItem = function (k, window) {
|
|
17
|
-
var data = StorageUtils.getLocalStorageItem(k, window);
|
|
18
|
-
StorageUtils.removeLocalStorageItem(k, window);
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
StorageUtils.removeLocalStorageItem = function (k, window) {
|
|
22
|
-
return window.localStorage.removeItem(k);
|
|
23
|
-
};
|
|
24
|
-
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
|
25
|
-
var item = window.localStorage.getItem(k);
|
|
26
|
-
if (item) {
|
|
27
|
-
try {
|
|
28
|
-
return JSON.parse(item);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
|
39
|
-
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
|
40
|
-
StorageUtils.removeLocalStorageItem(k, window);
|
|
41
|
-
return item;
|
|
42
|
-
};
|
|
43
|
-
StorageUtils.clearLocalStorage = function (window) {
|
|
44
|
-
window.localStorage.clear();
|
|
45
|
-
};
|
|
46
|
-
return StorageUtils;
|
|
47
|
-
}());
|
|
48
|
-
exports.StorageUtils = StorageUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageUtils = void 0;
|
|
4
|
+
var StorageUtils = /** @class */ (function () {
|
|
5
|
+
function StorageUtils() {
|
|
6
|
+
}
|
|
7
|
+
StorageUtils.setLocalStorageItem = function (k, v, window) {
|
|
8
|
+
if (typeof v === 'object') {
|
|
9
|
+
v = JSON.stringify(v);
|
|
10
|
+
}
|
|
11
|
+
window.localStorage.setItem(k, v);
|
|
12
|
+
};
|
|
13
|
+
StorageUtils.getLocalStorageItem = function (k, window) {
|
|
14
|
+
return window.localStorage.getItem(k);
|
|
15
|
+
};
|
|
16
|
+
StorageUtils.cutLocalStorageItem = function (k, window) {
|
|
17
|
+
var data = StorageUtils.getLocalStorageItem(k, window);
|
|
18
|
+
StorageUtils.removeLocalStorageItem(k, window);
|
|
19
|
+
return data;
|
|
20
|
+
};
|
|
21
|
+
StorageUtils.removeLocalStorageItem = function (k, window) {
|
|
22
|
+
return window.localStorage.removeItem(k);
|
|
23
|
+
};
|
|
24
|
+
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
|
25
|
+
var item = window.localStorage.getItem(k);
|
|
26
|
+
if (item) {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(item);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
|
39
|
+
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
|
40
|
+
StorageUtils.removeLocalStorageItem(k, window);
|
|
41
|
+
return item;
|
|
42
|
+
};
|
|
43
|
+
StorageUtils.clearLocalStorage = function (window) {
|
|
44
|
+
window.localStorage.clear();
|
|
45
|
+
};
|
|
46
|
+
return StorageUtils;
|
|
47
|
+
}());
|
|
48
|
+
exports.StorageUtils = StorageUtils;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare class StringUtils {
|
|
2
|
-
static deleteEnter(data: string): string;
|
|
3
|
-
static regexExec(regex: RegExp, text: string): RegExpExecArray[];
|
|
4
|
-
static escapeSpecialCharacterRegExp(data: string): string;
|
|
5
|
-
}
|
|
1
|
+
export declare class StringUtils {
|
|
2
|
+
static deleteEnter(data: string): string;
|
|
3
|
+
static regexExec(regex: RegExp, text: string): RegExpExecArray[];
|
|
4
|
+
static escapeSpecialCharacterRegExp(data: string): string;
|
|
5
|
+
}
|