@nocobase/plugin-mobile-client 0.10.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/client.d.ts +4 -0
  2. package/client.js +30 -0
  3. package/docs/en-US/index.md +7 -0
  4. package/docs/en-US/installation.md +13 -0
  5. package/docs/en-US/tabs.json +14 -0
  6. package/docs/en-US/usage.md +1 -0
  7. package/docs/zh-CN/index.md +7 -0
  8. package/docs/zh-CN/installation.md +13 -0
  9. package/docs/zh-CN/tabs.json +14 -0
  10. package/docs/zh-CN/usage.md +2 -0
  11. package/lib/client/configuration/App.d.ts +2 -0
  12. package/lib/client/configuration/App.js +40 -0
  13. package/lib/client/configuration/Interface.d.ts +2 -0
  14. package/lib/client/configuration/Interface.js +20 -0
  15. package/lib/client/configuration/index.d.ts +2 -0
  16. package/lib/client/configuration/index.js +27 -0
  17. package/lib/client/core/bridge/index.d.ts +2 -0
  18. package/lib/client/core/bridge/index.js +17 -0
  19. package/lib/client/core/bridge/injects.d.ts +13 -0
  20. package/lib/client/core/bridge/injects.js +13 -0
  21. package/lib/client/core/bridge/native-call.d.ts +1 -0
  22. package/lib/client/core/bridge/native-call.js +24 -0
  23. package/lib/client/core/index.d.ts +3 -0
  24. package/lib/client/core/index.js +46 -0
  25. package/lib/client/core/schema/common/index.d.ts +1 -0
  26. package/lib/client/core/schema/common/index.js +16 -0
  27. package/lib/client/core/schema/common/page.d.ts +16 -0
  28. package/lib/client/core/schema/common/page.js +23 -0
  29. package/lib/client/core/schema/components/container/Container.Designer.d.ts +2 -0
  30. package/lib/client/core/schema/components/container/Container.Designer.js +138 -0
  31. package/lib/client/core/schema/components/container/Container.d.ts +5 -0
  32. package/lib/client/core/schema/components/container/Container.js +150 -0
  33. package/lib/client/core/schema/components/container/index.d.ts +1 -0
  34. package/lib/client/core/schema/components/container/index.js +16 -0
  35. package/lib/client/core/schema/components/header/Header.Designer.d.ts +2 -0
  36. package/lib/client/core/schema/components/header/Header.Designer.js +72 -0
  37. package/lib/client/core/schema/components/header/Header.d.ts +10 -0
  38. package/lib/client/core/schema/components/header/Header.js +85 -0
  39. package/lib/client/core/schema/components/header/index.d.ts +1 -0
  40. package/lib/client/core/schema/components/header/index.js +16 -0
  41. package/lib/client/core/schema/components/index.d.ts +6 -0
  42. package/lib/client/core/schema/components/index.js +71 -0
  43. package/lib/client/core/schema/components/menu/Menu.Designer.d.ts +2 -0
  44. package/lib/client/core/schema/components/menu/Menu.Designer.js +81 -0
  45. package/lib/client/core/schema/components/menu/Menu.Item.d.ts +6 -0
  46. package/lib/client/core/schema/components/menu/Menu.Item.js +129 -0
  47. package/lib/client/core/schema/components/menu/Menu.d.ts +7 -0
  48. package/lib/client/core/schema/components/menu/Menu.js +88 -0
  49. package/lib/client/core/schema/components/menu/MenuBlockInitializer.d.ts +2 -0
  50. package/lib/client/core/schema/components/menu/MenuBlockInitializer.js +51 -0
  51. package/lib/client/core/schema/components/menu/index.d.ts +2 -0
  52. package/lib/client/core/schema/components/menu/index.js +27 -0
  53. package/lib/client/core/schema/components/menu/schema.d.ts +17 -0
  54. package/lib/client/core/schema/components/menu/schema.js +24 -0
  55. package/lib/client/core/schema/components/page/Page.Designer.d.ts +2 -0
  56. package/lib/client/core/schema/components/page/Page.Designer.js +160 -0
  57. package/lib/client/core/schema/components/page/Page.d.ts +5 -0
  58. package/lib/client/core/schema/components/page/Page.js +157 -0
  59. package/lib/client/core/schema/components/page/index.d.ts +1 -0
  60. package/lib/client/core/schema/components/page/index.js +16 -0
  61. package/lib/client/core/schema/components/settings/Settings.Designer.d.ts +2 -0
  62. package/lib/client/core/schema/components/settings/Settings.Designer.js +37 -0
  63. package/lib/client/core/schema/components/settings/Settings.d.ts +6 -0
  64. package/lib/client/core/schema/components/settings/Settings.js +43 -0
  65. package/lib/client/core/schema/components/settings/SettingsBlockInitializer.d.ts +2 -0
  66. package/lib/client/core/schema/components/settings/SettingsBlockInitializer.js +51 -0
  67. package/lib/client/core/schema/components/settings/index.d.ts +2 -0
  68. package/lib/client/core/schema/components/settings/index.js +27 -0
  69. package/lib/client/core/schema/components/tab-bar/TabBar.Item.d.ts +6 -0
  70. package/lib/client/core/schema/components/tab-bar/TabBar.Item.js +80 -0
  71. package/lib/client/core/schema/components/tab-bar/TabBar.d.ts +6 -0
  72. package/lib/client/core/schema/components/tab-bar/TabBar.js +138 -0
  73. package/lib/client/core/schema/components/tab-bar/index.d.ts +1 -0
  74. package/lib/client/core/schema/components/tab-bar/index.js +16 -0
  75. package/lib/client/core/schema/components/tab-bar/schema.d.ts +18 -0
  76. package/lib/client/core/schema/components/tab-bar/schema.js +25 -0
  77. package/lib/client/core/schema/helpers/index.d.ts +67 -0
  78. package/lib/client/core/schema/helpers/index.js +49 -0
  79. package/lib/client/core/schema/hooks/index.d.ts +1 -0
  80. package/lib/client/core/schema/hooks/index.js +16 -0
  81. package/lib/client/core/schema/hooks/useSchemaPatch.d.ts +3 -0
  82. package/lib/client/core/schema/hooks/useSchemaPatch.js +61 -0
  83. package/lib/client/core/schema/index.d.ts +3 -0
  84. package/lib/client/core/schema/index.js +38 -0
  85. package/lib/client/core/schema/initializers/BlockInitializers.d.ts +147 -0
  86. package/lib/client/core/schema/initializers/BlockInitializers.js +79 -0
  87. package/lib/client/core/schema/initializers/index.d.ts +1 -0
  88. package/lib/client/core/schema/initializers/index.js +16 -0
  89. package/lib/client/core/schema/scopes/grid-card.d.ts +15 -0
  90. package/lib/client/core/schema/scopes/grid-card.js +45 -0
  91. package/lib/client/core/schema/scopes/index.d.ts +1 -0
  92. package/lib/client/core/schema/scopes/index.js +16 -0
  93. package/lib/client/devices/iOS6.d.ts +5 -0
  94. package/lib/client/devices/iOS6.js +32 -0
  95. package/lib/client/devices/index.d.ts +2 -0
  96. package/lib/client/devices/index.js +43 -0
  97. package/lib/client/index.d.ts +3 -0
  98. package/lib/client/index.js +47 -0
  99. package/lib/client/locale/en-US.d.ts +2 -0
  100. package/lib/client/locale/en-US.js +9 -0
  101. package/lib/client/locale/index.d.ts +4 -0
  102. package/lib/client/locale/index.js +43 -0
  103. package/lib/client/locale/zh-CN.d.ts +32 -0
  104. package/lib/client/locale/zh-CN.js +39 -0
  105. package/lib/client/router/Application.d.ts +3 -0
  106. package/lib/client/router/Application.js +129 -0
  107. package/lib/client/router/InterfaceProvider.d.ts +4 -0
  108. package/lib/client/router/InterfaceProvider.js +29 -0
  109. package/lib/client/router/InterfaceRouter.d.ts +6 -0
  110. package/lib/client/router/InterfaceRouter.js +58 -0
  111. package/lib/client/router/RouteSwitchProvider.d.ts +2 -0
  112. package/lib/client/router/RouteSwitchProvider.js +59 -0
  113. package/lib/client/router/index.d.ts +2 -0
  114. package/lib/client/router/index.js +27 -0
  115. package/lib/index.d.ts +1 -0
  116. package/lib/index.js +13 -0
  117. package/lib/server/index.d.ts +1 -0
  118. package/lib/server/index.js +13 -0
  119. package/lib/server/plugin.d.ts +10 -0
  120. package/lib/server/plugin.js +57 -0
  121. package/lib/server/routes.d.ts +34 -0
  122. package/lib/server/routes.js +41 -0
  123. package/package.json +28 -0
  124. package/server.d.ts +4 -0
  125. package/server.js +30 -0
  126. package/src/client/configuration/App.tsx +23 -0
  127. package/src/client/configuration/Interface.tsx +11 -0
  128. package/src/client/configuration/index.ts +2 -0
  129. package/src/client/core/bridge/index.ts +2 -0
  130. package/src/client/core/bridge/injects.ts +14 -0
  131. package/src/client/core/bridge/native-call.ts +23 -0
  132. package/src/client/core/index.tsx +45 -0
  133. package/src/client/core/schema/common/index.ts +1 -0
  134. package/src/client/core/schema/common/page.ts +16 -0
  135. package/src/client/core/schema/components/container/Container.Designer.tsx +88 -0
  136. package/src/client/core/schema/components/container/Container.tsx +135 -0
  137. package/src/client/core/schema/components/container/index.ts +1 -0
  138. package/src/client/core/schema/components/header/Header.Designer.tsx +39 -0
  139. package/src/client/core/schema/components/header/Header.tsx +49 -0
  140. package/src/client/core/schema/components/header/index.ts +1 -0
  141. package/src/client/core/schema/components/index.ts +6 -0
  142. package/src/client/core/schema/components/menu/Menu.Designer.tsx +46 -0
  143. package/src/client/core/schema/components/menu/Menu.Item.tsx +97 -0
  144. package/src/client/core/schema/components/menu/Menu.tsx +82 -0
  145. package/src/client/core/schema/components/menu/MenuBlockInitializer.tsx +20 -0
  146. package/src/client/core/schema/components/menu/index.ts +2 -0
  147. package/src/client/core/schema/components/menu/schema.ts +17 -0
  148. package/src/client/core/schema/components/page/Page.Designer.tsx +106 -0
  149. package/src/client/core/schema/components/page/Page.tsx +132 -0
  150. package/src/client/core/schema/components/page/index.ts +1 -0
  151. package/src/client/core/schema/components/settings/Settings.Designer.tsx +22 -0
  152. package/src/client/core/schema/components/settings/Settings.tsx +25 -0
  153. package/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx +20 -0
  154. package/src/client/core/schema/components/settings/index.ts +2 -0
  155. package/src/client/core/schema/components/tab-bar/TabBar.Item.tsx +67 -0
  156. package/src/client/core/schema/components/tab-bar/TabBar.tsx +108 -0
  157. package/src/client/core/schema/components/tab-bar/index.ts +1 -0
  158. package/src/client/core/schema/components/tab-bar/schema.ts +18 -0
  159. package/src/client/core/schema/helpers/index.ts +38 -0
  160. package/src/client/core/schema/hooks/index.ts +1 -0
  161. package/src/client/core/schema/hooks/useSchemaPatch.ts +24 -0
  162. package/src/client/core/schema/index.ts +3 -0
  163. package/src/client/core/schema/initializers/BlockInitializers.ts +81 -0
  164. package/src/client/core/schema/initializers/index.ts +1 -0
  165. package/src/client/core/schema/scopes/grid-card.ts +35 -0
  166. package/src/client/core/schema/scopes/index.ts +1 -0
  167. package/src/client/devices/iOS6.tsx +24 -0
  168. package/src/client/devices/index.tsx +27 -0
  169. package/src/client/index.tsx +33 -0
  170. package/src/client/locale/en-US.ts +5 -0
  171. package/src/client/locale/index.ts +23 -0
  172. package/src/client/locale/zh-CN.ts +33 -0
  173. package/src/client/router/Application.tsx +114 -0
  174. package/src/client/router/InterfaceProvider.tsx +11 -0
  175. package/src/client/router/InterfaceRouter.tsx +48 -0
  176. package/src/client/router/RouteSwitchProvider.tsx +31 -0
  177. package/src/client/router/index.ts +2 -0
  178. package/src/index.ts +1 -0
  179. package/src/server/collections/.gitkeep +0 -0
  180. package/src/server/index.ts +1 -0
  181. package/src/server/plugin.ts +25 -0
  182. package/src/server/routes.ts +38 -0
  183. package/types.d.ts +0 -0
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MSettingsBlockInitializer = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function _react() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _icons() {
15
+ const data = require("@ant-design/icons");
16
+ _icons = function _icons() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _client() {
22
+ const data = require("@nocobase/client");
23
+ _client = function _client() {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ 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); } }
30
+ 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); }); }; }
31
+ const MSettingsBlockInitializer = props => {
32
+ const insert = props.insert;
33
+ return _react().default.createElement(_client().SchemaInitializer.Item, {
34
+ icon: _react().default.createElement(_icons().SettingOutlined, null),
35
+ onClick: function () {
36
+ var _onClick = _asyncToGenerator(function* () {
37
+ insert({
38
+ type: 'void',
39
+ 'x-component': 'MSettings',
40
+ 'x-designer': 'MSettings.Designer',
41
+ 'x-component-props': {}
42
+ });
43
+ });
44
+ function onClick() {
45
+ return _onClick.apply(this, arguments);
46
+ }
47
+ return onClick;
48
+ }()
49
+ });
50
+ };
51
+ exports.MSettingsBlockInitializer = MSettingsBlockInitializer;
@@ -0,0 +1,2 @@
1
+ export * from './Settings';
2
+ export * from './SettingsBlockInitializer';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Settings = require("./Settings");
7
+ Object.keys(_Settings).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Settings[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _Settings[key];
14
+ }
15
+ });
16
+ });
17
+ var _SettingsBlockInitializer = require("./SettingsBlockInitializer");
18
+ Object.keys(_SettingsBlockInitializer).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _SettingsBlockInitializer[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _SettingsBlockInitializer[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { TabBarItemProps } from 'antd-mobile';
3
+ export declare const Designer: () => React.JSX.Element;
4
+ export declare const TabBarItem: React.FC<TabBarItemProps> & {
5
+ Designer: typeof Designer;
6
+ };
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TabBarItem = exports.Designer = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function _react() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _client() {
15
+ const data = require("@nocobase/client");
16
+ _client = function _client() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ var _locale = require("../../../../locale");
22
+ function _react2() {
23
+ const data = require("@formily/react");
24
+ _react2 = function _react2() {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
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
+ var _schema = require("./schema");
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+ const InternalItem = () => {
40
+ // NOTE: nothing to do
41
+ // return <TabBar.Item {...props}></TabBar.Item>;
42
+ const Designer = (0, _client().useDesigner)();
43
+ return _react().default.createElement(_client().SortableItem, {
44
+ className: (0, _css().cx)('nb-mobile-tab-bar-item', (0, _css().css)`
45
+ position: absolute !important;
46
+ width: 100%;
47
+ height: 100%;
48
+ top: 0;
49
+ left: 0;
50
+ `)
51
+ }, _react().default.createElement(Designer, null));
52
+ };
53
+ const Designer = () => {
54
+ const _useTranslation = (0, _locale.useTranslation)(),
55
+ t = _useTranslation.t;
56
+ const fieldSchema = (0, _react2().useFieldSchema)();
57
+ const _useSchemaPatch = (0, _hooks.useSchemaPatch)(),
58
+ onUpdateComponentProps = _useSchemaPatch.onUpdateComponentProps;
59
+ const field = (0, _react2().useField)();
60
+ const tabItems = Object.keys(fieldSchema.parent.properties).length;
61
+ return _react().default.createElement(_client().GeneralSchemaDesigner, null, _react().default.createElement(_client().SchemaSettings.ModalItem, {
62
+ title: t('Edit info'),
63
+ initialValues: field.componentProps,
64
+ schema: _schema.tabItemSchema,
65
+ onSubmit: onUpdateComponentProps
66
+ }), tabItems > 1 ? _react().default.createElement(_client().SchemaSettings.Remove, {
67
+ key: "remove",
68
+ removeParentsIfNoChildren: true,
69
+ confirm: {
70
+ title: t('Delete tab item?')
71
+ },
72
+ breakRemoveOn: {
73
+ 'x-component': 'MTabBar'
74
+ }
75
+ }) : null);
76
+ };
77
+ exports.Designer = Designer;
78
+ const TabBarItem = InternalItem;
79
+ exports.TabBarItem = TabBarItem;
80
+ TabBarItem.Designer = Designer;
@@ -0,0 +1,6 @@
1
+ import { TabBarItem } from './TabBar.Item';
2
+ import React from 'react';
3
+ export declare const InternalTabBar: React.FC;
4
+ export declare const MTabBar: React.FC<{}> & {
5
+ Item: typeof TabBarItem;
6
+ };
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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
+ function _react() {
16
+ const data = _interopRequireWildcard(require("react"));
17
+ _react = function _react() {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ function _react2() {
23
+ const data = require("@formily/react");
24
+ _react2 = function _react2() {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
29
+ function _client() {
30
+ const data = require("@nocobase/client");
31
+ _client = function _client() {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
36
+ var _locale = require("../../../../locale");
37
+ function _css() {
38
+ const data = require("@emotion/css");
39
+ _css = function _css() {
40
+ return data;
41
+ };
42
+ return data;
43
+ }
44
+ function _shared() {
45
+ const data = require("@formily/shared");
46
+ _shared = function _shared() {
47
+ return data;
48
+ };
49
+ return data;
50
+ }
51
+ function _reactRouterDom() {
52
+ const data = require("react-router-dom");
53
+ _reactRouterDom = function _reactRouterDom() {
54
+ return data;
55
+ };
56
+ return data;
57
+ }
58
+ var _schema = require("./schema");
59
+ var _common = require("../../common");
60
+ 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
+ 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
+ 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; }
63
+ 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; }
64
+ 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; }
65
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
66
+ 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
+ const InternalTabBar = props => {
68
+ const fieldSchema = (0, _react2().useFieldSchema)();
69
+ const _useDesignable = (0, _client().useDesignable)(),
70
+ designable = _useDesignable.designable;
71
+ const _useTranslation = (0, _locale.useTranslation)(),
72
+ t = _useTranslation.t;
73
+ const _useDesignable2 = (0, _client().useDesignable)(),
74
+ insertBeforeEnd = _useDesignable2.insertBeforeEnd;
75
+ const navigate = (0, _reactRouterDom().useNavigate)();
76
+ const params = (0, _reactRouterDom().useParams)();
77
+ const compile = (0, _client().useCompile)();
78
+ const onAddTab = (0, _react().useCallback)(values => {
79
+ return insertBeforeEnd({
80
+ type: 'void',
81
+ 'x-component': 'MTabBar.Item',
82
+ 'x-component-props': values,
83
+ 'x-designer': 'MTabBar.Item.Designer',
84
+ properties: {
85
+ [(0, _shared().uid)()]: _common.PageSchema
86
+ }
87
+ });
88
+ }, []);
89
+ return _react().default.createElement(_client().SortableItem, {
90
+ className: (0, _css().cx)('nb-mobile-tab-bar', (0, _css().css)`
91
+ position: relative;
92
+ width: 100%;
93
+ display: flex;
94
+ align-items: center;
95
+ `)
96
+ }, _react().default.createElement(_client().DndContext, null, _react().default.createElement(_antdMobile().TabBar, {
97
+ activeKey: params.name,
98
+ onChange: key => {
99
+ if (key === 'add-tab') {
100
+ return;
101
+ }
102
+ navigate(`/mobile/${key}`);
103
+ },
104
+ safeArea: true,
105
+ className: (0, _css().cx)((0, _css().css)`
106
+ width: 100%;
107
+ `)
108
+ }, fieldSchema.mapProperties((schema, name) => {
109
+ const cp = schema['x-component-props'];
110
+ return _react().default.createElement(_antdMobile().TabBar.Item, _objectSpread(_objectSpread({}, cp), {}, {
111
+ key: `tab_${schema['x-uid']}`,
112
+ title: _react().default.createElement(_react().default.Fragment, null, compile(cp.title), _react().default.createElement(_client().SchemaComponent, {
113
+ schema: schema,
114
+ name: name
115
+ })),
116
+ icon: cp.icon ? _react().default.createElement(_client().Icon, {
117
+ type: cp.icon
118
+ }) : undefined
119
+ }));
120
+ }), designable && (!fieldSchema.properties || Object.keys(fieldSchema.properties).length < 5) ? _react().default.createElement(_antdMobile().TabBar.Item, {
121
+ className: (0, _css().css)`
122
+ .adm-tab-bar-item-icon {
123
+ height: auto;
124
+ }
125
+ `,
126
+ icon: _react().default.createElement(_client().SchemaInitializer.ActionModal, {
127
+ title: t('Add tab'),
128
+ onSubmit: onAddTab,
129
+ schema: _schema.tabItemSchema
130
+ }),
131
+ key: "add-tab"
132
+ }) : null)));
133
+ };
134
+ exports.InternalTabBar = InternalTabBar;
135
+ const MTabBar = InternalTabBar;
136
+ exports.MTabBar = MTabBar;
137
+ MTabBar.Item = _TabBar.TabBarItem;
138
+ MTabBar.displayName = 'MTabBar';
@@ -0,0 +1 @@
1
+ export * from './TabBar';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _TabBar = require("./TabBar");
7
+ Object.keys(_TabBar).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _TabBar[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _TabBar[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,18 @@
1
+ export declare const tabItemSchema: {
2
+ properties: {
3
+ title: {
4
+ type: string;
5
+ title: string;
6
+ required: boolean;
7
+ 'x-component': string;
8
+ 'x-decorator': string;
9
+ };
10
+ icon: {
11
+ required: boolean;
12
+ 'x-decorator': string;
13
+ 'x-component': string;
14
+ title: string;
15
+ 'x-component-props': {};
16
+ };
17
+ };
18
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tabItemSchema = void 0;
7
+ const tabItemSchema = {
8
+ properties: {
9
+ title: {
10
+ type: 'string',
11
+ title: `{{ t('Title') }}`,
12
+ required: true,
13
+ 'x-component': 'Input',
14
+ 'x-decorator': 'FormItem'
15
+ },
16
+ icon: {
17
+ required: true,
18
+ 'x-decorator': 'FormItem',
19
+ 'x-component': 'IconPicker',
20
+ title: `{{ t('Icon') }}`,
21
+ 'x-component-props': {}
22
+ }
23
+ }
24
+ };
25
+ exports.tabItemSchema = tabItemSchema;
@@ -0,0 +1,67 @@
1
+ import { ISchema, Schema } from '@formily/react';
2
+ export declare const gridItemWrap: (schema: ISchema) => {
3
+ type: string;
4
+ 'x-component': string;
5
+ properties: {
6
+ [x: string]: import("@formily/react").Stringify<{
7
+ [key: symbol]: any;
8
+ [key: `x-${string}`]: any;
9
+ [key: `x-${number}`]: any;
10
+ version?: string;
11
+ name?: import("@formily/react").SchemaKey;
12
+ title?: any;
13
+ description?: any;
14
+ default?: any;
15
+ readOnly?: boolean;
16
+ writeOnly?: boolean;
17
+ type?: import("@formily/react").SchemaTypes;
18
+ enum?: import("@formily/react").SchemaEnum<any>;
19
+ const?: any;
20
+ multipleOf?: number;
21
+ maximum?: number;
22
+ exclusiveMaximum?: number;
23
+ minimum?: number;
24
+ exclusiveMinimum?: number;
25
+ maxLength?: number;
26
+ minLength?: number;
27
+ pattern?: string | RegExp;
28
+ maxItems?: number;
29
+ minItems?: number;
30
+ uniqueItems?: boolean;
31
+ maxProperties?: number;
32
+ minProperties?: number;
33
+ required?: string | boolean | string[];
34
+ format?: string;
35
+ $ref?: string;
36
+ $namespace?: string;
37
+ definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
38
+ properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
39
+ items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
40
+ additionalItems?: import("@formily/react").Stringify<any>;
41
+ patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
42
+ additionalProperties?: import("@formily/react").Stringify<any>;
43
+ "x-value"?: any;
44
+ "x-index"?: number;
45
+ "x-pattern"?: any;
46
+ "x-display"?: any;
47
+ "x-validator"?: any;
48
+ "x-decorator"?: any;
49
+ "x-decorator-props"?: any;
50
+ "x-component"?: any;
51
+ "x-component-props"?: any;
52
+ "x-reactions"?: import("@formily/react").SchemaReactions<any>;
53
+ "x-content"?: any;
54
+ "x-data"?: any;
55
+ "x-visible"?: boolean;
56
+ "x-hidden"?: boolean;
57
+ "x-disabled"?: boolean;
58
+ "x-editable"?: boolean;
59
+ "x-read-only"?: boolean;
60
+ "x-read-pretty"?: boolean;
61
+ "x-compile-omitted"?: string[];
62
+ }>;
63
+ };
64
+ };
65
+ export declare const findSchema: (schema: Schema, component: string) => Schema<any, any, any, any, any, any, any, any, any>;
66
+ export declare const findGridSchema: (schema: Schema) => Schema<any, any, any, any, any, any, any, any, any>;
67
+ export declare const countGridCol: (schema: Schema, countToStop?: number) => number;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.gridItemWrap = exports.findSchema = exports.findGridSchema = exports.countGridCol = void 0;
7
+ function _shared() {
8
+ const data = require("@formily/shared");
9
+ _shared = function _shared() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const gridItemWrap = schema => {
15
+ return {
16
+ type: 'void',
17
+ 'x-component': 'MGrid.Item',
18
+ properties: {
19
+ [schema.name || (0, _shared().uid)()]: schema
20
+ }
21
+ };
22
+ };
23
+ exports.gridItemWrap = gridItemWrap;
24
+ const findSchema = (schema, component) => {
25
+ const gridSchema = schema.reduceProperties((schema, next) => schema || next['x-component'] === component && next);
26
+ return gridSchema;
27
+ };
28
+ exports.findSchema = findSchema;
29
+ const findGridSchema = schema => {
30
+ return findSchema(schema, 'Grid');
31
+ };
32
+ exports.findGridSchema = findGridSchema;
33
+ const allowComponents = ['Grid', 'Grid.Row'];
34
+ const plusComponent = ['Grid.Col'];
35
+ const countGridCol = (schema, countToStop) => {
36
+ if (!schema) return 0;
37
+ let count = 0;
38
+ if (plusComponent.includes(schema['x-component'])) {
39
+ count += 1;
40
+ }
41
+ if (typeof countToStop === 'number' && count >= countToStop) return count;
42
+ if (allowComponents.includes(schema['x-component'])) {
43
+ schema.mapProperties(schema => {
44
+ count += countGridCol(schema, countToStop);
45
+ });
46
+ }
47
+ return count;
48
+ };
49
+ exports.countGridCol = countGridCol;
@@ -0,0 +1 @@
1
+ export * from './useSchemaPatch';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useSchemaPatch = require("./useSchemaPatch");
7
+ Object.keys(_useSchemaPatch).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useSchemaPatch[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _useSchemaPatch[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ export declare const useSchemaPatch: () => {
2
+ onUpdateComponentProps: (data: any) => void;
3
+ };
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSchemaPatch = void 0;
7
+ function _react() {
8
+ const data = require("@formily/react");
9
+ _react = function _react() {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _client() {
15
+ const data = require("@nocobase/client");
16
+ _client = function _client() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _lodash() {
22
+ const data = _interopRequireDefault(require("lodash"));
23
+ _lodash = function _lodash() {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _react2() {
29
+ const data = require("react");
30
+ _react2 = function _react2() {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
+ 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
+ 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
+ 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; }
39
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
40
+ 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); }
41
+ const useSchemaPatch = () => {
42
+ const _useDesignable = (0, _client().useDesignable)(),
43
+ dn = _useDesignable.dn;
44
+ const fieldSchema = (0, _react().useFieldSchema)();
45
+ const field = (0, _react().useField)();
46
+ const onUpdateComponentProps = (0, _react2().useCallback)(data => {
47
+ _lodash().default.set(fieldSchema, 'x-component-props', data);
48
+ field.componentProps = _objectSpread(_objectSpread({}, field.componentProps), data);
49
+ dn.emit('patch', {
50
+ schema: {
51
+ ['x-uid']: fieldSchema['x-uid'],
52
+ 'x-component-props': fieldSchema['x-component-props']
53
+ }
54
+ });
55
+ dn.refresh();
56
+ }, []);
57
+ return {
58
+ onUpdateComponentProps
59
+ };
60
+ };
61
+ exports.useSchemaPatch = useSchemaPatch;
@@ -0,0 +1,3 @@
1
+ export * from './initializers';
2
+ export * from './components';
3
+ export * from './scopes';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _initializers = require("./initializers");
7
+ Object.keys(_initializers).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _initializers[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _initializers[key];
14
+ }
15
+ });
16
+ });
17
+ var _components = require("./components");
18
+ Object.keys(_components).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _components[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _components[key];
25
+ }
26
+ });
27
+ });
28
+ var _scopes = require("./scopes");
29
+ Object.keys(_scopes).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _scopes[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _scopes[key];
36
+ }
37
+ });
38
+ });