@nocobase/plugin-mobile-client 0.10.0-alpha.5 → 0.11.0-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.js +15 -30
- package/lib/client/core/schema/components/header/Header.Designer.js +8 -8
- package/lib/client/core/schema/components/header/Header.js +1 -8
- 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 +15 -22
- package/lib/client/core/schema/components/page/Page.js +7 -14
- 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 +25 -32
- package/lib/client/core/schema/hooks/useSchemaPatch.js +4 -5
- 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/router/Application.js +6 -14
- 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.tsx +13 -29
- package/src/client/core/schema/components/header/Header.Designer.tsx +3 -3
- package/src/client/core/schema/components/header/Header.tsx +1 -2
- package/src/client/core/schema/components/menu/Menu.Item.tsx +10 -2
- package/src/client/core/schema/components/menu/Menu.tsx +7 -6
- package/src/client/core/schema/components/page/Page.tsx +3 -4
- 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 +8 -7
- package/src/client/core/schema/hooks/useSchemaPatch.ts +2 -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/router/Application.tsx +3 -3
- 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
|
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MTabBar = exports.InternalTabBar = void 0;
|
|
7
|
-
function _antdMobile() {
|
|
8
|
-
const data = require("antd-mobile");
|
|
9
|
-
_antdMobile = function _antdMobile() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _TabBar = require("./TabBar.Item");
|
|
15
7
|
function _react() {
|
|
16
|
-
const data =
|
|
8
|
+
const data = require("@formily/react");
|
|
17
9
|
_react = function _react() {
|
|
18
10
|
return data;
|
|
19
11
|
};
|
|
20
12
|
return data;
|
|
21
13
|
}
|
|
22
|
-
function
|
|
23
|
-
const data = require("@formily/
|
|
24
|
-
|
|
14
|
+
function _shared() {
|
|
15
|
+
const data = require("@formily/shared");
|
|
16
|
+
_shared = function _shared() {
|
|
25
17
|
return data;
|
|
26
18
|
};
|
|
27
19
|
return data;
|
|
@@ -33,17 +25,16 @@ function _client() {
|
|
|
33
25
|
};
|
|
34
26
|
return data;
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
_css = function _css() {
|
|
28
|
+
function _antdMobile() {
|
|
29
|
+
const data = require("antd-mobile");
|
|
30
|
+
_antdMobile = function _antdMobile() {
|
|
40
31
|
return data;
|
|
41
32
|
};
|
|
42
33
|
return data;
|
|
43
34
|
}
|
|
44
|
-
function
|
|
45
|
-
const data = require("
|
|
46
|
-
|
|
35
|
+
function _react2() {
|
|
36
|
+
const data = _interopRequireWildcard(require("react"));
|
|
37
|
+
_react2 = function _react2() {
|
|
47
38
|
return data;
|
|
48
39
|
};
|
|
49
40
|
return data;
|
|
@@ -55,8 +46,10 @@ function _reactRouterDom() {
|
|
|
55
46
|
};
|
|
56
47
|
return data;
|
|
57
48
|
}
|
|
58
|
-
var
|
|
49
|
+
var _locale = require("../../../../locale");
|
|
59
50
|
var _common = require("../../common");
|
|
51
|
+
var _schema = require("./schema");
|
|
52
|
+
var _TabBar = require("./TabBar.Item");
|
|
60
53
|
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); }
|
|
61
54
|
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; }
|
|
62
55
|
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; }
|
|
@@ -65,7 +58,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
65
58
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
66
59
|
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); }
|
|
67
60
|
const InternalTabBar = props => {
|
|
68
|
-
const fieldSchema = (0,
|
|
61
|
+
const fieldSchema = (0, _react().useFieldSchema)();
|
|
69
62
|
const _useDesignable = (0, _client().useDesignable)(),
|
|
70
63
|
designable = _useDesignable.designable;
|
|
71
64
|
const _useTranslation = (0, _locale.useTranslation)(),
|
|
@@ -75,7 +68,7 @@ const InternalTabBar = props => {
|
|
|
75
68
|
const navigate = (0, _reactRouterDom().useNavigate)();
|
|
76
69
|
const params = (0, _reactRouterDom().useParams)();
|
|
77
70
|
const compile = (0, _client().useCompile)();
|
|
78
|
-
const onAddTab = (0,
|
|
71
|
+
const onAddTab = (0, _react2().useCallback)(values => {
|
|
79
72
|
return insertBeforeEnd({
|
|
80
73
|
type: 'void',
|
|
81
74
|
'x-component': 'MTabBar.Item',
|
|
@@ -86,14 +79,14 @@ const InternalTabBar = props => {
|
|
|
86
79
|
}
|
|
87
80
|
});
|
|
88
81
|
}, []);
|
|
89
|
-
return
|
|
90
|
-
className: (0,
|
|
82
|
+
return _react2().default.createElement(_client().SortableItem, {
|
|
83
|
+
className: (0, _client().cx)('nb-mobile-tab-bar', (0, _client().css)`
|
|
91
84
|
position: relative;
|
|
92
85
|
width: 100%;
|
|
93
86
|
display: flex;
|
|
94
87
|
align-items: center;
|
|
95
88
|
`)
|
|
96
|
-
},
|
|
89
|
+
}, _react2().default.createElement(_client().DndContext, null, _react2().default.createElement(_antdMobile().TabBar, {
|
|
97
90
|
activeKey: params.name,
|
|
98
91
|
onChange: key => {
|
|
99
92
|
if (key === 'add-tab') {
|
|
@@ -102,28 +95,28 @@ const InternalTabBar = props => {
|
|
|
102
95
|
navigate(`/mobile/${key}`);
|
|
103
96
|
},
|
|
104
97
|
safeArea: true,
|
|
105
|
-
className: (0,
|
|
98
|
+
className: (0, _client().cx)((0, _client().css)`
|
|
106
99
|
width: 100%;
|
|
107
100
|
`)
|
|
108
101
|
}, fieldSchema.mapProperties((schema, name) => {
|
|
109
102
|
const cp = schema['x-component-props'];
|
|
110
|
-
return
|
|
103
|
+
return _react2().default.createElement(_antdMobile().TabBar.Item, _objectSpread(_objectSpread({}, cp), {}, {
|
|
111
104
|
key: `tab_${schema['x-uid']}`,
|
|
112
|
-
title:
|
|
105
|
+
title: _react2().default.createElement(_react2().default.Fragment, null, compile(cp.title), _react2().default.createElement(_client().SchemaComponent, {
|
|
113
106
|
schema: schema,
|
|
114
107
|
name: name
|
|
115
108
|
})),
|
|
116
|
-
icon: cp.icon ?
|
|
109
|
+
icon: cp.icon ? _react2().default.createElement(_client().Icon, {
|
|
117
110
|
type: cp.icon
|
|
118
111
|
}) : undefined
|
|
119
112
|
}));
|
|
120
|
-
}), designable && (!fieldSchema.properties || Object.keys(fieldSchema.properties).length < 5) ?
|
|
121
|
-
className: (0,
|
|
113
|
+
}), designable && (!fieldSchema.properties || Object.keys(fieldSchema.properties).length < 5) ? _react2().default.createElement(_antdMobile().TabBar.Item, {
|
|
114
|
+
className: (0, _client().css)`
|
|
122
115
|
.adm-tab-bar-item-icon {
|
|
123
116
|
height: auto;
|
|
124
117
|
}
|
|
125
118
|
`,
|
|
126
|
-
icon:
|
|
119
|
+
icon: _react2().default.createElement(_client().SchemaInitializer.ActionModal, {
|
|
127
120
|
title: t('Add tab'),
|
|
128
121
|
onSubmit: onAddTab,
|
|
129
122
|
schema: _schema.tabItemSchema
|
|
@@ -18,9 +18,9 @@ function _client() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _client2() {
|
|
22
|
+
const data = require("@nocobase/utils/client");
|
|
23
|
+
_client2 = function _client2() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -32,7 +32,6 @@ function _react2() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
35
|
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; }
|
|
37
36
|
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; }
|
|
38
37
|
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; }
|
|
@@ -44,7 +43,7 @@ const useSchemaPatch = () => {
|
|
|
44
43
|
const fieldSchema = (0, _react().useFieldSchema)();
|
|
45
44
|
const field = (0, _react().useField)();
|
|
46
45
|
const onUpdateComponentProps = (0, _react2().useCallback)(data => {
|
|
47
|
-
|
|
46
|
+
_client2().lodash.set(fieldSchema, 'x-component-props', data);
|
|
48
47
|
field.componentProps = _objectSpread(_objectSpread({}, field.componentProps), data);
|
|
49
48
|
dn.emit('patch', {
|
|
50
49
|
schema: {
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useGridCardBlockProps = exports.useGridCardBlockItemProps = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
var _InterfaceProvider = require("../../../router/InterfaceProvider");
|
|
15
|
-
const listCss = (0,
|
|
15
|
+
const listCss = (0, _client().css)`
|
|
16
16
|
padding: 0 var(--nb-spacing);
|
|
17
17
|
& > .nb-action-bar {
|
|
18
18
|
padding: unset !important;
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -21,7 +21,7 @@ function _react() {
|
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
const iOS6 = props => {
|
|
23
23
|
return _react().default.createElement("div", {
|
|
24
|
-
className: (0,
|
|
24
|
+
className: (0, _client().cx)('nb-mobile-device-ios6', (0, _client().css)(`
|
|
25
25
|
display: flex;
|
|
26
26
|
width: 375px;
|
|
27
27
|
height: 667px;
|
|
@@ -4,21 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MobileDevice = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_css = function _css() {
|
|
14
|
+
function _react() {
|
|
15
|
+
const data = _interopRequireDefault(require("react"));
|
|
16
|
+
_react = function _react() {
|
|
18
17
|
return data;
|
|
19
18
|
};
|
|
20
19
|
return data;
|
|
21
20
|
}
|
|
21
|
+
var _iOS = _interopRequireDefault(require("./iOS6"));
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
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; }
|
|
24
24
|
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; }
|
|
@@ -27,7 +27,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
27
27
|
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); }
|
|
28
28
|
const MobileDevice = props => {
|
|
29
29
|
return _react().default.createElement("div", {
|
|
30
|
-
className: (0,
|
|
30
|
+
className: (0, _client().cx)('nb-mobile-device-wrapper', (0, _client().css)`
|
|
31
31
|
width: 100%;
|
|
32
32
|
height: 100%;
|
|
33
33
|
display: flex;
|
|
@@ -35,7 +35,7 @@ const MobileDevice = props => {
|
|
|
35
35
|
align-items: center;
|
|
36
36
|
`)
|
|
37
37
|
}, _react().default.createElement(_iOS.default, _objectSpread({
|
|
38
|
-
className: (0,
|
|
38
|
+
className: (0, _client().css)`
|
|
39
39
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
|
|
40
40
|
`
|
|
41
41
|
}, props)));
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { Plugin, RouterManager } from '@nocobase/client';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
|
|
3
|
+
export declare class MobileClientPlugin extends Plugin {
|
|
4
|
+
mobileRouter: RouterManager;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
setMobileRouter(): void;
|
|
7
|
+
getMobileRouterComponent(): React.FC<{
|
|
8
|
+
BaseLayout?: React.ComponentType;
|
|
9
|
+
}>;
|
|
10
|
+
addRoutes(): void;
|
|
11
|
+
}
|
|
12
|
+
export default MobileClientPlugin;
|
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;
|
|
@@ -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 {
|
|
@@ -94,8 +87,8 @@ const modalProps = _objectSpread(_objectSpread({}, drawerProps), {}, {
|
|
|
94
87
|
maskStyle: {
|
|
95
88
|
position: 'absolute'
|
|
96
89
|
},
|
|
97
|
-
wrapClassName: (0,
|
|
98
|
-
position: absolute;
|
|
90
|
+
wrapClassName: (0, _client().css)`
|
|
91
|
+
position: absolute !important;
|
|
99
92
|
`
|
|
100
93
|
});
|
|
101
94
|
const useMobileSchemaUid = () => {
|
|
@@ -105,7 +98,6 @@ const useMobileSchemaUid = () => {
|
|
|
105
98
|
};
|
|
106
99
|
const MApplication = props => {
|
|
107
100
|
const mobileSchemaUid = useMobileSchemaUid();
|
|
108
|
-
console.log('mobileSchemaUid', mobileSchemaUid);
|
|
109
101
|
const params = (0, _reactRouterDom().useParams)();
|
|
110
102
|
const interfaceContext = (0, _InterfaceProvider.useInterfaceContext)();
|
|
111
103
|
const Provider = (0, _react().useMemo)(() => {
|
|
@@ -116,7 +108,7 @@ const MApplication = props => {
|
|
|
116
108
|
modalProps: modalProps,
|
|
117
109
|
drawerProps: drawerProps
|
|
118
110
|
}, _react().default.createElement("div", {
|
|
119
|
-
className: (0,
|
|
111
|
+
className: (0, _client().cx)('nb-mobile-application', commonDesignerCSS, commonCSSVariables, commonCSSOverride, (0, _client().css)`
|
|
120
112
|
display: flex;
|
|
121
113
|
flex-direction: column;
|
|
122
114
|
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.0-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.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",
|
|
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": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
|
|
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');
|