@nocobase/plugin-mobile-client 0.10.0-alpha.4 → 0.10.0-alpha.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.
@@ -11,6 +11,13 @@ function _css() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _react() {
15
+ const data = require("@formily/react");
16
+ _react = function _react() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _client() {
15
22
  const data = require("@nocobase/client");
16
23
  _client = function _client() {
@@ -25,9 +32,9 @@ function _antdMobile() {
25
32
  };
26
33
  return data;
27
34
  }
28
- function _react() {
35
+ function _react2() {
29
36
  const data = _interopRequireWildcard(require("react"));
30
- _react = function _react() {
37
+ _react2 = function _react2() {
31
38
  return data;
32
39
  };
33
40
  return data;
@@ -39,15 +46,8 @@ function _reactRouterDom() {
39
46
  };
40
47
  return data;
41
48
  }
42
- var _Header = require("./Header.Designer");
43
- function _react2() {
44
- const data = require("@formily/react");
45
- _react2 = function _react2() {
46
- return data;
47
- };
48
- return data;
49
- }
50
49
  var _locale = require("../../../../locale");
50
+ var _Header = require("./Header.Designer");
51
51
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
52
52
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
53
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -56,7 +56,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
56
56
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
57
57
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
58
58
  const InternalHeader = props => {
59
- const field = (0, _react2().useField)();
59
+ const field = (0, _react().useField)();
60
60
  const _props$field$componen = _objectSpread(_objectSpread({}, props), field === null || field === void 0 ? void 0 : field.componentProps),
61
61
  _props$field$componen2 = _props$field$componen.title,
62
62
  title = _props$field$componen2 === void 0 ? (0, _locale.generateNTemplate)('Untitled') : _props$field$componen2,
@@ -66,19 +66,21 @@ const InternalHeader = props => {
66
66
  const compile = (0, _client().useCompile)();
67
67
  const compiledTitle = compile(title);
68
68
  const navigate = (0, _reactRouterDom().useNavigate)();
69
- (0, _react().useEffect)(() => {
69
+ const _useDocumentTitle = (0, _client().useDocumentTitle)(),
70
+ setTitle = _useDocumentTitle.setTitle;
71
+ (0, _react2().useEffect)(() => {
70
72
  // sync title
71
- document.title = `${compiledTitle} - NocoBase`;
73
+ setTitle(compiledTitle);
72
74
  }, [compiledTitle]);
73
- return _react().default.createElement(_client().SortableItem, {
75
+ return _react2().default.createElement(_client().SortableItem, {
74
76
  className: (0, _css().cx)('nb-mobile-header', (0, _css().css)`
75
77
  width: 100%;
76
78
  background: #fff;
77
79
  `)
78
- }, _react().default.createElement(_antdMobile().NavBar, {
80
+ }, _react2().default.createElement(_antdMobile().NavBar, {
79
81
  backArrow: showBack,
80
82
  onBack: () => navigate(-1)
81
- }, compiledTitle), _react().default.createElement(Designer, null));
83
+ }, compiledTitle), _react2().default.createElement(Designer, null));
82
84
  };
83
85
  const MHeader = InternalHeader;
84
86
  exports.MHeader = MHeader;
@@ -20,7 +20,7 @@ class _default extends _server().Migration {
20
20
  up() {
21
21
  var _this = this;
22
22
  return _asyncToGenerator(function* () {
23
- var _instance$get;
23
+ var _instance, _instance$options;
24
24
  const systemSettings = _this.db.getRepository('systemSettings');
25
25
  let instance = yield systemSettings.findOne();
26
26
  const uiRoutes = _this.db.getRepository('uiRoutes');
@@ -46,7 +46,7 @@ class _default extends _server().Migration {
46
46
  _iterator.f();
47
47
  }
48
48
  instance = yield systemSettings.findOne();
49
- if (!((_instance$get = instance.get('options')) === null || _instance$get === void 0 ? void 0 : _instance$get.mobileSchemaUid)) {
49
+ if (!((_instance = instance) === null || _instance === void 0 ? void 0 : (_instance$options = _instance.options) === null || _instance$options === void 0 ? void 0 : _instance$options.mobileSchemaUid)) {
50
50
  throw new Error('mobileSchemaUid invalid');
51
51
  }
52
52
  _this.app.log.info('systemSettings.options', instance.toJSON());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-mobile-client",
3
- "version": "0.10.0-alpha.4",
3
+ "version": "0.10.0-alpha.5",
4
4
  "main": "lib/server/index.js",
5
5
  "displayName": "Mobile-client",
6
6
  "displayName.zh-CN": "移动端",
@@ -11,8 +11,8 @@
11
11
  "@formily/antd": "2.2.26",
12
12
  "@formily/react": "2.2.26",
13
13
  "@formily/shared": "2.2.26",
14
- "@nocobase/server": "0.10.0-alpha.4",
15
- "@nocobase/test": "0.10.0-alpha.4",
14
+ "@nocobase/server": "0.10.0-alpha.5",
15
+ "@nocobase/test": "0.10.0-alpha.5",
16
16
  "@types/react": "^17.0.0",
17
17
  "@types/react-dom": "^17.0.0",
18
18
  "antd": "^4.24.8",
@@ -24,5 +24,5 @@
24
24
  "dependencies": {
25
25
  "antd-mobile": "^5.29.1"
26
26
  },
27
- "gitHead": "62dacadb2a83d30cb36dda9074f2f3a072a37484"
27
+ "gitHead": "1be8fcdad42688064460761cea22830cf392c7c0"
28
28
  }
@@ -1,11 +1,11 @@
1
1
  import { css, cx } from '@emotion/css';
2
- import { SortableItem, useCompile, useDesigner } from '@nocobase/client';
2
+ import { useField } from '@formily/react';
3
+ import { SortableItem, useCompile, useDesigner, useDocumentTitle } from '@nocobase/client';
3
4
  import { NavBar, NavBarProps } from 'antd-mobile';
4
5
  import React, { useEffect } from 'react';
5
6
  import { useNavigate } from 'react-router-dom';
6
- import { HeaderDesigner } from './Header.Designer';
7
- import { useField } from '@formily/react';
8
7
  import { generateNTemplate } from '../../../../locale';
8
+ import { HeaderDesigner } from './Header.Designer';
9
9
 
10
10
  export interface HeaderProps extends NavBarProps {
11
11
  title?: string;
@@ -18,10 +18,11 @@ const InternalHeader = (props: HeaderProps) => {
18
18
  const compile = useCompile();
19
19
  const compiledTitle = compile(title);
20
20
  const navigate = useNavigate();
21
+ const { setTitle } = useDocumentTitle();
21
22
 
22
23
  useEffect(() => {
23
24
  // sync title
24
- document.title = `${compiledTitle} - NocoBase`;
25
+ setTitle(compiledTitle);
25
26
  }, [compiledTitle]);
26
27
 
27
28
  return (
@@ -18,7 +18,7 @@ export default class extends Migration {
18
18
  }
19
19
  }
20
20
  instance = await systemSettings.findOne();
21
- if (!instance.get('options')?.mobileSchemaUid) {
21
+ if (!instance?.options?.mobileSchemaUid) {
22
22
  throw new Error('mobileSchemaUid invalid');
23
23
  }
24
24
  this.app.log.info('systemSettings.options', instance.toJSON());