diff --git a/packages/core/client/src/application/components/AppComponent.tsx b/packages/core/client/src/application/components/AppComponent.tsx index c7fc35137..44e795100 100644 --- a/packages/core/client/src/application/components/AppComponent.tsx +++ b/packages/core/client/src/application/components/AppComponent.tsx @@ -1,6 +1,8 @@ +import React, { useCallback, useEffect } from 'react'; import { observer } from '@tachybase/schema'; -import React, { FC, useCallback, useEffect } from 'react'; + import { ErrorBoundary } from 'react-error-boundary'; + import type { Application } from '../Application'; import { ApplicationContext } from '../context'; @@ -8,8 +10,8 @@ export interface AppComponentProps { app: Application; } -export const AppComponent: FC = observer( - (props) => { +export const AppComponent = observer( + (props: AppComponentProps) => { const { app } = props; const handleErrors = useCallback((error: Error, info: { componentStack: string }) => { console.error(error); diff --git a/packages/core/client/src/application/components/RouterContextCleaner.tsx b/packages/core/client/src/application/components/RouterContextCleaner.tsx index 646e10c74..c6b816be6 100644 --- a/packages/core/client/src/application/components/RouterContextCleaner.tsx +++ b/packages/core/client/src/application/components/RouterContextCleaner.tsx @@ -1,7 +1,8 @@ -import React, { FC, ReactNode } from 'react'; +import React, { ReactNode } from 'react'; + import { UNSAFE_LocationContext, UNSAFE_RouteContext } from 'react-router-dom'; -export const RouterContextCleaner: FC<{ children?: ReactNode }> = React.memo((props) => { +export const RouterContextCleaner = React.memo((props: { children?: ReactNode }) => { return (
Loading...
; -const AppError: FC<{ error: Error }> = ({ error }) => ( +const Loading = () =>
Loading...
; +const AppError = ({ error }: { error: Error }) => (
Load Plugin Error
{error?.message}
); -const AppNotFound: FC = () =>
; +const AppNotFound = () =>
; export const defaultAppComponents = { AppMain: MainComponent, diff --git a/packages/core/client/src/application/hooks/useAppSpin.ts b/packages/core/client/src/application/hooks/useAppSpin.ts index 8160735e6..7f8598bce 100644 --- a/packages/core/client/src/application/hooks/useAppSpin.ts +++ b/packages/core/client/src/application/hooks/useAppSpin.ts @@ -1,5 +1,7 @@ -import { Spin } from 'antd'; import React from 'react'; + +import { Spin } from 'antd'; + import { useApp } from './useApp'; export const useAppSpin = () => { diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 0e479a4c9..3747e679a 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -8,6 +8,7 @@ import template from 'lodash/template'; import { Link } from 'react-router-dom'; import { + ACLCollectionProvider, DataBlockProvider, TableFieldResource, useCollectionManager, @@ -21,7 +22,6 @@ import { useRecord, WithoutTableFieldResource, } from '../'; -import { ACLCollectionProvider } from '../acl/ACLProvider'; import { CollectionProvider_deprecated, useCollection_deprecated, diff --git a/packages/core/client/src/block-provider/BlockSchemaComponentProvider.tsx b/packages/core/client/src/block-provider/BlockSchemaComponentProvider.tsx index 428dc3758..dcabde349 100644 --- a/packages/core/client/src/block-provider/BlockSchemaComponentProvider.tsx +++ b/packages/core/client/src/block-provider/BlockSchemaComponentProvider.tsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { Plugin } from '../application/Plugin'; import { ActionSchemaToolbar } from '../modules/actions/ActionSchemaToolbar'; import { BlockSchemaToolbar } from '../modules/blocks/BlockSchemaToolbar'; @@ -22,7 +20,6 @@ import { CollapseItemSchemaToolbar } from '../modules/blocks/filter-blocks/colla import { useCollapseBlockDecoratorProps } from '../modules/blocks/filter-blocks/collapse/hooks/useCollapseBlockDecoratorProps'; import { useFilterFormBlockDecoratorProps } from '../modules/blocks/filter-blocks/form/hooks/useFilterFormBlockDecoratorProps'; import { useFilterFormBlockProps } from '../modules/blocks/filter-blocks/form/hooks/useFilterFormBlockProps'; -import { SchemaComponentOptions } from '../schema-component'; import { RecordLink, useParamsFromRecord, useSourceIdFromParentRecord, useSourceIdFromRecord } from './BlockProvider'; import { DetailsBlockProvider, useDetailsBlockProps } from './DetailsBlockProvider'; import { FilterFormBlockProvider } from './FilterFormBlockProvider'; @@ -33,53 +30,6 @@ import { TableBlockProvider } from './TableBlockProvider'; import { TableFieldProvider, useTableFieldProps } from './TableFieldProvider'; import { TableSelectorProvider, useTableSelectorProps } from './TableSelectorProvider'; -// TODO: delete this, replaced by `BlockSchemaComponentPlugin` -export const BlockSchemaComponentProvider = (props) => { - return ( - - {props.children} - - ); -}; - export class BlockSchemaComponentPlugin extends Plugin { async load() { this.addComponents(); diff --git a/packages/core/client/src/acl/ACLProvider.tsx b/packages/core/client/src/buildin-plugin/acl/ACLProvider.tsx similarity index 93% rename from packages/core/client/src/acl/ACLProvider.tsx rename to packages/core/client/src/buildin-plugin/acl/ACLProvider.tsx index d13385622..3b349c9d3 100644 --- a/packages/core/client/src/acl/ACLProvider.tsx +++ b/packages/core/client/src/buildin-plugin/acl/ACLProvider.tsx @@ -1,17 +1,18 @@ -import { Field } from '@tachybase/schema'; -import { Schema, useField, useFieldSchema } from '@tachybase/schema'; import React, { createContext, useContext, useEffect } from 'react'; -import { Navigate } from 'react-router-dom'; +import { Field, Schema, useField, useFieldSchema } from '@tachybase/schema'; + import { omit } from 'lodash'; -import { useAPIClient, useRequest } from '../api-client'; -import { useAppSpin } from '../application/hooks/useAppSpin'; -import { useBlockRequestContext } from '../block-provider/BlockProvider'; -import { useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager'; -import { useResourceActionContext } from '../collection-manager/ResourceActionProvider'; -import { useRecord } from '../record-provider'; -import { SchemaComponentOptions, useDesignable } from '../schema-component'; -import { useApp } from '../application'; -import { useDataSourceKey } from '../data-source/data-source/DataSourceProvider'; +import { Navigate } from 'react-router-dom'; + +import { useAPIClient, useRequest } from '../../api-client'; +import { useApp } from '../../application'; +import { useAppSpin } from '../../application/hooks/useAppSpin'; +import { useBlockRequestContext } from '../../block-provider/BlockProvider'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../collection-manager'; +import { useResourceActionContext } from '../../collection-manager/ResourceActionProvider'; +import { useDataSourceKey } from '../../data-source/data-source/DataSourceProvider'; +import { useRecord } from '../../record-provider'; +import { SchemaComponentOptions, useDesignable } from '../../schema-component'; export const ACLContext = createContext({}); ACLContext.displayName = 'ACLContext'; diff --git a/packages/core/client/src/acl/ACLShortcut.tsx b/packages/core/client/src/buildin-plugin/acl/ACLShortcut.tsx similarity index 74% rename from packages/core/client/src/acl/ACLShortcut.tsx rename to packages/core/client/src/buildin-plugin/acl/ACLShortcut.tsx index 195154d4b..74539e4e5 100644 --- a/packages/core/client/src/acl/ACLShortcut.tsx +++ b/packages/core/client/src/buildin-plugin/acl/ACLShortcut.tsx @@ -1,8 +1,9 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { Card } from 'antd'; import React from 'react'; -import { SchemaComponent } from '../schema-component'; +import { ISchema, uid } from '@tachybase/schema'; + +import { Card } from 'antd'; + +import { SchemaComponent } from '../../schema-component'; import * as components from './Configuration'; const schema2: ISchema = { diff --git a/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/ConfigureCenter.tsx similarity index 94% rename from packages/core/client/src/acl/Configuration/ConfigureCenter.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/ConfigureCenter.tsx index 6d0755491..c14e7286f 100644 --- a/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/ConfigureCenter.tsx @@ -4,11 +4,11 @@ import { Checkbox, message, Table } from 'antd'; import { omit } from 'lodash'; import { useTranslation } from 'react-i18next'; -import { useAPIClient, useRequest } from '../../api-client'; -import { useApp } from '../../application'; +import { useAPIClient, useRequest } from '../../../api-client'; +import { useApp } from '../../../application'; +import { useRecord } from '../../../record-provider'; +import { useCompile } from '../../../schema-component'; import { SettingsCenterContext } from '../../pm'; -import { useRecord } from '../../record-provider'; -import { useCompile } from '../../schema-component'; import { useStyles } from '../style'; const getParentKeys = (tree, func, path = []) => { diff --git a/packages/core/client/src/acl/Configuration/MenuConfigure.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/MenuConfigure.tsx similarity index 97% rename from packages/core/client/src/acl/Configuration/MenuConfigure.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/MenuConfigure.tsx index 114a40def..ddd41022b 100644 --- a/packages/core/client/src/acl/Configuration/MenuConfigure.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/MenuConfigure.tsx @@ -4,8 +4,8 @@ import { Checkbox, message, Table } from 'antd'; import { uniq } from 'lodash'; import { useTranslation } from 'react-i18next'; -import { useAPIClient, useRequest } from '../../api-client'; -import { useRecord } from '../../record-provider'; +import { useAPIClient, useRequest } from '../../../api-client'; +import { useRecord } from '../../../record-provider'; import { useStyles } from '../style'; import { useMenuItems } from './MenuItemsProvider'; diff --git a/packages/core/client/src/acl/Configuration/MenuItemsProvider.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/MenuItemsProvider.tsx similarity index 92% rename from packages/core/client/src/acl/Configuration/MenuItemsProvider.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/MenuItemsProvider.tsx index 5a1210273..c453a7453 100644 --- a/packages/core/client/src/acl/Configuration/MenuItemsProvider.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/MenuItemsProvider.tsx @@ -1,7 +1,9 @@ -import { Spin } from 'antd'; import React, { createContext, useContext } from 'react'; -import { useRequest } from '../../api-client'; -import { useAdminSchemaUid } from '../../hooks'; + +import { Spin } from 'antd'; + +import { useRequest } from '../../../api-client'; +import { useAdminSchemaUid } from '../../../hooks'; const MenuItemsContext = createContext(null); MenuItemsContext.displayName = 'MenuItemsContext'; diff --git a/packages/core/client/src/acl/Configuration/PermisionProvider.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/PermisionProvider.tsx similarity index 94% rename from packages/core/client/src/acl/Configuration/PermisionProvider.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/PermisionProvider.tsx index fdaf51b6c..38df944f8 100644 --- a/packages/core/client/src/acl/Configuration/PermisionProvider.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/PermisionProvider.tsx @@ -1,9 +1,10 @@ -import { message } from 'antd'; import React, { createContext, useContext, useState } from 'react'; +import { message } from 'antd'; import { useTranslation } from 'react-i18next'; -import { useAPIClient } from '../../api-client'; -import { useRecord } from '../../record-provider'; + +import { useAPIClient } from '../../../api-client'; +import { useRecord } from '../../../record-provider'; export const SettingCenterPermissionProvider = (props) => { const { currentRecord } = useContext(PermissionContext); diff --git a/packages/core/client/src/acl/Configuration/RoleConfigure.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/RoleConfigure.tsx similarity index 94% rename from packages/core/client/src/acl/Configuration/RoleConfigure.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/RoleConfigure.tsx index fdeb7521a..10a526e7c 100644 --- a/packages/core/client/src/acl/Configuration/RoleConfigure.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/RoleConfigure.tsx @@ -1,11 +1,12 @@ -import { onFieldChange } from '@tachybase/schema'; -import { connect } from '@tachybase/schema'; +import React, { useContext } from 'react'; +import { connect, onFieldChange } from '@tachybase/schema'; + import { Checkbox } from 'antd'; import uniq from 'lodash/uniq'; -import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAPIClient, useRequest } from '../../api-client'; -import { SchemaComponent } from '../../schema-component'; + +import { useAPIClient, useRequest } from '../../../api-client'; +import { SchemaComponent } from '../../../schema-component'; import { PermissionContext } from './PermisionProvider'; const SnippetCheckboxGroup = connect((props) => { diff --git a/packages/core/client/src/acl/Configuration/RoleTable.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx similarity index 90% rename from packages/core/client/src/acl/Configuration/RoleTable.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx index 56effd260..3223ee30b 100644 --- a/packages/core/client/src/acl/Configuration/RoleTable.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/RoleTable.tsx @@ -2,8 +2,8 @@ import React, { createContext, useContext } from 'react'; import { Spin } from 'antd'; -import { useRequest } from '../../api-client'; -import { SchemaComponent, SchemaComponentContext } from '../../schema-component'; +import { useRequest } from '../../../api-client'; +import { SchemaComponent, SchemaComponentContext } from '../../../schema-component'; import { MenuItemsProvider } from '../Configuration/MenuItemsProvider'; import { PermissionProvider, SettingCenterPermissionProvider } from '../Configuration/PermisionProvider'; import { roleSchema } from './schemas/roles'; diff --git a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/RolesResourcesActions.tsx similarity index 99% rename from packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/RolesResourcesActions.tsx index d90ca5452..399c4ca72 100644 --- a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/RolesResourcesActions.tsx @@ -6,7 +6,7 @@ import { Checkbox, Table, Tag } from 'antd'; import { isEmpty } from 'lodash'; import { useTranslation } from 'react-i18next'; -import { useCollectionManager_deprecated, useCompile, useRecord } from '../..'; +import { useCollectionManager_deprecated, useCompile, useRecord } from '../../..'; import { useStyles } from '../style'; import { useAvailableActions } from './RoleTable'; import { ScopeSelect } from './ScopeSelect'; diff --git a/packages/core/client/src/acl/Configuration/ScopeSelect.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/ScopeSelect.tsx similarity index 94% rename from packages/core/client/src/acl/Configuration/ScopeSelect.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/ScopeSelect.tsx index fb54f3b1f..ca4e72e3b 100644 --- a/packages/core/client/src/acl/Configuration/ScopeSelect.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/ScopeSelect.tsx @@ -1,7 +1,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { createForm } from '@tachybase/schema'; -import { FormProvider, SchemaComponent } from '../../schema-component'; +import { FormProvider, SchemaComponent } from '../../../schema-component'; import { scopesSchema } from './schemas/scopes'; const RolesResourcesScopesSelectedRowKeysContext = createContext(null); diff --git a/packages/core/client/src/acl/Configuration/StrategyActions.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/StrategyActions.tsx similarity index 98% rename from packages/core/client/src/acl/Configuration/StrategyActions.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/StrategyActions.tsx index 2191d3bc3..028e145ca 100644 --- a/packages/core/client/src/acl/Configuration/StrategyActions.tsx +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/StrategyActions.tsx @@ -4,7 +4,7 @@ import { ArrayField, connect, useField } from '@tachybase/schema'; import { Checkbox, Select, Table, Tag } from 'antd'; import { useTranslation } from 'react-i18next'; -import { useCompile } from '../..'; +import { useCompile } from '../../..'; import { useAvailableActions } from './RoleTable'; const toScopes = (value) => { diff --git a/packages/core/client/src/acl/Configuration/index.tsx b/packages/core/client/src/buildin-plugin/acl/Configuration/index.tsx similarity index 100% rename from packages/core/client/src/acl/Configuration/index.tsx rename to packages/core/client/src/buildin-plugin/acl/Configuration/index.tsx diff --git a/packages/core/client/src/acl/Configuration/schemas/roles.ts b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/roles.ts similarity index 98% rename from packages/core/client/src/acl/Configuration/schemas/roles.ts rename to packages/core/client/src/buildin-plugin/acl/Configuration/schemas/roles.ts index 1a1df4d90..c5a09d81a 100644 --- a/packages/core/client/src/acl/Configuration/schemas/roles.ts +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/roles.ts @@ -1,10 +1,11 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import pick from 'lodash/pick'; import { useEffect } from 'react'; -import { useRequest } from '../../../api-client'; -import { useRecord } from '../../../record-provider'; -import { useActionContext } from '../../../schema-component'; +import { ISchema, uid } from '@tachybase/schema'; + +import pick from 'lodash/pick'; + +import { useRequest } from '../../../../api-client'; +import { useRecord } from '../../../../record-provider'; +import { useActionContext } from '../../../../schema-component'; const collection = { name: 'roles', diff --git a/packages/core/client/src/acl/Configuration/schemas/scopes.ts b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/scopes.ts similarity index 98% rename from packages/core/client/src/acl/Configuration/schemas/scopes.ts rename to packages/core/client/src/buildin-plugin/acl/Configuration/schemas/scopes.ts index a3a18c2c4..843bbcef0 100644 --- a/packages/core/client/src/acl/Configuration/schemas/scopes.ts +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/scopes.ts @@ -1,8 +1,9 @@ -import { ISchema } from '@tachybase/schema'; import { useContext, useEffect } from 'react'; -import { useFormBlockContext } from '../../../block-provider'; -import { useFilterOptions } from '../../../schema-component'; -import { VariableInput } from '../../../schema-settings'; +import { ISchema } from '@tachybase/schema'; + +import { useFormBlockContext } from '../../../../block-provider'; +import { useFilterOptions } from '../../../../schema-component'; +import { VariableInput } from '../../../../schema-settings'; import { RoleResourceCollectionContext } from '../RolesResourcesActions'; export const rolesResourcesScopesCollection = { diff --git a/packages/core/client/src/acl/Configuration/schemas/useRoleResourceValues.ts b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useRoleResourceValues.ts similarity index 98% rename from packages/core/client/src/acl/Configuration/schemas/useRoleResourceValues.ts rename to packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useRoleResourceValues.ts index 80d989c03..3892dbbe8 100644 --- a/packages/core/client/src/acl/Configuration/schemas/useRoleResourceValues.ts +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useRoleResourceValues.ts @@ -1,5 +1,6 @@ import { useEffect } from 'react'; -import { useActionContext, useRecord, useRequest } from '../../../'; + +import { useActionContext, useRecord, useRequest } from '../../../..'; export const useRoleResourceValues = (options) => { const record = useRecord(); diff --git a/packages/core/client/src/acl/Configuration/schemas/useSaveRoleResourceAction.ts b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useSaveRoleResourceAction.ts similarity index 94% rename from packages/core/client/src/acl/Configuration/schemas/useSaveRoleResourceAction.ts rename to packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useSaveRoleResourceAction.ts index 2a6405b08..6761dc0ec 100644 --- a/packages/core/client/src/acl/Configuration/schemas/useSaveRoleResourceAction.ts +++ b/packages/core/client/src/buildin-plugin/acl/Configuration/schemas/useSaveRoleResourceAction.ts @@ -1,5 +1,6 @@ import { useForm } from '@tachybase/schema'; -import { useActionContext, useAPIClient, useRecord, useResourceActionContext } from '../../../'; + +import { useActionContext, useAPIClient, useRecord, useResourceActionContext } from '../../../..'; export const useSaveRoleResourceAction = () => { const form = useForm(); diff --git a/packages/core/client/src/acl/index.ts b/packages/core/client/src/buildin-plugin/acl/index.ts similarity index 89% rename from packages/core/client/src/acl/index.ts rename to packages/core/client/src/buildin-plugin/acl/index.ts index fe86e2894..fef3a5742 100644 --- a/packages/core/client/src/acl/index.ts +++ b/packages/core/client/src/buildin-plugin/acl/index.ts @@ -1,8 +1,4 @@ -export * from './ACLProvider'; -export * from './ACLShortcut'; -export * from './Configuration'; - -import { Plugin } from '../application/Plugin'; +import { Plugin } from '../../application/Plugin'; import { ACLActionProvider, ACLCollectionFieldProvider, @@ -10,6 +6,10 @@ import { ACLMenuItemProvider, } from './ACLProvider'; +export * from './ACLProvider'; +export * from './ACLShortcut'; +export * from './Configuration'; + export class ACLPlugin extends Plugin { async load() { this.app.addComponents({ diff --git a/packages/core/client/src/acl/style.ts b/packages/core/client/src/buildin-plugin/acl/style.ts similarity index 100% rename from packages/core/client/src/acl/style.ts rename to packages/core/client/src/buildin-plugin/acl/style.ts diff --git a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx b/packages/core/client/src/buildin-plugin/admin-layout/index.tsx similarity index 98% rename from packages/core/client/src/route-switch/antd/admin-layout/index.tsx rename to packages/core/client/src/buildin-plugin/admin-layout/index.tsx index e42753aab..e35294381 100644 --- a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx +++ b/packages/core/client/src/buildin-plugin/admin-layout/index.tsx @@ -22,10 +22,10 @@ import { useDocumentTitle, useRequest, useSystemSettings, -} from '../../../'; -import { useAppSpin } from '../../../application/hooks/useAppSpin'; -import { Plugin } from '../../../application/Plugin'; -import { VariablesProvider } from '../../../variables'; +} from '../..'; +import { useAppSpin } from '../../application/hooks/useAppSpin'; +import { Plugin } from '../../application/Plugin'; +import { VariablesProvider } from '../../variables'; const useStyles = createStyles(({ css, token }) => { return { @@ -399,7 +399,6 @@ const SetThemeOfHeaderSubmenu = ({ children }) => { export const InternalAdminLayout = (props: any) => { const sideMenuRef = useRef(); const result = useSystemSettings(); - // const { service } = useCollectionManager_deprecated(); const params = useParams(); const { styles } = useStyles(); return ( diff --git a/packages/core/client/src/document-title/index.md b/packages/core/client/src/buildin-plugin/document-title/index.md similarity index 100% rename from packages/core/client/src/document-title/index.md rename to packages/core/client/src/buildin-plugin/document-title/index.md diff --git a/packages/core/client/src/document-title/index.tsx b/packages/core/client/src/buildin-plugin/document-title/index.tsx similarity index 97% rename from packages/core/client/src/document-title/index.tsx rename to packages/core/client/src/buildin-plugin/document-title/index.tsx index 2bd0ba374..9ed74ed50 100644 --- a/packages/core/client/src/document-title/index.tsx +++ b/packages/core/client/src/buildin-plugin/document-title/index.tsx @@ -3,7 +3,7 @@ import React, { createContext, useContext, useEffect, useState } from 'react'; import { Helmet } from 'react-helmet'; import { useTranslation } from 'react-i18next'; -import { Plugin } from '../application/Plugin'; +import { Plugin } from '../../application/Plugin'; import { useSystemSettings } from '../system-settings'; interface DocumentTitleContextProps { diff --git a/packages/core/client/src/buildin-plugin/index.tsx b/packages/core/client/src/buildin-plugin/index.tsx index 83785f6d7..a96b5a1f2 100644 --- a/packages/core/client/src/buildin-plugin/index.tsx +++ b/packages/core/client/src/buildin-plugin/index.tsx @@ -7,24 +7,24 @@ import { Button, Modal, Result, Spin } from 'antd'; import { createStyles } from 'antd-style'; import { Navigate, useNavigate } from 'react-router-dom'; -import { ACLPlugin } from '../acl'; import { useAPIClient } from '../api-client'; import { Application } from '../application'; import { Plugin } from '../application/Plugin'; import { BlockSchemaComponentPlugin } from '../block-provider'; import { CollectionPlugin } from '../collection-manager'; -import { RemoteDocumentTitlePlugin } from '../document-title'; -import { PinnedListPlugin } from '../plugin-manager'; -import { PMPlugin } from '../pm'; import { AdminLayoutPlugin, RouteSchemaComponent } from '../route-switch'; import { AntdSchemaComponentPlugin, SchemaComponentPlugin } from '../schema-component'; import { ErrorFallback } from '../schema-component/antd/error-fallback'; import { AssociationFilterPlugin, SchemaInitializerPlugin } from '../schema-initializer'; import { SchemaSettingsPlugin } from '../schema-settings'; import { BlockTemplateDetails, BlockTemplatePage } from '../schema-templates'; -import { SystemSettingsPlugin } from '../system-settings'; import { CurrentUserProvider, CurrentUserSettingsMenuProvider } from '../user'; -import { LocalePlugin } from './plugins/LocalePlugin'; +import { ACLPlugin } from './acl'; +import { RemoteDocumentTitlePlugin } from './document-title'; +import { LocalePlugin } from './locale/LocalePlugin'; +import { PinnedListPlugin } from './pinned-list'; +import { PMPlugin } from './pm'; +import { SystemSettingsPlugin } from './system-settings'; interface AppStatusProps { error: Error; diff --git a/packages/core/client/src/buildin-plugin/plugins/LocalePlugin.ts b/packages/core/client/src/buildin-plugin/locale/LocalePlugin.ts similarity index 100% rename from packages/core/client/src/buildin-plugin/plugins/LocalePlugin.ts rename to packages/core/client/src/buildin-plugin/locale/LocalePlugin.ts diff --git a/packages/core/client/src/plugin-manager/PinnedPluginListProvider.tsx b/packages/core/client/src/buildin-plugin/pinned-list/PinnedPluginListProvider.tsx similarity index 96% rename from packages/core/client/src/plugin-manager/PinnedPluginListProvider.tsx rename to packages/core/client/src/buildin-plugin/pinned-list/PinnedPluginListProvider.tsx index 45a41c044..542d00669 100644 --- a/packages/core/client/src/plugin-manager/PinnedPluginListProvider.tsx +++ b/packages/core/client/src/buildin-plugin/pinned-list/PinnedPluginListProvider.tsx @@ -4,7 +4,7 @@ import { SchemaOptionsContext } from '@tachybase/schema'; import { createStyles } from 'antd-style'; import { get } from 'lodash'; -import { useACLRoleContext } from '../acl/ACLProvider'; +import { useACLRoleContext } from '../acl'; import { PinnedPluginListContext } from './context'; export const PinnedPluginListProvider = (props: { items: any; children: React.ReactNode }) => { diff --git a/packages/core/client/src/plugin-manager/context.ts b/packages/core/client/src/buildin-plugin/pinned-list/context.ts similarity index 100% rename from packages/core/client/src/plugin-manager/context.ts rename to packages/core/client/src/buildin-plugin/pinned-list/context.ts diff --git a/packages/core/client/src/plugin-manager/index.ts b/packages/core/client/src/buildin-plugin/pinned-list/index.ts similarity index 84% rename from packages/core/client/src/plugin-manager/index.ts rename to packages/core/client/src/buildin-plugin/pinned-list/index.ts index da50b1ba2..9a4b20e49 100644 --- a/packages/core/client/src/plugin-manager/index.ts +++ b/packages/core/client/src/buildin-plugin/pinned-list/index.ts @@ -1,9 +1,9 @@ +import { Plugin } from '../../application/Plugin'; +import { PinnedPluginListProvider } from './PinnedPluginListProvider'; + export * from './context'; export * from './PinnedPluginListProvider'; -import { Plugin } from '../application/Plugin'; -import { PinnedPluginListProvider } from './PinnedPluginListProvider'; - export class PinnedListPlugin extends Plugin { async load() { this.app.use(PinnedPluginListProvider, this.options.config); diff --git a/packages/core/client/src/pm/PluginCard.tsx b/packages/core/client/src/buildin-plugin/pm/PluginCard.tsx similarity index 98% rename from packages/core/client/src/pm/PluginCard.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginCard.tsx index 1a5d0d0f7..efe56701e 100644 --- a/packages/core/client/src/pm/PluginCard.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginCard.tsx @@ -6,8 +6,8 @@ import classnames from 'classnames'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; -import { useAPIClient } from '../api-client'; -import { useApp } from '../application'; +import { useAPIClient } from '../../api-client'; +import { useApp } from '../../application'; import { PluginDetail } from './PluginDetail'; import { NPM_REGISTRY_ADDRESS } from './PluginForm/form/PluginNpmForm'; import { PluginUpgradeModal } from './PluginForm/modal/PluginUpgradeModal'; diff --git a/packages/core/client/src/pm/PluginDetail.tsx b/packages/core/client/src/buildin-plugin/pm/PluginDetail.tsx similarity index 99% rename from packages/core/client/src/pm/PluginDetail.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginDetail.tsx index 06a01ba69..b7859a564 100644 --- a/packages/core/client/src/pm/PluginDetail.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginDetail.tsx @@ -1,9 +1,11 @@ +import React, { FC, useMemo } from 'react'; + import { Alert, Col, Modal, Row, Space, Spin, Table, Tabs, TabsProps, Tag, Typography } from 'antd'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; -import React, { FC, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useRequest } from '../api-client'; + +import { useRequest } from '../../api-client'; import { PluginDocument } from './PluginDocument'; import { useStyles } from './style'; import { IPluginData } from './types'; diff --git a/packages/core/client/src/pm/PluginDocument.tsx b/packages/core/client/src/buildin-plugin/pm/PluginDocument.tsx similarity index 89% rename from packages/core/client/src/pm/PluginDocument.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginDocument.tsx index a629fc3b5..d540a255e 100644 --- a/packages/core/client/src/pm/PluginDocument.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginDocument.tsx @@ -1,11 +1,12 @@ -import { Spin } from 'antd'; import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; -import { useRequest } from '../api-client'; -import { useStyles as useMarkdownStyles } from '../schema-component/antd/markdown/style'; -import { useParseMarkdown } from '../schema-component/antd/markdown/util'; +import { Spin } from 'antd'; + +import { useRequest } from '../../api-client'; +import { useGlobalTheme } from '../../global-theme'; +import { useStyles as useMarkdownStyles } from '../../schema-component/antd/markdown/style'; +import { useParseMarkdown } from '../../schema-component/antd/markdown/util'; import { useStyles } from './style'; -import { useGlobalTheme } from '../global-theme'; const PLUGIN_STATICS_PATH = '/static/plugins/'; diff --git a/packages/core/client/src/pm/PluginForm/form/PluginNpmForm.tsx b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginNpmForm.tsx similarity index 94% rename from packages/core/client/src/pm/PluginForm/form/PluginNpmForm.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginNpmForm.tsx index 74adacb49..274265241 100644 --- a/packages/core/client/src/pm/PluginForm/form/PluginNpmForm.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginNpmForm.tsx @@ -1,13 +1,12 @@ -import { ISchema } from '@tachybase/schema'; -import { useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { App } from 'antd'; import React, { FC, useMemo } from 'react'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + +import { App } from 'antd'; +import { pick } from 'lodash'; import { useTranslation } from 'react-i18next'; -import { pick } from 'lodash'; -import { useAPIClient, useRequest } from '../../../api-client'; -import { SchemaComponent } from '../../../schema-component'; +import { useAPIClient, useRequest } from '../../../../api-client'; +import { SchemaComponent } from '../../../../schema-component'; import { IPluginData } from '../../types'; interface IPluginNpmFormProps { diff --git a/packages/core/client/src/pm/PluginForm/form/PluginUploadForm.tsx b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUploadForm.tsx similarity index 93% rename from packages/core/client/src/pm/PluginForm/form/PluginUploadForm.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUploadForm.tsx index eb2f78aa5..5af3c9e49 100644 --- a/packages/core/client/src/pm/PluginForm/form/PluginUploadForm.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUploadForm.tsx @@ -1,13 +1,12 @@ -import { ISchema } from '@tachybase/schema'; -import { useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { FC, useMemo } from 'react'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + import { App } from 'antd'; import type { RcFile } from 'antd/es/upload'; -import React, { FC, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useAPIClient } from '../../../api-client'; -import { SchemaComponent } from '../../../schema-component'; +import { useAPIClient } from '../../../../api-client'; +import { SchemaComponent } from '../../../../schema-component'; import { IPluginData } from '../../types'; interface IPluginUploadFormProps { diff --git a/packages/core/client/src/pm/PluginForm/form/PluginUrlForm.tsx b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUrlForm.tsx similarity index 91% rename from packages/core/client/src/pm/PluginForm/form/PluginUrlForm.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUrlForm.tsx index 9747c7fa9..ede03fda4 100644 --- a/packages/core/client/src/pm/PluginForm/form/PluginUrlForm.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginForm/form/PluginUrlForm.tsx @@ -1,12 +1,11 @@ -import { ISchema } from '@tachybase/schema'; -import { useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { App } from 'antd'; import React, { FC, useMemo } from 'react'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + +import { App } from 'antd'; import { useTranslation } from 'react-i18next'; -import { useAPIClient, useRequest } from '../../../api-client'; -import { SchemaComponent } from '../../../schema-component'; +import { useAPIClient, useRequest } from '../../../../api-client'; +import { SchemaComponent } from '../../../../schema-component'; import { IPluginData } from '../../types'; interface IPluginUrlFormProps { diff --git a/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx b/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginAddModal.tsx similarity index 99% rename from packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginAddModal.tsx index 3e30ede7b..7f610c020 100644 --- a/packages/core/client/src/pm/PluginForm/modal/PluginAddModal.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginAddModal.tsx @@ -1,8 +1,9 @@ -import { Modal, Radio } from 'antd'; import React, { FC, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useStyles } from '../../style'; +import { Modal, Radio } from 'antd'; +import { useTranslation } from 'react-i18next'; + +import { useStyles } from '../../style'; import { PluginNpmForm } from '../form/PluginNpmForm'; import { PluginUploadForm } from '../form/PluginUploadForm'; import { PluginUrlForm } from '../form/PluginUrlForm'; diff --git a/packages/core/client/src/pm/PluginForm/modal/PluginUpgradeModal.tsx b/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginUpgradeModal.tsx similarity index 99% rename from packages/core/client/src/pm/PluginForm/modal/PluginUpgradeModal.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginUpgradeModal.tsx index 7c699e48d..b69641698 100644 --- a/packages/core/client/src/pm/PluginForm/modal/PluginUpgradeModal.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginForm/modal/PluginUpgradeModal.tsx @@ -1,5 +1,6 @@ -import { Modal, Radio } from 'antd'; import React, { FC, useState } from 'react'; + +import { Modal, Radio } from 'antd'; import { useTranslation } from 'react-i18next'; import { useStyles } from '../../style'; diff --git a/packages/core/client/src/pm/PluginManager.tsx b/packages/core/client/src/buildin-plugin/pm/PluginManager.tsx similarity index 98% rename from packages/core/client/src/pm/PluginManager.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginManager.tsx index 7f47173a4..a5e7a6987 100644 --- a/packages/core/client/src/pm/PluginManager.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginManager.tsx @@ -8,10 +8,10 @@ import _ from 'lodash'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; -import { useACLRoleContext } from '../acl/ACLProvider'; -import { useRequest } from '../api-client'; -import { i18n } from '../i18n'; -import { useToken } from '../style'; +import { useRequest } from '../../api-client'; +import { useACLRoleContext } from '../../buildin-plugin/acl'; +import { i18n } from '../../i18n'; +import { useToken } from '../../style'; import { SwitchAction } from './PluginCard'; import { useStyles } from './style'; import { IPluginData } from './types'; diff --git a/packages/core/client/src/pm/PluginManagerLink.tsx b/packages/core/client/src/buildin-plugin/pm/PluginManagerLink.tsx similarity index 91% rename from packages/core/client/src/pm/PluginManagerLink.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginManagerLink.tsx index 771916311..90d81a329 100644 --- a/packages/core/client/src/pm/PluginManagerLink.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginManagerLink.tsx @@ -5,9 +5,9 @@ import { Button, Dropdown, Tooltip } from 'antd'; import { useTranslation } from 'react-i18next'; import { Link, useNavigate } from 'react-router-dom'; -import { useApp } from '../application'; -import { useCompile } from '../schema-component'; -import { useToken } from '../style'; +import { useApp } from '../../application'; +import { useCompile } from '../../schema-component'; +import { useToken } from '../../style'; export const PluginManagerLink = () => { const { t } = useTranslation(); diff --git a/packages/core/client/src/pm/PluginSetting.tsx b/packages/core/client/src/buildin-plugin/pm/PluginSetting.tsx similarity index 98% rename from packages/core/client/src/pm/PluginSetting.tsx rename to packages/core/client/src/buildin-plugin/pm/PluginSetting.tsx index b1f7c0551..19e8d2f45 100644 --- a/packages/core/client/src/pm/PluginSetting.tsx +++ b/packages/core/client/src/buildin-plugin/pm/PluginSetting.tsx @@ -5,8 +5,8 @@ import { Layout, Menu, Result } from 'antd'; import _ from 'lodash'; import { Navigate, Outlet, useLocation, useNavigate, useParams } from 'react-router-dom'; -import { ADMIN_SETTINGS_PATH, PluginSettingsPageType, useApp } from '../application'; -import { useCompile } from '../schema-component'; +import { ADMIN_SETTINGS_PATH, PluginSettingsPageType, useApp } from '../../application'; +import { useCompile } from '../../schema-component'; import { useStyles } from './style'; export const SettingsCenterContext = createContext({}); diff --git a/packages/core/client/src/pm/index.tsx b/packages/core/client/src/buildin-plugin/pm/index.tsx similarity index 77% rename from packages/core/client/src/pm/index.tsx rename to packages/core/client/src/buildin-plugin/pm/index.tsx index 70c008be5..45dcf6959 100644 --- a/packages/core/client/src/pm/index.tsx +++ b/packages/core/client/src/buildin-plugin/pm/index.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { ACLPane } from '../acl/ACLShortcut'; -import { ADMIN_SETTINGS_PATH } from '../application'; -import { Plugin } from '../application/Plugin'; -import { BlockTemplatesPane } from '../schema-templates'; -import { SystemSettingsPane } from '../system-settings'; + +import { ADMIN_SETTINGS_PATH } from '../../application'; +import { Plugin } from '../../application/Plugin'; +import { SystemSettingsPane } from '../../buildin-plugin/system-settings'; +import { BlockTemplatesPane } from '../../schema-templates'; import { PluginManager } from './PluginManager'; import { PluginManagerLink, SettingsCenterDropdown } from './PluginManagerLink'; import { AdminSettingsLayout } from './PluginSetting'; @@ -20,12 +20,6 @@ export class PMPlugin extends Plugin { } addSettings() { - // this.app.pluginSettingsManager.add('acl', { - // title: '{{t("Access control")}}', - // icon: 'LockOutlined', - // Component: ACLPane, - // aclSnippet: 'pm.acl.roles', - // }); this.app.pluginSettingsManager.add('ui-schema-storage', { title: '{{t("Block templates")}}', icon: 'LayoutOutlined', diff --git a/packages/core/client/src/pm/style.ts b/packages/core/client/src/buildin-plugin/pm/style.ts similarity index 100% rename from packages/core/client/src/pm/style.ts rename to packages/core/client/src/buildin-plugin/pm/style.ts diff --git a/packages/core/client/src/pm/types.ts b/packages/core/client/src/buildin-plugin/pm/types.ts similarity index 100% rename from packages/core/client/src/pm/types.ts rename to packages/core/client/src/buildin-plugin/pm/types.ts diff --git a/packages/core/client/src/system-settings/SystemSettingsProvider.tsx b/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsProvider.tsx similarity index 86% rename from packages/core/client/src/system-settings/SystemSettingsProvider.tsx rename to packages/core/client/src/buildin-plugin/system-settings/SystemSettingsProvider.tsx index f27a4964e..96518724b 100644 --- a/packages/core/client/src/system-settings/SystemSettingsProvider.tsx +++ b/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsProvider.tsx @@ -1,7 +1,9 @@ -import { Result } from 'ahooks/es/useRequest/src/types'; import React, { createContext, ReactNode, useContext } from 'react'; -import { useRequest } from '../api-client'; -import { useAppSpin } from '../application/hooks/useAppSpin'; + +import { Result } from 'ahooks/es/useRequest/src/types'; + +import { useRequest } from '../../api-client'; +import { useAppSpin } from '../../application/hooks/useAppSpin'; export const SystemSettingsContext = createContext>(null); SystemSettingsContext.displayName = 'SystemSettingsContext'; diff --git a/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx b/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsShortcut.tsx similarity index 79% rename from packages/core/client/src/system-settings/SystemSettingsShortcut.tsx rename to packages/core/client/src/buildin-plugin/system-settings/SystemSettingsShortcut.tsx index e6cdafd63..45a3fb87b 100644 --- a/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx +++ b/packages/core/client/src/buildin-plugin/system-settings/SystemSettingsShortcut.tsx @@ -1,13 +1,14 @@ -import { ISchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { Card, message } from 'antd'; -import cloneDeep from 'lodash/cloneDeep'; import React from 'react'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + +import { Card, message } from 'antd'; +import { cloneDeep } from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useSystemSettings } from '.'; -import { i18n, useAPIClient, useRequest } from '..'; -import locale from '../locale'; -import { SchemaComponent, useActionContext } from '../schema-component'; +import { i18n, useAPIClient, useRequest } from '../..'; +import locale from '../../locale'; +import { SchemaComponent, useActionContext } from '../../schema-component'; const langs = Object.keys(locale).map((lang) => { return { @@ -119,20 +120,6 @@ const schema: ISchema = { }); }, }, - // allowSignUp: { - // type: 'boolean', - // default: true, - // 'x-content': '{{t("Allow sign up")}}', - // 'x-component': 'Checkbox', - // 'x-decorator': 'FormItem', - // }, - // smsAuthEnabled: { - // type: 'boolean', - // default: false, - // 'x-content': '{{t("Enable SMS authentication")}}', - // 'x-component': 'Checkbox', - // 'x-decorator': 'FormItem', - // }, footer1: { type: 'void', 'x-component': 'ActionBar', @@ -149,13 +136,6 @@ const schema: ISchema = { useAction: '{{ useSaveSystemSettingsValues }}', }, }, - // cancel: { - // title: 'Cancel', - // 'x-component': 'Action', - // 'x-component-props': { - // useAction: '{{ useCloseAction }}', - // }, - // }, }, }, }, diff --git a/packages/core/client/src/system-settings/index.tsx b/packages/core/client/src/buildin-plugin/system-settings/index.tsx similarity index 84% rename from packages/core/client/src/system-settings/index.tsx rename to packages/core/client/src/buildin-plugin/system-settings/index.tsx index 745eacf45..17737d7d2 100644 --- a/packages/core/client/src/system-settings/index.tsx +++ b/packages/core/client/src/buildin-plugin/system-settings/index.tsx @@ -1,7 +1,8 @@ +import { Plugin } from '../../application/Plugin'; +import { SystemSettingsProvider } from './SystemSettingsProvider'; + export * from './SystemSettingsProvider'; export * from './SystemSettingsShortcut'; -import { Plugin } from '../application/Plugin'; -import { SystemSettingsProvider } from './SystemSettingsProvider'; export class SystemSettingsPlugin extends Plugin { async load() { diff --git a/packages/core/client/src/collection-manager/collectionPlugin.ts b/packages/core/client/src/collection-manager/collectionPlugin.ts index 93b0bf2b0..241609330 100644 --- a/packages/core/client/src/collection-manager/collectionPlugin.ts +++ b/packages/core/client/src/collection-manager/collectionPlugin.ts @@ -1,6 +1,6 @@ import { Plugin } from '../application/Plugin'; - -import { InheritanceCollectionMixin } from './mixins/InheritanceCollectionMixin'; +import { DataSource } from '../data-source/data-source/DataSource'; +import { DEFAULT_DATA_SOURCE_KEY, DEFAULT_DATA_SOURCE_TITLE } from '../data-source/data-source/DataSourceManager'; import { CheckboxFieldInterface, CheckboxGroupFieldInterface, @@ -21,38 +21,37 @@ import { M2OFieldInterface, MarkdownFieldInterface, MultipleSelectFieldInterface, + NanoidFieldInterface, NumberFieldInterface, O2MFieldInterface, O2OFieldInterface, - OHOFieldInterface, OBOFieldInterface, + OHOFieldInterface, PasswordFieldInterface, PercentFieldInterface, PhoneFieldInterface, RadioGroupFieldInterface, RichTextFieldInterface, SelectFieldInterface, + SortFieldInterface, SubTableFieldInterface, TableoidFieldInterface, TextareaFieldInterface, TimeFieldInterface, + UnixTimestampFieldInterface, UpdatedAtFieldInterface, UpdatedByFieldInterface, UrlFieldInterface, - SortFieldInterface, UUIDFieldInterface, - NanoidFieldInterface, - UnixTimestampFieldInterface, } from './interfaces'; +import { InheritanceCollectionMixin } from './mixins/InheritanceCollectionMixin'; import { - GeneralCollectionTemplate, ExpressionCollectionTemplate, + GeneralCollectionTemplate, SqlCollectionTemplate, TreeCollectionTemplate, ViewCollectionTemplate, } from './templates'; -import { DEFAULT_DATA_SOURCE_KEY, DEFAULT_DATA_SOURCE_TITLE } from '../data-source/data-source/DataSourceManager'; -import { DataSource } from '../data-source/data-source/DataSource'; class MainDataSource extends DataSource { async getDataSource() { 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 7a2b50a19..80efb96b6 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx @@ -1,8 +1,8 @@ import React, { createContext, ReactNode, useContext, useMemo } from 'react'; -import { ACLCollectionProvider } from '../../acl/ACLProvider'; import { UseRequestOptions, UseRequestService } from '../../api-client'; import { withDynamicSchemaProps } from '../../application/hoc'; +import { ACLCollectionProvider } from '../../buildin-plugin/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/index.ts b/packages/core/client/src/index.ts index 0b0a66afb..d31f01b74 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 './acl'; +export * from './buildin-plugin/acl'; export * from './antd-config-provider'; export * from './api-client'; export * from './appInfo'; @@ -15,7 +15,7 @@ export * from './collection-manager'; export * from './common'; export * from './css-variable'; export * from './data-source'; -export * from './document-title'; +export * from './buildin-plugin/document-title'; export * from './filter-provider'; export * from './flag-provider'; export * from './global-theme'; @@ -24,9 +24,9 @@ export * from './i18n'; export * from './icon'; export { default as locale } from './locale'; export * from './buildin-plugin'; -export * from './plugin-manager'; -export * from './pm'; -export * from './powered-by-v2'; +export * from './buildin-plugin/pinned-list'; +export * from './buildin-plugin/pm'; +export * from './powered-by'; export * from './record-provider'; export * from './route-switch'; export * from './schema-component'; @@ -36,7 +36,7 @@ export * from './schema-settings'; export * from './schema-templates'; export * from './style'; export type { CustomToken } from './global-theme'; -export * from './system-settings'; +export * from './buildin-plugin/system-settings'; export * from './testUtils'; export * from './user'; export * from './variables'; diff --git a/packages/core/client/src/powered-by-v2/index.tsx b/packages/core/client/src/powered-by/index.tsx similarity index 93% rename from packages/core/client/src/powered-by-v2/index.tsx rename to packages/core/client/src/powered-by/index.tsx index 216a4761b..a7f2b0fda 100644 --- a/packages/core/client/src/powered-by-v2/index.tsx +++ b/packages/core/client/src/powered-by/index.tsx @@ -17,7 +17,7 @@ const useStyles = createStyles(({ css, token }) => { }; }); -export const PoweredByV2 = () => { +export const PoweredBy = () => { const { styles } = useStyles(); const date = new Date(); const year = date.getFullYear(); diff --git a/packages/core/client/src/route-switch/antd/index.ts b/packages/core/client/src/route-switch/antd/index.ts index 313ae5965..6a8990912 100644 --- a/packages/core/client/src/route-switch/antd/index.ts +++ b/packages/core/client/src/route-switch/antd/index.ts @@ -1,2 +1,2 @@ -export * from './admin-layout'; +export * from '../../buildin-plugin/admin-layout'; export * from './route-schema-component'; diff --git a/packages/core/client/src/route-switch/antd/route-schema-component/index.tsx b/packages/core/client/src/route-switch/antd/route-schema-component/index.tsx index 9317f10cc..0b576a7da 100644 --- a/packages/core/client/src/route-switch/antd/route-schema-component/index.tsx +++ b/packages/core/client/src/route-switch/antd/route-schema-component/index.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { useParams } from 'react-router-dom'; + import { RemoteSchemaComponent } from '../../../'; export function RouteSchemaComponent(props: any) { 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 7229d9886..3a0422856 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next'; import { StablePopover, useActionContext } from '../..'; import { useDesignable } from '../../'; -import { useACLActionParamsContext } from '../../../acl'; import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; +import { useACLActionParamsContext } from '../../../buildin-plugin/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 e81d793d1..457c2a509 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 '../../../acl'; +import { ACLCollectionProvider, useACLActionParamsContext } from '../../../buildin-plugin/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 4902c622b..875136abf 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 '../../../acl'; +import { ACLCollectionProvider, useACLActionParamsContext } from '../../../buildin-plugin/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 9bff42d1b..3b4e89d5f 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 @@ -5,9 +5,9 @@ import { Field, observer, useField, useFieldSchema } from '@tachybase/schema'; import { createStyles } from 'antd-style'; import cx from 'classnames'; -import { ACLCollectionFieldProvider } from '../../../acl/ACLProvider'; import { useApp } from '../../../application'; import { useFormActiveFields } from '../../../block-provider/hooks/useFormActiveFields'; +import { ACLCollectionFieldProvider } from '../../../buildin-plugin/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/page/Page.tsx b/packages/core/client/src/schema-component/antd/page/Page.tsx index 0b3f835a7..474834b44 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.tsx @@ -1,17 +1,20 @@ -import { PlusOutlined } from '@ant-design/icons'; -import { PageHeader as AntdPageHeader } from '@ant-design/pro-layout'; +import React, { useContext, useEffect, useMemo, useState } from 'react'; import { FormLayout } from '@tachybase/components'; import { Schema, SchemaOptionsContext, useFieldSchema } from '@tachybase/schema'; + +import { PlusOutlined } from '@ant-design/icons'; +import { PageHeader as AntdPageHeader } from '@ant-design/pro-layout'; import { Button, Tabs } from 'antd'; import classNames from 'classnames'; -import React, { useContext, useEffect, useMemo, useState } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; import { useTranslation } from 'react-i18next'; import { useSearchParams } from 'react-router-dom'; + import { FormDialog } from '..'; -import { useStyles as useAClStyles } from '../../../acl/style'; +import { useToken } from '../__builtins__'; import { useAppSpin } from '../../../application/hooks/useAppSpin'; -import { useDocumentTitle } from '../../../document-title'; +import { useStyles as useAClStyles } from '../../../buildin-plugin/acl/style'; +import { useDocumentTitle } from '../../../buildin-plugin/document-title'; import { FilterBlockProvider } from '../../../filter-provider/FilterProvider'; import { useGlobalTheme } from '../../../global-theme'; import { Icon } from '../../../icon'; @@ -20,7 +23,6 @@ import { DndContext } from '../../common'; import { SortableItem } from '../../common/sortable-item'; import { SchemaComponent, SchemaComponentOptions } from '../../core'; import { useCompile, useDesignable } from '../../hooks'; -import { useToken } from '../__builtins__'; import { ErrorFallback } from '../error-fallback'; import FixedBlock from './FixedBlock'; import { PageDesigner, PageTabDesigner } from './PageTabDesigner'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.tsx index 3a8859335..a2fb19b26 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.tsx @@ -25,6 +25,7 @@ import { DndContext, useDesignable, useTableSize } from '../..'; import { RecordIndexProvider, RecordProvider, + useACLFieldWhitelist, useCollection, useCollection_deprecated, useCollectionParentRecordData, @@ -32,7 +33,6 @@ import { useTableBlockContext, useTableSelectorContext, } from '../../../'; -import { useACLFieldWhitelist } from '../../../acl/ACLProvider'; import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; import { isNewRecord, markRecordAsNew } from '../../../data-source/collection-record/isNewRecord'; import { SubFormProvider } from '../association-field/hooks'; diff --git a/packages/core/client/src/schema-component/core/DesignableSwitch.tsx b/packages/core/client/src/schema-component/core/DesignableSwitch.tsx index 4c0a76575..3e18be397 100644 --- a/packages/core/client/src/schema-component/core/DesignableSwitch.tsx +++ b/packages/core/client/src/schema-component/core/DesignableSwitch.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { HighlightOutlined } from '@ant-design/icons'; import { Button, Tooltip } from 'antd'; -import React from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; import { useTranslation } from 'react-i18next'; + import { useDesignable } from '..'; import { useToken } from '../../style'; @@ -22,10 +24,8 @@ export const DesignableSwitch = () => {