simple-boot-front 1.0.100 → 1.0.103
Sign up to get free protection for your applications and to get access to all the features.
- package/README.MD +388 -335
- package/SimpleBootFront.d.ts +34 -32
- package/SimpleBootFront.js +337 -327
- package/decorators/Component.d.ts +11 -11
- package/decorators/Component.js +30 -30
- package/decorators/Script.d.ts +10 -10
- package/decorators/Script.js +31 -31
- package/decorators/inject/InjectFrontSituationType.d.ts +3 -3
- package/decorators/inject/InjectFrontSituationType.js +7 -7
- package/fetch/Fetcher.d.ts +4 -4
- package/fetch/Fetcher.js +9 -9
- package/lifecycle/OnChangedRender.d.ts +3 -3
- package/lifecycle/OnChangedRender.js +2 -2
- package/lifecycle/OnDestroy.d.ts +3 -3
- package/lifecycle/OnDestroy.js +2 -2
- package/lifecycle/OnFinish.d.ts +3 -3
- package/lifecycle/OnFinish.js +2 -2
- package/lifecycle/OnInit.d.ts +8 -8
- package/lifecycle/OnInit.js +2 -2
- package/lifecycle/OnInitedChild.d.ts +3 -3
- package/lifecycle/OnInitedChild.js +2 -2
- package/option/SimFrontOption.d.ts +14 -14
- package/option/SimFrontOption.js +45 -45
- package/package.json +83 -84
- package/script/ScriptRunnable.d.ts +7 -7
- package/script/ScriptRunnable.js +22 -22
- package/service/CookieService.d.ts +11 -11
- package/service/CookieService.js +54 -54
- package/service/HttpService.d.ts +3 -3
- package/service/HttpService.js +23 -23
- package/service/MetaTagService.d.ts +11 -11
- package/service/MetaTagService.js +52 -52
- package/service/Navigation.d.ts +18 -18
- package/service/Navigation.js +117 -117
- package/service/ScriptService.d.ts +7 -7
- package/service/ScriptService.js +39 -39
- package/service/StorageService.d.ts +12 -12
- package/service/StorageService.js +67 -67
- package/service/view/View.d.ts +6 -6
- package/service/view/View.js +29 -29
- package/service/view/ViewService.d.ts +7 -7
- package/service/view/ViewService.js +46 -46
- package/throwable/RouterError.d.ts +4 -4
- package/throwable/RouterError.js +27 -27
- package/throwable/RouterIntentError.d.ts +4 -4
- package/throwable/RouterIntentError.js +27 -27
- package/throwable/RouterNotFount.d.ts +4 -4
- package/throwable/RouterNotFount.js +27 -27
package/script/ScriptRunnable.js
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ScriptRunnable = void 0;
|
4
|
-
var ScriptRunnable = (function () {
|
5
|
-
function ScriptRunnable() {
|
6
|
-
this.rawSets = new Map();
|
7
|
-
}
|
8
|
-
ScriptRunnable.prototype.render = function () {
|
9
|
-
var _this = this;
|
10
|
-
this.rawSets.forEach(function (value, key) {
|
11
|
-
var _a;
|
12
|
-
if (key.isConnected) {
|
13
|
-
(_a = value._DomRender_proxy) === null || _a === void 0 ? void 0 : _a.render([key]);
|
14
|
-
}
|
15
|
-
else {
|
16
|
-
_this.rawSets.delete(key);
|
17
|
-
}
|
18
|
-
});
|
19
|
-
};
|
20
|
-
return ScriptRunnable;
|
21
|
-
}());
|
22
|
-
exports.ScriptRunnable = ScriptRunnable;
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ScriptRunnable = void 0;
|
4
|
+
var ScriptRunnable = (function () {
|
5
|
+
function ScriptRunnable() {
|
6
|
+
this.rawSets = new Map();
|
7
|
+
}
|
8
|
+
ScriptRunnable.prototype.render = function () {
|
9
|
+
var _this = this;
|
10
|
+
this.rawSets.forEach(function (value, key) {
|
11
|
+
var _a;
|
12
|
+
if (key.isConnected) {
|
13
|
+
(_a = value._DomRender_proxy) === null || _a === void 0 ? void 0 : _a.render([key]);
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
_this.rawSets.delete(key);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
};
|
20
|
+
return ScriptRunnable;
|
21
|
+
}());
|
22
|
+
exports.ScriptRunnable = ScriptRunnable;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
-
export declare class CookieService {
|
3
|
-
private option;
|
4
|
-
constructor(option: SimFrontOption);
|
5
|
-
get(key: string): string | undefined;
|
6
|
-
getAll(): {
|
7
|
-
[k: string]: string;
|
8
|
-
};
|
9
|
-
set(name: string, value: string, exp?: number): void;
|
10
|
-
delete(name: string, path?: string): void;
|
11
|
-
}
|
1
|
+
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
+
export declare class CookieService {
|
3
|
+
private option;
|
4
|
+
constructor(option: SimFrontOption);
|
5
|
+
get(key: string): string | undefined;
|
6
|
+
getAll(): {
|
7
|
+
[k: string]: string;
|
8
|
+
};
|
9
|
+
set(name: string, value: string, exp?: number): void;
|
10
|
+
delete(name: string, path?: string): void;
|
11
|
+
}
|
package/service/CookieService.js
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.CookieService = void 0;
|
13
|
-
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
-
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
-
var CookieService = (function () {
|
16
|
-
function CookieService(option) {
|
17
|
-
this.option = option;
|
18
|
-
}
|
19
|
-
CookieService.prototype.get = function (key) {
|
20
|
-
return this.getAll()[key];
|
21
|
-
};
|
22
|
-
CookieService.prototype.getAll = function () {
|
23
|
-
var _a;
|
24
|
-
var all = {};
|
25
|
-
var strings = (_a = this.option.window.document.cookie.split(';')) !== null && _a !== void 0 ? _a : [];
|
26
|
-
strings.forEach(function (it) {
|
27
|
-
var set = it.split('=');
|
28
|
-
if (set[0] && set[1] && set[0].trim().length > 0 && set[1].trim().length > 0) {
|
29
|
-
all[set[0].trim()] = set[1].trim();
|
30
|
-
}
|
31
|
-
});
|
32
|
-
return all;
|
33
|
-
};
|
34
|
-
CookieService.prototype.set = function (name, value, exp) {
|
35
|
-
if (exp === undefined) {
|
36
|
-
this.option.window.document.cookie = name + '=' + value + ';path=/';
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
var date = new Date();
|
40
|
-
date.setTime(date.getTime() + exp);
|
41
|
-
this.option.window.document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/';
|
42
|
-
}
|
43
|
-
};
|
44
|
-
CookieService.prototype.delete = function (name, path) {
|
45
|
-
if (path === void 0) { path = '/'; }
|
46
|
-
this.option.window.document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;' + " path=".concat(path);
|
47
|
-
};
|
48
|
-
CookieService = __decorate([
|
49
|
-
(0, SimDecorator_1.Sim)(),
|
50
|
-
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
51
|
-
], CookieService);
|
52
|
-
return CookieService;
|
53
|
-
}());
|
54
|
-
exports.CookieService = CookieService;
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.CookieService = void 0;
|
13
|
+
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
+
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
+
var CookieService = (function () {
|
16
|
+
function CookieService(option) {
|
17
|
+
this.option = option;
|
18
|
+
}
|
19
|
+
CookieService.prototype.get = function (key) {
|
20
|
+
return this.getAll()[key];
|
21
|
+
};
|
22
|
+
CookieService.prototype.getAll = function () {
|
23
|
+
var _a;
|
24
|
+
var all = {};
|
25
|
+
var strings = (_a = this.option.window.document.cookie.split(';')) !== null && _a !== void 0 ? _a : [];
|
26
|
+
strings.forEach(function (it) {
|
27
|
+
var set = it.split('=');
|
28
|
+
if (set[0] && set[1] && set[0].trim().length > 0 && set[1].trim().length > 0) {
|
29
|
+
all[set[0].trim()] = set[1].trim();
|
30
|
+
}
|
31
|
+
});
|
32
|
+
return all;
|
33
|
+
};
|
34
|
+
CookieService.prototype.set = function (name, value, exp) {
|
35
|
+
if (exp === undefined) {
|
36
|
+
this.option.window.document.cookie = name + '=' + value + ';path=/';
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
var date = new Date();
|
40
|
+
date.setTime(date.getTime() + exp);
|
41
|
+
this.option.window.document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/';
|
42
|
+
}
|
43
|
+
};
|
44
|
+
CookieService.prototype.delete = function (name, path) {
|
45
|
+
if (path === void 0) { path = '/'; }
|
46
|
+
this.option.window.document.cookie = name + '=; expires=Thu, 01 Jan 1999 00:00:10 GMT;' + " path=".concat(path);
|
47
|
+
};
|
48
|
+
CookieService = __decorate([
|
49
|
+
(0, SimDecorator_1.Sim)(),
|
50
|
+
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
51
|
+
], CookieService);
|
52
|
+
return CookieService;
|
53
|
+
}());
|
54
|
+
exports.CookieService = CookieService;
|
package/service/HttpService.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export declare class HttpService {
|
2
|
-
constructor();
|
3
|
-
}
|
1
|
+
export declare class HttpService {
|
2
|
+
constructor();
|
3
|
+
}
|
package/service/HttpService.js
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.HttpService = void 0;
|
13
|
-
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
-
var HttpService = (function () {
|
15
|
-
function HttpService() {
|
16
|
-
}
|
17
|
-
HttpService = __decorate([
|
18
|
-
(0, SimDecorator_1.Sim)(),
|
19
|
-
__metadata("design:paramtypes", [])
|
20
|
-
], HttpService);
|
21
|
-
return HttpService;
|
22
|
-
}());
|
23
|
-
exports.HttpService = HttpService;
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.HttpService = void 0;
|
13
|
+
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
+
var HttpService = (function () {
|
15
|
+
function HttpService() {
|
16
|
+
}
|
17
|
+
HttpService = __decorate([
|
18
|
+
(0, SimDecorator_1.Sim)(),
|
19
|
+
__metadata("design:paramtypes", [])
|
20
|
+
], HttpService);
|
21
|
+
return HttpService;
|
22
|
+
}());
|
23
|
+
exports.HttpService = HttpService;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
-
export declare class MetaTagService {
|
3
|
-
option: SimFrontOption;
|
4
|
-
constructor(option: SimFrontOption);
|
5
|
-
setMetaTag(selector: string, set: {
|
6
|
-
[key: string]: string;
|
7
|
-
}): void;
|
8
|
-
createMetaTag(set: {
|
9
|
-
[p: string]: string;
|
10
|
-
}): HTMLMetaElement;
|
11
|
-
}
|
1
|
+
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
+
export declare class MetaTagService {
|
3
|
+
option: SimFrontOption;
|
4
|
+
constructor(option: SimFrontOption);
|
5
|
+
setMetaTag(selector: string, set: {
|
6
|
+
[key: string]: string;
|
7
|
+
}): void;
|
8
|
+
createMetaTag(set: {
|
9
|
+
[p: string]: string;
|
10
|
+
}): HTMLMetaElement;
|
11
|
+
}
|
@@ -1,52 +1,52 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.MetaTagService = void 0;
|
13
|
-
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
-
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
-
var MetaTagService = (function () {
|
16
|
-
function MetaTagService(option) {
|
17
|
-
this.option = option;
|
18
|
-
}
|
19
|
-
MetaTagService.prototype.setMetaTag = function (selector, set) {
|
20
|
-
var target = this.option.window.document.querySelector(selector);
|
21
|
-
if (!target) {
|
22
|
-
this.option.window.document.head.appendChild(this.createMetaTag(set));
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
Object.entries(set).forEach(function (_a) {
|
26
|
-
var key = _a[0], value = _a[1];
|
27
|
-
if (null === value) {
|
28
|
-
target.removeAttribute(key);
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
target.setAttribute(key, value);
|
32
|
-
}
|
33
|
-
});
|
34
|
-
}
|
35
|
-
};
|
36
|
-
MetaTagService.prototype.createMetaTag = function (set) {
|
37
|
-
var meta = this.option.window.document.createElement('meta');
|
38
|
-
Object.entries(set).forEach(function (_a) {
|
39
|
-
var key = _a[0], value = _a[1];
|
40
|
-
if (
|
41
|
-
meta.setAttribute(key, value);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
return meta;
|
45
|
-
};
|
46
|
-
MetaTagService = __decorate([
|
47
|
-
(0, SimDecorator_1.Sim)(),
|
48
|
-
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
49
|
-
], MetaTagService);
|
50
|
-
return MetaTagService;
|
51
|
-
}());
|
52
|
-
exports.MetaTagService = MetaTagService;
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.MetaTagService = void 0;
|
13
|
+
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
+
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
+
var MetaTagService = (function () {
|
16
|
+
function MetaTagService(option) {
|
17
|
+
this.option = option;
|
18
|
+
}
|
19
|
+
MetaTagService.prototype.setMetaTag = function (selector, set) {
|
20
|
+
var target = this.option.window.document.querySelector(selector);
|
21
|
+
if (!target) {
|
22
|
+
this.option.window.document.head.appendChild(this.createMetaTag(set));
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
Object.entries(set).forEach(function (_a) {
|
26
|
+
var key = _a[0], value = _a[1];
|
27
|
+
if (null === value) {
|
28
|
+
target.removeAttribute(key);
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
target.setAttribute(key, value);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
};
|
36
|
+
MetaTagService.prototype.createMetaTag = function (set) {
|
37
|
+
var meta = this.option.window.document.createElement('meta');
|
38
|
+
Object.entries(set).forEach(function (_a) {
|
39
|
+
var key = _a[0], value = _a[1];
|
40
|
+
if (value !== null) {
|
41
|
+
meta.setAttribute(key, value);
|
42
|
+
}
|
43
|
+
});
|
44
|
+
return meta;
|
45
|
+
};
|
46
|
+
MetaTagService = __decorate([
|
47
|
+
(0, SimDecorator_1.Sim)(),
|
48
|
+
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
49
|
+
], MetaTagService);
|
50
|
+
return MetaTagService;
|
51
|
+
}());
|
52
|
+
exports.MetaTagService = MetaTagService;
|
package/service/Navigation.d.ts
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
-
export declare class Navigation {
|
3
|
-
option: SimFrontOption;
|
4
|
-
constructor(option: SimFrontOption);
|
5
|
-
get url(): string;
|
6
|
-
get path(): string;
|
7
|
-
get queryParams(): Map<string, string>;
|
8
|
-
get queryParamsObject(): any;
|
9
|
-
get pathInfo(): {
|
10
|
-
path: string;
|
11
|
-
queryParams: Map<string, string>;
|
12
|
-
};
|
13
|
-
reload(): void;
|
14
|
-
pathAndSearch(): string;
|
15
|
-
goNoPopStateEvent(path: string, data?: any, title?: string): void;
|
16
|
-
go(path: string, data?: any, title?: string): void;
|
17
|
-
state(): any;
|
18
|
-
}
|
1
|
+
import { SimFrontOption } from '../option/SimFrontOption';
|
2
|
+
export declare class Navigation {
|
3
|
+
option: SimFrontOption;
|
4
|
+
constructor(option: SimFrontOption);
|
5
|
+
get url(): string;
|
6
|
+
get path(): string;
|
7
|
+
get queryParams(): Map<string, string>;
|
8
|
+
get queryParamsObject(): any;
|
9
|
+
get pathInfo(): {
|
10
|
+
path: string;
|
11
|
+
queryParams: Map<string, string>;
|
12
|
+
};
|
13
|
+
reload(): void;
|
14
|
+
pathAndSearch(): string;
|
15
|
+
goNoPopStateEvent(path: string, data?: any, title?: string): void;
|
16
|
+
go(path: string, data?: any, title?: string): void;
|
17
|
+
state(): any;
|
18
|
+
}
|
package/service/Navigation.js
CHANGED
@@ -1,117 +1,117 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.Navigation = void 0;
|
13
|
-
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
-
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
-
var LocationUtils_1 = require("dom-render/utils/location/LocationUtils");
|
16
|
-
var Navigation = (function () {
|
17
|
-
function Navigation(option) {
|
18
|
-
this.option = option;
|
19
|
-
}
|
20
|
-
Object.defineProperty(Navigation.prototype, "url", {
|
21
|
-
get: function () {
|
22
|
-
var queryParams = this.queryParamsObject;
|
23
|
-
var queryString = Object.entries(queryParams).map(function (_a) {
|
24
|
-
var key = _a[0], value = _a[1];
|
25
|
-
return "".concat(key, "=").concat(value);
|
26
|
-
}).join('&');
|
27
|
-
var path = this.path;
|
28
|
-
return path + (queryString.length > 0 ? ('?' + queryString) : '');
|
29
|
-
},
|
30
|
-
enumerable: false,
|
31
|
-
configurable: true
|
32
|
-
});
|
33
|
-
Object.defineProperty(Navigation.prototype, "path", {
|
34
|
-
get: function () {
|
35
|
-
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
36
|
-
return LocationUtils_1.LocationUtils.path(this.option.window);
|
37
|
-
}
|
38
|
-
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
39
|
-
return LocationUtils_1.LocationUtils.hashPath(this.option.window);
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
return '';
|
43
|
-
}
|
44
|
-
},
|
45
|
-
enumerable: false,
|
46
|
-
configurable: true
|
47
|
-
});
|
48
|
-
Object.defineProperty(Navigation.prototype, "queryParams", {
|
49
|
-
get: function () {
|
50
|
-
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
51
|
-
return LocationUtils_1.LocationUtils.pathQueryParams(this.option.window);
|
52
|
-
}
|
53
|
-
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
54
|
-
return LocationUtils_1.LocationUtils.hashQueryParams(this.option.window);
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
return new Map();
|
58
|
-
}
|
59
|
-
},
|
60
|
-
enumerable: false,
|
61
|
-
configurable: true
|
62
|
-
});
|
63
|
-
Object.defineProperty(Navigation.prototype, "queryParamsObject", {
|
64
|
-
get: function () {
|
65
|
-
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
66
|
-
return LocationUtils_1.LocationUtils.pathQueryParamsObject(this.option.window);
|
67
|
-
}
|
68
|
-
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
69
|
-
return LocationUtils_1.LocationUtils.hashQueryParamsObject(this.option.window);
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
return {};
|
73
|
-
}
|
74
|
-
},
|
75
|
-
enumerable: false,
|
76
|
-
configurable: true
|
77
|
-
});
|
78
|
-
Object.defineProperty(Navigation.prototype, "pathInfo", {
|
79
|
-
get: function () {
|
80
|
-
return { path: this.path, queryParams: this.queryParams };
|
81
|
-
},
|
82
|
-
enumerable: false,
|
83
|
-
configurable: true
|
84
|
-
});
|
85
|
-
Navigation.prototype.reload = function () {
|
86
|
-
this.option.window.dispatchEvent(new Event('popstate'));
|
87
|
-
};
|
88
|
-
Navigation.prototype.pathAndSearch = function () {
|
89
|
-
return this.option.window.location.pathname + this.option.window.location.search;
|
90
|
-
};
|
91
|
-
Navigation.prototype.goNoPopStateEvent = function (path, data, title) {
|
92
|
-
if (data === void 0) { data = {}; }
|
93
|
-
if (title === void 0) { title = ''; }
|
94
|
-
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
95
|
-
this.option.window.history.pushState(data, title, path);
|
96
|
-
}
|
97
|
-
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
98
|
-
path = '#' + path
|
99
|
-
this.option.window.history.pushState(data, title, path);
|
100
|
-
}
|
101
|
-
};
|
102
|
-
Navigation.prototype.go = function (path, data, title) {
|
103
|
-
if (data === void 0) { data = {}; }
|
104
|
-
if (title === void 0) { title = ''; }
|
105
|
-
this.goNoPopStateEvent(path, data, title);
|
106
|
-
this.option.window.dispatchEvent(new Event('popstate'));
|
107
|
-
};
|
108
|
-
Navigation.prototype.state = function () {
|
109
|
-
return this.option.window.history.state;
|
110
|
-
};
|
111
|
-
Navigation = __decorate([
|
112
|
-
(0, SimDecorator_1.Sim)(),
|
113
|
-
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
114
|
-
], Navigation);
|
115
|
-
return Navigation;
|
116
|
-
}());
|
117
|
-
exports.Navigation = Navigation;
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.Navigation = void 0;
|
13
|
+
var SimDecorator_1 = require("simple-boot-core/decorators/SimDecorator");
|
14
|
+
var SimFrontOption_1 = require("../option/SimFrontOption");
|
15
|
+
var LocationUtils_1 = require("dom-render/utils/location/LocationUtils");
|
16
|
+
var Navigation = (function () {
|
17
|
+
function Navigation(option) {
|
18
|
+
this.option = option;
|
19
|
+
}
|
20
|
+
Object.defineProperty(Navigation.prototype, "url", {
|
21
|
+
get: function () {
|
22
|
+
var queryParams = this.queryParamsObject;
|
23
|
+
var queryString = Object.entries(queryParams).map(function (_a) {
|
24
|
+
var key = _a[0], value = _a[1];
|
25
|
+
return "".concat(key, "=").concat(value);
|
26
|
+
}).join('&');
|
27
|
+
var path = this.path;
|
28
|
+
return path + (queryString.length > 0 ? ('?' + queryString) : '');
|
29
|
+
},
|
30
|
+
enumerable: false,
|
31
|
+
configurable: true
|
32
|
+
});
|
33
|
+
Object.defineProperty(Navigation.prototype, "path", {
|
34
|
+
get: function () {
|
35
|
+
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
36
|
+
return LocationUtils_1.LocationUtils.path(this.option.window);
|
37
|
+
}
|
38
|
+
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
39
|
+
return LocationUtils_1.LocationUtils.hashPath(this.option.window);
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
return '';
|
43
|
+
}
|
44
|
+
},
|
45
|
+
enumerable: false,
|
46
|
+
configurable: true
|
47
|
+
});
|
48
|
+
Object.defineProperty(Navigation.prototype, "queryParams", {
|
49
|
+
get: function () {
|
50
|
+
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
51
|
+
return LocationUtils_1.LocationUtils.pathQueryParams(this.option.window);
|
52
|
+
}
|
53
|
+
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
54
|
+
return LocationUtils_1.LocationUtils.hashQueryParams(this.option.window);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
return new Map();
|
58
|
+
}
|
59
|
+
},
|
60
|
+
enumerable: false,
|
61
|
+
configurable: true
|
62
|
+
});
|
63
|
+
Object.defineProperty(Navigation.prototype, "queryParamsObject", {
|
64
|
+
get: function () {
|
65
|
+
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
66
|
+
return LocationUtils_1.LocationUtils.pathQueryParamsObject(this.option.window);
|
67
|
+
}
|
68
|
+
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
69
|
+
return LocationUtils_1.LocationUtils.hashQueryParamsObject(this.option.window);
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
return {};
|
73
|
+
}
|
74
|
+
},
|
75
|
+
enumerable: false,
|
76
|
+
configurable: true
|
77
|
+
});
|
78
|
+
Object.defineProperty(Navigation.prototype, "pathInfo", {
|
79
|
+
get: function () {
|
80
|
+
return { path: this.path, queryParams: this.queryParams };
|
81
|
+
},
|
82
|
+
enumerable: false,
|
83
|
+
configurable: true
|
84
|
+
});
|
85
|
+
Navigation.prototype.reload = function () {
|
86
|
+
this.option.window.dispatchEvent(new Event('popstate'));
|
87
|
+
};
|
88
|
+
Navigation.prototype.pathAndSearch = function () {
|
89
|
+
return this.option.window.location.pathname + this.option.window.location.search;
|
90
|
+
};
|
91
|
+
Navigation.prototype.goNoPopStateEvent = function (path, data, title) {
|
92
|
+
if (data === void 0) { data = {}; }
|
93
|
+
if (title === void 0) { title = ''; }
|
94
|
+
if (SimFrontOption_1.UrlType.path === this.option.urlType) {
|
95
|
+
this.option.window.history.pushState(data, title, path);
|
96
|
+
}
|
97
|
+
else if (SimFrontOption_1.UrlType.hash === this.option.urlType) {
|
98
|
+
path = '#' + path;
|
99
|
+
this.option.window.history.pushState(data, title, path);
|
100
|
+
}
|
101
|
+
};
|
102
|
+
Navigation.prototype.go = function (path, data, title) {
|
103
|
+
if (data === void 0) { data = {}; }
|
104
|
+
if (title === void 0) { title = ''; }
|
105
|
+
this.goNoPopStateEvent(path, data, title);
|
106
|
+
this.option.window.dispatchEvent(new Event('popstate'));
|
107
|
+
};
|
108
|
+
Navigation.prototype.state = function () {
|
109
|
+
return this.option.window.history.state;
|
110
|
+
};
|
111
|
+
Navigation = __decorate([
|
112
|
+
(0, SimDecorator_1.Sim)(),
|
113
|
+
__metadata("design:paramtypes", [SimFrontOption_1.SimFrontOption])
|
114
|
+
], Navigation);
|
115
|
+
return Navigation;
|
116
|
+
}());
|
117
|
+
exports.Navigation = Navigation;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { ScriptRunnable } from '../script/ScriptRunnable';
|
2
|
-
import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
|
3
|
-
export declare class ScriptService {
|
4
|
-
private simstanceManager;
|
5
|
-
constructor(simstanceManager: SimstanceManager);
|
6
|
-
getScript<T = ScriptRunnable>(name: string): T | undefined;
|
7
|
-
}
|
1
|
+
import { ScriptRunnable } from '../script/ScriptRunnable';
|
2
|
+
import { SimstanceManager } from 'simple-boot-core/simstance/SimstanceManager';
|
3
|
+
export declare class ScriptService {
|
4
|
+
private simstanceManager;
|
5
|
+
constructor(simstanceManager: SimstanceManager);
|
6
|
+
getScript<T = ScriptRunnable>(name: string): T | undefined;
|
7
|
+
}
|