@nocobase/client-v2 2.3.0-alpha.1 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/acl/ACLProvider.d.ts +10 -0
- package/es/authRedirect.d.ts +5 -0
- package/es/components/AttachmentUpload.d.ts +51 -0
- package/es/components/form/ScanInput/useCodeScanner.d.ts +2 -2
- package/es/components/index.d.ts +1 -0
- package/es/flow/actions/linkageRules.d.ts +1 -0
- package/es/flow/admin-shell/admin-layout/NocoBaseLogo.d.ts +10 -0
- package/es/flow/components/FlowRoute.d.ts +2 -2
- package/es/flow/internal/registerDeviceTypeContext.d.ts +10 -0
- package/es/flow/models/base/ActionModelCore.d.ts +4 -2
- package/es/flow/models/base/BlockGridModel.d.ts +3 -0
- package/es/flow/models/blocks/table/TableColumnModel.d.ts +1 -0
- package/es/flow/models/fields/DateTimeFieldModel/dateLimit.d.ts +15 -7
- package/es/index.d.ts +4 -1
- package/es/index.mjs +139 -125
- package/es/nocobase-buildin-plugin/currentUserAuthStatus.d.ts +11 -0
- package/es/nocobase-buildin-plugin/index.d.ts +9 -0
- package/es/settings-app/SettingsApplication.d.ts +18 -0
- package/es/settings-app/SettingsBrand.d.ts +16 -0
- package/es/settings-app/SettingsBuildInPlugin.d.ts +9 -0
- package/es/settings-app/SettingsDocumentRedirect.d.ts +10 -0
- package/es/settings-app/SettingsGroupNav.d.ts +17 -0
- package/es/settings-app/SettingsPluginSettingsManager.d.ts +14 -0
- package/es/settings-app/SettingsRouterManager.d.ts +15 -0
- package/es/settings-app/SettingsSearch.d.ts +17 -0
- package/es/settings-app/SettingsShell.d.ts +10 -0
- package/es/settings-app/isSettingsApp.d.ts +18 -0
- package/es/settings-app/runtimePaths.d.ts +18 -0
- package/es/settings-app/settingsDocumentPath.d.ts +14 -0
- package/es/settings-app/settingsTheme.d.ts +87 -0
- package/es/settings-app/useSettingsThemeConfig.d.ts +22 -0
- package/es/settings-center/AdminSettingsLayout.d.ts +2 -2
- package/es/settings-center/groups.d.ts +66 -0
- package/es/settings-center/useSettingsGroups.d.ts +36 -0
- package/es/settings-center/useSettingsSearch.d.ts +35 -0
- package/es/settings-center/utils.d.ts +24 -0
- package/es/theme/index.d.ts +1 -0
- package/es/theme/itemActive.d.ts +24 -0
- package/es/theme/type.d.ts +9 -0
- package/lib/index.js +141 -127
- package/lib/locale/languageCodes.js +1 -0
- package/package.json +8 -7
- package/src/__tests__/authRedirect.test.ts +137 -0
- package/src/__tests__/browserChecker.test.ts +124 -6
- package/src/__tests__/mockSettingsApplication.ts +29 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +51 -10
- package/src/__tests__/plugin-manager.test.tsx +7 -6
- package/src/__tests__/settings-application.test.ts +164 -0
- package/src/__tests__/settings-auth-routes.test.ts +71 -0
- package/src/__tests__/settings-center.test.tsx +38 -37
- package/src/__tests__/settings-layout-root.test.tsx +260 -0
- package/src/__tests__/settings-runtime-paths.test.ts +99 -0
- package/src/__tests__/settings-shell.test.tsx +200 -0
- package/src/acl/ACLProvider.tsx +21 -0
- package/src/authRedirect.ts +72 -3
- package/src/components/AttachmentUpload.tsx +275 -0
- package/src/components/form/ScanInput/CodeScanner.tsx +61 -34
- package/src/components/form/ScanInput/__tests__/CodeScanner.test.tsx +101 -0
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +114 -18
- package/src/components/form/ScanInput/useCodeScanner.ts +166 -23
- package/src/components/index.ts +1 -0
- package/src/flow/__tests__/FlowRoute.test.tsx +126 -8
- package/src/flow/__tests__/PluginFlowEngine.test.ts +58 -0
- package/src/flow/actions/__tests__/actionLinkageRules.forkProps.test.ts +314 -0
- package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +102 -0
- package/src/flow/actions/linkageRules.tsx +26 -6
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +1 -56
- package/src/flow/admin-shell/admin-layout/NocoBaseLogo.tsx +77 -0
- package/src/flow/admin-shell/admin-layout/TopbarActionsBar.tsx +37 -14
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +77 -13
- package/src/flow/common/Markdown/style.ts +4 -0
- package/src/flow/components/BlockItemCard.tsx +2 -2
- package/src/flow/components/FlowRoute.tsx +71 -29
- package/src/flow/index.ts +2 -0
- package/src/flow/internal/registerDeviceTypeContext.ts +39 -0
- package/src/flow/models/base/ActionModelCore.tsx +11 -2
- package/src/flow/models/base/BlockGridModel.tsx +26 -0
- package/src/flow/models/base/CollectionBlockModel.tsx +6 -2
- package/src/flow/models/base/PageModel/PageTabModel.tsx +67 -17
- package/src/flow/models/base/PageModel/__tests__/PageTabModel.test.ts +509 -12
- package/src/flow/models/base/__tests__/ActionModelCore.render.test.tsx +49 -0
- package/src/flow/models/base/__tests__/BlockGridModel.selectSceneActivation.test.ts +124 -0
- package/src/flow/models/base/__tests__/CollectionBlockModel.addAppends.test.ts +41 -0
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +27 -3
- package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +32 -4
- package/src/flow/models/blocks/js-block/JSBlock.tsx +1 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +3 -1
- package/src/flow/models/blocks/table/TableColumnModel.tsx +30 -1
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.quickEditRefresh.test.ts +12 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +33 -0
- package/src/flow/models/fields/DateTimeFieldModel/__tests__/DateTimeNoTzFieldModel.dateLimit.test.tsx +149 -0
- package/src/flow/models/fields/DateTimeFieldModel/dateLimit.ts +149 -113
- package/src/flow/models/fields/JsonFieldModel.tsx +31 -8
- package/src/flow/models/fields/__tests__/JsonFieldModel.test.ts +82 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +52 -180
- package/src/flow/utils/dataScopeFormValueClear.ts +4 -3
- package/src/index.ts +10 -1
- package/src/locale/languageCodes.ts +1 -0
- package/src/nocobase-buildin-plugin/currentUserAuthStatus.ts +58 -0
- package/src/nocobase-buildin-plugin/index.tsx +99 -71
- package/src/settings-app/SettingsApplication.ts +31 -0
- package/src/settings-app/SettingsBrand.tsx +108 -0
- package/src/settings-app/SettingsBuildInPlugin.ts +10 -0
- package/src/settings-app/SettingsDocumentRedirect.tsx +26 -0
- package/src/settings-app/SettingsGroupNav.tsx +124 -0
- package/src/settings-app/SettingsPluginSettingsManager.ts +38 -0
- package/src/settings-app/SettingsRouterManager.ts +92 -0
- package/src/settings-app/SettingsSearch.tsx +238 -0
- package/src/settings-app/SettingsShell.tsx +167 -0
- package/src/settings-app/isSettingsApp.ts +21 -0
- package/src/settings-app/runtimePaths.ts +104 -0
- package/src/settings-app/settingsDocumentPath.ts +66 -0
- package/src/settings-app/settingsTheme.ts +301 -0
- package/src/settings-app/useSettingsThemeConfig.ts +100 -0
- package/src/settings-center/AdminSettingsLayout.tsx +122 -141
- package/src/settings-center/SystemSettingsPage.tsx +4 -170
- package/src/settings-center/groups.ts +108 -0
- package/src/settings-center/useSettingsGroups.ts +105 -0
- package/src/settings-center/useSettingsSearch.ts +173 -0
- package/src/settings-center/utils.tsx +50 -1
- package/src/theme/index.tsx +1 -0
- package/src/theme/itemActive.ts +31 -0
- package/src/theme/type.ts +10 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export type CurrentUserAuthStatus = 'unknown' | 'authenticated' | 'unauthenticated' | 'redirecting';
|
|
10
|
+
export declare function setCurrentUserAuthStatus(app: object, status: CurrentUserAuthStatus): void;
|
|
11
|
+
export declare function useCurrentUserAuthStatus(app: object): CurrentUserAuthStatus;
|
|
@@ -39,4 +39,13 @@ export declare class NocoBaseBuildInPlugin extends Plugin<any, Application> {
|
|
|
39
39
|
addComponents(): void;
|
|
40
40
|
addPlugins(): Promise<void>;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Internal built-in runtime for the standalone Client V2 settings entry.
|
|
44
|
+
* It intentionally shares the existing plugin lane and runtime providers but
|
|
45
|
+
* does not register the Admin Layout.
|
|
46
|
+
*/
|
|
47
|
+
export declare class SettingsBuildInPlugin extends Plugin<any, Application> {
|
|
48
|
+
afterAdd(): Promise<void>;
|
|
49
|
+
load(): Promise<void>;
|
|
50
|
+
}
|
|
42
51
|
export { NocoBaseBuildInPlugin as NocoBaseBuildInPluginV2 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Application, type ApplicationOptions } from '../index';
|
|
10
|
+
import { SettingsPluginSettingsManager } from './SettingsPluginSettingsManager';
|
|
11
|
+
import { SettingsRouterManager } from './SettingsRouterManager';
|
|
12
|
+
export declare class SettingsApplication extends Application {
|
|
13
|
+
/** 设置中心的标记,插件通过 `isSettingsApp(app)` 读它,避免反向依赖这个类。 */
|
|
14
|
+
readonly isSettingsApp = true;
|
|
15
|
+
protected addCustomProviders(): void;
|
|
16
|
+
protected createRouterManager(options: ApplicationOptions): SettingsRouterManager<this>;
|
|
17
|
+
protected createPluginSettingsManager(_options: ApplicationOptions): SettingsPluginSettingsManager<this>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* 设置中心顶栏品牌区。
|
|
12
|
+
*
|
|
13
|
+
* 沿用系统设置里的站点 logo / 标题,并在其后补一个弱化的「设置中心」副标题,
|
|
14
|
+
* 用于区分设置中心和业务端。
|
|
15
|
+
*/
|
|
16
|
+
export declare const SettingsBrand: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<unknown>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { SettingsBuildInPlugin } from '../nocobase-buildin-plugin';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export declare function SettingsDocumentRedirect(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* 设置中心顶栏的一级导航。
|
|
12
|
+
*
|
|
13
|
+
* 应用、插件管理各自只有一个页面,直接当一级入口;其余全部收在「系统设置」下,
|
|
14
|
+
* 鼠标移上去展开下拉,也可以点进去从左栏走。
|
|
15
|
+
*/
|
|
16
|
+
export declare const SettingsGroupNav: React.FC;
|
|
17
|
+
export default SettingsGroupNav;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { BaseApplication } from '../BaseApplication';
|
|
10
|
+
import { PluginSettingsManager } from '../PluginSettingsManager';
|
|
11
|
+
export declare class SettingsPluginSettingsManager<TApp extends BaseApplication<any> = BaseApplication<any>> extends PluginSettingsManager<TApp> {
|
|
12
|
+
getRouteName(name: string): string;
|
|
13
|
+
getRoutePath(name: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { BaseApplication } from '../BaseApplication';
|
|
10
|
+
import { RouterManager, type RouteType } from '../RouterManager';
|
|
11
|
+
export declare class SettingsRouterManager<TApp extends BaseApplication<any> = BaseApplication<any>> extends RouterManager<TApp> {
|
|
12
|
+
private rebaseScopedSettingsRoute;
|
|
13
|
+
private rebaseAuthenticationRoute;
|
|
14
|
+
add(name: string, route: RouteType): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* 设置中心的搜索入口。
|
|
12
|
+
*
|
|
13
|
+
* 顶栏放一个轻量触发器,真正的搜索在弹层里进行;关键词为空时展示最近访问,
|
|
14
|
+
* 这样分组化之后被收进左侧栏的深层页面仍然一步可达。支持 `Cmd/Ctrl + K` 唤起。
|
|
15
|
+
*/
|
|
16
|
+
export declare const SettingsSearch: React.FC;
|
|
17
|
+
export default SettingsSearch;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { type FC } from 'react';
|
|
10
|
+
export declare const SettingsShell: FC;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 判断当前跑的是不是设置中心那个壳。
|
|
11
|
+
*
|
|
12
|
+
* 插件用它来决定某个入口要不要出现在设置中心里,不用 import `SettingsApplication`
|
|
13
|
+
* 本身——那会让插件反向依赖壳的实现。
|
|
14
|
+
*
|
|
15
|
+
* @param {any} app 应用实例
|
|
16
|
+
* @returns {boolean} 是设置中心返回 true
|
|
17
|
+
*/
|
|
18
|
+
export declare function isSettingsApp(app?: any): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { BaseApplication } from '../BaseApplication';
|
|
10
|
+
type SettingsRuntimeApp = Pick<BaseApplication<any>, 'name'> & {
|
|
11
|
+
getPublicPath?: () => string;
|
|
12
|
+
router?: {
|
|
13
|
+
basename?: string;
|
|
14
|
+
getBasename?: () => string | undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveStandaloneSettingsPath(app: SettingsRuntimeApp, pathLike: string, contextPathname?: string): string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export type SettingsAppScope = '' | `/${'apps' | '_app'}/${string}`;
|
|
10
|
+
export declare function normalizeSettingsRootPublicPath(value?: string): string;
|
|
11
|
+
export declare function resolveSettingsAppScope(pathname?: string): SettingsAppScope;
|
|
12
|
+
export declare function resolveSettingsAppScopeWithinPublicPath(publicPath: string, pathname?: string): SettingsAppScope;
|
|
13
|
+
export declare function resolveSettingsDocumentPath(rootPublicPath: string, appScope: SettingsAppScope, settingsRoutePath: string): string;
|
|
14
|
+
export declare function resolveSettingsDocumentBasename(rootPublicPath: string, appScope: SettingsAppScope): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { GlobalToken, ThemeConfig } from 'antd';
|
|
10
|
+
/**
|
|
11
|
+
* 粗略判断一个颜色是不是深色背景。
|
|
12
|
+
*
|
|
13
|
+
* 只支持 `#rgb` / `#rrggbb`,解析不出来时按浅色处理。
|
|
14
|
+
*
|
|
15
|
+
* @param {string | undefined} color 背景色
|
|
16
|
+
* @returns {boolean} 是否为深色
|
|
17
|
+
*/
|
|
18
|
+
export declare function isDarkColor(color?: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 取顶栏配色。
|
|
21
|
+
*
|
|
22
|
+
* 设置中心的顶栏刻意**不跟随**主题编辑器里的 `colorBgHeader`:那套深色顶栏是给业务端的,
|
|
23
|
+
* 设置中心用容器底色(浅色主题下就是白色)+ 一条细分割线,和业务端在视觉上分开。
|
|
24
|
+
* 文字和图标一律走正文色,深色主题下由 `colorBgContainer` 自动翻成浅色。
|
|
25
|
+
*
|
|
26
|
+
* @param {GlobalToken} token 外层主题 token
|
|
27
|
+
* @returns 顶栏底色、文字色、hover / active 色,以及顶栏是否为深色
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSettingsHeaderColors(token: GlobalToken): {
|
|
30
|
+
bg: string;
|
|
31
|
+
dark: boolean;
|
|
32
|
+
text: string;
|
|
33
|
+
textHover: string;
|
|
34
|
+
textActive: string;
|
|
35
|
+
bgHover: string;
|
|
36
|
+
bgActive: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 顶栏一级导航专用主题。
|
|
40
|
+
*
|
|
41
|
+
* 顶栏自己是透明底(底色由 Layout.Header 给),下拉浮层跟着顶栏用容器色;
|
|
42
|
+
* 选中 / hover 的颜色一律交给外层主题,也就是默认蓝。
|
|
43
|
+
*
|
|
44
|
+
* @param {GlobalToken} token 外层主题 token
|
|
45
|
+
* @returns {ThemeConfig} 顶栏菜单主题
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildSettingsHeaderMenuTheme(token: GlobalToken): ThemeConfig;
|
|
48
|
+
/**
|
|
49
|
+
* 构造设置中心的外壳主题。
|
|
50
|
+
*
|
|
51
|
+
* 只做**顶栏**这一层:白(或深色主题下的容器色)底 + 细分割线,文字与图标走正文色,
|
|
52
|
+
* 和业务端那条深色顶栏区分开。
|
|
53
|
+
*
|
|
54
|
+
* 选中态一律用浅灰底 + 正文色,只有开关这类「开/关」控件才用纯黑填充。
|
|
55
|
+
* 各插件页面里 `controlItemBgActive` 常被当成纯背景用、文字色不跟着走,所以那个 token
|
|
56
|
+
* 也保持浅色,不然列表行会变成深底深字。
|
|
57
|
+
*
|
|
58
|
+
* @param {GlobalToken} token 外层主题 token
|
|
59
|
+
* @returns {ThemeConfig} 设置中心外壳主题
|
|
60
|
+
*/
|
|
61
|
+
export declare function buildSettingsNeutralTheme(token: GlobalToken): ThemeConfig;
|
|
62
|
+
/**
|
|
63
|
+
* 给外部主题补上设置中心的顶栏配色。
|
|
64
|
+
*
|
|
65
|
+
* 顶栏那几个 token(`colorBgHeader`、`colorTextHeaderMenu` 系列、`Layout.headerBg`)
|
|
66
|
+
* 刻意不放进「简约」主题记录里:那条记录是通用的,业务端顶栏是深色的、logo 和图标都按
|
|
67
|
+
* 深底做的,一旦被改成白底就得连 logo 一起反色。设置中心的顶栏是白的,所以在这一层补。
|
|
68
|
+
*
|
|
69
|
+
* @param {ThemeConfig} theme 主题记录里读到的配置
|
|
70
|
+
* @param {GlobalToken} token 外层主题 token
|
|
71
|
+
* @returns {ThemeConfig} 补齐顶栏配色后的主题
|
|
72
|
+
*/
|
|
73
|
+
export declare function withSettingsHeaderTheme(theme: ThemeConfig, token: GlobalToken): ThemeConfig;
|
|
74
|
+
/**
|
|
75
|
+
* 设置中心的全局补丁样式。
|
|
76
|
+
*
|
|
77
|
+
* 这几件事 antd 没给 token,只能落到 CSS:
|
|
78
|
+
* - 裸 `<a>` 的颜色。它吃的是**最外层** ConfigProvider 生成的全局 reset 样式,
|
|
79
|
+
* 我们这层嵌套 ConfigProvider 的 `colorLink` 够不着,只能在 CSS 里压一次。
|
|
80
|
+
* - 链接下划线(`colorLink` 只管颜色)
|
|
81
|
+
* - Switch 禁用态压得更淡,跟「未启用但可点」区分开
|
|
82
|
+
* - 顶栏选中项的下划线、左栏选中项的加粗
|
|
83
|
+
*
|
|
84
|
+
* @param {GlobalToken} token 外层主题 token
|
|
85
|
+
* @returns {string} 可直接塞进 `<style>` 的 CSS
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildSettingsGlobalCss(token: GlobalToken): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { type ThemeConfig } from 'antd';
|
|
10
|
+
/** 简约主题在 `themeConfig` 表里的固定标识,见 plugin-theme-editor 的 builtinThemes */
|
|
11
|
+
export declare const MINIMAL_THEME_UID = "minimal";
|
|
12
|
+
/**
|
|
13
|
+
* 读取设置中心主题。
|
|
14
|
+
*
|
|
15
|
+
* 设置中心的外观由 `themeConfig` 里那条「简约」记录约束,在主题编辑器里就能改;
|
|
16
|
+
* 它本身是一条普通的可选主题,别的应用要同一套观感直接选它即可。
|
|
17
|
+
* 读不到(主题编辑器插件没启、老实例还没迁移、请求失败)时返回 `null`,
|
|
18
|
+
* 由调用方回落到代码里的默认中性配色,避免设置中心突然变回一片蓝。
|
|
19
|
+
*
|
|
20
|
+
* @returns {ThemeConfig | null | undefined} 主题配置;`undefined` 表示还没读完
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSettingsThemeConfig(): ThemeConfig | null | undefined;
|
|
@@ -10,8 +10,8 @@ import React from 'react';
|
|
|
10
10
|
/**
|
|
11
11
|
* `client-v2` 的 settings 页面壳实现。
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* 一级分组铺在顶栏(见 `SettingsGroupNav`),这里负责当前分组下的二三级嵌套菜单、
|
|
14
|
+
* 默认落点和两类空态,页面内容本身继续由各个 settings route 的 `<Outlet />` 渲染。
|
|
15
15
|
*/
|
|
16
16
|
export declare const InternalAdminSettingsLayout: () => React.JSX.Element;
|
|
17
17
|
/**
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginSettingsPageType } from '../PluginSettingsManager';
|
|
10
|
+
/**
|
|
11
|
+
* Settings 顶层分组。
|
|
12
|
+
*
|
|
13
|
+
* 顶栏铺一级(分组),左侧栏铺该分组下的二级 / 三级菜单。
|
|
14
|
+
* 分组归属优先取配置项自身的 `group` 字段,其次落到内置映射表,最后兜底到 `system`,
|
|
15
|
+
* 因此第三方插件不改代码也能出现在设置中心里。
|
|
16
|
+
*/
|
|
17
|
+
export type SettingsGroupKey = 'applications' | 'plugins' | 'data' | 'access' | 'automation' | 'ai' | 'system';
|
|
18
|
+
export type SettingsGroupDefinition = {
|
|
19
|
+
key: SettingsGroupKey;
|
|
20
|
+
/** 未翻译的分组标题,交由调用方过 i18n */
|
|
21
|
+
title: string;
|
|
22
|
+
/**
|
|
23
|
+
* 分组的门面配置项。
|
|
24
|
+
*
|
|
25
|
+
* 它会被排到该分组的第一位,并作为点击顶栏分组时的落点;
|
|
26
|
+
* 不存在(插件没装 / 无权限)时自然退回到分组内的第一项。
|
|
27
|
+
*/
|
|
28
|
+
primary?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 顶栏铺六个独立入口 + 一个「其他设置」兜底分组。
|
|
32
|
+
*
|
|
33
|
+
* 前六个各自只有一个配置项、且都是日常高频,直接当一级入口(标题取配置项自己的名字,
|
|
34
|
+
* 顺带继承插件的翻译);其余零散配置全部收进其他设置,靠左栏和悬浮下拉展开。
|
|
35
|
+
*
|
|
36
|
+
* 兜底分组不叫「系统设置」:它下面本来就有一个同名的配置项(站点标题、logo 那个),
|
|
37
|
+
* 分组和子项重名会让人以为点进去是同一个东西。
|
|
38
|
+
*/
|
|
39
|
+
export declare const SETTINGS_GROUPS: SettingsGroupDefinition[];
|
|
40
|
+
export declare const DEFAULT_SETTINGS_GROUP: SettingsGroupKey;
|
|
41
|
+
/**
|
|
42
|
+
* 解析某个顶级配置项所属的分组。
|
|
43
|
+
*
|
|
44
|
+
* @param {PluginSettingsPageType | null | undefined} setting 顶级配置项
|
|
45
|
+
* @returns {SettingsGroupKey} 分组 key
|
|
46
|
+
*/
|
|
47
|
+
export declare function getSettingsGroupKey(setting?: PluginSettingsPageType | null): SettingsGroupKey;
|
|
48
|
+
/**
|
|
49
|
+
* 按分组切分顶级配置项,并丢掉没有任何配置项的空分组。
|
|
50
|
+
*
|
|
51
|
+
* @param {PluginSettingsPageType[]} settings 已排序的顶级配置项
|
|
52
|
+
* @returns 非空分组
|
|
53
|
+
*/
|
|
54
|
+
export declare function groupTopLevelSettings(settings?: readonly PluginSettingsPageType[]): {
|
|
55
|
+
settings: PluginSettingsPageType[];
|
|
56
|
+
key: SettingsGroupKey;
|
|
57
|
+
/** 未翻译的分组标题,交由调用方过 i18n */
|
|
58
|
+
title: string;
|
|
59
|
+
/**
|
|
60
|
+
* 分组的门面配置项。
|
|
61
|
+
*
|
|
62
|
+
* 它会被排到该分组的第一位,并作为点击顶栏分组时的落点;
|
|
63
|
+
* 不存在(插件没装 / 无权限)时自然退回到分组内的第一项。
|
|
64
|
+
*/
|
|
65
|
+
primary?: string;
|
|
66
|
+
}[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginSettingsPageType } from '../PluginSettingsManager';
|
|
10
|
+
import { type SettingsGroupKey } from './groups';
|
|
11
|
+
/**
|
|
12
|
+
* 设置中心分组导航的共享状态。
|
|
13
|
+
*
|
|
14
|
+
* 顶栏一级导航和左侧栏二三级菜单都从这里取数据,保证两边永远一致:
|
|
15
|
+
* 同一份可见配置树、同一套分组规则、同一个「当前分组」判定。
|
|
16
|
+
*/
|
|
17
|
+
export declare function useSettingsGroups(): {
|
|
18
|
+
activeGroupKey: SettingsGroupKey;
|
|
19
|
+
activeGroupSettings: PluginSettingsPageType[];
|
|
20
|
+
allSettings: PluginSettingsPageType[];
|
|
21
|
+
currentSetting: PluginSettingsPageType;
|
|
22
|
+
currentTopLevelSetting: PluginSettingsPageType;
|
|
23
|
+
getGroupEntryPath: (groupKey: string) => string;
|
|
24
|
+
groups: {
|
|
25
|
+
settings: PluginSettingsPageType[];
|
|
26
|
+
key: SettingsGroupKey;
|
|
27
|
+
title: string;
|
|
28
|
+
primary?: string; /**
|
|
29
|
+
* 设置中心分组导航的共享状态。
|
|
30
|
+
*
|
|
31
|
+
* 顶栏一级导航和左侧栏二三级菜单都从这里取数据,保证两边永远一致:
|
|
32
|
+
* 同一份可见配置树、同一套分组规则、同一个「当前分组」判定。
|
|
33
|
+
*/
|
|
34
|
+
}[];
|
|
35
|
+
visibleSettings: PluginSettingsPageType[];
|
|
36
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from 'react';
|
|
10
|
+
export type SettingsSearchItem = {
|
|
11
|
+
/** 配置项名称,同时用作最近访问的存储标识 */
|
|
12
|
+
name: string;
|
|
13
|
+
title: string;
|
|
14
|
+
/** 分组名 + 上级菜单名,用于在结果里给出上下文 */
|
|
15
|
+
breadcrumb: string;
|
|
16
|
+
path: string;
|
|
17
|
+
/** 外链配置项跳转到站外 */
|
|
18
|
+
link?: string;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** 预先拼好并转小写的匹配文本 */
|
|
21
|
+
searchText: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 设置中心的搜索与最近访问。
|
|
25
|
+
*
|
|
26
|
+
* 一级分组只剩五个、二三级收进左侧栏之后,深层页面变得不好够;这里把整棵可见配置树拍平成
|
|
27
|
+
* 一份可搜索的清单,并记住最近去过的几个,作为搜索框的空态。
|
|
28
|
+
*
|
|
29
|
+
* @returns 搜索清单、匹配函数、最近访问项,以及记录访问的回调
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSettingsSearch(): {
|
|
32
|
+
items: SettingsSearchItem[];
|
|
33
|
+
recentItems: SettingsSearchItem[];
|
|
34
|
+
search: (keyword: string) => SettingsSearchItem[];
|
|
35
|
+
};
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import type { MenuProps } from 'antd';
|
|
9
10
|
import type { PluginSettingsPageType } from '../PluginSettingsManager';
|
|
11
|
+
export type SidebarMenuItem = NonNullable<MenuProps['items']>[number];
|
|
10
12
|
export declare const ADMIN_SETTINGS_LAYOUT_MODEL_UID = "admin-settings-layout-model";
|
|
11
13
|
export declare const PLUGIN_MANAGER_SETTING_NAME = "plugin-manager";
|
|
12
14
|
export declare const SYSTEM_SETTINGS_SETTING_NAME = "system-settings";
|
|
15
|
+
export declare const MULTI_PORTAL_SETTING_NAME = "multi-portal";
|
|
13
16
|
/**
|
|
14
17
|
* 判断配置项是否拥有可直接渲染的页面。
|
|
15
18
|
*
|
|
@@ -85,6 +88,27 @@ export declare function findSettingsByName(settings: readonly PluginSettingsPage
|
|
|
85
88
|
* @returns {string | undefined} 默认跳转路径
|
|
86
89
|
*/
|
|
87
90
|
export declare function getDefaultSettingsPath(settings?: readonly PluginSettingsPageType[]): string;
|
|
91
|
+
/**
|
|
92
|
+
* 构造左侧栏菜单。
|
|
93
|
+
*
|
|
94
|
+
* 左栏只铺**一级**配置项,不下钻子菜单:备份管理器、通知管理这类插件的子页面统一走页头下的
|
|
95
|
+
* Tab(和 v1 设置中心一致),左栏折叠展开再叠一层反而多一次点击、也和 Tab 表达重复。
|
|
96
|
+
*
|
|
97
|
+
* @param {PluginSettingsPageType[]} settings 某个分组下的配置项
|
|
98
|
+
* @returns {SidebarMenuItem[]} antd Menu items
|
|
99
|
+
*/
|
|
100
|
+
export declare function getSidebarMenuItems(settings?: readonly PluginSettingsPageType[]): SidebarMenuItem[];
|
|
101
|
+
/**
|
|
102
|
+
* 把当前命中的配置项换算成左侧栏里真实存在的菜单 key。
|
|
103
|
+
*
|
|
104
|
+
* 左栏只有一级,命中的可能是某个子页面(它在左栏没有自己的条目),
|
|
105
|
+
* 这里回退到它所属的那个一级项。
|
|
106
|
+
*
|
|
107
|
+
* @param {PluginSettingsPageType[]} settings 某个分组下的配置项
|
|
108
|
+
* @param {string | undefined} activeName 当前命中的配置项名称
|
|
109
|
+
* @returns {string | undefined} 左栏应选中的 key
|
|
110
|
+
*/
|
|
111
|
+
export declare function getSidebarSelectedKey(settings?: readonly PluginSettingsPageType[], activeName?: string): string | undefined;
|
|
88
112
|
/**
|
|
89
113
|
* 把 settings 结构转换成 antd Menu items。
|
|
90
114
|
*
|
package/es/theme/index.d.ts
CHANGED
|
@@ -32,5 +32,6 @@ interface GlobalThemeProviderProps {
|
|
|
32
32
|
export declare const GlobalThemeProvider: FC<GlobalThemeProviderProps>;
|
|
33
33
|
export { default as compatOldTheme } from './compatOldTheme';
|
|
34
34
|
export { addCustomAlgorithmToTheme, customAlgorithm } from './customAlgorithm';
|
|
35
|
+
export { getItemActiveColors } from './itemActive';
|
|
35
36
|
export * from './type';
|
|
36
37
|
export { defaultTheme };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { GlobalToken } from 'antd';
|
|
10
|
+
/**
|
|
11
|
+
* 取「选中项」的底色与文字色。
|
|
12
|
+
*
|
|
13
|
+
* antd 只有 `controlItemBgActive` 一个背景 token,没有配对的文字色,页面各自写背景、
|
|
14
|
+
* 文字色照旧,底色一被主题改深就成了深底深字。这里统一读 `colorBgItemActive` /
|
|
15
|
+
* `colorTextItemActive` 这一对自定义 token,没设置时回落到 antd 的默认表现,
|
|
16
|
+
* 于是同一段代码在默认主题和设置中心的黑白主题下都对。
|
|
17
|
+
*
|
|
18
|
+
* @param {GlobalToken} token antd token
|
|
19
|
+
* @returns {{ bg: string; color: string | undefined }} 选中项底色,以及需要显式指定的文字色(回落时为 undefined)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getItemActiveColors(token: GlobalToken): {
|
|
22
|
+
bg: string;
|
|
23
|
+
color: string;
|
|
24
|
+
};
|
package/es/theme/type.d.ts
CHANGED
|
@@ -22,6 +22,15 @@ export interface CustomToken extends AliasToken {
|
|
|
22
22
|
colorTextSiderMenuActive: string;
|
|
23
23
|
colorBgSiderMenuHover: string;
|
|
24
24
|
colorBgSiderMenuActive: string;
|
|
25
|
+
/**
|
|
26
|
+
* 「选中项」的底色与压在其上的文字色。
|
|
27
|
+
*
|
|
28
|
+
* antd 只给了 `controlItemBgActive` 一个背景 token,没有配对的文字色,于是各页面
|
|
29
|
+
* 自己写背景、文字色照旧,底色一变深就成了深底深字。这一对补齐了那半边:
|
|
30
|
+
* 列表行、树节点、卡片这类自绘选中态统一读它,未设置时回落到 antd 的默认表现。
|
|
31
|
+
*/
|
|
32
|
+
colorBgItemActive: string;
|
|
33
|
+
colorTextItemActive: string;
|
|
25
34
|
colorSettings: string;
|
|
26
35
|
colorBgSettingsHover: string;
|
|
27
36
|
colorTemplateBgSettingsHover: string;
|