@lemon-fe/mini-app 1.2.0 → 1.2.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.
@@ -1,11 +1,12 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
  declare type ContentType = ReactElement | null;
3
3
  declare function PortalHost(props: {
4
4
  children: ContentType;
5
5
  }): JSX.Element;
6
6
  declare function PortalSlot(props: {
7
7
  slot: string;
8
- }): ContentType;
8
+ children?: ReactNode;
9
+ }): JSX.Element;
9
10
  declare function Portal(props: {
10
11
  children: ContentType;
11
12
  slot: string;
@@ -98,7 +98,9 @@ function PortalHost(props) {
98
98
  }
99
99
 
100
100
  function PortalSlot(props) {
101
- var slot = props.slot;
101
+ var slot = props.slot,
102
+ _props$children = props.children,
103
+ children = _props$children === void 0 ? null : _props$children;
102
104
 
103
105
  var _useContext = useContext(Context),
104
106
  observable = _useContext.observable;
@@ -118,7 +120,7 @@ function PortalSlot(props) {
118
120
 
119
121
  return unsubscribe;
120
122
  }, [slot]);
121
- return node;
123
+ return node || /*#__PURE__*/React.createElement(React.Fragment, null, children);
122
124
  }
123
125
 
124
126
  function Portal(props) {
@@ -54,7 +54,9 @@ function Content(props, ref) {
54
54
  fillRule: "evenodd"
55
55
  }))), /*#__PURE__*/React.createElement("div", {
56
56
  className: "lemon-route-header-center"
57
- }, route.title), /*#__PURE__*/React.createElement("div", {
57
+ }, /*#__PURE__*/React.createElement(Portal.Slot, {
58
+ slot: "header-title"
59
+ }, route.title)), /*#__PURE__*/React.createElement("div", {
58
60
  className: "lemon-route-header-right"
59
61
  }, /*#__PURE__*/React.createElement(Portal.Slot, {
60
62
  slot: "header-right"
@@ -13,5 +13,6 @@ export declare const SYNC_ROUTES = "SYNC_ROUTES";
13
13
  export declare const NEXT_ACTION = "NEXT_ACTION";
14
14
  export declare const REQUEST_PAYMENT = "REQUEST_PAYMENT";
15
15
  export declare const NAVIGATE = "NAVIGATE";
16
+ export declare const PRINT = "PRINT";
16
17
  export declare const ACTION_CONTINUE = "ACTION_CONTINUE";
17
18
  export declare const ACTION_CANCEL = "ACTION_CANCEL";
@@ -13,7 +13,8 @@ export var SET_CAPSULE = 'SET_CAPSULE';
13
13
  export var SYNC_ROUTES = 'SYNC_ROUTES';
14
14
  export var NEXT_ACTION = 'NEXT_ACTION';
15
15
  export var REQUEST_PAYMENT = 'REQUEST_PAYMENT';
16
- export var NAVIGATE = 'NAVIGATE'; // actions
16
+ export var NAVIGATE = 'NAVIGATE';
17
+ export var PRINT = 'PRINT'; // actions
17
18
 
18
19
  export var ACTION_CONTINUE = 'ACTION_CONTINUE';
19
20
  export var ACTION_CANCEL = 'ACTION_CANCEL';
package/es/global.d.ts CHANGED
@@ -103,6 +103,11 @@ declare const bridge: {
103
103
  success?: (() => void) | undefined;
104
104
  fail?: ((err: Error) => void) | undefined;
105
105
  }): void;
106
+ print(opts: {
107
+ params: {
108
+ data: number[];
109
+ };
110
+ }): void;
106
111
  };
107
112
  export declare const mini: {
108
113
  getSystemInfoSync: () => {
@@ -183,6 +188,11 @@ export declare const mini: {
183
188
  success?: (() => void) | undefined;
184
189
  fail?: ((err: Error) => void) | undefined;
185
190
  }) => void;
191
+ print: (opts: {
192
+ params: {
193
+ data: number[];
194
+ };
195
+ }) => void;
186
196
  loaded: boolean;
187
197
  };
188
198
  /**
package/es/global.js CHANGED
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { CHECK_ACCESS_TOKEN, EXIT, GET_ACCESS_TOKEN, GET_USER_INFO, INIT_IFRAME, METHOD, METHOD_CALLBACK, NAVIGATE, NEXT_ACTION, REQUEST_PAYMENT, SCAN_CODE, SET_CAPSULE, SET_STATUS_BAR_STYLE, SYNC_ROUTES } from './constants';
7
+ import { CHECK_ACCESS_TOKEN, EXIT, GET_ACCESS_TOKEN, GET_USER_INFO, INIT_IFRAME, METHOD, METHOD_CALLBACK, NAVIGATE, NEXT_ACTION, PRINT, REQUEST_PAYMENT, SCAN_CODE, SET_CAPSULE, SET_STATUS_BAR_STYLE, SYNC_ROUTES } from './constants';
8
8
  var methods = {};
9
9
  var listeners = [];
10
10
  var methodID = 0;
@@ -173,6 +173,9 @@ var bridge = {
173
173
  */
174
174
  requestPayment: function requestPayment(opts) {
175
175
  bridge.methodRegister(REQUEST_PAYMENT, opts);
176
+ },
177
+ print: function print(opts) {
178
+ bridge.methodRegister(PRINT, opts);
176
179
  }
177
180
  };
178
181
  export var mini = _objectSpread(_objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/mini-app",
3
- "version": "1.2.0",
3
+ "version": "1.2.6",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -31,5 +31,5 @@
31
31
  "react": "^17.0.2",
32
32
  "react-dom": "17.0.2"
33
33
  },
34
- "gitHead": "a2027e9e0d57e66684b9fbe3478cd42e1ec18cad"
34
+ "gitHead": "409551a9fb0476ae3fefdb1a68479b92c7f8a945"
35
35
  }