@doreamonjs/plugin-shared 0.3.8 → 0.3.9
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/CHANGELOG.md +8 -0
- package/lib/message.d.ts +2 -3
- package/lib/message.js +11 -19
- package/lib/notification.d.ts +1 -1
- package/lib/notification.js +3 -11
- package/lib/router.d.ts +0 -1
- package/lib/router.js +2 -11
- package/lib/shared.js +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.9](https://github.com/zcorky/zodash/compare/v0.3.8...v0.3.9) (2022-08-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @doreamonjs/plugin-shared
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.3.8](https://github.com/zcorky/zodash/compare/v0.3.7...v0.3.8) (2022-08-31)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @doreamonjs/plugin-shared
|
package/lib/message.d.ts
CHANGED
|
@@ -33,13 +33,12 @@ export interface OpenConfig {
|
|
|
33
33
|
}
|
|
34
34
|
export declare type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
|
35
35
|
export interface MessageConfig {
|
|
36
|
-
|
|
36
|
+
message?: IMessage;
|
|
37
37
|
}
|
|
38
38
|
export declare class Message implements IMessage {
|
|
39
39
|
private readonly options?;
|
|
40
|
-
private _messager;
|
|
41
40
|
constructor(options?: MessageConfig);
|
|
42
|
-
private get
|
|
41
|
+
private get message();
|
|
43
42
|
info(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
44
43
|
success(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
45
44
|
error(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
package/lib/message.js
CHANGED
|
@@ -6,43 +6,35 @@ class Message {
|
|
|
6
6
|
constructor(options) {
|
|
7
7
|
this.options = options;
|
|
8
8
|
}
|
|
9
|
-
get
|
|
9
|
+
get message() {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
if (this.
|
|
12
|
-
return this.
|
|
13
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.messager) {
|
|
14
|
-
this._messager = (_b = this.options) === null || _b === void 0 ? void 0 : _b.messager;
|
|
11
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.message) {
|
|
12
|
+
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.message;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
this._messager = shared_1.shared.get('message');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
throw new Error('[doreamonjs] message is not registered');
|
|
21
|
-
}
|
|
22
|
-
return this._messager;
|
|
14
|
+
return shared_1.shared.get('message');
|
|
23
15
|
}
|
|
24
16
|
info(content, duration, onClose) {
|
|
25
|
-
return this.
|
|
17
|
+
return this.message.info(content, duration, onClose);
|
|
26
18
|
}
|
|
27
19
|
success(content, duration, onClose) {
|
|
28
|
-
return this.
|
|
20
|
+
return this.message.success(content, duration, onClose);
|
|
29
21
|
}
|
|
30
22
|
error(content, duration, onClose) {
|
|
31
|
-
return this.
|
|
23
|
+
return this.message.error(content, duration, onClose);
|
|
32
24
|
}
|
|
33
25
|
warning(content, duration, onClose) {
|
|
34
|
-
return this.
|
|
26
|
+
return this.message.warning(content, duration, onClose);
|
|
35
27
|
}
|
|
36
28
|
loading(content, duration, onClose) {
|
|
37
|
-
return this.
|
|
29
|
+
return this.message.loading(content, duration, onClose);
|
|
38
30
|
}
|
|
39
31
|
//
|
|
40
32
|
open(config) {
|
|
41
|
-
return this.
|
|
33
|
+
return this.message.open(config);
|
|
42
34
|
}
|
|
43
35
|
config(options) {
|
|
44
36
|
var _a, _b;
|
|
45
|
-
return (_b = (_a = this.
|
|
37
|
+
return (_b = (_a = this.message) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.call(_a, options);
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
40
|
exports.Message = Message;
|
package/lib/notification.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface ConfigNotificationOptions {
|
|
|
40
40
|
export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
41
41
|
export declare type IconType = 'success' | 'info' | 'error' | 'warning';
|
|
42
42
|
export interface NotificationConfig {
|
|
43
|
-
|
|
43
|
+
notification?: INotification;
|
|
44
44
|
}
|
|
45
45
|
export declare class Notification implements INotification {
|
|
46
46
|
private readonly options?;
|
package/lib/notification.js
CHANGED
|
@@ -8,18 +8,10 @@ class Notification {
|
|
|
8
8
|
}
|
|
9
9
|
get notifier() {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
if (this.
|
|
12
|
-
return this.
|
|
13
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.notifier) {
|
|
14
|
-
this._notifier = (_b = this.options) === null || _b === void 0 ? void 0 : _b.notifier;
|
|
11
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.notification) {
|
|
12
|
+
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.notification;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
this._notifier = shared_1.shared.get('notification');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
throw new Error('[doreamonjs] nitification is not registered');
|
|
21
|
-
}
|
|
22
|
-
return this._notifier;
|
|
14
|
+
return shared_1.shared.get('notification');
|
|
23
15
|
}
|
|
24
16
|
success(cfg) {
|
|
25
17
|
return this.notifier.success(cfg);
|
package/lib/router.d.ts
CHANGED
package/lib/router.js
CHANGED
|
@@ -8,19 +8,10 @@ class Router {
|
|
|
8
8
|
}
|
|
9
9
|
get router() {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
if (this._router)
|
|
12
|
-
return this._router;
|
|
13
11
|
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.router) {
|
|
14
|
-
|
|
12
|
+
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.router;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
// doreamonjs
|
|
18
|
-
this._router = shared_1.shared.get('router');
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
throw new Error('[doreamonjs] router is not registered');
|
|
22
|
-
}
|
|
23
|
-
return this._router;
|
|
14
|
+
return shared_1.shared.get('router');
|
|
24
15
|
}
|
|
25
16
|
push(path, state) {
|
|
26
17
|
this.router.push(path, state);
|
package/lib/shared.js
CHANGED
|
@@ -11,7 +11,8 @@ class Shared {
|
|
|
11
11
|
get(key) {
|
|
12
12
|
const service = this.store[key];
|
|
13
13
|
if (!service) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
// throw new Error('[doreamonjs] router is not registered');
|
|
15
|
+
throw new Error(`[doreamonjs] shared service ${key} is not registered`);
|
|
15
16
|
}
|
|
16
17
|
return service;
|
|
17
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doreamonjs/plugin-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "shared plugin for doreamonjs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"doreamonjs",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"@zodash/doreamon": "^1.0.17",
|
|
72
72
|
"history": "^5.3.0"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "fa400a314445ddfe73c9764f0b05bdb9568aa029"
|
|
75
75
|
}
|