@nocobase/plugin-mobile-client 0.10.1-alpha.1 → 0.11.1-alpha.1
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/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/MobileClientProvider.d.ts +2 -0
- package/lib/client/MobileClientProvider.js +64 -0
- package/lib/client/core/schema/components/container/Container.Designer.js +2 -2
- package/lib/client/core/schema/components/container/Container.js +20 -51
- package/lib/client/core/schema/components/container/style.d.ts +5 -0
- package/lib/client/core/schema/components/container/style.js +48 -0
- package/lib/client/core/schema/components/header/Header.Designer.js +8 -8
- package/lib/client/core/schema/components/header/Header.js +10 -11
- package/lib/client/core/schema/components/menu/Menu.Designer.js +18 -18
- package/lib/client/core/schema/components/menu/Menu.Item.js +1 -8
- package/lib/client/core/schema/components/menu/Menu.d.ts +1 -1
- package/lib/client/core/schema/components/menu/Menu.js +18 -26
- package/lib/client/core/schema/components/menu/style.d.ts +4 -0
- package/lib/client/core/schema/components/menu/style.js +34 -0
- package/lib/client/core/schema/components/page/Page.Designer.js +2 -2
- package/lib/client/core/schema/components/page/Page.js +9 -43
- package/lib/client/core/schema/components/page/style.d.ts +6 -0
- package/lib/client/core/schema/components/page/style.js +55 -0
- package/lib/client/core/schema/components/settings/Settings.js +1 -8
- package/lib/client/core/schema/components/tab-bar/TabBar.Item.d.ts +1 -1
- package/lib/client/core/schema/components/tab-bar/TabBar.Item.js +10 -17
- package/lib/client/core/schema/components/tab-bar/TabBar.d.ts +1 -1
- package/lib/client/core/schema/components/tab-bar/TabBar.js +30 -33
- package/lib/client/core/schema/hooks/useSchemaPatch.js +9 -6
- package/lib/client/core/schema/scopes/grid-card.js +4 -4
- package/lib/client/devices/iOS6.js +4 -4
- package/lib/client/devices/index.js +9 -9
- package/lib/client/index.d.ts +11 -2
- package/lib/client/index.js +62 -26
- package/lib/client/locale/index.js +2 -5
- package/lib/client/router/Application.js +8 -15
- package/lib/client/router/InterfaceRouter.d.ts +1 -5
- package/lib/client/router/InterfaceRouter.js +10 -38
- package/lib/client/router/index.d.ts +0 -1
- package/lib/client/router/index.js +0 -11
- package/lib/server/migrations/20230620203218-mobile-ui-schema-uid.js +1 -1
- package/package.json +26 -10
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/MobileClientProvider.tsx +41 -0
- package/src/client/core/schema/components/container/Container.Designer.tsx +2 -2
- package/src/client/core/schema/components/container/Container.tsx +18 -64
- package/src/client/core/schema/components/container/style.ts +35 -0
- package/src/client/core/schema/components/header/Header.Designer.tsx +3 -3
- package/src/client/core/schema/components/header/Header.tsx +11 -12
- package/src/client/core/schema/components/menu/Menu.Designer.tsx +5 -5
- package/src/client/core/schema/components/menu/Menu.Item.tsx +10 -2
- package/src/client/core/schema/components/menu/Menu.tsx +9 -16
- package/src/client/core/schema/components/menu/style.ts +20 -0
- package/src/client/core/schema/components/page/Page.Designer.tsx +2 -2
- package/src/client/core/schema/components/page/Page.tsx +6 -46
- package/src/client/core/schema/components/page/style.ts +43 -0
- package/src/client/core/schema/components/settings/Settings.tsx +1 -2
- package/src/client/core/schema/components/tab-bar/TabBar.Item.tsx +4 -5
- package/src/client/core/schema/components/tab-bar/TabBar.tsx +15 -8
- package/src/client/core/schema/hooks/useSchemaPatch.ts +8 -2
- package/src/client/core/schema/scopes/grid-card.ts +1 -1
- package/src/client/devices/iOS6.tsx +1 -1
- package/src/client/devices/index.tsx +1 -1
- package/src/client/index.tsx +45 -30
- package/src/client/locale/index.ts +2 -4
- package/src/client/router/Application.tsx +5 -4
- package/src/client/router/InterfaceRouter.tsx +11 -43
- package/src/client/router/index.ts +0 -1
- package/docs/en-US/index.md +0 -7
- package/docs/en-US/installation.md +0 -13
- package/docs/en-US/tabs.json +0 -14
- package/docs/en-US/usage.md +0 -1
- package/docs/zh-CN/index.md +0 -7
- package/docs/zh-CN/installation.md +0 -13
- package/docs/zh-CN/tabs.json +0 -14
- package/docs/zh-CN/usage.md +0 -2
- package/lib/client/router/RouteSwitchProvider.d.ts +0 -2
- package/lib/client/router/RouteSwitchProvider.js +0 -59
- package/src/client/router/RouteSwitchProvider.tsx +0 -31
- package/types.d.ts +0 -0
package/lib/client/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.MobileClientPlugin = void 0;
|
|
7
7
|
function _client() {
|
|
8
8
|
const data = require("@nocobase/client");
|
|
9
9
|
_client = function _client() {
|
|
@@ -18,30 +18,66 @@ function _react() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
function _reactRouterDom() {
|
|
22
|
+
const data = require("react-router-dom");
|
|
23
|
+
_reactRouterDom = function _reactRouterDom() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
var _MobileClientProvider = require("./MobileClientProvider");
|
|
29
|
+
var _Application = _interopRequireDefault(require("./router/Application"));
|
|
24
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
32
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
|
+
class MobileClientPlugin extends _client().Plugin {
|
|
34
|
+
constructor(...args) {
|
|
35
|
+
super(...args);
|
|
36
|
+
this.mobileRouter = void 0;
|
|
37
|
+
}
|
|
38
|
+
load() {
|
|
39
|
+
var _this = this;
|
|
40
|
+
return _asyncToGenerator(function* () {
|
|
41
|
+
_this.setMobileRouter();
|
|
42
|
+
_this.addRoutes();
|
|
43
|
+
_this.app.use(_MobileClientProvider.MobileClientProvider);
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
setMobileRouter() {
|
|
47
|
+
const router = (0, _client().createRouterManager)({
|
|
48
|
+
type: 'hash'
|
|
49
|
+
});
|
|
50
|
+
router.add('root', {
|
|
51
|
+
path: '/',
|
|
52
|
+
element: _react().default.createElement(_reactRouterDom().Navigate, {
|
|
53
|
+
replace: true,
|
|
54
|
+
to: "/mobile"
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
router.add('mobile', {
|
|
58
|
+
path: '/mobile',
|
|
59
|
+
element: _react().default.createElement(_Application.default, null)
|
|
60
|
+
});
|
|
61
|
+
router.add('mobile.page', {
|
|
62
|
+
path: '/mobile/:name',
|
|
63
|
+
element: _react().default.createElement(_client().RouteSchemaComponent, null)
|
|
64
|
+
});
|
|
65
|
+
this.mobileRouter = router;
|
|
66
|
+
}
|
|
67
|
+
getMobileRouterComponent() {
|
|
68
|
+
return this.mobileRouter.getRouterComponent();
|
|
69
|
+
}
|
|
70
|
+
addRoutes() {
|
|
71
|
+
this.app.router.add('mobile', {
|
|
72
|
+
path: '/mobile',
|
|
73
|
+
element: _react().default.createElement(_Application.default, null)
|
|
74
|
+
});
|
|
75
|
+
this.app.router.add('mobile.page', {
|
|
76
|
+
path: '/mobile/:name',
|
|
77
|
+
Component: 'RouteSchemaComponent'
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.MobileClientPlugin = MobileClientPlugin;
|
|
82
|
+
var _default = MobileClientPlugin;
|
|
47
83
|
exports.default = _default;
|
|
@@ -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
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function _css() {
|
|
8
|
-
const data = require("@emotion/css");
|
|
9
|
-
_css = function _css() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _client() {
|
|
15
8
|
const data = require("@nocobase/client");
|
|
16
9
|
_client = function _client() {
|
|
@@ -41,11 +34,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
41
34
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
42
35
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
43
36
|
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); }
|
|
44
|
-
const commonCSSVariables = (0,
|
|
37
|
+
const commonCSSVariables = (0, _client().css)`
|
|
45
38
|
--nb-spacing: 14px;
|
|
46
39
|
`;
|
|
47
|
-
const commonCSSOverride = (0,
|
|
48
|
-
const commonDesignerCSS = (0,
|
|
40
|
+
const commonCSSOverride = (0, _client().css)``;
|
|
41
|
+
const commonDesignerCSS = (0, _client().css)`
|
|
49
42
|
--nb-designer-top: 2px;
|
|
50
43
|
--nb-designer-right: 2px;
|
|
51
44
|
.nb-sortable-designer:hover {
|
|
@@ -71,11 +64,12 @@ const commonDesignerCSS = (0, _css().css)`
|
|
|
71
64
|
line-height: 16px;
|
|
72
65
|
pointer-events: all;
|
|
73
66
|
.ant-space-item {
|
|
74
|
-
background-color:
|
|
67
|
+
background-color: var(--colorSettings);
|
|
75
68
|
color: #fff;
|
|
76
69
|
line-height: 16px;
|
|
77
70
|
width: 16px;
|
|
78
71
|
padding-left: 1px;
|
|
72
|
+
align-self: stretch;
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
75
|
}
|
|
@@ -94,8 +88,8 @@ const modalProps = _objectSpread(_objectSpread({}, drawerProps), {}, {
|
|
|
94
88
|
maskStyle: {
|
|
95
89
|
position: 'absolute'
|
|
96
90
|
},
|
|
97
|
-
wrapClassName: (0,
|
|
98
|
-
position: absolute;
|
|
91
|
+
wrapClassName: (0, _client().css)`
|
|
92
|
+
position: absolute !important;
|
|
99
93
|
`
|
|
100
94
|
});
|
|
101
95
|
const useMobileSchemaUid = () => {
|
|
@@ -105,7 +99,6 @@ const useMobileSchemaUid = () => {
|
|
|
105
99
|
};
|
|
106
100
|
const MApplication = props => {
|
|
107
101
|
const mobileSchemaUid = useMobileSchemaUid();
|
|
108
|
-
console.log('mobileSchemaUid', mobileSchemaUid);
|
|
109
102
|
const params = (0, _reactRouterDom().useParams)();
|
|
110
103
|
const interfaceContext = (0, _InterfaceProvider.useInterfaceContext)();
|
|
111
104
|
const Provider = (0, _react().useMemo)(() => {
|
|
@@ -116,7 +109,7 @@ const MApplication = props => {
|
|
|
116
109
|
modalProps: modalProps,
|
|
117
110
|
drawerProps: drawerProps
|
|
118
111
|
}, _react().default.createElement("div", {
|
|
119
|
-
className: (0,
|
|
112
|
+
className: (0, _client().cx)('nb-mobile-application', commonDesignerCSS, commonCSSVariables, commonCSSOverride, (0, _client().css)`
|
|
120
113
|
display: flex;
|
|
121
114
|
flex-direction: column;
|
|
122
115
|
width: 100%;
|
|
@@ -12,47 +12,19 @@ function _client() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
function _react() {
|
|
15
|
-
const data =
|
|
15
|
+
const data = _interopRequireDefault(require("react"));
|
|
16
16
|
_react = function _react() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
const data = require("react-router-dom");
|
|
23
|
-
_reactRouterDom = function _reactRouterDom() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
21
|
+
var _index = require("../index");
|
|
28
22
|
var _InterfaceProvider = require("./InterfaceProvider");
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}, _react().default.createElement(_reactRouterDom().UNSAFE_LocationContext.Provider, {
|
|
39
|
-
value: null
|
|
40
|
-
}, props.children));
|
|
41
|
-
}
|
|
42
|
-
const InterfaceRouter = props => {
|
|
43
|
-
const allRoutes = (0, _client().useRoutes)();
|
|
44
|
-
const routes = (0, _react().useMemo)(() => allRoutes.reduce((nextRoutes, item) => {
|
|
45
|
-
if (item['component'] === 'MApplication') {
|
|
46
|
-
nextRoutes.push(item, {
|
|
47
|
-
type: 'redirect',
|
|
48
|
-
to: '/mobile',
|
|
49
|
-
from: '/'
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return nextRoutes;
|
|
53
|
-
}, []), [allRoutes]);
|
|
54
|
-
return _react().default.createElement(RouteCleaner, null, _react().default.createElement(_reactRouterDom().HashRouter, null, _react().default.createElement(_InterfaceProvider.InterfaceProvider, null, _react().default.createElement(_client().RouteSwitch, {
|
|
55
|
-
routes: routes
|
|
56
|
-
}))));
|
|
57
|
-
};
|
|
58
|
-
exports.InterfaceRouter = InterfaceRouter;
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
const InterfaceRouter = _react().default.memo(() => {
|
|
25
|
+
const plugin = (0, _client().usePlugin)(_index.MobileClientPlugin);
|
|
26
|
+
const MobileRouter = plugin.getMobileRouterComponent();
|
|
27
|
+
return _react().default.createElement(_InterfaceProvider.InterfaceProvider, null, _react().default.createElement(MobileRouter, null));
|
|
28
|
+
});
|
|
29
|
+
exports.InterfaceRouter = InterfaceRouter;
|
|
30
|
+
InterfaceRouter.displayName = 'InterfaceRouter';
|
|
@@ -13,15 +13,4 @@ Object.keys(_InterfaceRouter).forEach(function (key) {
|
|
|
13
13
|
return _InterfaceRouter[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
});
|
|
17
|
-
var _RouteSwitchProvider = require("./RouteSwitchProvider");
|
|
18
|
-
Object.keys(_RouteSwitchProvider).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _RouteSwitchProvider[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _RouteSwitchProvider[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
16
|
});
|
|
@@ -46,7 +46,7 @@ class _default extends _server().Migration {
|
|
|
46
46
|
_iterator.f();
|
|
47
47
|
}
|
|
48
48
|
instance = yield systemSettings.findOne();
|
|
49
|
-
if (!((_instance = instance)
|
|
49
|
+
if (!((_instance = instance) !== null && _instance !== void 0 && (_instance$options = _instance.options) !== null && _instance$options !== 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,28 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-mobile-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "lib/server/index.js",
|
|
3
|
+
"version": "0.11.1-alpha.1",
|
|
4
|
+
"main": "./lib/server/index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib",
|
|
7
|
+
"src",
|
|
8
|
+
"README.md",
|
|
9
|
+
"README.zh-CN.md",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"server.js",
|
|
12
|
+
"server.d.ts",
|
|
13
|
+
"client.js",
|
|
14
|
+
"client.d.ts"
|
|
15
|
+
],
|
|
5
16
|
"displayName": "Mobile-client",
|
|
6
17
|
"displayName.zh-CN": "移动端",
|
|
7
18
|
"description": "Provide mobile client access",
|
|
8
19
|
"description.zh-CN": "提供移动端访问",
|
|
9
20
|
"devDependencies": {
|
|
10
|
-
"@
|
|
11
|
-
"@formily/antd": "
|
|
21
|
+
"@ant-design/icons": "^5.1.4",
|
|
22
|
+
"@formily/antd-v5": "^1.1.0-beta.4",
|
|
12
23
|
"@formily/react": "2.2.26",
|
|
13
24
|
"@formily/shared": "2.2.26",
|
|
14
|
-
"@nocobase/
|
|
15
|
-
"@nocobase/
|
|
25
|
+
"@nocobase/client": "0.11.1-alpha.1",
|
|
26
|
+
"@nocobase/database": "0.11.1-alpha.1",
|
|
27
|
+
"@nocobase/server": "0.11.1-alpha.1",
|
|
28
|
+
"@nocobase/test": "0.11.1-alpha.1",
|
|
29
|
+
"@nocobase/utils": "0.11.1-alpha.1",
|
|
16
30
|
"@types/react": "^17.0.0",
|
|
17
31
|
"@types/react-dom": "^17.0.0",
|
|
18
|
-
"antd": "^
|
|
19
|
-
"
|
|
32
|
+
"antd": "^5.6.4",
|
|
33
|
+
"antd-style": "^3.3.0",
|
|
20
34
|
"react": "^18.0.0",
|
|
21
35
|
"react-dom": "^18.0.0",
|
|
36
|
+
"react-i18next": "^11.15.1",
|
|
22
37
|
"react-router-dom": "^6.11.2"
|
|
23
38
|
},
|
|
24
39
|
"dependencies": {
|
|
25
|
-
"antd-mobile": "^5.29.1"
|
|
40
|
+
"antd-mobile": "^5.29.1",
|
|
41
|
+
"classnames": "^2.3.1"
|
|
26
42
|
},
|
|
27
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
|
|
28
44
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/server"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/server/index.js');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SettingsCenterProvider } from '@nocobase/client';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
4
|
+
import { AppConfiguration, InterfaceConfiguration } from './configuration';
|
|
5
|
+
import { isJSBridge } from './core/bridge';
|
|
6
|
+
import { useTranslation } from './locale';
|
|
7
|
+
|
|
8
|
+
export const MobileClientProvider = React.memo((props) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const location = useLocation();
|
|
11
|
+
const navigation = useNavigate();
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (isJSBridge() && location.pathname === '/admin') {
|
|
15
|
+
navigation('/mobile', { replace: true });
|
|
16
|
+
}
|
|
17
|
+
}, [location.pathname, navigation]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SettingsCenterProvider
|
|
21
|
+
settings={{
|
|
22
|
+
['mobile-client']: {
|
|
23
|
+
title: t('Mobile Client-side'),
|
|
24
|
+
icon: 'MobileOutlined',
|
|
25
|
+
tabs: {
|
|
26
|
+
interface: {
|
|
27
|
+
title: t('Interface Configuration'),
|
|
28
|
+
component: InterfaceConfiguration,
|
|
29
|
+
},
|
|
30
|
+
app: {
|
|
31
|
+
title: t('App Configuration'),
|
|
32
|
+
component: AppConfiguration,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{props.children}
|
|
39
|
+
</SettingsCenterProvider>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -30,8 +30,8 @@ export const ContainerDesigner = () => {
|
|
|
30
30
|
title={
|
|
31
31
|
<Button
|
|
32
32
|
style={{
|
|
33
|
-
borderColor: '
|
|
34
|
-
color: '
|
|
33
|
+
borderColor: 'var(--colorSettings)',
|
|
34
|
+
color: 'var(--colorSettings)',
|
|
35
35
|
width: '100%',
|
|
36
36
|
}}
|
|
37
37
|
icon={<MenuOutlined />}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { css, cx } from '@emotion/css';
|
|
2
1
|
import { useFieldSchema } from '@formily/react';
|
|
3
|
-
import {
|
|
4
|
-
import React, {
|
|
5
|
-
import { Navigate,
|
|
2
|
+
import { cx, SchemaComponent, SortableItem, useDesigner, useToken } from '@nocobase/client';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { Navigate, useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
6
5
|
import { ContainerDesigner } from './Container.Designer';
|
|
6
|
+
import useStyles from './style';
|
|
7
7
|
|
|
8
8
|
const findGrid = (schema, uid) => {
|
|
9
9
|
return schema.reduceProperties((final, next) => {
|
|
@@ -29,8 +29,11 @@ const TabContentComponent = () => {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const InternalContainer: React.FC = (props) => {
|
|
32
|
+
const { styles } = useStyles();
|
|
33
|
+
const { token } = useToken();
|
|
32
34
|
const Designer = useDesigner();
|
|
33
35
|
const fieldSchema = useFieldSchema();
|
|
36
|
+
const navigate = useNavigate();
|
|
34
37
|
const params = useParams<{ name: string }>();
|
|
35
38
|
const location = useLocation();
|
|
36
39
|
const tabBarSchema = fieldSchema?.properties?.['tabBar'];
|
|
@@ -39,58 +42,24 @@ const InternalContainer: React.FC = (props) => {
|
|
|
39
42
|
if (tabBarCurrentFirstKey) {
|
|
40
43
|
redirectToUid = tabBarSchema?.properties[tabBarCurrentFirstKey]?.['x-uid'];
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (redirectToUid && !params.name) {
|
|
47
|
+
const locationPath = location.pathname.endsWith('/') ? location.pathname.slice(0, -1) : location.pathname;
|
|
48
|
+
navigate(`${locationPath}/tab_${redirectToUid}`, { replace: true });
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return [
|
|
50
|
-
!params.name
|
|
51
|
-
? {
|
|
52
|
-
type: 'redirect',
|
|
53
|
-
to: `${locationPath}/tab_${redirectToUid}`,
|
|
54
|
-
from: location.pathname,
|
|
55
|
-
}
|
|
56
|
-
: null,
|
|
57
|
-
{
|
|
58
|
-
type: 'route',
|
|
59
|
-
path: location.pathname,
|
|
60
|
-
component: TabContentComponent,
|
|
61
|
-
},
|
|
62
|
-
].filter(Boolean) as any[];
|
|
63
|
-
}, [redirectToUid, params.name, location.pathname]);
|
|
50
|
+
}, [location.pathname, navigate, params.name, redirectToUid]);
|
|
64
51
|
|
|
65
52
|
return (
|
|
66
|
-
<SortableItem
|
|
67
|
-
eid="nb-mobile-scroll-wrapper"
|
|
68
|
-
className={cx(
|
|
69
|
-
'nb-mobile-container',
|
|
70
|
-
css`
|
|
71
|
-
& > .general-schema-designer > .general-schema-designer-icons {
|
|
72
|
-
right: unset;
|
|
73
|
-
left: 2px;
|
|
74
|
-
}
|
|
75
|
-
background: #f0f2f5;
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-direction: column;
|
|
78
|
-
width: 100%;
|
|
79
|
-
height: 100%;
|
|
80
|
-
overflow-y: scroll;
|
|
81
|
-
position: initial !important;
|
|
82
|
-
`,
|
|
83
|
-
)}
|
|
84
|
-
>
|
|
53
|
+
<SortableItem eid="nb-mobile-scroll-wrapper" className={cx('nb-mobile-container', styles.mobileContainer)}>
|
|
85
54
|
<Designer></Designer>
|
|
86
55
|
<div
|
|
87
56
|
style={{
|
|
88
|
-
paddingBottom:
|
|
57
|
+
paddingBottom: redirectToUid ? token.paddingLG * 2 : 0,
|
|
89
58
|
}}
|
|
90
|
-
className=
|
|
59
|
+
className="nb-mobile-container-content"
|
|
91
60
|
>
|
|
92
|
-
{
|
|
93
|
-
<
|
|
61
|
+
{redirectToUid ? (
|
|
62
|
+
<TabContentComponent />
|
|
94
63
|
) : (
|
|
95
64
|
<SchemaComponent
|
|
96
65
|
filterProperties={(schema) => {
|
|
@@ -100,22 +69,7 @@ const InternalContainer: React.FC = (props) => {
|
|
|
100
69
|
/>
|
|
101
70
|
)}
|
|
102
71
|
</div>
|
|
103
|
-
<div
|
|
104
|
-
className={cx(
|
|
105
|
-
'nb-mobile-container-tab-bar',
|
|
106
|
-
css`
|
|
107
|
-
& > .general-schema-designer {
|
|
108
|
-
--nb-designer-top: 20px;
|
|
109
|
-
}
|
|
110
|
-
position: absolute;
|
|
111
|
-
background: #ffffff;
|
|
112
|
-
width: 100%;
|
|
113
|
-
bottom: 0;
|
|
114
|
-
left: 0;
|
|
115
|
-
z-index: 1000;
|
|
116
|
-
`,
|
|
117
|
-
)}
|
|
118
|
-
>
|
|
72
|
+
<div className={cx('nb-mobile-container-tab-bar', styles.tabBar)}>
|
|
119
73
|
<SchemaComponent
|
|
120
74
|
onlyRenderProperties
|
|
121
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
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Switch } from '@formily/antd-v5';
|
|
2
|
+
import { useField } from '@formily/react';
|
|
3
|
+
import { GeneralSchemaDesigner, SchemaSettings } from '@nocobase/client';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
import { Switch } from '@formily/antd';
|
|
5
5
|
import { useTranslation } from '../../../../locale';
|
|
6
6
|
import { useSchemaPatch } from '../../hooks';
|
|
7
7
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { css, cx } from '@emotion/css';
|
|
2
1
|
import { useField } from '@formily/react';
|
|
3
|
-
import { SortableItem, useCompile, useDesigner, useDocumentTitle } from '@nocobase/client';
|
|
2
|
+
import { cx, SortableItem, useCompile, useDesigner, useDocumentTitle, useToken } from '@nocobase/client';
|
|
4
3
|
import { NavBar, NavBarProps } from 'antd-mobile';
|
|
5
|
-
import React, { useEffect } from 'react';
|
|
4
|
+
import React, { useEffect, useMemo } from 'react';
|
|
6
5
|
import { useNavigate } from 'react-router-dom';
|
|
7
6
|
import { generateNTemplate } from '../../../../locale';
|
|
8
7
|
import { HeaderDesigner } from './Header.Designer';
|
|
@@ -19,22 +18,22 @@ const InternalHeader = (props: HeaderProps) => {
|
|
|
19
18
|
const compiledTitle = compile(title);
|
|
20
19
|
const navigate = useNavigate();
|
|
21
20
|
const { setTitle } = useDocumentTitle();
|
|
21
|
+
const { token } = useToken();
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
// sync title
|
|
25
25
|
setTitle(compiledTitle);
|
|
26
26
|
}, [compiledTitle]);
|
|
27
27
|
|
|
28
|
+
const style = useMemo(() => {
|
|
29
|
+
return {
|
|
30
|
+
width: '100%',
|
|
31
|
+
background: token.colorBgContainer,
|
|
32
|
+
};
|
|
33
|
+
}, [token.colorBgContainer]);
|
|
34
|
+
|
|
28
35
|
return (
|
|
29
|
-
<SortableItem
|
|
30
|
-
className={cx(
|
|
31
|
-
'nb-mobile-header',
|
|
32
|
-
css`
|
|
33
|
-
width: 100%;
|
|
34
|
-
background: #fff;
|
|
35
|
-
`,
|
|
36
|
-
)}
|
|
37
|
-
>
|
|
36
|
+
<SortableItem className={cx('nb-mobile-header')} style={style}>
|
|
38
37
|
<NavBar backArrow={showBack} onBack={() => navigate(-1)}>
|
|
39
38
|
{compiledTitle}
|
|
40
39
|
</NavBar>
|