@nocobase/plugin-mobile-client 0.11.1-alpha.5 → 0.12.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.
Files changed (206) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -1
  3. package/dist/client/index.js +2465 -0
  4. package/{lib → dist}/index.d.ts +1 -0
  5. package/dist/index.js +18 -0
  6. package/dist/locale/en-US.js +6 -0
  7. package/dist/locale/fr-FR.js +6 -0
  8. package/dist/locale/zh-CN.js +36 -0
  9. package/dist/server/index.js +11 -0
  10. package/dist/server/migrations/20230620203218-mobile-ui-schema-uid.js +33 -0
  11. package/dist/server/plugin.js +68 -0
  12. package/dist/server/routes.js +42 -0
  13. package/docs/en-US/index.md +7 -0
  14. package/docs/en-US/installation.md +13 -0
  15. package/docs/en-US/tabs.json +14 -0
  16. package/docs/en-US/usage.md +1 -0
  17. package/docs/zh-CN/index.md +7 -0
  18. package/docs/zh-CN/installation.md +13 -0
  19. package/docs/zh-CN/tabs.json +14 -0
  20. package/docs/zh-CN/usage.md +2 -0
  21. package/package.json +16 -27
  22. package/server.d.ts +2 -3
  23. package/server.js +1 -1
  24. package/lib/client/MobileClientProvider.js +0 -64
  25. package/lib/client/configuration/App.js +0 -40
  26. package/lib/client/configuration/Interface.js +0 -20
  27. package/lib/client/configuration/index.js +0 -27
  28. package/lib/client/core/bridge/index.js +0 -17
  29. package/lib/client/core/bridge/injects.js +0 -13
  30. package/lib/client/core/bridge/native-call.js +0 -24
  31. package/lib/client/core/index.js +0 -46
  32. package/lib/client/core/schema/common/index.js +0 -16
  33. package/lib/client/core/schema/common/page.js +0 -23
  34. package/lib/client/core/schema/components/container/Container.Designer.js +0 -139
  35. package/lib/client/core/schema/components/container/Container.js +0 -119
  36. package/lib/client/core/schema/components/container/index.js +0 -16
  37. package/lib/client/core/schema/components/container/style.js +0 -48
  38. package/lib/client/core/schema/components/header/Header.Designer.js +0 -72
  39. package/lib/client/core/schema/components/header/Header.js +0 -86
  40. package/lib/client/core/schema/components/header/index.js +0 -16
  41. package/lib/client/core/schema/components/index.js +0 -71
  42. package/lib/client/core/schema/components/menu/Menu.Designer.js +0 -81
  43. package/lib/client/core/schema/components/menu/Menu.Item.js +0 -106
  44. package/lib/client/core/schema/components/menu/Menu.js +0 -80
  45. package/lib/client/core/schema/components/menu/MenuBlockInitializer.js +0 -51
  46. package/lib/client/core/schema/components/menu/index.js +0 -27
  47. package/lib/client/core/schema/components/menu/schema.js +0 -25
  48. package/lib/client/core/schema/components/menu/style.js +0 -34
  49. package/lib/client/core/schema/components/page/Page.Designer.js +0 -161
  50. package/lib/client/core/schema/components/page/Page.js +0 -130
  51. package/lib/client/core/schema/components/page/index.js +0 -16
  52. package/lib/client/core/schema/components/page/style.js +0 -55
  53. package/lib/client/core/schema/components/settings/Settings.Designer.js +0 -37
  54. package/lib/client/core/schema/components/settings/Settings.js +0 -36
  55. package/lib/client/core/schema/components/settings/SettingsBlockInitializer.js +0 -51
  56. package/lib/client/core/schema/components/settings/index.js +0 -27
  57. package/lib/client/core/schema/components/tab-bar/TabBar.Item.js +0 -73
  58. package/lib/client/core/schema/components/tab-bar/TabBar.js +0 -135
  59. package/lib/client/core/schema/components/tab-bar/index.js +0 -16
  60. package/lib/client/core/schema/components/tab-bar/schema.js +0 -25
  61. package/lib/client/core/schema/helpers/index.js +0 -49
  62. package/lib/client/core/schema/hooks/index.js +0 -16
  63. package/lib/client/core/schema/hooks/useSchemaPatch.js +0 -64
  64. package/lib/client/core/schema/index.js +0 -38
  65. package/lib/client/core/schema/initializers/BlockInitializers.js +0 -79
  66. package/lib/client/core/schema/initializers/index.js +0 -16
  67. package/lib/client/core/schema/scopes/grid-card.js +0 -45
  68. package/lib/client/core/schema/scopes/index.js +0 -16
  69. package/lib/client/devices/iOS6.js +0 -32
  70. package/lib/client/devices/index.js +0 -43
  71. package/lib/client/index.js +0 -83
  72. package/lib/client/locale/index.js +0 -40
  73. package/lib/client/router/Application.js +0 -128
  74. package/lib/client/router/InterfaceProvider.js +0 -29
  75. package/lib/client/router/InterfaceRouter.js +0 -30
  76. package/lib/client/router/index.js +0 -16
  77. package/lib/index.js +0 -13
  78. package/lib/locale/en-US.js +0 -9
  79. package/lib/locale/fr-FR.js +0 -9
  80. package/lib/locale/zh-CN.js +0 -39
  81. package/lib/server/index.js +0 -13
  82. package/lib/server/migrations/20230620203218-mobile-ui-schema-uid.js +0 -59
  83. package/lib/server/plugin.js +0 -102
  84. package/lib/server/routes.js +0 -41
  85. package/src/client/MobileClientProvider.tsx +0 -41
  86. package/src/client/configuration/App.tsx +0 -23
  87. package/src/client/configuration/Interface.tsx +0 -11
  88. package/src/client/configuration/index.ts +0 -2
  89. package/src/client/core/bridge/index.ts +0 -2
  90. package/src/client/core/bridge/injects.ts +0 -15
  91. package/src/client/core/bridge/native-call.ts +0 -23
  92. package/src/client/core/index.tsx +0 -45
  93. package/src/client/core/schema/common/index.ts +0 -1
  94. package/src/client/core/schema/common/page.ts +0 -16
  95. package/src/client/core/schema/components/container/Container.Designer.tsx +0 -89
  96. package/src/client/core/schema/components/container/Container.tsx +0 -89
  97. package/src/client/core/schema/components/container/index.ts +0 -1
  98. package/src/client/core/schema/components/container/style.ts +0 -35
  99. package/src/client/core/schema/components/header/Header.Designer.tsx +0 -39
  100. package/src/client/core/schema/components/header/Header.tsx +0 -49
  101. package/src/client/core/schema/components/header/index.ts +0 -1
  102. package/src/client/core/schema/components/index.ts +0 -6
  103. package/src/client/core/schema/components/menu/Menu.Designer.tsx +0 -46
  104. package/src/client/core/schema/components/menu/Menu.Item.tsx +0 -89
  105. package/src/client/core/schema/components/menu/Menu.tsx +0 -75
  106. package/src/client/core/schema/components/menu/MenuBlockInitializer.tsx +0 -20
  107. package/src/client/core/schema/components/menu/index.ts +0 -2
  108. package/src/client/core/schema/components/menu/schema.ts +0 -19
  109. package/src/client/core/schema/components/menu/style.ts +0 -20
  110. package/src/client/core/schema/components/page/Page.Designer.tsx +0 -107
  111. package/src/client/core/schema/components/page/Page.tsx +0 -115
  112. package/src/client/core/schema/components/page/index.ts +0 -1
  113. package/src/client/core/schema/components/page/style.ts +0 -43
  114. package/src/client/core/schema/components/settings/Settings.Designer.tsx +0 -22
  115. package/src/client/core/schema/components/settings/Settings.tsx +0 -24
  116. package/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx +0 -20
  117. package/src/client/core/schema/components/settings/index.ts +0 -2
  118. package/src/client/core/schema/components/tab-bar/TabBar.Item.tsx +0 -66
  119. package/src/client/core/schema/components/tab-bar/TabBar.tsx +0 -115
  120. package/src/client/core/schema/components/tab-bar/index.ts +0 -1
  121. package/src/client/core/schema/components/tab-bar/schema.ts +0 -18
  122. package/src/client/core/schema/helpers/index.ts +0 -38
  123. package/src/client/core/schema/hooks/index.ts +0 -1
  124. package/src/client/core/schema/hooks/useSchemaPatch.ts +0 -30
  125. package/src/client/core/schema/index.ts +0 -3
  126. package/src/client/core/schema/initializers/BlockInitializers.ts +0 -81
  127. package/src/client/core/schema/initializers/index.ts +0 -1
  128. package/src/client/core/schema/scopes/grid-card.ts +0 -35
  129. package/src/client/core/schema/scopes/index.ts +0 -1
  130. package/src/client/devices/iOS6.tsx +0 -24
  131. package/src/client/devices/index.tsx +0 -27
  132. package/src/client/index.tsx +0 -48
  133. package/src/client/locale/index.ts +0 -21
  134. package/src/client/router/Application.tsx +0 -128
  135. package/src/client/router/InterfaceProvider.tsx +0 -11
  136. package/src/client/router/InterfaceRouter.tsx +0 -16
  137. package/src/client/router/index.ts +0 -1
  138. package/src/index.ts +0 -1
  139. package/src/locale/en-US.ts +0 -3
  140. package/src/locale/fr-FR.ts +0 -3
  141. package/src/locale/zh-CN.ts +0 -33
  142. package/src/server/collections/.gitkeep +0 -0
  143. package/src/server/index.ts +0 -1
  144. package/src/server/migrations/20230620203218-mobile-ui-schema-uid.ts +0 -29
  145. package/src/server/plugin.ts +0 -63
  146. package/src/server/routes.ts +0 -38
  147. /package/{lib → dist}/client/MobileClientProvider.d.ts +0 -0
  148. /package/{lib → dist}/client/configuration/App.d.ts +0 -0
  149. /package/{lib → dist}/client/configuration/Interface.d.ts +0 -0
  150. /package/{lib → dist}/client/configuration/index.d.ts +0 -0
  151. /package/{lib → dist}/client/core/bridge/index.d.ts +0 -0
  152. /package/{lib → dist}/client/core/bridge/injects.d.ts +0 -0
  153. /package/{lib → dist}/client/core/bridge/native-call.d.ts +0 -0
  154. /package/{lib → dist}/client/core/index.d.ts +0 -0
  155. /package/{lib → dist}/client/core/schema/common/index.d.ts +0 -0
  156. /package/{lib → dist}/client/core/schema/common/page.d.ts +0 -0
  157. /package/{lib → dist}/client/core/schema/components/container/Container.Designer.d.ts +0 -0
  158. /package/{lib → dist}/client/core/schema/components/container/Container.d.ts +0 -0
  159. /package/{lib → dist}/client/core/schema/components/container/index.d.ts +0 -0
  160. /package/{lib → dist}/client/core/schema/components/container/style.d.ts +0 -0
  161. /package/{lib → dist}/client/core/schema/components/header/Header.Designer.d.ts +0 -0
  162. /package/{lib → dist}/client/core/schema/components/header/Header.d.ts +0 -0
  163. /package/{lib → dist}/client/core/schema/components/header/index.d.ts +0 -0
  164. /package/{lib → dist}/client/core/schema/components/index.d.ts +0 -0
  165. /package/{lib → dist}/client/core/schema/components/menu/Menu.Designer.d.ts +0 -0
  166. /package/{lib → dist}/client/core/schema/components/menu/Menu.Item.d.ts +0 -0
  167. /package/{lib → dist}/client/core/schema/components/menu/Menu.d.ts +0 -0
  168. /package/{lib → dist}/client/core/schema/components/menu/MenuBlockInitializer.d.ts +0 -0
  169. /package/{lib → dist}/client/core/schema/components/menu/index.d.ts +0 -0
  170. /package/{lib → dist}/client/core/schema/components/menu/schema.d.ts +0 -0
  171. /package/{lib → dist}/client/core/schema/components/menu/style.d.ts +0 -0
  172. /package/{lib → dist}/client/core/schema/components/page/Page.Designer.d.ts +0 -0
  173. /package/{lib → dist}/client/core/schema/components/page/Page.d.ts +0 -0
  174. /package/{lib → dist}/client/core/schema/components/page/index.d.ts +0 -0
  175. /package/{lib → dist}/client/core/schema/components/page/style.d.ts +0 -0
  176. /package/{lib → dist}/client/core/schema/components/settings/Settings.Designer.d.ts +0 -0
  177. /package/{lib → dist}/client/core/schema/components/settings/Settings.d.ts +0 -0
  178. /package/{lib → dist}/client/core/schema/components/settings/SettingsBlockInitializer.d.ts +0 -0
  179. /package/{lib → dist}/client/core/schema/components/settings/index.d.ts +0 -0
  180. /package/{lib → dist}/client/core/schema/components/tab-bar/TabBar.Item.d.ts +0 -0
  181. /package/{lib → dist}/client/core/schema/components/tab-bar/TabBar.d.ts +0 -0
  182. /package/{lib → dist}/client/core/schema/components/tab-bar/index.d.ts +0 -0
  183. /package/{lib → dist}/client/core/schema/components/tab-bar/schema.d.ts +0 -0
  184. /package/{lib → dist}/client/core/schema/helpers/index.d.ts +0 -0
  185. /package/{lib → dist}/client/core/schema/hooks/index.d.ts +0 -0
  186. /package/{lib → dist}/client/core/schema/hooks/useSchemaPatch.d.ts +0 -0
  187. /package/{lib → dist}/client/core/schema/index.d.ts +0 -0
  188. /package/{lib → dist}/client/core/schema/initializers/BlockInitializers.d.ts +0 -0
  189. /package/{lib → dist}/client/core/schema/initializers/index.d.ts +0 -0
  190. /package/{lib → dist}/client/core/schema/scopes/grid-card.d.ts +0 -0
  191. /package/{lib → dist}/client/core/schema/scopes/index.d.ts +0 -0
  192. /package/{lib → dist}/client/devices/iOS6.d.ts +0 -0
  193. /package/{lib → dist}/client/devices/index.d.ts +0 -0
  194. /package/{lib → dist}/client/index.d.ts +0 -0
  195. /package/{lib → dist}/client/locale/index.d.ts +0 -0
  196. /package/{lib → dist}/client/router/Application.d.ts +0 -0
  197. /package/{lib → dist}/client/router/InterfaceProvider.d.ts +0 -0
  198. /package/{lib → dist}/client/router/InterfaceRouter.d.ts +0 -0
  199. /package/{lib → dist}/client/router/index.d.ts +0 -0
  200. /package/{lib → dist}/locale/en-US.d.ts +0 -0
  201. /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
  202. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  203. /package/{lib → dist}/server/index.d.ts +0 -0
  204. /package/{lib → dist}/server/migrations/20230620203218-mobile-ui-schema-uid.d.ts +0 -0
  205. /package/{lib → dist}/server/plugin.d.ts +0 -0
  206. /package/{lib → dist}/server/routes.d.ts +0 -0
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- function _server() {
8
- const data = require("@nocobase/server");
9
- _server = function _server() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
15
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
- 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; }
17
- 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); } }
18
- 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); }); }; }
19
- class _default extends _server().Migration {
20
- up() {
21
- var _this = this;
22
- return _asyncToGenerator(function* () {
23
- var _instance, _instance$options, _instance2, _instance2$options;
24
- const systemSettings = _this.db.getRepository('systemSettings');
25
- let instance = yield systemSettings.findOne();
26
- if ((_instance = instance) !== null && _instance !== void 0 && (_instance$options = _instance.options) !== null && _instance$options !== void 0 && _instance$options.mobileSchemaUid) {
27
- return;
28
- }
29
- const uiRoutes = _this.db.getRepository('uiRoutes');
30
- const routes = yield uiRoutes.find();
31
- var _iterator = _createForOfIteratorHelper(routes),
32
- _step;
33
- try {
34
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
35
- var _route$options;
36
- const route = _step.value;
37
- if (route.uiSchemaUid && (route === null || route === void 0 ? void 0 : (_route$options = route.options) === null || _route$options === void 0 ? void 0 : _route$options.component) === 'MApplication') {
38
- const options = instance.options || {};
39
- options['mobileSchemaUid'] = route.uiSchemaUid;
40
- instance.set('options', options);
41
- instance.changed('options', true);
42
- yield instance.save();
43
- return;
44
- }
45
- }
46
- } catch (err) {
47
- _iterator.e(err);
48
- } finally {
49
- _iterator.f();
50
- }
51
- instance = yield systemSettings.findOne();
52
- if (!((_instance2 = instance) !== null && _instance2 !== void 0 && (_instance2$options = _instance2.options) !== null && _instance2$options !== void 0 && _instance2$options.mobileSchemaUid)) {
53
- throw new Error('mobileSchemaUid invalid');
54
- }
55
- _this.app.log.info('systemSettings.options', instance.toJSON());
56
- })();
57
- }
58
- }
59
- exports.default = _default;
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.MobileClientPlugin = void 0;
7
- function _server() {
8
- const data = require("@nocobase/server");
9
- _server = function _server() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _path() {
15
- const data = require("path");
16
- _path = function _path() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- var _routes = require("./routes");
22
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
23
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
24
- 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; }
25
- 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); } }
26
- 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); }); }; }
27
- class MobileClientPlugin extends _server().Plugin {
28
- afterAdd() {}
29
- load() {
30
- var _this = this;
31
- return _asyncToGenerator(function* () {
32
- _this.db.addMigrations({
33
- namespace: 'client',
34
- directory: (0, _path().resolve)(__dirname, './migrations'),
35
- context: {
36
- plugin: _this
37
- }
38
- });
39
- })();
40
- }
41
- install() {
42
- var _this2 = this;
43
- return _asyncToGenerator(function* () {
44
- const repository = _this2.app.db.getRepository('uiRoutes');
45
- var _iterator = _createForOfIteratorHelper(_routes.routes),
46
- _step;
47
- try {
48
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
49
- const values = _step.value;
50
- yield repository.create({
51
- values
52
- });
53
- }
54
- } catch (err) {
55
- _iterator.e(err);
56
- } finally {
57
- _iterator.f();
58
- }
59
- const uiSchemas = _this2.db.getRepository('uiSchemas');
60
- const systemSettings = _this2.db.getRepository('systemSettings');
61
- const schema = yield uiSchemas.insert({
62
- type: 'void',
63
- 'x-component': 'MContainer',
64
- 'x-designer': 'MContainer.Designer',
65
- 'x-component-props': {},
66
- properties: {
67
- page: {
68
- type: 'void',
69
- 'x-component': 'MPage',
70
- 'x-designer': 'MPage.Designer',
71
- 'x-component-props': {},
72
- properties: {
73
- grid: {
74
- type: 'void',
75
- 'x-component': 'Grid',
76
- 'x-initializer': 'MBlockInitializers',
77
- 'x-component-props': {
78
- showDivider: false
79
- }
80
- }
81
- }
82
- }
83
- }
84
- });
85
- const instance = yield systemSettings.findOne();
86
- instance.set('options.mobileSchemaUid', schema['x-uid']);
87
- yield instance.save();
88
- })();
89
- }
90
- afterEnable() {
91
- return _asyncToGenerator(function* () {})();
92
- }
93
- afterDisable() {
94
- return _asyncToGenerator(function* () {})();
95
- }
96
- remove() {
97
- return _asyncToGenerator(function* () {})();
98
- }
99
- }
100
- exports.MobileClientPlugin = MobileClientPlugin;
101
- var _default = MobileClientPlugin;
102
- exports.default = _default;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.routes = void 0;
7
- const routes = [{
8
- type: 'route',
9
- path: '/mobile/:name(.+)?',
10
- component: 'MApplication',
11
- uiSchema: {
12
- type: 'void',
13
- 'x-component': 'MContainer',
14
- 'x-designer': 'MContainer.Designer',
15
- 'x-component-props': {},
16
- properties: {
17
- page: {
18
- type: 'void',
19
- 'x-component': 'MPage',
20
- 'x-designer': 'MPage.Designer',
21
- 'x-component-props': {},
22
- properties: {
23
- grid: {
24
- type: 'void',
25
- 'x-component': 'Grid',
26
- 'x-initializer': 'MBlockInitializers',
27
- 'x-component-props': {
28
- showDivider: false
29
- }
30
- }
31
- }
32
- }
33
- }
34
- },
35
- routes: [{
36
- type: 'route',
37
- path: '',
38
- component: 'RouteSchemaComponent'
39
- }]
40
- }];
41
- exports.routes = routes;
@@ -1,41 +0,0 @@
1
- import { SettingsCenterProvider } from '@nocobase/client';
2
- import React, { useEffect } from 'react';
3
- import { useLocation, useNavigate } from 'react-router-dom';
4
- import { AppConfiguration, InterfaceConfiguration } from './configuration';
5
- import { isJSBridge } from './core/bridge';
6
- import { useTranslation } from './locale';
7
-
8
- export const MobileClientProvider = React.memo((props) => {
9
- const { t } = useTranslation();
10
- const location = useLocation();
11
- const navigation = useNavigate();
12
-
13
- useEffect(() => {
14
- if (isJSBridge() && location.pathname === '/admin') {
15
- navigation('/mobile', { replace: true });
16
- }
17
- }, [location.pathname, navigation]);
18
-
19
- return (
20
- <SettingsCenterProvider
21
- settings={{
22
- ['mobile-client']: {
23
- title: t('Mobile Client-side'),
24
- icon: 'MobileOutlined',
25
- tabs: {
26
- interface: {
27
- title: t('Interface Configuration'),
28
- component: InterfaceConfiguration,
29
- },
30
- app: {
31
- title: t('App Configuration'),
32
- component: AppConfiguration,
33
- },
34
- },
35
- },
36
- }}
37
- >
38
- {props.children}
39
- </SettingsCenterProvider>
40
- );
41
- });
@@ -1,23 +0,0 @@
1
- import { Card, Form, Input } from 'antd';
2
- import React from 'react';
3
- import { useTranslation } from '../locale';
4
-
5
- export const AppConfiguration = () => {
6
- const { t } = useTranslation();
7
- return (
8
- <Card
9
- style={{
10
- minHeight: '600px',
11
- }}
12
- >
13
- <Form layout="vertical">
14
- <Form.Item
15
- tooltip={`${t('The full address is')} ${window.origin}/mobile`}
16
- label={t('Mobile client access address')}
17
- >
18
- <Input value="/mobile" disabled />
19
- </Form.Item>
20
- </Form>
21
- </Card>
22
- );
23
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { InterfaceRouter } from '../router';
3
- import { MobileDevice } from '../devices';
4
-
5
- export const InterfaceConfiguration = () => {
6
- return (
7
- <MobileDevice>
8
- <InterfaceRouter></InterfaceRouter>
9
- </MobileDevice>
10
- );
11
- };
@@ -1,2 +0,0 @@
1
- export * from './App';
2
- export * from './Interface';
@@ -1,2 +0,0 @@
1
- import './native-call';
2
- export * from './injects';
@@ -1,15 +0,0 @@
1
- interface InvokeFunction {
2
- (params: { action: 'scan' }, cb: (data: { url: string }) => void): void;
3
- (params: { action: 'moveTaskToBack' }, cb?: () => void): void;
4
- }
5
-
6
- const getJsBridge = () =>
7
- (window as any).JsBridge as {
8
- invoke: InvokeFunction;
9
- };
10
-
11
- export const invoke: InvokeFunction = (params, cb) => {
12
- return getJsBridge().invoke(params, cb);
13
- };
14
-
15
- export const isJSBridge = () => !!getJsBridge();
@@ -1,23 +0,0 @@
1
- import { invoke } from './injects';
2
-
3
- /**
4
- * App 右滑返回
5
- * @param cb 回调函数,返回 true 表示 web 自己消费,false表示 app 消费
6
- */
7
-
8
- const JSBridgeFunction = {
9
- /**
10
- * @description JSBridge injects
11
- */
12
- onBackPressed: () => {
13
- if (history.length === 1) {
14
- invoke({ action: 'moveTaskToBack' });
15
- } else {
16
- history.back();
17
- }
18
- },
19
- };
20
-
21
- Object.keys(JSBridgeFunction).forEach((key) => {
22
- window[key] = JSBridgeFunction[key];
23
- });
@@ -1,45 +0,0 @@
1
- import { SchemaComponentOptions, SchemaInitializerProvider } from '@nocobase/client';
2
- import React from 'react';
3
- import {
4
- MBlockInitializers,
5
- MMenuBlockInitializer,
6
- MMenu,
7
- MContainer,
8
- MTabBar,
9
- MPage,
10
- MHeader,
11
- MSettingsBlockInitializer,
12
- MSettings,
13
- useGridCardBlockItemProps,
14
- useGridCardBlockProps,
15
- } from './schema';
16
- import './bridge';
17
-
18
- export const MobileCore: React.FC = (props) => {
19
- return (
20
- <SchemaInitializerProvider
21
- initializers={{
22
- MBlockInitializers,
23
- }}
24
- >
25
- <SchemaComponentOptions
26
- components={{
27
- MMenuBlockInitializer,
28
- MSettingsBlockInitializer,
29
- MContainer,
30
- MMenu,
31
- MTabBar,
32
- MPage,
33
- MHeader,
34
- MSettings,
35
- }}
36
- scope={{
37
- useGridCardBlockItemProps,
38
- useGridCardBlockProps,
39
- }}
40
- >
41
- {props.children}
42
- </SchemaComponentOptions>
43
- </SchemaInitializerProvider>
44
- );
45
- };
@@ -1 +0,0 @@
1
- export * from './page';
@@ -1,16 +0,0 @@
1
- export const PageSchema = {
2
- type: 'void',
3
- 'x-component': 'MPage',
4
- 'x-designer': 'MPage.Designer',
5
- 'x-component-props': {},
6
- properties: {
7
- grid: {
8
- type: 'void',
9
- 'x-component': 'Grid',
10
- 'x-initializer': 'MBlockInitializers',
11
- 'x-component-props': {
12
- showDivider: false,
13
- },
14
- },
15
- },
16
- };
@@ -1,89 +0,0 @@
1
- import { MenuOutlined } from '@ant-design/icons';
2
- import { Schema, useField, useFieldSchema } from '@formily/react';
3
- import { uid } from '@formily/shared';
4
- import { SchemaSettings, useDesignable } from '@nocobase/client';
5
- import { Button } from 'antd';
6
- import React from 'react';
7
- import { useNavigate } from 'react-router-dom';
8
- import { generateNTemplate, useTranslation } from '../../../../locale';
9
- import { PageSchema } from '../../common';
10
- import { findSchema } from '../../helpers';
11
-
12
- export const ContainerDesigner = () => {
13
- const { t } = useTranslation();
14
- const fieldSchema = useFieldSchema();
15
- const { dn } = useDesignable();
16
- const tabBarSchema = fieldSchema.reduceProperties(
17
- (schema, next) => schema || (next['x-component'] === 'MTabBar' && next),
18
- ) as Schema;
19
-
20
- const navigate = useNavigate();
21
-
22
- const field = useField();
23
- const schemaSettingsProps = {
24
- dn,
25
- field,
26
- fieldSchema,
27
- };
28
- return (
29
- <SchemaSettings
30
- title={
31
- <Button
32
- style={{
33
- borderColor: 'var(--colorSettings)',
34
- color: 'var(--colorSettings)',
35
- width: '100%',
36
- }}
37
- icon={<MenuOutlined />}
38
- type="dashed"
39
- >
40
- {t('App level Configuration')}
41
- </Button>
42
- }
43
- {...schemaSettingsProps}
44
- >
45
- <SchemaSettings.SwitchItem
46
- checked={!!tabBarSchema}
47
- title={t('Enable TabBar')}
48
- onChange={async (v) => {
49
- if (v) {
50
- const pageSchema = findSchema(fieldSchema, 'MPage');
51
- if (!pageSchema) return;
52
- await dn.remove(pageSchema);
53
- await dn.insertBeforeEnd({
54
- type: 'void',
55
- 'x-component': 'MTabBar',
56
- 'x-component-props': {},
57
- name: 'tabBar',
58
- properties: {
59
- [uid()]: {
60
- type: 'void',
61
- 'x-component': 'MTabBar.Item',
62
- 'x-designer': 'MTabBar.Item.Designer',
63
- 'x-component-props': {
64
- icon: 'HomeOutlined',
65
- title: generateNTemplate('Untitled'),
66
- },
67
- properties: {
68
- page: pageSchema.toJSON(),
69
- },
70
- },
71
- },
72
- });
73
- } else {
74
- const tabBarSchemaFirstKey = Object.keys(tabBarSchema.properties || {})?.[0];
75
- const pageSchema = tabBarSchemaFirstKey
76
- ? findSchema(tabBarSchema.properties[tabBarSchemaFirstKey], 'MPage')
77
- : null;
78
- await dn.remove(tabBarSchema);
79
- await dn.insertBeforeEnd(pageSchema || PageSchema, {
80
- onSuccess() {
81
- navigate('../');
82
- },
83
- });
84
- }
85
- }}
86
- />
87
- </SchemaSettings>
88
- );
89
- };
@@ -1,89 +0,0 @@
1
- import { useFieldSchema } from '@formily/react';
2
- import { cx, SchemaComponent, SortableItem, useDesigner, useToken } from '@nocobase/client';
3
- import React, { useEffect } from 'react';
4
- import { Navigate, useLocation, useNavigate, useParams } from 'react-router-dom';
5
- import { ContainerDesigner } from './Container.Designer';
6
- import useStyles from './style';
7
-
8
- const findGrid = (schema, uid) => {
9
- return schema.reduceProperties((final, next) => {
10
- if (final) return final;
11
- if (next['x-component'] === 'MTabBar') {
12
- return findGrid(next, uid);
13
- }
14
- if (next['x-component'] === 'MTabBar.Item' && uid === next['x-uid']) {
15
- return next;
16
- }
17
- });
18
- };
19
-
20
- const TabContentComponent = () => {
21
- const { name } = useParams<{ name: string }>();
22
- const fieldSchema = useFieldSchema();
23
- if (!name) return <></>;
24
- const gridSchema = findGrid(fieldSchema.properties['tabBar'], name.replace('tab_', ''));
25
- if (!gridSchema) {
26
- return <Navigate replace to="../" />;
27
- }
28
- return <SchemaComponent schema={gridSchema} />;
29
- };
30
-
31
- const InternalContainer: React.FC = (props) => {
32
- const { styles } = useStyles();
33
- const { token } = useToken();
34
- const Designer = useDesigner();
35
- const fieldSchema = useFieldSchema();
36
- const navigate = useNavigate();
37
- const params = useParams<{ name: string }>();
38
- const location = useLocation();
39
- const tabBarSchema = fieldSchema?.properties?.['tabBar'];
40
- const tabBarCurrentFirstKey = tabBarSchema?.properties ? Object.keys(tabBarSchema.properties)[0] : null;
41
- let redirectToUid = null;
42
- if (tabBarCurrentFirstKey) {
43
- redirectToUid = tabBarSchema?.properties[tabBarCurrentFirstKey]?.['x-uid'];
44
- }
45
- useEffect(() => {
46
- if (redirectToUid && !params.name) {
47
- const locationPath = location.pathname.endsWith('/') ? location.pathname.slice(0, -1) : location.pathname;
48
- navigate(`${locationPath}/tab_${redirectToUid}`, { replace: true });
49
- }
50
- }, [location.pathname, navigate, params.name, redirectToUid]);
51
-
52
- return (
53
- <SortableItem eid="nb-mobile-scroll-wrapper" className={cx('nb-mobile-container', styles.mobileContainer)}>
54
- <Designer></Designer>
55
- <div
56
- style={{
57
- paddingBottom: redirectToUid ? token.paddingLG * 2 : 0,
58
- }}
59
- className="nb-mobile-container-content"
60
- >
61
- {redirectToUid ? (
62
- <TabContentComponent />
63
- ) : (
64
- <SchemaComponent
65
- filterProperties={(schema) => {
66
- return schema['x-component'] !== 'MTabBar';
67
- }}
68
- schema={fieldSchema}
69
- />
70
- )}
71
- </div>
72
- <div className={cx('nb-mobile-container-tab-bar', styles.tabBar)}>
73
- <SchemaComponent
74
- onlyRenderProperties
75
- filterProperties={(schema) => {
76
- return schema['x-component'] === 'MTabBar';
77
- }}
78
- schema={fieldSchema}
79
- ></SchemaComponent>
80
- </div>
81
- </SortableItem>
82
- );
83
- };
84
-
85
- export const MContainer = InternalContainer as unknown as typeof InternalContainer & {
86
- Designer: typeof ContainerDesigner;
87
- };
88
- MContainer.Designer = ContainerDesigner;
89
- MContainer.displayName = 'MContainer';
@@ -1 +0,0 @@
1
- export * from './Container';
@@ -1,35 +0,0 @@
1
- import { createStyles } from '@nocobase/client';
2
-
3
- const useStyles = createStyles(({ token, css }) => {
4
- return {
5
- mobileContainer: css`
6
- --adm-color-primary: ${token.colorPrimary};
7
-
8
- & > .general-schema-designer > .general-schema-designer-icons {
9
- right: unset;
10
- left: 2px;
11
- }
12
- background: var(--nb-box-bg);
13
- display: flex;
14
- flex-direction: column;
15
- width: 100%;
16
- height: 100%;
17
- overflow-y: scroll;
18
- position: initial !important;
19
- `,
20
-
21
- tabBar: css`
22
- & > .general-schema-designer {
23
- --nb-designer-top: ${token.marginMD}px;
24
- }
25
- position: absolute;
26
- background: ${token.colorBgContainer};
27
- width: 100%;
28
- bottom: 0;
29
- left: 0;
30
- z-index: 1000;
31
- `,
32
- };
33
- });
34
-
35
- export default useStyles;
@@ -1,39 +0,0 @@
1
- import { Switch } from '@formily/antd-v5';
2
- import { useField } from '@formily/react';
3
- import { GeneralSchemaDesigner, SchemaSettings } from '@nocobase/client';
4
- import React from 'react';
5
- import { useTranslation } from '../../../../locale';
6
- import { useSchemaPatch } from '../../hooks';
7
-
8
- export const HeaderDesigner = () => {
9
- const field = useField();
10
- const { onUpdateComponentProps } = useSchemaPatch();
11
- const { t } = useTranslation();
12
- return (
13
- <GeneralSchemaDesigner draggable={false}>
14
- <SchemaSettings.ModalItem
15
- title={t('Edit info')}
16
- components={{ Switch }}
17
- initialValues={field.componentProps}
18
- schema={{
19
- properties: {
20
- title: {
21
- type: 'string',
22
- title: t('Title'),
23
- required: true,
24
- 'x-component': 'Input',
25
- 'x-decorator': 'FormItem',
26
- },
27
- showBack: {
28
- type: 'boolean',
29
- title: t('Display back button'),
30
- 'x-component': 'Switch',
31
- 'x-decorator': 'FormItem',
32
- },
33
- },
34
- }}
35
- onSubmit={onUpdateComponentProps}
36
- />
37
- </GeneralSchemaDesigner>
38
- );
39
- };