dom-render 1.0.73 → 1.0.76
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 -4
- package/DomRender.js +90 -39
- package/DomRenderProxy.d.ts +29 -29
- package/DomRenderProxy.js +338 -327
- package/README.MD +638 -511
- package/RawSet.d.ts +140 -117
- package/RawSet.js +765 -882
- package/components/ComponentSet.d.ts +7 -0
- package/components/ComponentSet.js +14 -0
- package/dist/bundle.js +3796 -3133
- package/events/EventManager.d.ts +47 -47
- package/events/EventManager.js +499 -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 -0
- package/lifecycle/OnDestroyRender.js +2 -0
- 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 +4 -0
- package/operators/AttrExpresion.js +68 -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 -22
- package/routers/Router.js +116 -94
- 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
package/routers/Router.js
CHANGED
@@ -1,94 +1,116 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
3
|
-
__assign = Object.assign || function(t) {
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
-
s = arguments[i];
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
-
t[p] = s[p];
|
8
|
-
}
|
9
|
-
return t;
|
10
|
-
};
|
11
|
-
return __assign.apply(this, arguments);
|
12
|
-
};
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
exports.Router = void 0;
|
15
|
-
var EventManager_1 = require("../events/EventManager");
|
16
|
-
var Router = /** @class */ (function () {
|
17
|
-
function Router(rootObj, window) {
|
18
|
-
this.rootObj = rootObj;
|
19
|
-
this.window = window;
|
20
|
-
this.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
+
exports.Router = void 0;
|
15
|
+
var EventManager_1 = require("../events/EventManager");
|
16
|
+
var Router = /** @class */ (function () {
|
17
|
+
function Router(rootObj, window) {
|
18
|
+
this.rootObj = rootObj;
|
19
|
+
this.window = window;
|
20
|
+
this.attachCallbacks = new Set();
|
21
|
+
this.go(this.getUrl());
|
22
|
+
}
|
23
|
+
Router.prototype.addAttachCallback = function (callback) {
|
24
|
+
this.attachCallbacks.add(callback);
|
25
|
+
};
|
26
|
+
Router.prototype.attach = function () {
|
27
|
+
var _this = this;
|
28
|
+
var proxy = this.rootObj._DomRender_proxy;
|
29
|
+
if (proxy) {
|
30
|
+
var key = "___".concat(EventManager_1.EventManager.ROUTER_VARNAME);
|
31
|
+
proxy.render(key);
|
32
|
+
}
|
33
|
+
this.attachCallbacks.forEach(function (it) {
|
34
|
+
it(_this.getRouteData());
|
35
|
+
});
|
36
|
+
};
|
37
|
+
Router.prototype.testRegexp = function (regexp) {
|
38
|
+
var b = RegExp(regexp).test(this.getPath());
|
39
|
+
return b;
|
40
|
+
};
|
41
|
+
Router.prototype.getRouteData = function (urlExpression) {
|
42
|
+
var newVar = {
|
43
|
+
path: this.getPath(),
|
44
|
+
url: this.getUrl(),
|
45
|
+
searchParams: this.getSearchParams()
|
46
|
+
};
|
47
|
+
var data = this.getData();
|
48
|
+
if (data) {
|
49
|
+
newVar.data = data;
|
50
|
+
}
|
51
|
+
if (urlExpression) {
|
52
|
+
var data_1 = this.getPathData(urlExpression);
|
53
|
+
if (data_1) {
|
54
|
+
newVar.pathData = data_1;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return Object.freeze(newVar);
|
58
|
+
};
|
59
|
+
// eslint-disable-next-line no-dupe-class-members
|
60
|
+
Router.prototype.go = function (path, urlExpressionOrData, dataOrTitle, title) {
|
61
|
+
// console.log('go-->', path, urlExpressionOrData, dataOrTitle, title);
|
62
|
+
if (typeof urlExpressionOrData === 'string') {
|
63
|
+
var pathData = this.getPathData(urlExpressionOrData, path);
|
64
|
+
if (pathData) {
|
65
|
+
dataOrTitle = dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : {};
|
66
|
+
dataOrTitle = __assign(__assign({}, dataOrTitle), pathData);
|
67
|
+
}
|
68
|
+
this.set(path, dataOrTitle, title !== null && title !== void 0 ? title : '');
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
this.set(path, urlExpressionOrData, dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : '');
|
72
|
+
}
|
73
|
+
this.attach();
|
74
|
+
};
|
75
|
+
Router.prototype.getPathData = function (urlExpression, currentUrl) {
|
76
|
+
// console.log('getPathData-->', urlExpression, currentUrl);
|
77
|
+
// const regexps = StringUtils.regexExec(/(\{(?:\{??[^{]*?\}))/g, urlExpression);
|
78
|
+
// const regexpMap = new Map<string, string>()
|
79
|
+
// regexps.forEach((item, idx) => {
|
80
|
+
// const key = `{${idx}}`;
|
81
|
+
// const value = item[0];
|
82
|
+
// urlExpression = urlExpression.replace(value, key)
|
83
|
+
// regexpMap.set(key, value)
|
84
|
+
// })
|
85
|
+
if (currentUrl === void 0) { currentUrl = this.getPath(); }
|
86
|
+
var urls = currentUrl.split('?')[0].split('/');
|
87
|
+
var urlExpressions = urlExpression.split('/');
|
88
|
+
if (urls.length !== urlExpressions.length) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
var data = {};
|
92
|
+
for (var i = 0; i < urlExpressions.length; i++) {
|
93
|
+
var it_1 = urlExpressions[i];
|
94
|
+
// it = regexpMap.get(it) ?? it;
|
95
|
+
var urlit = urls[i];
|
96
|
+
// ex) {serialNo:[0-9]+} or {no} ..
|
97
|
+
var execResult = /^\{(.+)\}$/g.exec(it_1);
|
98
|
+
if (!execResult) {
|
99
|
+
if (it_1 !== urlit) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
continue;
|
103
|
+
}
|
104
|
+
// regex check
|
105
|
+
var _a = execResult[1].split(':'), name_1 = _a[0], regex = _a[1]; // group1
|
106
|
+
var regExp = RegExp(regex);
|
107
|
+
if (regex && !regExp.test(urlit)) {
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
data[name_1] = urlit;
|
111
|
+
}
|
112
|
+
return data;
|
113
|
+
};
|
114
|
+
return Router;
|
115
|
+
}());
|
116
|
+
exports.Router = Router;
|
package/types/Types.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
export interface ConstructorType<T> {
|
2
|
-
new (...args: any[]): T;
|
3
|
-
}
|
4
|
-
export declare class Shield {
|
5
|
-
[name: string]: any;
|
6
|
-
}
|
7
|
-
export declare class DomRenderFinalProxy<T extends object> implements ProxyHandler<T> {
|
8
|
-
set(target: T, p: string | symbol, value: any, receiver: any): boolean;
|
9
|
-
get(target: T, p: string | symbol, receiver: any): any;
|
10
|
-
static final<T = any>(obj: T): T;
|
11
|
-
static isFinal<T = any>(obj: T): boolean;
|
12
|
-
static unFinal<T = any>(obj: T): T;
|
13
|
-
has(target: T, p: string | symbol): boolean;
|
14
|
-
}
|
1
|
+
export interface ConstructorType<T> {
|
2
|
+
new (...args: any[]): T;
|
3
|
+
}
|
4
|
+
export declare class Shield {
|
5
|
+
[name: string]: any;
|
6
|
+
}
|
7
|
+
export declare class DomRenderFinalProxy<T extends object> implements ProxyHandler<T> {
|
8
|
+
set(target: T, p: string | symbol, value: any, receiver: any): boolean;
|
9
|
+
get(target: T, p: string | symbol, receiver: any): any;
|
10
|
+
static final<T = any>(obj: T): T;
|
11
|
+
static isFinal<T = any>(obj: T): boolean;
|
12
|
+
static unFinal<T = any>(obj: T): T;
|
13
|
+
has(target: T, p: string | symbol): boolean;
|
14
|
+
}
|
package/types/Types.js
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DomRenderFinalProxy = exports.Shield = void 0;
|
4
|
-
var Shield = /** @class */ (function () {
|
5
|
-
function Shield() {
|
6
|
-
}
|
7
|
-
return Shield;
|
8
|
-
}());
|
9
|
-
exports.Shield = Shield;
|
10
|
-
var DomRenderFinalProxy = /** @class */ (function () {
|
11
|
-
function DomRenderFinalProxy() {
|
12
|
-
}
|
13
|
-
DomRenderFinalProxy.prototype.set = function (target, p, value, receiver) {
|
14
|
-
target[p] = value;
|
15
|
-
return true;
|
16
|
-
};
|
17
|
-
DomRenderFinalProxy.prototype.get = function (target, p, receiver) {
|
18
|
-
return target[p];
|
19
|
-
};
|
20
|
-
DomRenderFinalProxy.final = function (obj) {
|
21
|
-
obj._DomRender_isFinal = true;
|
22
|
-
return obj;
|
23
|
-
};
|
24
|
-
DomRenderFinalProxy.isFinal = function (obj) {
|
25
|
-
return '_DomRender_isFinal' in obj;
|
26
|
-
};
|
27
|
-
DomRenderFinalProxy.unFinal = function (obj) {
|
28
|
-
delete obj._DomRender_isFinal;
|
29
|
-
return obj;
|
30
|
-
};
|
31
|
-
DomRenderFinalProxy.prototype.has = function (target, p) {
|
32
|
-
return p === '_DomRender_isFinal' || p in target;
|
33
|
-
};
|
34
|
-
return DomRenderFinalProxy;
|
35
|
-
}());
|
36
|
-
exports.DomRenderFinalProxy = DomRenderFinalProxy;
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DomRenderFinalProxy = exports.Shield = void 0;
|
4
|
+
var Shield = /** @class */ (function () {
|
5
|
+
function Shield() {
|
6
|
+
}
|
7
|
+
return Shield;
|
8
|
+
}());
|
9
|
+
exports.Shield = Shield;
|
10
|
+
var DomRenderFinalProxy = /** @class */ (function () {
|
11
|
+
function DomRenderFinalProxy() {
|
12
|
+
}
|
13
|
+
DomRenderFinalProxy.prototype.set = function (target, p, value, receiver) {
|
14
|
+
target[p] = value;
|
15
|
+
return true;
|
16
|
+
};
|
17
|
+
DomRenderFinalProxy.prototype.get = function (target, p, receiver) {
|
18
|
+
return target[p];
|
19
|
+
};
|
20
|
+
DomRenderFinalProxy.final = function (obj) {
|
21
|
+
obj._DomRender_isFinal = true;
|
22
|
+
return obj;
|
23
|
+
};
|
24
|
+
DomRenderFinalProxy.isFinal = function (obj) {
|
25
|
+
return '_DomRender_isFinal' in obj;
|
26
|
+
};
|
27
|
+
DomRenderFinalProxy.unFinal = function (obj) {
|
28
|
+
delete obj._DomRender_isFinal;
|
29
|
+
return obj;
|
30
|
+
};
|
31
|
+
DomRenderFinalProxy.prototype.has = function (target, p) {
|
32
|
+
return p === '_DomRender_isFinal' || p in target;
|
33
|
+
};
|
34
|
+
return DomRenderFinalProxy;
|
35
|
+
}());
|
36
|
+
exports.DomRenderFinalProxy = DomRenderFinalProxy;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export declare class ClipBoardUtils {
|
2
|
-
static readText(clipboard?: Clipboard): Promise<string>;
|
3
|
-
static read(clipboard?: Clipboard): Promise<ClipboardItems>;
|
4
|
-
static writeText(data: string, clipboard?: Clipboard): Promise<void>;
|
5
|
-
static write(data: ClipboardItems, clipboard?: Clipboard): Promise<void>;
|
6
|
-
}
|
1
|
+
export declare class ClipBoardUtils {
|
2
|
+
static readText(clipboard?: Clipboard): Promise<string>;
|
3
|
+
static read(clipboard?: Clipboard): Promise<ClipboardItems>;
|
4
|
+
static writeText(data: string, clipboard?: Clipboard): Promise<void>;
|
5
|
+
static write(data: ClipboardItems, clipboard?: Clipboard): Promise<void>;
|
6
|
+
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ClipBoardUtils = void 0;
|
4
|
-
var ClipBoardUtils = /** @class */ (function () {
|
5
|
-
function ClipBoardUtils() {
|
6
|
-
}
|
7
|
-
ClipBoardUtils.readText = function (clipboard) {
|
8
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
9
|
-
return clipboard.readText();
|
10
|
-
};
|
11
|
-
ClipBoardUtils.read = function (clipboard) {
|
12
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
13
|
-
return clipboard.read();
|
14
|
-
};
|
15
|
-
ClipBoardUtils.writeText = function (data, clipboard) {
|
16
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
17
|
-
return clipboard.writeText(data);
|
18
|
-
};
|
19
|
-
ClipBoardUtils.write = function (data, clipboard) {
|
20
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
21
|
-
return clipboard.write(data);
|
22
|
-
};
|
23
|
-
return ClipBoardUtils;
|
24
|
-
}());
|
25
|
-
exports.ClipBoardUtils = ClipBoardUtils;
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ClipBoardUtils = void 0;
|
4
|
+
var ClipBoardUtils = /** @class */ (function () {
|
5
|
+
function ClipBoardUtils() {
|
6
|
+
}
|
7
|
+
ClipBoardUtils.readText = function (clipboard) {
|
8
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
9
|
+
return clipboard.readText();
|
10
|
+
};
|
11
|
+
ClipBoardUtils.read = function (clipboard) {
|
12
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
13
|
+
return clipboard.read();
|
14
|
+
};
|
15
|
+
ClipBoardUtils.writeText = function (data, clipboard) {
|
16
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
17
|
+
return clipboard.writeText(data);
|
18
|
+
};
|
19
|
+
ClipBoardUtils.write = function (data, clipboard) {
|
20
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
21
|
+
return clipboard.write(data);
|
22
|
+
};
|
23
|
+
return ClipBoardUtils;
|
24
|
+
}());
|
25
|
+
exports.ClipBoardUtils = ClipBoardUtils;
|
package/utils/dom/DomUtils.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
export declare type Attr = {
|
2
|
-
name: string;
|
3
|
-
value: any;
|
4
|
-
};
|
5
|
-
export declare class DomUtils {
|
6
|
-
static selectorElements(selector: string, element?: Element | Document): Element[];
|
7
|
-
static selectorNodes(selector: string, element?: Element | Document): NodeListOf<Element>;
|
8
|
-
static removeAttribute(result: Element, attrs: string[]): void;
|
9
|
-
static setAttribute(result: Element, attrs: string[]): void;
|
10
|
-
static setAttributeAttr(result: Element, attrs: Attr[]): void;
|
11
|
-
static getAttributeToObject(input: Element): any;
|
12
|
-
static getStyleToObject(input: HTMLElement): any;
|
13
|
-
}
|
1
|
+
export declare type Attr = {
|
2
|
+
name: string;
|
3
|
+
value: any;
|
4
|
+
};
|
5
|
+
export declare class DomUtils {
|
6
|
+
static selectorElements(selector: string, element?: Element | Document): Element[];
|
7
|
+
static selectorNodes(selector: string, element?: Element | Document): NodeListOf<Element>;
|
8
|
+
static removeAttribute(result: Element, attrs: string[]): void;
|
9
|
+
static setAttribute(result: Element, attrs: string[]): void;
|
10
|
+
static setAttributeAttr(result: Element, attrs: Attr[]): void;
|
11
|
+
static getAttributeToObject(input: Element): any;
|
12
|
+
static getStyleToObject(input: HTMLElement): any;
|
13
|
+
}
|
package/utils/dom/DomUtils.js
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DomUtils = void 0;
|
4
|
-
var DomUtils = /** @class */ (function () {
|
5
|
-
function DomUtils() {
|
6
|
-
}
|
7
|
-
DomUtils.selectorElements = function (selector, element) {
|
8
|
-
if (element === void 0) { element = document; }
|
9
|
-
return Array.prototype.slice.call(element.querySelectorAll(selector));
|
10
|
-
};
|
11
|
-
DomUtils.selectorNodes = function (selector, element) {
|
12
|
-
if (element === void 0) { element = document; }
|
13
|
-
return element.querySelectorAll(selector);
|
14
|
-
};
|
15
|
-
DomUtils.removeAttribute = function (result, attrs) {
|
16
|
-
attrs.forEach(function (it) {
|
17
|
-
result.removeAttribute(it);
|
18
|
-
});
|
19
|
-
};
|
20
|
-
DomUtils.setAttribute = function (result, attrs) {
|
21
|
-
attrs.forEach(function (it) {
|
22
|
-
result.setAttribute(it, '');
|
23
|
-
});
|
24
|
-
};
|
25
|
-
DomUtils.setAttributeAttr = function (result, attrs) {
|
26
|
-
attrs.forEach(function (it) {
|
27
|
-
result.setAttribute(it.name, it.value);
|
28
|
-
});
|
29
|
-
};
|
30
|
-
DomUtils.getAttributeToObject = function (input) {
|
31
|
-
var attribute = {};
|
32
|
-
input.getAttributeNames().forEach(function (ait) {
|
33
|
-
attribute[ait] = input.getAttribute(ait);
|
34
|
-
});
|
35
|
-
return attribute;
|
36
|
-
};
|
37
|
-
DomUtils.getStyleToObject = function (input) {
|
38
|
-
var style = {};
|
39
|
-
for (var i = 0; i < input.style.length; i++) {
|
40
|
-
var key = input.style[i];
|
41
|
-
style[key] = input.style[key];
|
42
|
-
}
|
43
|
-
return style;
|
44
|
-
};
|
45
|
-
return DomUtils;
|
46
|
-
}());
|
47
|
-
exports.DomUtils = DomUtils;
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DomUtils = void 0;
|
4
|
+
var DomUtils = /** @class */ (function () {
|
5
|
+
function DomUtils() {
|
6
|
+
}
|
7
|
+
DomUtils.selectorElements = function (selector, element) {
|
8
|
+
if (element === void 0) { element = document; }
|
9
|
+
return Array.prototype.slice.call(element.querySelectorAll(selector));
|
10
|
+
};
|
11
|
+
DomUtils.selectorNodes = function (selector, element) {
|
12
|
+
if (element === void 0) { element = document; }
|
13
|
+
return element.querySelectorAll(selector);
|
14
|
+
};
|
15
|
+
DomUtils.removeAttribute = function (result, attrs) {
|
16
|
+
attrs.forEach(function (it) {
|
17
|
+
result.removeAttribute(it);
|
18
|
+
});
|
19
|
+
};
|
20
|
+
DomUtils.setAttribute = function (result, attrs) {
|
21
|
+
attrs.forEach(function (it) {
|
22
|
+
result.setAttribute(it, '');
|
23
|
+
});
|
24
|
+
};
|
25
|
+
DomUtils.setAttributeAttr = function (result, attrs) {
|
26
|
+
attrs.forEach(function (it) {
|
27
|
+
result.setAttribute(it.name, it.value);
|
28
|
+
});
|
29
|
+
};
|
30
|
+
DomUtils.getAttributeToObject = function (input) {
|
31
|
+
var attribute = {};
|
32
|
+
input.getAttributeNames().forEach(function (ait) {
|
33
|
+
attribute[ait] = input.getAttribute(ait);
|
34
|
+
});
|
35
|
+
return attribute;
|
36
|
+
};
|
37
|
+
DomUtils.getStyleToObject = function (input) {
|
38
|
+
var style = {};
|
39
|
+
for (var i = 0; i < input.style.length; i++) {
|
40
|
+
var key = input.style[i];
|
41
|
+
style[key] = input.style[key];
|
42
|
+
}
|
43
|
+
return style;
|
44
|
+
};
|
45
|
+
return DomUtils;
|
46
|
+
}());
|
47
|
+
exports.DomUtils = DomUtils;
|
@@ -1,16 +1,16 @@
|
|
1
|
-
export declare class LocationUtils {
|
2
|
-
static hash(window: Window): string;
|
3
|
-
static hashPath(window: Window): string;
|
4
|
-
static hashSearch(window: Window): string;
|
5
|
-
static hashQueryParams(window: Window): Map<string, string>;
|
6
|
-
static path(window: Window): string;
|
7
|
-
static pathQueryParamsObject(window: Window): {
|
8
|
-
[key: string]: string;
|
9
|
-
};
|
10
|
-
static hashQueryParamsObject(window: Window): {
|
11
|
-
[key: string]: string;
|
12
|
-
};
|
13
|
-
static pathQueryParams(window: Window): Map<string, string>;
|
14
|
-
private static queryStringToMap;
|
15
|
-
private static queryStringToObject;
|
16
|
-
}
|
1
|
+
export declare class LocationUtils {
|
2
|
+
static hash(window: Window): string;
|
3
|
+
static hashPath(window: Window): string;
|
4
|
+
static hashSearch(window: Window): string;
|
5
|
+
static hashQueryParams(window: Window): Map<string, string>;
|
6
|
+
static path(window: Window): string;
|
7
|
+
static pathQueryParamsObject(window: Window): {
|
8
|
+
[key: string]: string;
|
9
|
+
};
|
10
|
+
static hashQueryParamsObject(window: Window): {
|
11
|
+
[key: string]: string;
|
12
|
+
};
|
13
|
+
static pathQueryParams(window: Window): Map<string, string>;
|
14
|
+
private static queryStringToMap;
|
15
|
+
private static queryStringToObject;
|
16
|
+
}
|
@@ -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;
|