@doreamonjs/plugin-shared 0.3.5 → 0.3.6

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 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.6](https://github.com/zcorky/zodash/compare/v0.3.5...v0.3.6) (2022-08-31)
7
+
8
+ **Note:** Version bump only for package @doreamonjs/plugin-shared
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.3.5](https://github.com/zcorky/zodash/compare/v0.3.4...v0.3.5) (2022-08-31)
7
15
 
8
16
  **Note:** Version bump only for package @doreamonjs/plugin-shared
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './type';
2
2
  export * from './message';
3
+ export * from './notification';
3
4
  export * from './router';
package/lib/index.js CHANGED
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./type"), exports);
14
14
  __exportStar(require("./message"), exports);
15
+ __exportStar(require("./notification"), exports);
15
16
  __exportStar(require("./router"), exports);
package/lib/message.d.ts CHANGED
@@ -6,6 +6,16 @@ export interface IMessage {
6
6
  warning(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
7
7
  loading(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
8
8
  open(config: OpenConfig): void | Promise<void>;
9
+ config(options: ConfigMessageOptions): void;
10
+ }
11
+ export interface ConfigMessageOptions {
12
+ top?: number;
13
+ duration?: number;
14
+ prefixCls?: string;
15
+ getContainer?: () => HTMLElement;
16
+ transitionName?: string;
17
+ maxCount?: number;
18
+ rtl?: boolean;
9
19
  }
10
20
  export interface OpenConfig {
11
21
  content: ReactNode;
@@ -36,4 +46,6 @@ export declare class Message implements IMessage {
36
46
  warning(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
37
47
  loading(content: string, duration?: number, onClose?: () => void): void | Promise<void>;
38
48
  open(config: OpenConfig): void | Promise<void>;
49
+ config(options: ConfigMessageOptions): void;
39
50
  }
51
+ export declare const message: Message;
package/lib/message.js CHANGED
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Message = void 0;
3
+ exports.message = exports.Message = void 0;
4
4
  class Message {
5
5
  constructor(options) {
6
6
  this.options = options;
7
7
  }
8
8
  get messager() {
9
+ var _a, _b;
9
10
  if (this._messager)
10
11
  return this._messager;
11
- if (window.__doreamonjs.message) {
12
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.messager) {
13
+ this._messager = (_b = this.options) === null || _b === void 0 ? void 0 : _b.messager;
14
+ }
15
+ else if (window.__doreamonjs.message) {
12
16
  this._messager = window.__doreamonjs.message;
13
17
  }
14
18
  return this._messager;
@@ -32,5 +36,10 @@ class Message {
32
36
  open(config) {
33
37
  return this.messager.open(config);
34
38
  }
39
+ config(options) {
40
+ var _a, _b;
41
+ return (_b = (_a = this.messager) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.call(_a, options);
42
+ }
35
43
  }
36
44
  exports.Message = Message;
45
+ exports.message = new Message();
@@ -0,0 +1,57 @@
1
+ import type { ReactNode, CSSProperties } from 'react';
2
+ export interface INotification {
3
+ success(cfg: ArgsProps): void;
4
+ error(cfg: ArgsProps): void;
5
+ info(cfg: ArgsProps): void;
6
+ warning(cfg: ArgsProps): void;
7
+ open(cfg: ArgsProps): void;
8
+ config(options: ConfigNotificationOptions): void;
9
+ }
10
+ export interface ArgsProps {
11
+ message: ReactNode;
12
+ description?: ReactNode;
13
+ btn?: ReactNode;
14
+ key?: string;
15
+ onClose?: () => void;
16
+ duration?: number | null;
17
+ icon?: ReactNode;
18
+ placement?: NotificationPlacement;
19
+ style?: CSSProperties;
20
+ prefixCls?: string;
21
+ className?: string;
22
+ readonly type?: IconType;
23
+ onClick?: () => void;
24
+ top?: number;
25
+ bottom?: number;
26
+ getContainer?: () => HTMLElement;
27
+ closeIcon?: ReactNode;
28
+ }
29
+ export interface ConfigNotificationOptions {
30
+ top?: number;
31
+ bottom?: number;
32
+ duration?: number;
33
+ prefixCls?: string;
34
+ placement?: NotificationPlacement;
35
+ getContainer?: () => HTMLElement;
36
+ closeIcon?: ReactNode;
37
+ rtl?: boolean;
38
+ maxCount?: number;
39
+ }
40
+ export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
41
+ export declare type IconType = 'success' | 'info' | 'error' | 'warning';
42
+ export interface NotificationConfig {
43
+ notifier?: INotification;
44
+ }
45
+ export declare class Notification implements INotification {
46
+ private readonly options?;
47
+ private _notifier;
48
+ constructor(options?: NotificationConfig);
49
+ private get notifier();
50
+ success(cfg: ArgsProps): void;
51
+ error(cfg: ArgsProps): void;
52
+ info(cfg: ArgsProps): void;
53
+ warning(cfg: ArgsProps): void;
54
+ open(cfg: ArgsProps): void;
55
+ config(options: ConfigNotificationOptions): void;
56
+ }
57
+ export declare const notification: Notification;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notification = exports.Notification = void 0;
4
+ class Notification {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ get notifier() {
9
+ var _a, _b;
10
+ if (this._notifier)
11
+ return this._notifier;
12
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.notifier) {
13
+ this._notifier = (_b = this.options) === null || _b === void 0 ? void 0 : _b.notifier;
14
+ }
15
+ else if (window.__doreamonjs.notification) {
16
+ this._notifier = window.__doreamonjs.notification;
17
+ }
18
+ return this._notifier;
19
+ }
20
+ success(cfg) {
21
+ return this.notifier.success(cfg);
22
+ }
23
+ error(cfg) {
24
+ return this.notifier.error(cfg);
25
+ }
26
+ info(cfg) {
27
+ return this.notifier.info(cfg);
28
+ }
29
+ warning(cfg) {
30
+ return this.notifier.warning(cfg);
31
+ }
32
+ //
33
+ open(cfg) {
34
+ return this.notifier.open(cfg);
35
+ }
36
+ config(options) {
37
+ var _a, _b;
38
+ return (_b = (_a = this.notifier) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.call(_a, options);
39
+ }
40
+ }
41
+ exports.Notification = Notification;
42
+ exports.notification = new Notification();
package/lib/type.d.ts CHANGED
@@ -6,4 +6,5 @@ declare global {
6
6
  export interface DoreamonJS {
7
7
  message: any;
8
8
  history: any;
9
+ notification: any;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doreamonjs/plugin-shared",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "shared plugin for doreamonjs",
5
5
  "keywords": [
6
6
  "doreamonjs",
@@ -64,10 +64,12 @@
64
64
  "bugs": {
65
65
  "url": "https://github.com/zcorky/zodash/issues"
66
66
  },
67
+ "devDependencies": {
68
+ "@types/react": "^16"
69
+ },
67
70
  "dependencies": {
68
- "@zcorky/query-string": "^1.0.2",
69
71
  "@zodash/doreamon": "^1.0.17",
70
72
  "history": "^5.3.0"
71
73
  },
72
- "gitHead": "b98aa80b724d635801ecdb8044f2256bf186abe4"
74
+ "gitHead": "3ad0b680e6da424c4b48b4df426b7482c38eef24"
73
75
  }