@doreamonjs/plugin-shared 0.3.4 → 0.3.5
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/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/message.d.ts +39 -0
- package/lib/message.js +36 -0
- package/lib/router.js +8 -0
- package/lib/type.d.ts +9 -0
- package/lib/type.js +3 -0
- 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.5](https://github.com/zcorky/zodash/compare/v0.3.4...v0.3.5) (2022-08-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @doreamonjs/plugin-shared
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.3.4](https://github.com/zcorky/zodash/compare/v0.3.3...v0.3.4) (2022-08-31)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @doreamonjs/plugin-shared
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -10,4 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./type"), exports);
|
|
14
|
+
__exportStar(require("./message"), exports);
|
|
13
15
|
__exportStar(require("./router"), exports);
|
package/lib/message.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode, CSSProperties, MouseEvent } from 'react';
|
|
2
|
+
export interface IMessage {
|
|
3
|
+
info(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
4
|
+
success(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
5
|
+
error(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
6
|
+
warning(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
7
|
+
loading(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
8
|
+
open(config: OpenConfig): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export interface OpenConfig {
|
|
11
|
+
content: ReactNode;
|
|
12
|
+
duration?: number;
|
|
13
|
+
type: NoticeType;
|
|
14
|
+
prefixCls?: string;
|
|
15
|
+
rootPrefixCls?: string;
|
|
16
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
key?: string | number;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
className?: string;
|
|
22
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
|
25
|
+
export interface MessageConfig {
|
|
26
|
+
messager?: IMessage;
|
|
27
|
+
}
|
|
28
|
+
export declare class Message implements IMessage {
|
|
29
|
+
private readonly options?;
|
|
30
|
+
private _messager;
|
|
31
|
+
constructor(options?: MessageConfig);
|
|
32
|
+
private get messager();
|
|
33
|
+
info(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
34
|
+
success(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
35
|
+
error(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
36
|
+
warning(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
37
|
+
loading(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
|
|
38
|
+
open(config: OpenConfig): void | Promise<void>;
|
|
39
|
+
}
|
package/lib/message.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Message = void 0;
|
|
4
|
+
class Message {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
get messager() {
|
|
9
|
+
if (this._messager)
|
|
10
|
+
return this._messager;
|
|
11
|
+
if (window.__doreamonjs.message) {
|
|
12
|
+
this._messager = window.__doreamonjs.message;
|
|
13
|
+
}
|
|
14
|
+
return this._messager;
|
|
15
|
+
}
|
|
16
|
+
info(content, duration, onClose) {
|
|
17
|
+
return this.messager.info(content, duration, onClose);
|
|
18
|
+
}
|
|
19
|
+
success(content, duration, onClose) {
|
|
20
|
+
return this.messager.success(content, duration, onClose);
|
|
21
|
+
}
|
|
22
|
+
error(content, duration, onClose) {
|
|
23
|
+
return this.messager.error(content, duration, onClose);
|
|
24
|
+
}
|
|
25
|
+
warning(content, duration, onClose) {
|
|
26
|
+
return this.messager.warning(content, duration, onClose);
|
|
27
|
+
}
|
|
28
|
+
loading(content, duration, onClose) {
|
|
29
|
+
return this.messager.loading(content, duration, onClose);
|
|
30
|
+
}
|
|
31
|
+
//
|
|
32
|
+
open(config) {
|
|
33
|
+
return this.messager.open(config);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.Message = Message;
|
package/lib/router.js
CHANGED
|
@@ -13,6 +13,14 @@ class Router {
|
|
|
13
13
|
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.history) {
|
|
14
14
|
this._history = (_b = this.options) === null || _b === void 0 ? void 0 : _b.history;
|
|
15
15
|
}
|
|
16
|
+
else if (window.__doreamonjs.history) {
|
|
17
|
+
// doreamonjs
|
|
18
|
+
this._history = window.__doreamonjs.history;
|
|
19
|
+
}
|
|
20
|
+
else if (window.g_history) {
|
|
21
|
+
// umi
|
|
22
|
+
this._history = window.g_history;
|
|
23
|
+
}
|
|
16
24
|
else {
|
|
17
25
|
this._history = history_1.createBrowserHistory();
|
|
18
26
|
}
|
package/lib/type.d.ts
ADDED
package/lib/type.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doreamonjs/plugin-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "shared plugin for doreamonjs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"doreamonjs",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"@zodash/doreamon": "^1.0.17",
|
|
70
70
|
"history": "^5.3.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b98aa80b724d635801ecdb8044f2256bf186abe4"
|
|
73
73
|
}
|