From 9c165db0f724fda75f8cb0283ae41818682d8f74 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Thu, 8 Jun 2023 19:54:00 +0800 Subject: [PATCH] feat(plugin-mobile-client): support mobile-side client (#1879) * feat: init mobile client * feat: add plugin * feat: ready to develop * feat: update pm styels * feat: add mobile center * feat: router ready * feat: support menu block, then menu ready * fix: incorrect path * feat: support TabBar * feat: tabbar, menu support dragging * feat: support page and header * feat: mobile view * fix: optional schema * feat: improve styles * fix: user-scalable * feat: support pc component show in mobile * feat: hidden divider * fix: improve drawer props * feat: support list block * feat: rename to details list * feat: page support tabs * feat: improve designer css * feat: complete enable/disabled header of page * feat: some improve * feat: improve empty data * fix: header info cannot displayed * chore: update deps * fix: incorrect spacing * fix: menu designer * refactor: re implement * feat: support page template * feat: clean code * feat: support i18n * chore: update lock * feat: support GirdCard in mobile * fix: build failed * feat: only render one column in mobile interface * fix: back button should not display in container * fix: switch to padding * fix: fixedBlockDesignRItem shouldn't display in dosen't support block * fix: update font family * fix: remove gridcard title * fix: dragging scope is too wide * fix: add menu cannot direct display * refactor: improve tabbar schema usage * refactor: improve menu schema * feat: should to use simple pagination * feat: the tag should pre-wrap * feat: improve the configuration button * feat: improve name * fix: clear data when modal is closed * fix: the tag is too long * fix: i18n * fix: font incorrect * feat: add map block * fix: some maps error * feat: support global action in page * feat: improve border color * feat: improve performance, the count stop early * style: improve * fix: incorrect font * fix: style conflict * chore: update version * chore: missing dep * feat: support setting block * feat: improve settings block and improve * feat: support onBackPressed * fix: ts error * feat: improve cannot find tab should navigate to mobile * docs: update * chore: update deps * fix: showTitle state is incorrect * feat: improve jsbridge apis * fix: navigate to admin after signout * chore: remove mgrid block * fix: ts error * fix: switch role will reload to root page * fix: update deps * fix: upgrade formily to 2.2.24 --------- Co-authored-by: dream2023 <1098626505@qq.com> Co-authored-by: chenos --- packages/app/client/src/pages/document.ejs | 7 +- .../app/client/src/plugins/mobile-client.ts | 1 + .../client/src/application/Application.tsx | 4 +- packages/core/client/src/pm/index.tsx | 28 +++- .../client/src/route-switch/RouteSwitch.tsx | 41 +++-- .../route-switch/antd/admin-layout/index.tsx | 28 ++-- .../core/client/src/route-switch/context.ts | 4 +- .../core/client/src/route-switch/types.ts | 1 + .../antd/action/Action.Drawer.tsx | 149 +++++++++-------- .../antd/action/Action.Modal.tsx | 136 ++++++++-------- .../schema-component/antd/action/Action.tsx | 41 ++--- .../antd/action/ActionBar.tsx | 109 ++++++++----- .../schema-component/antd/action/context.tsx | 15 +- .../antd/block-item/BlockItem.tsx | 7 +- .../antd/card-item/CardItem.tsx | 2 +- .../antd/grid-card/GridCard.Designer.tsx | 3 +- .../antd/grid-card/GridCard.tsx | 11 +- .../src/schema-component/antd/grid/Grid.tsx | 111 +++++++------ .../src/schema-component/antd/index.less | 16 +- .../schema-component/antd/page/FixedBlock.tsx | 7 +- .../src/schema-component/antd/page/Page.tsx | 2 +- .../antd/record-picker/InputRecordPicker.tsx | 6 +- .../record-picker/ReadPrettyRecordPicker.tsx | 12 +- .../schema-component/antd/table-v2/index.ts | 1 + .../src/schema-component/antd/tabs/Tabs.tsx | 5 +- .../schema-component/antd/tabs/context.tsx | 12 ++ .../src/schema-component/antd/tabs/index.ts | 1 + .../common/sortable-item/SortableItem.tsx | 30 ++-- .../schema-component/hooks/useDesignable.tsx | 8 +- .../schema-initializer/SchemaInitializer.tsx | 136 +++++++++++++--- .../buttons/TabPaneInitializers.tsx | 9 +- .../client/src/schema-initializer/utils.ts | 5 +- .../src/schema-items/GeneralSchemaItems.tsx | 2 +- .../schema-settings/GeneralSchemaDesigner.tsx | 7 +- .../src/schema-settings/SchemaSettings.tsx | 8 +- .../SchemaTemplateManagerProvider.tsx | 4 + .../core/client/src/user/ChangePassword.tsx | 6 +- packages/core/client/src/user/CurrentUser.tsx | 139 ++++++++-------- packages/core/client/src/user/EditProfile.tsx | 8 +- packages/core/client/src/user/SigninPage.tsx | 2 +- packages/core/client/src/user/SwitchRole.tsx | 3 +- .../map/src/client/components/AMap.tsx | 31 +++- packages/plugins/mobile-client/client.d.ts | 4 + packages/plugins/mobile-client/client.js | 30 ++++ .../plugins/mobile-client/docs/en-US/index.md | 7 + .../mobile-client/docs/en-US/installation.md | 13 ++ .../mobile-client/docs/en-US/tabs.json | 14 ++ .../plugins/mobile-client/docs/en-US/usage.md | 1 + .../plugins/mobile-client/docs/zh-CN/index.md | 7 + .../mobile-client/docs/zh-CN/installation.md | 13 ++ .../mobile-client/docs/zh-CN/tabs.json | 14 ++ .../plugins/mobile-client/docs/zh-CN/usage.md | 2 + packages/plugins/mobile-client/package.json | 27 ++++ packages/plugins/mobile-client/server.d.ts | 4 + packages/plugins/mobile-client/server.js | 30 ++++ .../src/client/configuration/App.tsx | 5 + .../src/client/configuration/Interface.tsx | 11 ++ .../src/client/configuration/index.ts | 2 + .../src/client/core/bridge/index.ts | 1 + .../src/client/core/bridge/injects.ts | 12 ++ .../src/client/core/bridge/native-call.ts | 23 +++ .../mobile-client/src/client/core/index.tsx | 45 ++++++ .../container/Container.Designer.tsx | 85 ++++++++++ .../schema/components/container/Container.tsx | 130 +++++++++++++++ .../core/schema/components/container/index.ts | 1 + .../components/header/Header.Designer.tsx | 39 +++++ .../core/schema/components/header/Header.tsx | 41 +++++ .../core/schema/components/header/index.ts | 1 + .../client/core/schema/components/index.ts | 6 + .../schema/components/menu/Menu.Designer.tsx | 46 ++++++ .../core/schema/components/menu/Menu.Item.tsx | 104 ++++++++++++ .../core/schema/components/menu/Menu.tsx | 105 ++++++++++++ .../components/menu/MenuBlockInitializer.tsx | 20 +++ .../core/schema/components/menu/index.ts | 2 + .../core/schema/components/menu/schema.ts | 17 ++ .../schema/components/page/Page.Designer.tsx | 106 ++++++++++++ .../core/schema/components/page/Page.tsx | 140 ++++++++++++++++ .../core/schema/components/page/index.ts | 1 + .../components/settings/Settings.Designer.tsx | 22 +++ .../schema/components/settings/Settings.tsx | 25 +++ .../settings/SettingsBlockInitializer.tsx | 20 +++ .../core/schema/components/settings/index.ts | 2 + .../schema/components/tab-bar/TabBar.Item.tsx | 67 ++++++++ .../core/schema/components/tab-bar/TabBar.tsx | 113 +++++++++++++ .../core/schema/components/tab-bar/index.ts | 1 + .../core/schema/components/tab-bar/schema.ts | 18 +++ .../src/client/core/schema/helpers/index.ts | 38 +++++ .../src/client/core/schema/hooks/index.ts | 1 + .../core/schema/hooks/useSchemaPatch.ts | 24 +++ .../src/client/core/schema/index.ts | 3 + .../schema/initializers/BlockInitializers.ts | 81 ++++++++++ .../client/core/schema/initializers/index.ts | 1 + .../client/core/schema/scopes/grid-card.ts | 35 ++++ .../src/client/core/schema/scopes/index.ts | 1 + .../mobile-client/src/client/devices/iOS6.tsx | 24 +++ .../src/client/devices/index.tsx | 27 ++++ .../mobile-client/src/client/index.tsx | 33 ++++ .../mobile-client/src/client/locale/en-US.ts | 5 + .../mobile-client/src/client/locale/index.ts | 23 +++ .../mobile-client/src/client/locale/zh-CN.ts | 31 ++++ .../src/client/router/Application.tsx | 111 +++++++++++++ .../src/client/router/InterfaceProvider.tsx | 11 ++ .../src/client/router/InterfaceRouter.tsx | 33 ++++ .../src/client/router/RouteSwitchProvider.tsx | 18 +++ .../mobile-client/src/client/router/index.ts | 2 + packages/plugins/mobile-client/src/index.ts | 1 + .../src/server/collections/.gitkeep | 0 .../plugins/mobile-client/src/server/index.ts | 1 + .../mobile-client/src/server/plugin.ts | 62 +++++++ packages/plugins/mobile-client/types.d.ts | 0 packages/presets/nocobase/package.json | 3 +- packages/presets/nocobase/src/index.ts | 1 + yarn.lock | 153 +++++++++++++++++- 113 files changed, 2807 insertions(+), 451 deletions(-) create mode 100644 packages/app/client/src/plugins/mobile-client.ts create mode 100644 packages/core/client/src/schema-component/antd/tabs/context.tsx create mode 100755 packages/plugins/mobile-client/client.d.ts create mode 100755 packages/plugins/mobile-client/client.js create mode 100644 packages/plugins/mobile-client/docs/en-US/index.md create mode 100644 packages/plugins/mobile-client/docs/en-US/installation.md create mode 100644 packages/plugins/mobile-client/docs/en-US/tabs.json create mode 100644 packages/plugins/mobile-client/docs/en-US/usage.md create mode 100644 packages/plugins/mobile-client/docs/zh-CN/index.md create mode 100644 packages/plugins/mobile-client/docs/zh-CN/installation.md create mode 100644 packages/plugins/mobile-client/docs/zh-CN/tabs.json create mode 100644 packages/plugins/mobile-client/docs/zh-CN/usage.md create mode 100644 packages/plugins/mobile-client/package.json create mode 100755 packages/plugins/mobile-client/server.d.ts create mode 100755 packages/plugins/mobile-client/server.js create mode 100644 packages/plugins/mobile-client/src/client/configuration/App.tsx create mode 100644 packages/plugins/mobile-client/src/client/configuration/Interface.tsx create mode 100644 packages/plugins/mobile-client/src/client/configuration/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/bridge/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/bridge/injects.ts create mode 100644 packages/plugins/mobile-client/src/client/core/bridge/native-call.ts create mode 100644 packages/plugins/mobile-client/src/client/core/index.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/container/Container.Designer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/container/Container.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/container/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/header/Header.Designer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/header/Header.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/header/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/Menu.Designer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/Menu.Item.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/Menu.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/MenuBlockInitializer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/menu/schema.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/page/Page.Designer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/page/Page.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/page/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/settings/Settings.Designer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/settings/Settings.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/settings/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/tab-bar/TabBar.Item.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/tab-bar/TabBar.tsx create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/tab-bar/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/components/tab-bar/schema.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/helpers/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/hooks/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/hooks/useSchemaPatch.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/initializers/BlockInitializers.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/initializers/index.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/scopes/grid-card.ts create mode 100644 packages/plugins/mobile-client/src/client/core/schema/scopes/index.ts create mode 100644 packages/plugins/mobile-client/src/client/devices/iOS6.tsx create mode 100644 packages/plugins/mobile-client/src/client/devices/index.tsx create mode 100644 packages/plugins/mobile-client/src/client/index.tsx create mode 100644 packages/plugins/mobile-client/src/client/locale/en-US.ts create mode 100644 packages/plugins/mobile-client/src/client/locale/index.ts create mode 100644 packages/plugins/mobile-client/src/client/locale/zh-CN.ts create mode 100644 packages/plugins/mobile-client/src/client/router/Application.tsx create mode 100644 packages/plugins/mobile-client/src/client/router/InterfaceProvider.tsx create mode 100644 packages/plugins/mobile-client/src/client/router/InterfaceRouter.tsx create mode 100644 packages/plugins/mobile-client/src/client/router/RouteSwitchProvider.tsx create mode 100644 packages/plugins/mobile-client/src/client/router/index.ts create mode 100644 packages/plugins/mobile-client/src/index.ts create mode 100644 packages/plugins/mobile-client/src/server/collections/.gitkeep create mode 100644 packages/plugins/mobile-client/src/server/index.ts create mode 100644 packages/plugins/mobile-client/src/server/plugin.ts create mode 100644 packages/plugins/mobile-client/types.d.ts diff --git a/packages/app/client/src/pages/document.ejs b/packages/app/client/src/pages/document.ejs index 9f44edc55..349691650 100644 --- a/packages/app/client/src/pages/document.ejs +++ b/packages/app/client/src/pages/document.ejs @@ -2,12 +2,17 @@ + Loading...