diff --git a/packages/core/client/src/application/Application.tsx b/packages/core/client/src/application/Application.tsx index 88372c375..3cccb954e 100644 --- a/packages/core/client/src/application/Application.tsx +++ b/packages/core/client/src/application/Application.tsx @@ -90,6 +90,14 @@ export class Application { return this.pluginManager; } + get adminUrl() { + if (this.name === 'main') { + return '/admin/'; + } else { + return `/apps/${this.name}/admin/`; + } + } + constructor(protected options: ApplicationOptions = {}) { this.initRequireJs(); define(this, { diff --git a/packages/core/client/src/application/demos/demo3.tsx b/packages/core/client/src/application/demos/demo3.tsx index 101b90155..4e6672e95 100644 --- a/packages/core/client/src/application/demos/demo3.tsx +++ b/packages/core/client/src/application/demos/demo3.tsx @@ -1,10 +1,10 @@ -import { Application, BuildinPlugin } from '@tachybase/client'; +import { Application, BuiltInPlugin } from '@tachybase/client'; export const app = new Application({ apiClient: { baseURL: process.env.API_BASE_URL, }, - plugins: [BuildinPlugin], + plugins: [BuiltInPlugin], }); export default app.getRootComponent(); diff --git a/packages/core/client/src/application/hooks/useApp.ts b/packages/core/client/src/application/hooks/useApp.ts index 43107dcda..c365109c9 100644 --- a/packages/core/client/src/application/hooks/useApp.ts +++ b/packages/core/client/src/application/hooks/useApp.ts @@ -1,4 +1,5 @@ import { useContext } from 'react'; + import type { Application } from '../Application'; import { ApplicationContext } from '../context'; diff --git a/packages/core/client/src/buildin-plugin/acl/ACLProvider.tsx b/packages/core/client/src/built-in/acl/ACLProvider.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/ACLProvider.tsx rename to packages/core/client/src/built-in/acl/ACLProvider.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/ACLShortcut.tsx b/packages/core/client/src/built-in/acl/ACLShortcut.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/ACLShortcut.tsx rename to packages/core/client/src/built-in/acl/ACLShortcut.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/ConfigureCenter.tsx b/packages/core/client/src/built-in/acl/Configuration/ConfigureCenter.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/ConfigureCenter.tsx rename to packages/core/client/src/built-in/acl/Configuration/ConfigureCenter.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/MenuConfigure.tsx b/packages/core/client/src/built-in/acl/Configuration/MenuConfigure.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/MenuConfigure.tsx rename to packages/core/client/src/built-in/acl/Configuration/MenuConfigure.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/MenuItemsProvider.tsx b/packages/core/client/src/built-in/acl/Configuration/MenuItemsProvider.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/MenuItemsProvider.tsx rename to packages/core/client/src/built-in/acl/Configuration/MenuItemsProvider.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/PermisionProvider.tsx b/packages/core/client/src/built-in/acl/Configuration/PermisionProvider.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/PermisionProvider.tsx rename to packages/core/client/src/built-in/acl/Configuration/PermisionProvider.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/RoleConfigure.tsx b/packages/core/client/src/built-in/acl/Configuration/RoleConfigure.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/RoleConfigure.tsx rename to packages/core/client/src/built-in/acl/Configuration/RoleConfigure.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx b/packages/core/client/src/built-in/acl/Configuration/RoleTable.tsx similarity index 91% rename from packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx rename to packages/core/client/src/built-in/acl/Configuration/RoleTable.tsx index 3223ee30b..05df8b984 100644 --- a/packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx +++ b/packages/core/client/src/built-in/acl/Configuration/RoleTable.tsx @@ -4,8 +4,8 @@ import { Spin } from 'antd'; import { useRequest } from '../../../api-client'; import { SchemaComponent, SchemaComponentContext } from '../../../schema-component'; -import { MenuItemsProvider } from '../Configuration/MenuItemsProvider'; -import { PermissionProvider, SettingCenterPermissionProvider } from '../Configuration/PermisionProvider'; +import { MenuItemsProvider } from './MenuItemsProvider'; +import { PermissionProvider, SettingCenterPermissionProvider } from './PermisionProvider'; import { roleSchema } from './schemas/roles'; const AvailableActionsContext = createContext([]); diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/RolesResourcesActions.tsx b/packages/core/client/src/built-in/acl/Configuration/RolesResourcesActions.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/RolesResourcesActions.tsx rename to packages/core/client/src/built-in/acl/Configuration/RolesResourcesActions.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/ScopeSelect.tsx b/packages/core/client/src/built-in/acl/Configuration/ScopeSelect.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/ScopeSelect.tsx rename to packages/core/client/src/built-in/acl/Configuration/ScopeSelect.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/StrategyActions.tsx b/packages/core/client/src/built-in/acl/Configuration/StrategyActions.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/StrategyActions.tsx rename to packages/core/client/src/built-in/acl/Configuration/StrategyActions.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/index.tsx b/packages/core/client/src/built-in/acl/Configuration/index.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/index.tsx rename to packages/core/client/src/built-in/acl/Configuration/index.tsx diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/roles.ts b/packages/core/client/src/built-in/acl/Configuration/schemas/roles.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/schemas/roles.ts rename to packages/core/client/src/built-in/acl/Configuration/schemas/roles.ts diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/scopes.ts b/packages/core/client/src/built-in/acl/Configuration/schemas/scopes.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/schemas/scopes.ts rename to packages/core/client/src/built-in/acl/Configuration/schemas/scopes.ts diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useRoleResourceValues.ts b/packages/core/client/src/built-in/acl/Configuration/schemas/useRoleResourceValues.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useRoleResourceValues.ts rename to packages/core/client/src/built-in/acl/Configuration/schemas/useRoleResourceValues.ts diff --git a/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useSaveRoleResourceAction.ts b/packages/core/client/src/built-in/acl/Configuration/schemas/useSaveRoleResourceAction.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useSaveRoleResourceAction.ts rename to packages/core/client/src/built-in/acl/Configuration/schemas/useSaveRoleResourceAction.ts diff --git a/packages/core/client/src/buildin-plugin/acl/index.ts b/packages/core/client/src/built-in/acl/index.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/index.ts rename to packages/core/client/src/built-in/acl/index.ts diff --git a/packages/core/client/src/buildin-plugin/acl/style.ts b/packages/core/client/src/built-in/acl/style.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/acl/style.ts rename to packages/core/client/src/built-in/acl/style.ts diff --git a/packages/core/client/src/buildin-plugin/admin-layout/index.tsx b/packages/core/client/src/built-in/admin-layout/index.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/admin-layout/index.tsx rename to packages/core/client/src/built-in/admin-layout/index.tsx diff --git a/packages/core/client/src/buildin-plugin/document-title/index.md b/packages/core/client/src/built-in/document-title/index.md similarity index 100% rename from packages/core/client/src/buildin-plugin/document-title/index.md rename to packages/core/client/src/built-in/document-title/index.md diff --git a/packages/core/client/src/buildin-plugin/document-title/index.tsx b/packages/core/client/src/built-in/document-title/index.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/document-title/index.tsx rename to packages/core/client/src/built-in/document-title/index.tsx diff --git a/packages/core/client/src/buildin-plugin/index.tsx b/packages/core/client/src/built-in/index.tsx similarity index 96% rename from packages/core/client/src/buildin-plugin/index.tsx rename to packages/core/client/src/built-in/index.tsx index 2541496c7..751cac93c 100644 --- a/packages/core/client/src/buildin-plugin/index.tsx +++ b/packages/core/client/src/built-in/index.tsx @@ -5,10 +5,11 @@ import { getSubAppName } from '@tachybase/sdk'; import { DisconnectOutlined, LoadingOutlined } from '@ant-design/icons'; import { Button, Modal, Result, Spin } from 'antd'; import { createStyles } from 'antd-style'; +import { useTranslation } from 'react-i18next'; import { Navigate, useNavigate } from 'react-router-dom'; import { useAPIClient } from '../api-client'; -import { Application } from '../application'; +import { Application, useApp } from '../application'; import { Plugin } from '../application/Plugin'; import { BlockSchemaComponentPlugin } from '../block-provider'; import { CollectionPlugin } from '../collection-manager'; @@ -248,21 +249,23 @@ const AppMaintainingDialog = observer( export const AppNotFound = () => { const navigate = useNavigate(); + const { t } = useTranslation(); + const app = useApp(); return ( navigate('/', { replace: true })} type="primary"> - Back Home + } /> ); }; -export class BuildinPlugin extends Plugin { +export class BuiltInPlugin extends Plugin { async afterAdd() { this.app.addComponents({ AppSpin, diff --git a/packages/core/client/src/buildin-plugin/locale/LocalePlugin.ts b/packages/core/client/src/built-in/locale/LocalePlugin.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/locale/LocalePlugin.ts rename to packages/core/client/src/built-in/locale/LocalePlugin.ts diff --git a/packages/core/client/src/buildin-plugin/locale/loadConstrueLocale.ts b/packages/core/client/src/built-in/locale/loadConstrueLocale.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/locale/loadConstrueLocale.ts rename to packages/core/client/src/built-in/locale/loadConstrueLocale.ts diff --git a/packages/core/client/src/buildin-plugin/pinned-list/PinnedPluginListProvider.tsx b/packages/core/client/src/built-in/pinned-list/PinnedPluginListProvider.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pinned-list/PinnedPluginListProvider.tsx rename to packages/core/client/src/built-in/pinned-list/PinnedPluginListProvider.tsx diff --git a/packages/core/client/src/buildin-plugin/pinned-list/context.ts b/packages/core/client/src/built-in/pinned-list/context.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/pinned-list/context.ts rename to packages/core/client/src/built-in/pinned-list/context.ts diff --git a/packages/core/client/src/buildin-plugin/pinned-list/index.ts b/packages/core/client/src/built-in/pinned-list/index.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/pinned-list/index.ts rename to packages/core/client/src/built-in/pinned-list/index.ts diff --git a/packages/core/client/src/buildin-plugin/pm/PluginCard.tsx b/packages/core/client/src/built-in/pm/PluginCard.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginCard.tsx rename to packages/core/client/src/built-in/pm/PluginCard.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginDetail.tsx b/packages/core/client/src/built-in/pm/PluginDetail.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginDetail.tsx rename to packages/core/client/src/built-in/pm/PluginDetail.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginDocument.tsx b/packages/core/client/src/built-in/pm/PluginDocument.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginDocument.tsx rename to packages/core/client/src/built-in/pm/PluginDocument.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginNpmForm.tsx b/packages/core/client/src/built-in/pm/PluginForm/form/PluginNpmForm.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginNpmForm.tsx rename to packages/core/client/src/built-in/pm/PluginForm/form/PluginNpmForm.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUploadForm.tsx b/packages/core/client/src/built-in/pm/PluginForm/form/PluginUploadForm.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUploadForm.tsx rename to packages/core/client/src/built-in/pm/PluginForm/form/PluginUploadForm.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUrlForm.tsx b/packages/core/client/src/built-in/pm/PluginForm/form/PluginUrlForm.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUrlForm.tsx rename to packages/core/client/src/built-in/pm/PluginForm/form/PluginUrlForm.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginAddModal.tsx b/packages/core/client/src/built-in/pm/PluginForm/modal/PluginAddModal.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginAddModal.tsx rename to packages/core/client/src/built-in/pm/PluginForm/modal/PluginAddModal.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginUpgradeModal.tsx b/packages/core/client/src/built-in/pm/PluginForm/modal/PluginUpgradeModal.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginUpgradeModal.tsx rename to packages/core/client/src/built-in/pm/PluginForm/modal/PluginUpgradeModal.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginManager.tsx b/packages/core/client/src/built-in/pm/PluginManager.tsx similarity index 99% rename from packages/core/client/src/buildin-plugin/pm/PluginManager.tsx rename to packages/core/client/src/built-in/pm/PluginManager.tsx index a5e7a6987..69e708d93 100644 --- a/packages/core/client/src/buildin-plugin/pm/PluginManager.tsx +++ b/packages/core/client/src/built-in/pm/PluginManager.tsx @@ -9,9 +9,9 @@ import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; import { useRequest } from '../../api-client'; -import { useACLRoleContext } from '../../buildin-plugin/acl'; import { i18n } from '../../i18n'; import { useToken } from '../../style'; +import { useACLRoleContext } from '../acl'; import { SwitchAction } from './PluginCard'; import { useStyles } from './style'; import { IPluginData } from './types'; diff --git a/packages/core/client/src/buildin-plugin/pm/PluginManagerLink.tsx b/packages/core/client/src/built-in/pm/PluginManagerLink.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginManagerLink.tsx rename to packages/core/client/src/built-in/pm/PluginManagerLink.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/PluginSetting.tsx b/packages/core/client/src/built-in/pm/PluginSetting.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/PluginSetting.tsx rename to packages/core/client/src/built-in/pm/PluginSetting.tsx diff --git a/packages/core/client/src/buildin-plugin/pm/index.tsx b/packages/core/client/src/built-in/pm/index.tsx similarity index 95% rename from packages/core/client/src/buildin-plugin/pm/index.tsx rename to packages/core/client/src/built-in/pm/index.tsx index 45dcf6959..7b483daea 100644 --- a/packages/core/client/src/buildin-plugin/pm/index.tsx +++ b/packages/core/client/src/built-in/pm/index.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { ADMIN_SETTINGS_PATH } from '../../application'; import { Plugin } from '../../application/Plugin'; -import { SystemSettingsPane } from '../../buildin-plugin/system-settings'; import { BlockTemplatesPane } from '../../schema-templates'; +import { SystemSettingsPane } from '../system-settings'; import { PluginManager } from './PluginManager'; import { PluginManagerLink, SettingsCenterDropdown } from './PluginManagerLink'; import { AdminSettingsLayout } from './PluginSetting'; diff --git a/packages/core/client/src/buildin-plugin/pm/style.ts b/packages/core/client/src/built-in/pm/style.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/style.ts rename to packages/core/client/src/built-in/pm/style.ts diff --git a/packages/core/client/src/buildin-plugin/pm/types.ts b/packages/core/client/src/built-in/pm/types.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/pm/types.ts rename to packages/core/client/src/built-in/pm/types.ts diff --git a/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsProvider.tsx b/packages/core/client/src/built-in/system-settings/SystemSettingsProvider.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/system-settings/SystemSettingsProvider.tsx rename to packages/core/client/src/built-in/system-settings/SystemSettingsProvider.tsx diff --git a/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsShortcut.tsx b/packages/core/client/src/built-in/system-settings/SystemSettingsShortcut.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/system-settings/SystemSettingsShortcut.tsx rename to packages/core/client/src/built-in/system-settings/SystemSettingsShortcut.tsx diff --git a/packages/core/client/src/buildin-plugin/system-settings/index.tsx b/packages/core/client/src/built-in/system-settings/index.tsx similarity index 100% rename from packages/core/client/src/buildin-plugin/system-settings/index.tsx rename to packages/core/client/src/built-in/system-settings/index.tsx diff --git a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx index 80efb96b6..2224bd381 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx @@ -2,7 +2,7 @@ import React, { createContext, ReactNode, useContext, useMemo } from 'react'; import { UseRequestOptions, UseRequestService } from '../../api-client'; import { withDynamicSchemaProps } from '../../application/hoc'; -import { ACLCollectionProvider } from '../../buildin-plugin/acl'; +import { ACLCollectionProvider } from '../../built-in/acl'; import { Designable, useDesignable } from '../../schema-component'; import { AssociationProvider, CollectionManagerProvider, CollectionOptions, CollectionProvider } from '../collection'; import { CollectionRecord } from '../collection-record'; diff --git a/packages/core/client/src/hooks/useMenuItem.tsx b/packages/core/client/src/hooks/useMenuItem.tsx index 60f6e6e2c..574a75f16 100644 --- a/packages/core/client/src/hooks/useMenuItem.tsx +++ b/packages/core/client/src/hooks/useMenuItem.tsx @@ -33,7 +33,7 @@ export const useCollectMenuItems = () => { */ export const useMenuItem = () => { const list = useRef([]); - const renderItems = useRef<() => JSX.Element>(null); + const renderItems = useRef<() => ReactNode>(null); const shouldRerender = useRef(false); const Component = useCallback(({ limitCount }: { limitCount?: number }) => { diff --git a/packages/core/client/src/index.ts b/packages/core/client/src/index.ts index 8cf6186b8..01ac5ccf7 100644 --- a/packages/core/client/src/index.ts +++ b/packages/core/client/src/index.ts @@ -3,7 +3,7 @@ import 'antd/dist/reset.css'; import './global.less'; export * from '@emotion/css'; -export * from './buildin-plugin/acl'; +export * from './built-in/acl'; export * from './api-client'; export * from './appInfo'; export * from './application'; @@ -14,7 +14,7 @@ export * from './collection-manager'; export * from './common'; export * from './style/css-variable'; export * from './data-source'; -export * from './buildin-plugin/document-title'; +export * from './built-in/document-title'; export * from './filter-provider'; export * from './flag-provider'; export * from './style/theme'; @@ -22,9 +22,9 @@ export * from './hooks'; export * from './i18n'; export * from './icon'; export { default as locale } from './locale'; -export * from './buildin-plugin'; -export * from './buildin-plugin/pinned-list'; -export * from './buildin-plugin/pm'; +export * from './built-in'; +export * from './built-in/pinned-list'; +export * from './built-in/pm'; export * from './powered-by'; export * from './record-provider'; export * from './route-switch'; @@ -35,7 +35,7 @@ export * from './schema-settings'; export * from './schema-templates'; export * from './style'; export type { CustomToken } from './style/theme'; -export * from './buildin-plugin/system-settings'; +export * from './built-in/system-settings'; export * from './testUtils'; export * from './user'; export * from './variables'; diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 0906297bb..4696e5acd 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -930,5 +930,7 @@ "Designer properties": "设计属性", "Load": "加载", "Dump": "存储", + "Sorry, the page you visited does not exist.": "对不起,您访问的页面不存在。", + "Back Home": "回到主页", "Chang on Parent": "选择父级" } diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index c05f6f2c4..ad5c93d0d 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next'; import { StablePopover, useActionContext } from '../..'; import { useDesignable } from '../../'; import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; -import { useACLActionParamsContext } from '../../../buildin-plugin/acl'; +import { useACLActionParamsContext } from '../../../built-in/acl'; import { Icon } from '../../../icon'; import { RecordProvider, useRecord } from '../../../record-provider'; import { useLocalVariables, useVariables } from '../../../variables'; diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalNester.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalNester.tsx index 457c2a509..dc4055f4b 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalNester.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalNester.tsx @@ -5,7 +5,7 @@ import { observer, RecursionField, useField, useFieldSchema } from '@tachybase/s import { createStyles } from 'antd-style'; import cx from 'classnames'; -import { ACLCollectionProvider, useACLActionParamsContext } from '../../../buildin-plugin/acl'; +import { ACLCollectionProvider, useACLActionParamsContext } from '../../../built-in/acl'; import { CollectionProvider_deprecated } from '../../../collection-manager'; import { useAssociationFieldContext, useInsertSchema } from './hooks'; import schema from './schema'; diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx index 875136abf..a4301d412 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx @@ -4,7 +4,7 @@ import { observer, RecursionField, SchemaOptionsContext, useField, useFieldSchem import { createStyles } from 'antd-style'; -import { ACLCollectionProvider, useACLActionParamsContext } from '../../../buildin-plugin/acl'; +import { ACLCollectionProvider, useACLActionParamsContext } from '../../../built-in/acl'; import { CollectionProvider_deprecated } from '../../../collection-manager'; import { FormItem, useSchemaOptionsContext } from '../../../schema-component'; import Select from '../select/Select'; diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx index 3b4e89d5f..f9101c86d 100644 --- a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx @@ -7,7 +7,7 @@ import cx from 'classnames'; import { useApp } from '../../../application'; import { useFormActiveFields } from '../../../block-provider/hooks/useFormActiveFields'; -import { ACLCollectionFieldProvider } from '../../../buildin-plugin/acl'; +import { ACLCollectionFieldProvider } from '../../../built-in/acl'; import { Collection_deprecated } from '../../../collection-manager'; import { CollectionFieldProvider, useContextConfigSetting } from '../../../data-source'; import { GeneralSchemaDesigner } from '../../../schema-settings'; diff --git a/packages/core/client/src/schema-component/antd/menu/Menu.tsx b/packages/core/client/src/schema-component/antd/menu/Menu.tsx index 849cbdd88..fbd7e4d33 100644 --- a/packages/core/client/src/schema-component/antd/menu/Menu.tsx +++ b/packages/core/client/src/schema-component/antd/menu/Menu.tsx @@ -11,12 +11,13 @@ import { } from '@tachybase/schema'; import { error } from '@tachybase/utils/client'; -import { Menu as AntdMenu, MenuProps } from 'antd'; +import { MoreOutlined } from '@ant-design/icons'; +import { Menu as AntdMenu, Button, Dropdown, MenuProps } from 'antd'; import { createPortal } from 'react-dom'; import { useTranslation } from 'react-i18next'; import { createDesignable, DndContext, SortableItem, useDesignable, useDesigner } from '../..'; -import { Icon, useAPIClient, useSchemaInitializerRender } from '../../../'; +import { css, Icon, useAPIClient, useSchemaInitializerRender, useToken } from '../../../'; import { useCollectMenuItems, useMenuItem } from '../../../hooks/useMenuItem'; import { useProps } from '../../hooks/useProps'; import { useMenuTranslation } from './locale'; @@ -47,10 +48,11 @@ const HeaderMenu = ({ }) => { const { Component, getMenuItems } = useMenuItem(); const { styles } = useStyles(); + const { token } = useToken(); const items = useMemo(() => { const designerBtn = { key: 'x-designer-button', - style: { padding: '0 8px', order: 9999 }, + style: { padding: '0 8px', order: -1 }, label: render({ 'data-testid': 'schema-initializer-Menu-header', style: { background: 'none' }, @@ -66,55 +68,68 @@ const HeaderMenu = ({ } return result; - }, [children, designable]); + }, [children, designable, getMenuItems, render]); return ( - <> - - { - const s = schema.properties?.[info.key]; - - if (!s) { - return; - } - - if (mode === 'mix') { - if (s['x-component'] !== 'Menu.SubMenu') { - onSelect?.(info); - } else { - const menuItemSchema = findMenuItem(s); - if (!menuItemSchema) { - return onSelect?.(info); - } - setLoading(true); - const keys = findKeysByUid(schema, menuItemSchema['x-uid']); - setDefaultSelectedKeys(keys); - setTimeout(() => { - setLoading(false); - }, 100); - onSelect?.({ - key: menuItemSchema.name, - item: { - props: { - schema: menuItemSchema, - }, - }, - }); +
+
+
- + `} + > + { + setLoading(false); + }, 100); + onSelect?.({ + key: menuItemSchema.name, + item: { + props: { + schema: menuItemSchema, + }, + }, + }); + } + } else { + onSelect?.(info); + } + }, + }} + > +
+
); }; diff --git a/packages/core/client/src/schema-component/antd/page/Page.tsx b/packages/core/client/src/schema-component/antd/page/Page.tsx index 6a1204f47..f2430234b 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.tsx @@ -13,8 +13,8 @@ import { useSearchParams } from 'react-router-dom'; import { FormDialog } from '..'; import { useToken } from '../__builtins__'; import { useAppSpin } from '../../../application/hooks/useAppSpin'; -import { useStyles as useAClStyles } from '../../../buildin-plugin/acl/style'; -import { useDocumentTitle } from '../../../buildin-plugin/document-title'; +import { useStyles as useAClStyles } from '../../../built-in/acl/style'; +import { useDocumentTitle } from '../../../built-in/document-title'; import { FilterBlockProvider } from '../../../filter-provider/FilterProvider'; import { Icon } from '../../../icon'; import { useGetAriaLabelOfSchemaInitializer } from '../../../schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer'; diff --git a/packages/core/client/src/user/CurrentUserProvider.tsx b/packages/core/client/src/user/CurrentUserProvider.tsx index dbe0bde57..41f4c49a2 100644 --- a/packages/core/client/src/user/CurrentUserProvider.tsx +++ b/packages/core/client/src/user/CurrentUserProvider.tsx @@ -4,7 +4,7 @@ import { Navigate, useLocation } from 'react-router-dom'; import { ReturnTypeOfUseRequest, useRequest } from '../api-client'; import { useAppSpin } from '../application/hooks/useAppSpin'; -import { useACLRoleContext } from '../buildin-plugin/acl'; +import { useACLRoleContext } from '../built-in/acl'; import { useCompile } from '../schema-component'; export const CurrentUserContext = createContext(null); diff --git a/packages/plugins/@hera/plugin-core/package.json b/packages/plugins/@hera/plugin-core/package.json index c405a653d..99e72cdbf 100644 --- a/packages/plugins/@hera/plugin-core/package.json +++ b/packages/plugins/@hera/plugin-core/package.json @@ -8,10 +8,7 @@ ], "main": "dist/server/index.js", "devDependencies": { - "@ant-design/cssinjs": "^1.11.1", "@ant-design/icons": "~5.3.6", - "@ant-design/pro-layout": "^7.16.11", - "@formily/antd-v5": "1.x", "@react-pdf/renderer": "^3.3.2", "@tachybase/components": "workspace:*", "@tachybase/schema": "workspace:*", diff --git a/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx b/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx index dd0b2ee90..0a6191d61 100644 --- a/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx @@ -9,6 +9,7 @@ import { SchemaComponent, useACLRoleContext, useAdminSchemaUid, + useApp, useDocumentTitle, useRequest, useSystemSettings, @@ -194,6 +195,7 @@ export const InternalAdminLayout = () => { const sideMenuRef = useRef(); const result = useSystemSettings(); const params = useParams<{ name?: string }>(); + const app = useApp(); const { token } = useToken(); const pageStyle = usePageStyle(); @@ -255,7 +257,11 @@ export const InternalAdminLayout = () => { padding: 0; align-items: center; padding: 0 12px 0 12px; + cursor: pointer; `} + onClick={() => { + location.href = app.adminUrl; + }} > { const timezoneOffset = new Date().getTimezoneOffset() / -60; @@ -22,7 +22,7 @@ export class TachyBaseClientPresetPlugin extends Plugin { config.headers['X-Timezone'] = getCurrentTimezone(); return config; }); - await this.app.pm.add(BuildinPlugin); + await this.app.pm.add(BuiltInPlugin); } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6bcd17485..c2f071e0b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1562,18 +1562,9 @@ importers: specifier: workspace:* version: link:../../../core/utils devDependencies: - '@ant-design/cssinjs': - specifier: ^1.11.1 - version: 1.18.2(react-dom@18.2.0)(react@18.2.0) '@ant-design/icons': specifier: ~5.3.6 version: 5.3.6(react-dom@18.2.0)(react@18.2.0) - '@ant-design/pro-layout': - specifier: ^7.16.11 - version: 7.17.16(antd@5.16.1)(react-dom@18.2.0)(react@18.2.0) - '@formily/antd-v5': - specifier: 1.x - version: 1.2.0(@types/react-dom@18.2.25)(@types/react@18.2.79)(antd@5.16.1)(react-dom@18.2.0)(react-is@18.3.1)(react@18.2.0)(typescript@4.9.5) '@react-pdf/renderer': specifier: ^3.3.2 version: 3.3.8(react@18.2.0) @@ -5060,6 +5051,7 @@ packages: react-dom: 18.2.0(react@18.2.0) swr: 2.2.4(react@18.2.0) warning: 4.0.3 + dev: false /@ant-design/pro-provider@2.13.5(antd@5.16.1)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-ZVmzY2cq4nUvgmAlfgyCAaSZYV2l3n/upIQPXPj8sYcT+N/Pt1CeSVkkgW6By3EqokF6apWdIFU7hZMK2rNhrg==} @@ -5076,6 +5068,7 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) swr: 2.2.4(react@18.2.0) + dev: false /@ant-design/pro-utils@2.15.2(antd@5.16.1)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-kzMT658CGrQqoihKPlZhbnRioovwMhM59vqqVXuT6A+IuyxJhs5pxN73C6sN2+ZoeYCo/Gewnfn9v1/2vHU2Zg==} @@ -5096,6 +5089,7 @@ packages: react-dom: 18.2.0(react@18.2.0) safe-stable-stringify: 2.4.3 swr: 2.2.4(react@18.2.0) + dev: false /@ant-design/react-slick@1.1.2(react@18.2.0): resolution: {integrity: sha512-EzlvzE6xQUBrZuuhSAFTdsr4P2bBBHGZwKFemEfq8gIGyIQCxalYfZW/T2ORbtQx5rU69o+WycP3exY/7T1hGA==} @@ -8118,18 +8112,6 @@ packages: tslib: 2.6.2 dev: false - /@dnd-kit/sortable@7.0.2(@dnd-kit/core@6.1.0)(react@18.2.0): - resolution: {integrity: sha512-wDkBHHf9iCi1veM834Gbk1429bd4lHX4RpAwT0y2cHLf246GAvU2sVw/oxWNpPKQNQRQaeGXhAVgrOl1IT+iyA==} - peerDependencies: - '@dnd-kit/core': ^6.0.7 - react: '>=16.8.0' - dependencies: - '@dnd-kit/core': 6.1.0(react-dom@18.2.0)(react@18.2.0) - '@dnd-kit/utilities': 3.2.2(react@18.2.0) - react: 18.2.0 - tslib: 2.6.2 - dev: true - /@dnd-kit/sortable@8.0.0(@dnd-kit/core@6.1.0)(react@18.2.0): resolution: {integrity: sha512-U3jk5ebVXe1Lr7c2wU7SBZjcWdQP+j7peHJfCspnA81enlu88Mgd7CC8Q+pub9ubP7eKVETzJW+IBAhsqbSu/g==} peerDependencies: @@ -9393,40 +9375,6 @@ packages: /@floating-ui/utils@0.2.1: resolution: {integrity: sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==} - /@formily/antd-v5@1.2.0(@types/react-dom@18.2.25)(@types/react@18.2.79)(antd@5.16.1)(react-dom@18.2.0)(react-is@18.3.1)(react@18.2.0)(typescript@4.9.5): - resolution: {integrity: sha512-6K1fV7pwvy7j5KoO/5dEe5llosann7211I/bH/WJkLQtDSDK+XLFUQ4/lU7CdNpwHMrspzXS3lF82EM3hGyM8w==} - engines: {npm: '>=3.0.0'} - peerDependencies: - '@types/react': '>=16.8.0 || >=17.0.0' - '@types/react-dom': '>=16.8.0 || >=17.0.0' - antd: ^5.13.0 - react: '>=16.8.0 || >=17.0.0' - react-dom: '>=16.8.0' - react-is: '>=16.8.0 || >=17.0.0' - dependencies: - '@ant-design/cssinjs': 1.20.0(react-dom@18.2.0)(react@18.2.0) - '@ant-design/icons': 5.3.6(react-dom@18.2.0)(react@18.2.0) - '@dnd-kit/core': 6.1.0(react-dom@18.2.0)(react@18.2.0) - '@dnd-kit/sortable': 7.0.2(@dnd-kit/core@6.1.0)(react@18.2.0) - '@formily/core': 2.2.27 - '@formily/grid': 2.2.27(typescript@4.9.5) - '@formily/json-schema': 2.2.27(typescript@4.9.5) - '@formily/react': 2.2.27(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0)(react-is@18.3.1)(react@18.2.0)(typescript@4.9.5) - '@formily/reactive': 2.2.27 - '@formily/reactive-react': 2.2.27(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0)(react-is@18.3.1)(react@18.2.0) - '@formily/shared': 2.2.27 - '@types/react': 18.2.79 - '@types/react-dom': 18.2.25 - antd: 5.16.1(react-dom@18.2.0)(react@18.2.0) - classnames: 2.5.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-is: 18.3.1 - react-sticky-box: 1.0.2(react@18.2.0) - transitivePeerDependencies: - - typescript - dev: true - /@formily/core@2.2.27: resolution: {integrity: sha512-f8e4f/WlimOA7zN1ARmiRKMlIpsIH00XxT7NWAE7EV3DO2B6sq6gSq9GDc5JLwHqhiyJBAIPzUdfmIpRLwPxyQ==} engines: {npm: '>=3.0.0'} @@ -9444,6 +9392,7 @@ packages: '@formily/reactive': 2.2.27 '@juggle/resize-observer': 3.4.0 typescript: 4.9.5 + dev: false /@formily/json-schema@2.2.27(typescript@4.9.5): resolution: {integrity: sha512-YqtpPp9bmXO28iw10ZLT5KCAqipr2SwPrzfskUJ/Oa8O3xZi64+9TMVPylX73cBe49lVaOgFiQPNAljLudeveg==} @@ -9455,6 +9404,7 @@ packages: '@formily/reactive': 2.2.27 '@formily/shared': 2.2.27 typescript: 4.9.5 + dev: false /@formily/json-schema@2.2.27(typescript@5.4.5): resolution: {integrity: sha512-YqtpPp9bmXO28iw10ZLT5KCAqipr2SwPrzfskUJ/Oa8O3xZi64+9TMVPylX73cBe49lVaOgFiQPNAljLudeveg==} @@ -9501,6 +9451,7 @@ packages: react-is: 18.3.1 transitivePeerDependencies: - typescript + dev: false /@formily/reactive-react@2.2.27(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0)(react-is@18.3.1)(react@18.2.0): resolution: {integrity: sha512-LJefK/9g8MorhGexMiVF+FVWyMR/Vc4C63Djrj08XeXtTF0NUNUUKVBT1eZqmtdRHJSyDE7SSgUmpxcXP7QmQQ==} @@ -9524,6 +9475,7 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-is: 18.3.1 + dev: false /@formily/reactive@2.2.27: resolution: {integrity: sha512-ksdA4uIw3WMo0FmHcGsyqZgPwhujVgtXqxiWPSV+Tc2eEoJrInZhr15Q0IeTQ6glMh8izNsb19YK+PphBHwXGg==} @@ -9781,6 +9733,7 @@ packages: /@juggle/resize-observer@3.4.0: resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} + dev: false /@koa/cors@3.4.3: resolution: {integrity: sha512-WPXQUaAeAMVaLTEFpoq3T2O1C+FstkjJnDQqy95Ck1UdILajsRhu6mhJ8H2f4NFPRBoCNN+qywTJfq/gGki5mw==} @@ -13598,6 +13551,7 @@ packages: /@umijs/route-utils@4.0.1: resolution: {integrity: sha512-+1ixf1BTOLuH+ORb4x8vYMPeIt38n9q0fJDwhv9nSxrV46mxbLF0nmELIo9CKQB2gHfuC4+hww6xejJ6VYnBHQ==} + dev: false /@umijs/server@4.1.10: resolution: {integrity: sha512-BDR+4+ieSkq/+J0ZRhLo78z5aWS0CTphzRhHvSUNtrgjz7XJljizUaBLXUy7aerVwnWOoYCleGF9vUg386Jh7g==} @@ -13664,6 +13618,7 @@ packages: react: '*' dependencies: react: 18.2.0 + dev: false /@umijs/utils@3.5.20: resolution: {integrity: sha512-Y0i27zZTCKoqdHHyTuebO/GOIY4gGLUwDFs1eoH+m4etPn+uRq0iax9KJOkelmax2K3YLsT4KbRwM1enlSsv3A==} @@ -15749,6 +15704,7 @@ packages: /client-only@0.0.1: resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} + dev: false /clipboardy@2.3.0: resolution: {integrity: sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==} @@ -22755,6 +22711,7 @@ packages: /omit.js@2.0.2: resolution: {integrity: sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg==} + dev: false /on-exit-leak-free@0.2.0: resolution: {integrity: sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==} @@ -23176,6 +23133,7 @@ packages: /path-to-regexp@2.4.0: resolution: {integrity: sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w==} + dev: false /path-to-regexp@6.2.1: resolution: {integrity: sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==} @@ -25631,6 +25589,7 @@ packages: dependencies: react: 18.2.0 resize-observer-polyfill: 1.5.1 + dev: false /react-to-print@2.14.15(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-SKnwOzU2cJ8eaAkoJO7+gNhvfEDmm+Y34IdcHsjtHioUevUPhprqbVtvNJlZ2JkGJ8ExK2QNWM9pXECTDR5D8w==} @@ -27572,6 +27531,7 @@ packages: client-only: 0.0.1 react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) + dev: false /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}