@nocobase/plugin-mobile-client 0.11.0-alpha.1 → 0.11.1-alpha.2

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.
Files changed (33) hide show
  1. package/lib/client/core/schema/components/container/Container.Designer.js +2 -2
  2. package/lib/client/core/schema/components/container/Container.js +10 -26
  3. package/lib/client/core/schema/components/container/style.d.ts +5 -0
  4. package/lib/client/core/schema/components/container/style.js +48 -0
  5. package/lib/client/core/schema/components/header/Header.js +10 -4
  6. package/lib/client/core/schema/components/menu/Menu.Designer.js +18 -18
  7. package/lib/client/core/schema/components/menu/Menu.js +4 -5
  8. package/lib/client/core/schema/components/menu/style.d.ts +4 -0
  9. package/lib/client/core/schema/components/menu/style.js +34 -0
  10. package/lib/client/core/schema/components/page/Page.Designer.js +2 -2
  11. package/lib/client/core/schema/components/page/Page.js +7 -34
  12. package/lib/client/core/schema/components/page/style.d.ts +6 -0
  13. package/lib/client/core/schema/components/page/style.js +55 -0
  14. package/lib/client/core/schema/components/tab-bar/TabBar.js +6 -2
  15. package/lib/client/core/schema/hooks/useSchemaPatch.js +5 -1
  16. package/lib/client/locale/index.js +2 -5
  17. package/lib/client/router/Application.js +2 -1
  18. package/package.json +7 -7
  19. package/src/client/core/schema/components/container/Container.Designer.tsx +2 -2
  20. package/src/client/core/schema/components/container/Container.tsx +8 -38
  21. package/src/client/core/schema/components/container/style.ts +35 -0
  22. package/src/client/core/schema/components/header/Header.tsx +11 -11
  23. package/src/client/core/schema/components/menu/Menu.Designer.tsx +5 -5
  24. package/src/client/core/schema/components/menu/Menu.Item.tsx +2 -2
  25. package/src/client/core/schema/components/menu/Menu.tsx +3 -11
  26. package/src/client/core/schema/components/menu/style.ts +20 -0
  27. package/src/client/core/schema/components/page/Page.Designer.tsx +2 -2
  28. package/src/client/core/schema/components/page/Page.tsx +6 -45
  29. package/src/client/core/schema/components/page/style.ts +43 -0
  30. package/src/client/core/schema/components/tab-bar/TabBar.tsx +7 -1
  31. package/src/client/core/schema/hooks/useSchemaPatch.ts +6 -0
  32. package/src/client/locale/index.ts +2 -4
  33. package/src/client/router/Application.tsx +2 -1
@@ -81,8 +81,8 @@ const ContainerDesigner = () => {
81
81
  return _react2().default.createElement(_client().SchemaSettings, _objectSpread({
82
82
  title: _react2().default.createElement(_antd().Button, {
83
83
  style: {
84
- borderColor: 'rgb(241, 139, 98)',
85
- color: 'rgb(241, 139, 98)',
84
+ borderColor: 'var(--colorSettings)',
85
+ color: 'var(--colorSettings)',
86
86
  width: '100%'
87
87
  },
88
88
  icon: _react2().default.createElement(_icons().MenuOutlined, null),
@@ -33,6 +33,8 @@ function _reactRouterDom() {
33
33
  return data;
34
34
  }
35
35
  var _Container = require("./Container.Designer");
36
+ var _style = _interopRequireDefault(require("./style"));
37
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
38
  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); }
37
39
  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; }
38
40
  const findGrid = (schema, uid) => {
@@ -64,6 +66,10 @@ const TabContentComponent = () => {
64
66
  };
65
67
  const InternalContainer = props => {
66
68
  var _fieldSchema$properti;
69
+ const _useStyles = (0, _style.default)(),
70
+ styles = _useStyles.styles;
71
+ const _useToken = (0, _client().useToken)(),
72
+ token = _useToken.token;
67
73
  const Designer = (0, _client().useDesigner)();
68
74
  const fieldSchema = (0, _react().useFieldSchema)();
69
75
  const navigate = (0, _reactRouterDom().useNavigate)();
@@ -86,41 +92,19 @@ const InternalContainer = props => {
86
92
  }, [location.pathname, navigate, params.name, redirectToUid]);
87
93
  return _react2().default.createElement(_client().SortableItem, {
88
94
  eid: "nb-mobile-scroll-wrapper",
89
- className: (0, _client().cx)('nb-mobile-container', (0, _client().css)`
90
- & > .general-schema-designer > .general-schema-designer-icons {
91
- right: unset;
92
- left: 2px;
93
- }
94
- background: var(--nb-box-bg);
95
- display: flex;
96
- flex-direction: column;
97
- width: 100%;
98
- height: 100%;
99
- overflow-y: scroll;
100
- position: initial !important;
101
- `)
95
+ className: (0, _client().cx)('nb-mobile-container', styles.mobileContainer)
102
96
  }, _react2().default.createElement(Designer, null), _react2().default.createElement("div", {
103
97
  style: {
104
- paddingBottom: redirectToUid ? '50px' : '0px'
98
+ paddingBottom: redirectToUid ? token.paddingLG * 2 : 0
105
99
  },
106
- className: (0, _client().cx)('nb-mobile-container-content')
100
+ className: "nb-mobile-container-content"
107
101
  }, redirectToUid ? _react2().default.createElement(TabContentComponent, null) : _react2().default.createElement(_client().SchemaComponent, {
108
102
  filterProperties: schema => {
109
103
  return schema['x-component'] !== 'MTabBar';
110
104
  },
111
105
  schema: fieldSchema
112
106
  })), _react2().default.createElement("div", {
113
- className: (0, _client().cx)('nb-mobile-container-tab-bar', (0, _client().css)`
114
- & > .general-schema-designer {
115
- --nb-designer-top: 20px;
116
- }
117
- position: absolute;
118
- background: #ffffff;
119
- width: 100%;
120
- bottom: 0;
121
- left: 0;
122
- z-index: 1000;
123
- `)
107
+ className: (0, _client().cx)('nb-mobile-container-tab-bar', styles.tabBar)
124
108
  }, _react2().default.createElement(_client().SchemaComponent, {
125
109
  onlyRenderProperties: true,
126
110
  filterProperties: schema => {
@@ -0,0 +1,5 @@
1
+ declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ mobileContainer: import("antd-style").SerializedStyles;
3
+ tabBar: import("antd-style").SerializedStyles;
4
+ }>;
5
+ export default useStyles;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const useStyles = (0, _client().createStyles)(({
15
+ token,
16
+ css
17
+ }) => {
18
+ return {
19
+ mobileContainer: css`
20
+ --adm-color-primary: ${token.colorPrimary};
21
+
22
+ & > .general-schema-designer > .general-schema-designer-icons {
23
+ right: unset;
24
+ left: 2px;
25
+ }
26
+ background: var(--nb-box-bg);
27
+ display: flex;
28
+ flex-direction: column;
29
+ width: 100%;
30
+ height: 100%;
31
+ overflow-y: scroll;
32
+ position: initial !important;
33
+ `,
34
+ tabBar: css`
35
+ & > .general-schema-designer {
36
+ --nb-designer-top: ${token.marginMD}px;
37
+ }
38
+ position: absolute;
39
+ background: ${token.colorBgContainer};
40
+ width: 100%;
41
+ bottom: 0;
42
+ left: 0;
43
+ z-index: 1000;
44
+ `
45
+ };
46
+ });
47
+ var _default = useStyles;
48
+ exports.default = _default;
@@ -61,15 +61,21 @@ const InternalHeader = props => {
61
61
  const navigate = (0, _reactRouterDom().useNavigate)();
62
62
  const _useDocumentTitle = (0, _client().useDocumentTitle)(),
63
63
  setTitle = _useDocumentTitle.setTitle;
64
+ const _useToken = (0, _client().useToken)(),
65
+ token = _useToken.token;
64
66
  (0, _react2().useEffect)(() => {
65
67
  // sync title
66
68
  setTitle(compiledTitle);
67
69
  }, [compiledTitle]);
70
+ const style = (0, _react2().useMemo)(() => {
71
+ return {
72
+ width: '100%',
73
+ background: token.colorBgContainer
74
+ };
75
+ }, [token.colorBgContainer]);
68
76
  return _react2().default.createElement(_client().SortableItem, {
69
- className: (0, _client().cx)('nb-mobile-header', (0, _client().css)`
70
- width: 100%;
71
- background: #fff;
72
- `)
77
+ className: (0, _client().cx)('nb-mobile-header'),
78
+ style: style
73
79
  }, _react2().default.createElement(_antdMobile().NavBar, {
74
80
  backArrow: showBack,
75
81
  onBack: () => navigate(-1)
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MenuDesigner = void 0;
7
- function _client() {
8
- const data = require("@nocobase/client");
9
- _client = function _client() {
10
- return data;
11
- };
12
- return data;
13
- }
14
7
  function _icons() {
15
8
  const data = require("@ant-design/icons");
16
9
  _icons = function _icons() {
@@ -19,13 +12,19 @@ function _icons() {
19
12
  return data;
20
13
  }
21
14
  function _react() {
22
- const data = _interopRequireDefault(require("react"));
15
+ const data = require("@formily/react");
23
16
  _react = function _react() {
24
17
  return data;
25
18
  };
26
19
  return data;
27
20
  }
28
- var _locale = require("../../../../locale");
21
+ function _client() {
22
+ const data = require("@nocobase/client");
23
+ _client = function _client() {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
29
28
  function _antd() {
30
29
  const data = require("antd");
31
30
  _antd = function _antd() {
@@ -34,12 +33,13 @@ function _antd() {
34
33
  return data;
35
34
  }
36
35
  function _react2() {
37
- const data = require("@formily/react");
36
+ const data = _interopRequireDefault(require("react"));
38
37
  _react2 = function _react2() {
39
38
  return data;
40
39
  };
41
40
  return data;
42
41
  }
42
+ var _locale = require("../../../../locale");
43
43
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
44
  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; }
45
45
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -49,25 +49,25 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
49
49
  const MenuDesigner = props => {
50
50
  const _useTranslation = (0, _locale.useTranslation)(),
51
51
  t = _useTranslation.t;
52
- const fieldSchema = (0, _react2().useFieldSchema)();
52
+ const fieldSchema = (0, _react().useFieldSchema)();
53
53
  const _useDesignable = (0, _client().useDesignable)(),
54
54
  dn = _useDesignable.dn;
55
- const field = (0, _react2().useField)();
55
+ const field = (0, _react().useField)();
56
56
  const schemaSettingsProps = {
57
57
  dn,
58
58
  field,
59
59
  fieldSchema
60
60
  };
61
- return _react().default.createElement(_client().SchemaSettings, _objectSpread({
62
- title: _react().default.createElement(_antd().Button, {
61
+ return _react2().default.createElement(_client().SchemaSettings, _objectSpread({
62
+ title: _react2().default.createElement(_antd().Button, {
63
63
  style: {
64
- borderColor: 'rgb(241, 139, 98)',
65
- color: 'rgb(241, 139, 98)'
64
+ borderColor: 'var(--colorSettings)',
65
+ color: 'var(--colorSettings)'
66
66
  },
67
- icon: _react().default.createElement(_icons().MenuOutlined, null),
67
+ icon: _react2().default.createElement(_icons().MenuOutlined, null),
68
68
  type: "dashed"
69
69
  }, t('Menu configuration'))
70
- }, schemaSettingsProps), _react().default.createElement(_client().SchemaSettings.Remove, {
70
+ }, schemaSettingsProps), _react2().default.createElement(_client().SchemaSettings.Remove, {
71
71
  key: "remove",
72
72
  removeParentsIfNoChildren: true,
73
73
  confirm: {
@@ -37,8 +37,11 @@ var _common = require("../../common");
37
37
  var _Menu = require("./Menu.Designer");
38
38
  var _Menu2 = require("./Menu.Item");
39
39
  var _schema = require("./schema");
40
+ var _style = _interopRequireDefault(require("./style"));
40
41
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
42
  const InternalMenu = props => {
43
+ const _useStyles = (0, _style.default)(),
44
+ styles = _useStyles.styles;
42
45
  const Designer = (0, _client().useDesigner)();
43
46
  const fieldSchema = (0, _react().useFieldSchema)();
44
47
  const _useDesignable = (0, _client().useDesignable)(),
@@ -60,11 +63,7 @@ const InternalMenu = props => {
60
63
  });
61
64
  };
62
65
  return _react2().default.createElement(_client().SortableItem, {
63
- className: (0, _client().cx)('nb-mobile-menu', (0, _client().css)`
64
- background: #ffffff;
65
- width: 100%;
66
- margin-bottom: var(--nb-spacing);
67
- `)
66
+ className: (0, _client().cx)('nb-mobile-menu', styles.mobileMenu)
68
67
  }, _react2().default.createElement(_antdMobile().List, null, designable && _react2().default.createElement(_antdMobile().List.Item, null, _react2().default.createElement(Designer, null)), _react2().default.createElement(_client().DndContext, null, _react2().default.createElement(_client().SchemaComponent, {
69
68
  onlyRenderProperties: true,
70
69
  schema: fieldSchema
@@ -0,0 +1,4 @@
1
+ declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ mobileMenu: import("antd-style").SerializedStyles;
3
+ }>;
4
+ export default useStyles;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const useStyles = (0, _client().createStyles)(({
15
+ token,
16
+ css
17
+ }) => {
18
+ return {
19
+ mobileMenu: css`
20
+ --adm-color-primary: ${token.colorPrimary};
21
+ --adm-color-primary-hover: ${token.colorPrimaryHover};
22
+ --adm-color-primary-active: ${token.colorPrimaryActive};
23
+ --padding-left: ${token.paddingSM}px;
24
+ --adm-color-background: ${token.colorBgContainer};
25
+ --adm-color-border: ${token.colorBorder};
26
+
27
+ background: ${token.colorBgContainer};
28
+ width: 100%;
29
+ margin-bottom: var(--nb-spacing);
30
+ `
31
+ };
32
+ });
33
+ var _default = useStyles;
34
+ exports.default = _default;
@@ -75,8 +75,8 @@ const PageDesigner = props => {
75
75
  return _react2().default.createElement(_client().SchemaSettings, _objectSpread({
76
76
  title: _react2().default.createElement(_antd().Button, {
77
77
  style: {
78
- borderColor: 'rgb(241, 139, 98)',
79
- color: 'rgb(241, 139, 98)',
78
+ borderColor: 'var(--colorSettings)',
79
+ color: 'var(--colorSettings)',
80
80
  width: '100%'
81
81
  },
82
82
  icon: _react2().default.createElement(_icons().MenuOutlined, null),
@@ -34,6 +34,8 @@ function _reactRouterDom() {
34
34
  }
35
35
  var _helpers = require("../../helpers");
36
36
  var _Page = require("./Page.Designer");
37
+ var _style = _interopRequireDefault(require("./style"));
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
39
  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); }
38
40
  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; }
39
41
  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; }
@@ -47,20 +49,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
47
49
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
48
50
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
49
51
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
50
- const globalActionCSS = (0, _client().css)`
51
- #nb-position-container > & {
52
- height: 49px;
53
- border-top: 1px solid var(--nb-box-bg);
54
- margin-bottom: 0px !important;
55
- padding: 0 var(--nb-spacing);
56
- align-items: center;
57
- overflow-x: auto;
58
- background: #ffffff;
59
- z-index: 100;
60
- }
61
- `;
62
52
  const InternalPage = props => {
63
53
  var _fieldSchema$properti, _tabsSchema$propertie;
54
+ const _useStyles = (0, _style.default)(),
55
+ styles = _useStyles.styles;
64
56
  const Designer = (0, _client().useDesigner)();
65
57
  const fieldSchema = (0, _react().useFieldSchema)();
66
58
  const _useSearchParams = (0, _reactRouterDom().useSearchParams)(),
@@ -97,7 +89,7 @@ const InternalPage = props => {
97
89
  container: (typeof props.active !== 'undefined' ? props.active : true) && onlyInPage ? document.getElementById('nb-position-container') : null,
98
90
  forceProps: {
99
91
  layout: 'one-column',
100
- className: globalActionCSS
92
+ className: styles.globalActionCSS
101
93
  }
102
94
  }, props.children));
103
95
  }
@@ -105,31 +97,12 @@ const InternalPage = props => {
105
97
  }, [hasGlobalActions, onlyInPage]);
106
98
  return _react2().default.createElement(_client().SortableItem, {
107
99
  eid: "nb-mobile-scroll-wrapper",
108
- className: (0, _client().cx)('nb-mobile-page', (0, _client().css)`
109
- background: var(--nb-box-bg);
110
- display: flex;
111
- flex-direction: column;
112
- width: 100%;
113
- height: 100%;
114
- overflow-x: hidden;
115
- overflow-y: auto;
116
- padding-bottom: var(--nb-spacing);
117
- `)
100
+ className: (0, _client().cx)('nb-mobile-page', styles.mobilePage)
118
101
  }, _react2().default.createElement(Designer, _objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-designer-props'])), _react2().default.createElement("div", {
119
102
  style: {
120
103
  paddingBottom: tabsSchema ? null : 'var(--nb-spacing)'
121
104
  },
122
- className: (0, _client().cx)('nb-mobile-page-header', (0, _client().css)`
123
- & > .ant-tabs > .ant-tabs-nav {
124
- .ant-tabs-tab {
125
- margin: 0 !important;
126
- padding: 0 16px !important;
127
- }
128
- background: #fff;
129
- }
130
- display: flex;
131
- flex-direction: column;
132
- `)
105
+ className: (0, _client().cx)('nb-mobile-page-header', styles.mobilePageHeader)
133
106
  }, _react2().default.createElement(_react().RecursionField, {
134
107
  schema: fieldSchema,
135
108
  filterProperties: s => {
@@ -0,0 +1,6 @@
1
+ declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ globalActionCSS: import("antd-style").SerializedStyles;
3
+ mobilePage: import("antd-style").SerializedStyles;
4
+ mobilePageHeader: import("antd-style").SerializedStyles;
5
+ }>;
6
+ export default useStyles;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const useStyles = (0, _client().createStyles)(({
15
+ token,
16
+ css
17
+ }) => {
18
+ return {
19
+ globalActionCSS: css`
20
+ #nb-position-container > & {
21
+ height: ${token.sizeXXL}px;
22
+ border-top: 1px solid var(--nb-box-bg);
23
+ margin-bottom: 0px !important;
24
+ padding: 0 var(--nb-spacing);
25
+ align-items: center;
26
+ overflow-x: auto;
27
+ background: ${token.colorBgContainer};
28
+ z-index: 100;
29
+ }
30
+ `,
31
+ mobilePage: css`
32
+ background: var(--nb-box-bg);
33
+ display: flex;
34
+ flex-direction: column;
35
+ width: 100%;
36
+ height: 100%;
37
+ overflow-x: hidden;
38
+ overflow-y: auto;
39
+ padding-bottom: var(--nb-spacing);
40
+ `,
41
+ mobilePageHeader: css`
42
+ & > .ant-tabs > .ant-tabs-nav {
43
+ .ant-tabs-tab {
44
+ margin: 0 !important;
45
+ padding: 0 ${token.paddingContentHorizontal}px !important;
46
+ }
47
+ background: ${token.colorBgContainer};
48
+ }
49
+ display: flex;
50
+ flex-direction: column;
51
+ `
52
+ };
53
+ });
54
+ var _default = useStyles;
55
+ exports.default = _default;
@@ -76,7 +76,11 @@ const InternalTabBar = props => {
76
76
  'x-designer': 'MTabBar.Item.Designer',
77
77
  properties: {
78
78
  [(0, _shared().uid)()]: _common.PageSchema
79
- }
79
+ },
80
+ 'x-server-hooks': [{
81
+ type: 'onSelfSave',
82
+ method: 'extractTextToLocale'
83
+ }]
80
84
  });
81
85
  }, []);
82
86
  return _react2().default.createElement(_client().SortableItem, {
@@ -102,7 +106,7 @@ const InternalTabBar = props => {
102
106
  const cp = schema['x-component-props'];
103
107
  return _react2().default.createElement(_antdMobile().TabBar.Item, _objectSpread(_objectSpread({}, cp), {}, {
104
108
  key: `tab_${schema['x-uid']}`,
105
- title: _react2().default.createElement(_react2().default.Fragment, null, compile(cp.title), _react2().default.createElement(_client().SchemaComponent, {
109
+ title: _react2().default.createElement(_react2().default.Fragment, null, t(compile(cp.title)), _react2().default.createElement(_client().SchemaComponent, {
106
110
  schema: schema,
107
111
  name: name
108
112
  })),
@@ -48,7 +48,11 @@ const useSchemaPatch = () => {
48
48
  dn.emit('patch', {
49
49
  schema: {
50
50
  ['x-uid']: fieldSchema['x-uid'],
51
- 'x-component-props': fieldSchema['x-component-props']
51
+ 'x-component-props': fieldSchema['x-component-props'],
52
+ 'x-server-hooks': [{
53
+ type: 'onSelfSave',
54
+ method: 'extractTextToLocale'
55
+ }]
52
56
  }
53
57
  });
54
58
  dn.refresh();
@@ -21,13 +21,10 @@ function _reactI18next() {
21
21
  };
22
22
  return data;
23
23
  }
24
- var _enUS = _interopRequireDefault(require("./en-US"));
25
- var _zhCN = _interopRequireDefault(require("./zh-CN"));
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
24
  const NAMESPACE = 'mobile-client';
25
+ // i18n.addResources('zh-CN', NAMESPACE, zhCN);
26
+ // i18n.addResources('en-US', NAMESPACE, enUS);
28
27
  exports.NAMESPACE = NAMESPACE;
29
- _client().i18n.addResources('zh-CN', NAMESPACE, _zhCN.default);
30
- _client().i18n.addResources('en-US', NAMESPACE, _enUS.default);
31
28
  function lang(key) {
32
29
  return _client().i18n.t(key, {
33
30
  ns: NAMESPACE
@@ -64,11 +64,12 @@ const commonDesignerCSS = (0, _client().css)`
64
64
  line-height: 16px;
65
65
  pointer-events: all;
66
66
  .ant-space-item {
67
- background-color: #f18b62;
67
+ background-color: var(--colorSettings);
68
68
  color: #fff;
69
69
  line-height: 16px;
70
70
  width: 16px;
71
71
  padding-left: 1px;
72
+ align-self: stretch;
72
73
  }
73
74
  }
74
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-mobile-client",
3
- "version": "0.11.0-alpha.1",
3
+ "version": "0.11.1-alpha.2",
4
4
  "main": "./lib/server/index.js",
5
5
  "files": [
6
6
  "lib",
@@ -22,11 +22,11 @@
22
22
  "@formily/antd-v5": "^1.1.0-beta.4",
23
23
  "@formily/react": "2.2.26",
24
24
  "@formily/shared": "2.2.26",
25
- "@nocobase/client": "0.11.0-alpha.1",
26
- "@nocobase/database": "0.11.0-alpha.1",
27
- "@nocobase/server": "0.11.0-alpha.1",
28
- "@nocobase/test": "0.11.0-alpha.1",
29
- "@nocobase/utils": "0.11.0-alpha.1",
25
+ "@nocobase/client": "0.11.1-alpha.2",
26
+ "@nocobase/database": "0.11.1-alpha.2",
27
+ "@nocobase/server": "0.11.1-alpha.2",
28
+ "@nocobase/test": "0.11.1-alpha.2",
29
+ "@nocobase/utils": "0.11.1-alpha.2",
30
30
  "@types/react": "^17.0.0",
31
31
  "@types/react-dom": "^17.0.0",
32
32
  "antd": "^5.6.4",
@@ -40,5 +40,5 @@
40
40
  "antd-mobile": "^5.29.1",
41
41
  "classnames": "^2.3.1"
42
42
  },
43
- "gitHead": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
43
+ "gitHead": "8482aa720ea1c3abbbb9fe1208e73778bd63f1cf"
44
44
  }
@@ -30,8 +30,8 @@ export const ContainerDesigner = () => {
30
30
  title={
31
31
  <Button
32
32
  style={{
33
- borderColor: 'rgb(241, 139, 98)',
34
- color: 'rgb(241, 139, 98)',
33
+ borderColor: 'var(--colorSettings)',
34
+ color: 'var(--colorSettings)',
35
35
  width: '100%',
36
36
  }}
37
37
  icon={<MenuOutlined />}
@@ -1,8 +1,9 @@
1
1
  import { useFieldSchema } from '@formily/react';
2
- import { css, cx, SchemaComponent, SortableItem, useDesigner } from '@nocobase/client';
2
+ import { cx, SchemaComponent, SortableItem, useDesigner, useToken } from '@nocobase/client';
3
3
  import React, { useEffect } from 'react';
4
4
  import { Navigate, useLocation, useNavigate, useParams } from 'react-router-dom';
5
5
  import { ContainerDesigner } from './Container.Designer';
6
+ import useStyles from './style';
6
7
 
7
8
  const findGrid = (schema, uid) => {
8
9
  return schema.reduceProperties((final, next) => {
@@ -28,6 +29,8 @@ const TabContentComponent = () => {
28
29
  };
29
30
 
30
31
  const InternalContainer: React.FC = (props) => {
32
+ const { styles } = useStyles();
33
+ const { token } = useToken();
31
34
  const Designer = useDesigner();
32
35
  const fieldSchema = useFieldSchema();
33
36
  const navigate = useNavigate();
@@ -47,31 +50,13 @@ const InternalContainer: React.FC = (props) => {
47
50
  }, [location.pathname, navigate, params.name, redirectToUid]);
48
51
 
49
52
  return (
50
- <SortableItem
51
- eid="nb-mobile-scroll-wrapper"
52
- className={cx(
53
- 'nb-mobile-container',
54
- css`
55
- & > .general-schema-designer > .general-schema-designer-icons {
56
- right: unset;
57
- left: 2px;
58
- }
59
- background: var(--nb-box-bg);
60
- display: flex;
61
- flex-direction: column;
62
- width: 100%;
63
- height: 100%;
64
- overflow-y: scroll;
65
- position: initial !important;
66
- `,
67
- )}
68
- >
53
+ <SortableItem eid="nb-mobile-scroll-wrapper" className={cx('nb-mobile-container', styles.mobileContainer)}>
69
54
  <Designer></Designer>
70
55
  <div
71
56
  style={{
72
- paddingBottom: redirectToUid ? '50px' : '0px',
57
+ paddingBottom: redirectToUid ? token.paddingLG * 2 : 0,
73
58
  }}
74
- className={cx('nb-mobile-container-content')}
59
+ className="nb-mobile-container-content"
75
60
  >
76
61
  {redirectToUid ? (
77
62
  <TabContentComponent />
@@ -84,22 +69,7 @@ const InternalContainer: React.FC = (props) => {
84
69
  />
85
70
  )}
86
71
  </div>
87
- <div
88
- className={cx(
89
- 'nb-mobile-container-tab-bar',
90
- css`
91
- & > .general-schema-designer {
92
- --nb-designer-top: 20px;
93
- }
94
- position: absolute;
95
- background: #ffffff;
96
- width: 100%;
97
- bottom: 0;
98
- left: 0;
99
- z-index: 1000;
100
- `,
101
- )}
102
- >
72
+ <div className={cx('nb-mobile-container-tab-bar', styles.tabBar)}>
103
73
  <SchemaComponent
104
74
  onlyRenderProperties
105
75
  filterProperties={(schema) => {
@@ -0,0 +1,35 @@
1
+ import { createStyles } from '@nocobase/client';
2
+
3
+ const useStyles = createStyles(({ token, css }) => {
4
+ return {
5
+ mobileContainer: css`
6
+ --adm-color-primary: ${token.colorPrimary};
7
+
8
+ & > .general-schema-designer > .general-schema-designer-icons {
9
+ right: unset;
10
+ left: 2px;
11
+ }
12
+ background: var(--nb-box-bg);
13
+ display: flex;
14
+ flex-direction: column;
15
+ width: 100%;
16
+ height: 100%;
17
+ overflow-y: scroll;
18
+ position: initial !important;
19
+ `,
20
+
21
+ tabBar: css`
22
+ & > .general-schema-designer {
23
+ --nb-designer-top: ${token.marginMD}px;
24
+ }
25
+ position: absolute;
26
+ background: ${token.colorBgContainer};
27
+ width: 100%;
28
+ bottom: 0;
29
+ left: 0;
30
+ z-index: 1000;
31
+ `,
32
+ };
33
+ });
34
+
35
+ export default useStyles;
@@ -1,7 +1,7 @@
1
1
  import { useField } from '@formily/react';
2
- import { css, cx, SortableItem, useCompile, useDesigner, useDocumentTitle } from '@nocobase/client';
2
+ import { cx, SortableItem, useCompile, useDesigner, useDocumentTitle, useToken } from '@nocobase/client';
3
3
  import { NavBar, NavBarProps } from 'antd-mobile';
4
- import React, { useEffect } from 'react';
4
+ import React, { useEffect, useMemo } from 'react';
5
5
  import { useNavigate } from 'react-router-dom';
6
6
  import { generateNTemplate } from '../../../../locale';
7
7
  import { HeaderDesigner } from './Header.Designer';
@@ -18,22 +18,22 @@ const InternalHeader = (props: HeaderProps) => {
18
18
  const compiledTitle = compile(title);
19
19
  const navigate = useNavigate();
20
20
  const { setTitle } = useDocumentTitle();
21
+ const { token } = useToken();
21
22
 
22
23
  useEffect(() => {
23
24
  // sync title
24
25
  setTitle(compiledTitle);
25
26
  }, [compiledTitle]);
26
27
 
28
+ const style = useMemo(() => {
29
+ return {
30
+ width: '100%',
31
+ background: token.colorBgContainer,
32
+ };
33
+ }, [token.colorBgContainer]);
34
+
27
35
  return (
28
- <SortableItem
29
- className={cx(
30
- 'nb-mobile-header',
31
- css`
32
- width: 100%;
33
- background: #fff;
34
- `,
35
- )}
36
- >
36
+ <SortableItem className={cx('nb-mobile-header')} style={style}>
37
37
  <NavBar backArrow={showBack} onBack={() => navigate(-1)}>
38
38
  {compiledTitle}
39
39
  </NavBar>
@@ -1,9 +1,9 @@
1
- import { GeneralSchemaDesigner, SchemaSettings, useDesignable } from '@nocobase/client';
2
1
  import { MenuOutlined } from '@ant-design/icons';
2
+ import { useField, useFieldSchema } from '@formily/react';
3
+ import { SchemaSettings, useDesignable } from '@nocobase/client';
4
+ import { Button } from 'antd';
3
5
  import React from 'react';
4
6
  import { useTranslation } from '../../../../locale';
5
- import { Button } from 'antd';
6
- import { useFieldSchema, useField } from '@formily/react';
7
7
 
8
8
  export const MenuDesigner: React.FC = (props) => {
9
9
  const { t } = useTranslation();
@@ -20,8 +20,8 @@ export const MenuDesigner: React.FC = (props) => {
20
20
  title={
21
21
  <Button
22
22
  style={{
23
- borderColor: 'rgb(241, 139, 98)',
24
- color: 'rgb(241, 139, 98)',
23
+ borderColor: 'var(--colorSettings)',
24
+ color: 'var(--colorSettings)',
25
25
  }}
26
26
  icon={<MenuOutlined />}
27
27
  type="dashed"
@@ -1,11 +1,11 @@
1
1
  import { useField, useFieldSchema } from '@formily/react';
2
2
  import {
3
- css,
4
- cx,
5
3
  GeneralSchemaDesigner,
6
4
  Icon,
7
5
  SchemaSettings,
8
6
  SortableItem,
7
+ css,
8
+ cx,
9
9
  useCompile,
10
10
  useDesigner,
11
11
  } from '@nocobase/client';
@@ -1,6 +1,5 @@
1
1
  import { useFieldSchema } from '@formily/react';
2
2
  import {
3
- css,
4
3
  cx,
5
4
  DndContext,
6
5
  SchemaComponent,
@@ -16,8 +15,10 @@ import { PageSchema } from '../../common';
16
15
  import { MenuDesigner } from './Menu.Designer';
17
16
  import { MenuItem } from './Menu.Item';
18
17
  import { menuItemSchema } from './schema';
18
+ import useStyles from './style';
19
19
 
20
20
  const InternalMenu: React.FC = (props) => {
21
+ const { styles } = useStyles();
21
22
  const Designer = useDesigner();
22
23
  const fieldSchema = useFieldSchema();
23
24
  const { insertBeforeEnd, designable } = useDesignable();
@@ -40,16 +41,7 @@ const InternalMenu: React.FC = (props) => {
40
41
  };
41
42
 
42
43
  return (
43
- <SortableItem
44
- className={cx(
45
- 'nb-mobile-menu',
46
- css`
47
- background: #ffffff;
48
- width: 100%;
49
- margin-bottom: var(--nb-spacing);
50
- `,
51
- )}
52
- >
44
+ <SortableItem className={cx('nb-mobile-menu', styles.mobileMenu)}>
53
45
  <List>
54
46
  {designable && (
55
47
  <List.Item>
@@ -0,0 +1,20 @@
1
+ import { createStyles } from '@nocobase/client';
2
+
3
+ const useStyles = createStyles(({ token, css }) => {
4
+ return {
5
+ mobileMenu: css`
6
+ --adm-color-primary: ${token.colorPrimary};
7
+ --adm-color-primary-hover: ${token.colorPrimaryHover};
8
+ --adm-color-primary-active: ${token.colorPrimaryActive};
9
+ --padding-left: ${token.paddingSM}px;
10
+ --adm-color-background: ${token.colorBgContainer};
11
+ --adm-color-border: ${token.colorBorder};
12
+
13
+ background: ${token.colorBgContainer};
14
+ width: 100%;
15
+ margin-bottom: var(--nb-spacing);
16
+ `,
17
+ };
18
+ });
19
+
20
+ export default useStyles;
@@ -26,8 +26,8 @@ export const PageDesigner = (props) => {
26
26
  title={
27
27
  <Button
28
28
  style={{
29
- borderColor: 'rgb(241, 139, 98)',
30
- color: 'rgb(241, 139, 98)',
29
+ borderColor: 'var(--colorSettings)',
30
+ color: 'var(--colorSettings)',
31
31
  width: '100%',
32
32
  }}
33
33
  icon={<MenuOutlined />}
@@ -1,25 +1,14 @@
1
1
  import { RecursionField, useFieldSchema } from '@formily/react';
2
- import { ActionBarProvider, css, cx, SortableItem, TabsContextProvider, useDesigner } from '@nocobase/client';
2
+ import { ActionBarProvider, SortableItem, TabsContextProvider, cx, useDesigner } from '@nocobase/client';
3
3
  import { TabsProps } from 'antd';
4
4
  import React, { useCallback } from 'react';
5
5
  import { useSearchParams } from 'react-router-dom';
6
6
  import { countGridCol } from '../../helpers';
7
7
  import { PageDesigner } from './Page.Designer';
8
-
9
- const globalActionCSS = css`
10
- #nb-position-container > & {
11
- height: 49px;
12
- border-top: 1px solid var(--nb-box-bg);
13
- margin-bottom: 0px !important;
14
- padding: 0 var(--nb-spacing);
15
- align-items: center;
16
- overflow-x: auto;
17
- background: #ffffff;
18
- z-index: 100;
19
- }
20
- `;
8
+ import useStyles from './style';
21
9
 
22
10
  const InternalPage: React.FC = (props) => {
11
+ const { styles } = useStyles();
23
12
  const Designer = useDesigner();
24
13
  const fieldSchema = useFieldSchema();
25
14
  const [searchParams, setSearchParams] = useSearchParams();
@@ -64,7 +53,7 @@ const InternalPage: React.FC = (props) => {
64
53
  }
65
54
  forceProps={{
66
55
  layout: 'one-column',
67
- className: globalActionCSS,
56
+ className: styles.globalActionCSS,
68
57
  }}
69
58
  >
70
59
  {props.children}
@@ -78,41 +67,13 @@ const InternalPage: React.FC = (props) => {
78
67
  );
79
68
 
80
69
  return (
81
- <SortableItem
82
- eid="nb-mobile-scroll-wrapper"
83
- className={cx(
84
- 'nb-mobile-page',
85
- css`
86
- background: var(--nb-box-bg);
87
- display: flex;
88
- flex-direction: column;
89
- width: 100%;
90
- height: 100%;
91
- overflow-x: hidden;
92
- overflow-y: auto;
93
- padding-bottom: var(--nb-spacing);
94
- `,
95
- )}
96
- >
70
+ <SortableItem eid="nb-mobile-scroll-wrapper" className={cx('nb-mobile-page', styles.mobilePage)}>
97
71
  <Designer {...fieldSchema?.['x-designer-props']}></Designer>
98
72
  <div
99
73
  style={{
100
74
  paddingBottom: tabsSchema ? null : 'var(--nb-spacing)',
101
75
  }}
102
- className={cx(
103
- 'nb-mobile-page-header',
104
- css`
105
- & > .ant-tabs > .ant-tabs-nav {
106
- .ant-tabs-tab {
107
- margin: 0 !important;
108
- padding: 0 16px !important;
109
- }
110
- background: #fff;
111
- }
112
- display: flex;
113
- flex-direction: column;
114
- `,
115
- )}
76
+ className={cx('nb-mobile-page-header', styles.mobilePageHeader)}
116
77
  >
117
78
  <RecursionField
118
79
  schema={fieldSchema}
@@ -0,0 +1,43 @@
1
+ import { createStyles } from '@nocobase/client';
2
+
3
+ const useStyles = createStyles(({ token, css }) => {
4
+ return {
5
+ globalActionCSS: css`
6
+ #nb-position-container > & {
7
+ height: ${token.sizeXXL}px;
8
+ border-top: 1px solid var(--nb-box-bg);
9
+ margin-bottom: 0px !important;
10
+ padding: 0 var(--nb-spacing);
11
+ align-items: center;
12
+ overflow-x: auto;
13
+ background: ${token.colorBgContainer};
14
+ z-index: 100;
15
+ }
16
+ `,
17
+
18
+ mobilePage: css`
19
+ background: var(--nb-box-bg);
20
+ display: flex;
21
+ flex-direction: column;
22
+ width: 100%;
23
+ height: 100%;
24
+ overflow-x: hidden;
25
+ overflow-y: auto;
26
+ padding-bottom: var(--nb-spacing);
27
+ `,
28
+
29
+ mobilePageHeader: css`
30
+ & > .ant-tabs > .ant-tabs-nav {
31
+ .ant-tabs-tab {
32
+ margin: 0 !important;
33
+ padding: 0 ${token.paddingContentHorizontal}px !important;
34
+ }
35
+ background: ${token.colorBgContainer};
36
+ }
37
+ display: flex;
38
+ flex-direction: column;
39
+ `,
40
+ };
41
+ });
42
+
43
+ export default useStyles;
@@ -37,6 +37,12 @@ export const InternalTabBar: React.FC = (props) => {
37
37
  properties: {
38
38
  [uid()]: PageSchema,
39
39
  },
40
+ 'x-server-hooks': [
41
+ {
42
+ type: 'onSelfSave',
43
+ method: 'extractTextToLocale',
44
+ },
45
+ ],
40
46
  });
41
47
  }, []);
42
48
 
@@ -76,7 +82,7 @@ export const InternalTabBar: React.FC = (props) => {
76
82
  key={`tab_${schema['x-uid']}`}
77
83
  title={
78
84
  <>
79
- {compile(cp.title)}
85
+ {t(compile(cp.title))}
80
86
  <SchemaComponent schema={schema} name={name} />
81
87
  </>
82
88
  }
@@ -15,6 +15,12 @@ export const useSchemaPatch = () => {
15
15
  schema: {
16
16
  ['x-uid']: fieldSchema['x-uid'],
17
17
  'x-component-props': fieldSchema['x-component-props'],
18
+ 'x-server-hooks': [
19
+ {
20
+ type: 'onSelfSave',
21
+ method: 'extractTextToLocale',
22
+ },
23
+ ],
18
24
  },
19
25
  });
20
26
  dn.refresh();
@@ -1,12 +1,10 @@
1
1
  import { i18n } from '@nocobase/client';
2
2
  import { useTranslation as useT } from 'react-i18next';
3
- import enUS from './en-US';
4
- import zhCN from './zh-CN';
5
3
 
6
4
  export const NAMESPACE = 'mobile-client';
7
5
 
8
- i18n.addResources('zh-CN', NAMESPACE, zhCN);
9
- i18n.addResources('en-US', NAMESPACE, enUS);
6
+ // i18n.addResources('zh-CN', NAMESPACE, zhCN);
7
+ // i18n.addResources('en-US', NAMESPACE, enUS);
10
8
 
11
9
  export function lang(key: string) {
12
10
  return i18n.t(key, { ns: NAMESPACE });
@@ -43,11 +43,12 @@ const commonDesignerCSS = css`
43
43
  line-height: 16px;
44
44
  pointer-events: all;
45
45
  .ant-space-item {
46
- background-color: #f18b62;
46
+ background-color: var(--colorSettings);
47
47
  color: #fff;
48
48
  line-height: 16px;
49
49
  width: 16px;
50
50
  padding-left: 1px;
51
+ align-self: stretch;
51
52
  }
52
53
  }
53
54
  }