@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
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MPage = 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 _react() {
|
|
15
8
|
const data = require("@formily/react");
|
|
16
9
|
_react = function _react() {
|
|
@@ -41,6 +34,8 @@ function _reactRouterDom() {
|
|
|
41
34
|
}
|
|
42
35
|
var _helpers = require("../../helpers");
|
|
43
36
|
var _Page = require("./Page.Designer");
|
|
37
|
+
var _style = _interopRequireDefault(require("./style"));
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
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); }
|
|
45
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; }
|
|
46
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; }
|
|
@@ -54,20 +49,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
54
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; }
|
|
55
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; } }
|
|
56
51
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
|
-
const globalActionCSS = (0, _css().css)`
|
|
58
|
-
#nb-position-container > & {
|
|
59
|
-
height: 49px;
|
|
60
|
-
border-top: 1px solid #f0f2f5;
|
|
61
|
-
margin-bottom: 0px !important;
|
|
62
|
-
padding: 0 var(--nb-spacing);
|
|
63
|
-
align-items: center;
|
|
64
|
-
overflow-x: auto;
|
|
65
|
-
background: #ffffff;
|
|
66
|
-
z-index: 100;
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
52
|
const InternalPage = props => {
|
|
70
53
|
var _fieldSchema$properti, _tabsSchema$propertie;
|
|
54
|
+
const _useStyles = (0, _style.default)(),
|
|
55
|
+
styles = _useStyles.styles;
|
|
71
56
|
const Designer = (0, _client().useDesigner)();
|
|
72
57
|
const fieldSchema = (0, _react().useFieldSchema)();
|
|
73
58
|
const _useSearchParams = (0, _reactRouterDom().useSearchParams)(),
|
|
@@ -80,10 +65,10 @@ const InternalPage = props => {
|
|
|
80
65
|
let hasGlobalActions = false;
|
|
81
66
|
if (!tabsSchema && fieldSchema.properties) {
|
|
82
67
|
hasGlobalActions = (0, _helpers.countGridCol)(fieldSchema.properties['grid'], 2) === 1;
|
|
83
|
-
} else if (searchParams.has('tab') &&
|
|
68
|
+
} else if (searchParams.has('tab') && tabsSchema !== null && tabsSchema !== void 0 && (_tabsSchema$propertie = tabsSchema.properties) !== null && _tabsSchema$propertie !== void 0 && _tabsSchema$propertie[searchParams.get('tab')]) {
|
|
84
69
|
var _tabsSchema$propertie2, _tabsSchema$propertie3;
|
|
85
70
|
hasGlobalActions = (0, _helpers.countGridCol)((_tabsSchema$propertie2 = tabsSchema.properties[searchParams.get('tab')]) === null || _tabsSchema$propertie2 === void 0 ? void 0 : (_tabsSchema$propertie3 = _tabsSchema$propertie2.properties) === null || _tabsSchema$propertie3 === void 0 ? void 0 : _tabsSchema$propertie3['grid'], 2) === 1;
|
|
86
|
-
} else if (tabsSchema
|
|
71
|
+
} else if (tabsSchema !== null && tabsSchema !== void 0 && tabsSchema.properties) {
|
|
87
72
|
const schema = Object.values(tabsSchema.properties).sort((t1, t2) => t1['x-index'] - t2['x-index'])[0];
|
|
88
73
|
if (schema) {
|
|
89
74
|
setTimeout(() => {
|
|
@@ -104,7 +89,7 @@ const InternalPage = props => {
|
|
|
104
89
|
container: (typeof props.active !== 'undefined' ? props.active : true) && onlyInPage ? document.getElementById('nb-position-container') : null,
|
|
105
90
|
forceProps: {
|
|
106
91
|
layout: 'one-column',
|
|
107
|
-
className: globalActionCSS
|
|
92
|
+
className: styles.globalActionCSS
|
|
108
93
|
}
|
|
109
94
|
}, props.children));
|
|
110
95
|
}
|
|
@@ -112,31 +97,12 @@ const InternalPage = props => {
|
|
|
112
97
|
}, [hasGlobalActions, onlyInPage]);
|
|
113
98
|
return _react2().default.createElement(_client().SortableItem, {
|
|
114
99
|
eid: "nb-mobile-scroll-wrapper",
|
|
115
|
-
className: (0,
|
|
116
|
-
background: #f0f2f5;
|
|
117
|
-
display: flex;
|
|
118
|
-
flex-direction: column;
|
|
119
|
-
width: 100%;
|
|
120
|
-
height: 100%;
|
|
121
|
-
overflow-x: hidden;
|
|
122
|
-
overflow-y: auto;
|
|
123
|
-
padding-bottom: var(--nb-spacing);
|
|
124
|
-
`)
|
|
100
|
+
className: (0, _client().cx)('nb-mobile-page', styles.mobilePage)
|
|
125
101
|
}, _react2().default.createElement(Designer, _objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-designer-props'])), _react2().default.createElement("div", {
|
|
126
102
|
style: {
|
|
127
103
|
paddingBottom: tabsSchema ? null : 'var(--nb-spacing)'
|
|
128
104
|
},
|
|
129
|
-
className: (0,
|
|
130
|
-
& > .ant-tabs > .ant-tabs-nav {
|
|
131
|
-
.ant-tabs-tab {
|
|
132
|
-
margin: 0 !important;
|
|
133
|
-
padding: 0 16px !important;
|
|
134
|
-
}
|
|
135
|
-
background: #fff;
|
|
136
|
-
}
|
|
137
|
-
display: flex;
|
|
138
|
-
flex-direction: column;
|
|
139
|
-
`)
|
|
105
|
+
className: (0, _client().cx)('nb-mobile-page-header', styles.mobilePageHeader)
|
|
140
106
|
}, _react2().default.createElement(_react().RecursionField, {
|
|
141
107
|
schema: fieldSchema,
|
|
142
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;
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MSettings = exports.InternalSettings = 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() {
|
|
@@ -30,7 +23,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
30
23
|
const InternalSettings = () => {
|
|
31
24
|
const Designer = (0, _client().useDesigner)();
|
|
32
25
|
return _react().default.createElement(_client().SortableItem, {
|
|
33
|
-
className: (0,
|
|
26
|
+
className: (0, _client().cx)('nb-mobile-setting', (0, _client().css)`
|
|
34
27
|
margin-bottom: var(--nb-spacing);
|
|
35
28
|
`)
|
|
36
29
|
}, _react().default.createElement(Designer, null), _react().default.createElement(_client().SettingsMenu, {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TabBarItem = exports.Designer = void 0;
|
|
7
7
|
function _react() {
|
|
8
|
-
const data =
|
|
8
|
+
const data = require("@formily/react");
|
|
9
9
|
_react = function _react() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
@@ -18,52 +18,45 @@ function _client() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
var _locale = require("../../../../locale");
|
|
22
21
|
function _react2() {
|
|
23
|
-
const data = require("
|
|
22
|
+
const data = _interopRequireDefault(require("react"));
|
|
24
23
|
_react2 = function _react2() {
|
|
25
24
|
return data;
|
|
26
25
|
};
|
|
27
26
|
return data;
|
|
28
27
|
}
|
|
28
|
+
var _locale = require("../../../../locale");
|
|
29
29
|
var _hooks = require("../../hooks");
|
|
30
|
-
function _css() {
|
|
31
|
-
const data = require("@emotion/css");
|
|
32
|
-
_css = function _css() {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
30
|
var _schema = require("./schema");
|
|
38
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
32
|
const InternalItem = () => {
|
|
40
33
|
// NOTE: nothing to do
|
|
41
34
|
// return <TabBar.Item {...props}></TabBar.Item>;
|
|
42
35
|
const Designer = (0, _client().useDesigner)();
|
|
43
|
-
return
|
|
44
|
-
className: (0,
|
|
36
|
+
return _react2().default.createElement(_client().SortableItem, {
|
|
37
|
+
className: (0, _client().cx)('nb-mobile-tab-bar-item', (0, _client().css)`
|
|
45
38
|
position: absolute !important;
|
|
46
39
|
width: 100%;
|
|
47
40
|
height: 100%;
|
|
48
41
|
top: 0;
|
|
49
42
|
left: 0;
|
|
50
43
|
`)
|
|
51
|
-
},
|
|
44
|
+
}, _react2().default.createElement(Designer, null));
|
|
52
45
|
};
|
|
53
46
|
const Designer = () => {
|
|
54
47
|
const _useTranslation = (0, _locale.useTranslation)(),
|
|
55
48
|
t = _useTranslation.t;
|
|
56
|
-
const fieldSchema = (0,
|
|
49
|
+
const fieldSchema = (0, _react().useFieldSchema)();
|
|
57
50
|
const _useSchemaPatch = (0, _hooks.useSchemaPatch)(),
|
|
58
51
|
onUpdateComponentProps = _useSchemaPatch.onUpdateComponentProps;
|
|
59
|
-
const field = (0,
|
|
52
|
+
const field = (0, _react().useField)();
|
|
60
53
|
const tabItems = Object.keys(fieldSchema.parent.properties).length;
|
|
61
|
-
return
|
|
54
|
+
return _react2().default.createElement(_client().GeneralSchemaDesigner, null, _react2().default.createElement(_client().SchemaSettings.ModalItem, {
|
|
62
55
|
title: t('Edit info'),
|
|
63
56
|
initialValues: field.componentProps,
|
|
64
57
|
schema: _schema.tabItemSchema,
|
|
65
58
|
onSubmit: onUpdateComponentProps
|
|
66
|
-
}), tabItems > 1 ?
|
|
59
|
+
}), tabItems > 1 ? _react2().default.createElement(_client().SchemaSettings.Remove, {
|
|
67
60
|
key: "remove",
|
|
68
61
|
removeParentsIfNoChildren: true,
|
|
69
62
|
confirm: {
|
|
@@ -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',
|
|
@@ -83,17 +76,21 @@ const InternalTabBar = props => {
|
|
|
83
76
|
'x-designer': 'MTabBar.Item.Designer',
|
|
84
77
|
properties: {
|
|
85
78
|
[(0, _shared().uid)()]: _common.PageSchema
|
|
86
|
-
}
|
|
79
|
+
},
|
|
80
|
+
'x-server-hooks': [{
|
|
81
|
+
type: 'onSelfSave',
|
|
82
|
+
method: 'extractTextToLocale'
|
|
83
|
+
}]
|
|
87
84
|
});
|
|
88
85
|
}, []);
|
|
89
|
-
return
|
|
90
|
-
className: (0,
|
|
86
|
+
return _react2().default.createElement(_client().SortableItem, {
|
|
87
|
+
className: (0, _client().cx)('nb-mobile-tab-bar', (0, _client().css)`
|
|
91
88
|
position: relative;
|
|
92
89
|
width: 100%;
|
|
93
90
|
display: flex;
|
|
94
91
|
align-items: center;
|
|
95
92
|
`)
|
|
96
|
-
},
|
|
93
|
+
}, _react2().default.createElement(_client().DndContext, null, _react2().default.createElement(_antdMobile().TabBar, {
|
|
97
94
|
activeKey: params.name,
|
|
98
95
|
onChange: key => {
|
|
99
96
|
if (key === 'add-tab') {
|
|
@@ -102,28 +99,28 @@ const InternalTabBar = props => {
|
|
|
102
99
|
navigate(`/mobile/${key}`);
|
|
103
100
|
},
|
|
104
101
|
safeArea: true,
|
|
105
|
-
className: (0,
|
|
102
|
+
className: (0, _client().cx)((0, _client().css)`
|
|
106
103
|
width: 100%;
|
|
107
104
|
`)
|
|
108
105
|
}, fieldSchema.mapProperties((schema, name) => {
|
|
109
106
|
const cp = schema['x-component-props'];
|
|
110
|
-
return
|
|
107
|
+
return _react2().default.createElement(_antdMobile().TabBar.Item, _objectSpread(_objectSpread({}, cp), {}, {
|
|
111
108
|
key: `tab_${schema['x-uid']}`,
|
|
112
|
-
title:
|
|
109
|
+
title: _react2().default.createElement(_react2().default.Fragment, null, t(compile(cp.title)), _react2().default.createElement(_client().SchemaComponent, {
|
|
113
110
|
schema: schema,
|
|
114
111
|
name: name
|
|
115
112
|
})),
|
|
116
|
-
icon: cp.icon ?
|
|
113
|
+
icon: cp.icon ? _react2().default.createElement(_client().Icon, {
|
|
117
114
|
type: cp.icon
|
|
118
115
|
}) : undefined
|
|
119
116
|
}));
|
|
120
|
-
}), designable && (!fieldSchema.properties || Object.keys(fieldSchema.properties).length < 5) ?
|
|
121
|
-
className: (0,
|
|
117
|
+
}), designable && (!fieldSchema.properties || Object.keys(fieldSchema.properties).length < 5) ? _react2().default.createElement(_antdMobile().TabBar.Item, {
|
|
118
|
+
className: (0, _client().css)`
|
|
122
119
|
.adm-tab-bar-item-icon {
|
|
123
120
|
height: auto;
|
|
124
121
|
}
|
|
125
122
|
`,
|
|
126
|
-
icon:
|
|
123
|
+
icon: _react2().default.createElement(_client().SchemaInitializer.ActionModal, {
|
|
127
124
|
title: t('Add tab'),
|
|
128
125
|
onSubmit: onAddTab,
|
|
129
126
|
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,12 +43,16 @@ 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: {
|
|
51
50
|
['x-uid']: fieldSchema['x-uid'],
|
|
52
|
-
'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
|
+
}]
|
|
53
56
|
}
|
|
54
57
|
});
|
|
55
58
|
dn.refresh();
|
|
@@ -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;
|