@qlover/create-app 0.10.1 → 0.10.3
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/CHANGELOG.md +178 -0
- package/dist/configs/_common/.github/workflows/general-check.yml +1 -1
- package/dist/configs/_common/.github/workflows/release.yml +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/templates/next-app/config/IOCIdentifier.ts +2 -2
- package/dist/templates/next-app/config/Identifier/common/common.ts +14 -0
- package/dist/templates/next-app/config/Identifier/pages/index.ts +1 -0
- package/dist/templates/next-app/config/Identifier/pages/page.about.ts +20 -0
- package/dist/templates/next-app/config/common.ts +1 -1
- package/dist/templates/next-app/config/cookies.ts +23 -0
- package/dist/templates/next-app/config/i18n/AboutI18n.ts +14 -0
- package/dist/templates/next-app/config/i18n/i18nConfig.ts +3 -1
- package/dist/templates/next-app/config/i18n/index.ts +1 -0
- package/dist/templates/next-app/config/i18n/loginI18n.ts +8 -0
- package/dist/templates/next-app/config/theme.ts +4 -0
- package/dist/templates/next-app/eslint.config.mjs +9 -2
- package/dist/templates/next-app/next.config.ts +1 -0
- package/dist/templates/next-app/package.json +17 -6
- package/dist/templates/next-app/public/locales/en.json +5 -0
- package/dist/templates/next-app/public/locales/zh.json +5 -0
- package/dist/templates/next-app/src/app/[locale]/admin/AdminI18nProvider.tsx +37 -0
- package/dist/templates/next-app/src/app/[locale]/admin/layout.tsx +30 -6
- package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +1 -1
- package/dist/templates/next-app/src/app/[locale]/layout.tsx +47 -10
- package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +1 -1
- package/dist/templates/next-app/src/app/[locale]/login/page.tsx +22 -10
- package/dist/templates/next-app/src/app/[locale]/page.tsx +23 -8
- package/dist/templates/next-app/src/app/[locale]/register/page.tsx +21 -9
- package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +7 -28
- package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +7 -34
- package/dist/templates/next-app/src/app/api/admin/locales/route.ts +12 -34
- package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +7 -26
- package/dist/templates/next-app/src/app/api/admin/users/route.ts +14 -33
- package/dist/templates/next-app/src/app/api/locales/json/route.ts +13 -25
- package/dist/templates/next-app/src/app/api/user/login/route.ts +6 -46
- package/dist/templates/next-app/src/app/api/user/logout/route.ts +5 -24
- package/dist/templates/next-app/src/app/api/user/register/route.ts +6 -45
- package/dist/templates/next-app/src/app/manifest.ts +16 -0
- package/dist/templates/next-app/src/app/robots.txt +2 -0
- package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +3 -3
- package/dist/templates/next-app/src/base/cases/AppConfig.ts +14 -13
- package/dist/templates/next-app/src/base/cases/Datetime.ts +3 -3
- package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +8 -2
- package/dist/templates/next-app/src/base/cases/DialogHandler.ts +30 -4
- package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +16 -4
- package/dist/templates/next-app/src/base/cases/NavigateBridge.ts +20 -4
- package/dist/templates/next-app/src/base/cases/RequestEncryptPlugin.ts +8 -2
- package/dist/templates/next-app/src/base/cases/ResourceState.ts +3 -3
- package/dist/templates/next-app/src/base/cases/RouterService.ts +28 -10
- package/dist/templates/next-app/src/base/cases/StringEncryptor.ts +14 -2
- package/dist/templates/next-app/src/base/cases/TranslateI18nInterface.ts +1 -1
- package/dist/templates/next-app/src/base/cases/UserServiceApi.ts +20 -5
- package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +31 -8
- package/dist/templates/next-app/src/base/port/AdminLayoutInterface.ts +4 -1
- package/dist/templates/next-app/src/base/port/AppApiInterface.ts +22 -0
- package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +27 -7
- package/dist/templates/next-app/src/base/port/IOCInterface.ts +9 -0
- package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +1 -1
- package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +3 -3
- package/dist/templates/next-app/src/base/services/I18nService.ts +20 -10
- package/dist/templates/next-app/src/base/services/ResourceService.ts +32 -11
- package/dist/templates/next-app/src/base/services/UserService.ts +12 -3
- package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +9 -6
- package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +20 -5
- package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +21 -4
- package/dist/templates/next-app/src/base/services/appApi/AppUserApi.ts +12 -3
- package/dist/templates/next-app/src/base/services/appApi/AppUserApiBootstrap.ts +10 -2
- package/dist/templates/next-app/src/base/types/{PageProps.ts → AppPageRouter.ts} +4 -1
- package/dist/templates/next-app/src/base/types/PagesRouter.ts +9 -0
- package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +20 -6
- package/dist/templates/next-app/src/core/bootstraps/BootstrapServer.ts +27 -9
- package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +6 -4
- package/dist/templates/next-app/src/core/clientIoc/ClientIOC.ts +39 -9
- package/dist/templates/next-app/src/core/clientIoc/ClientIOCRegister.ts +9 -2
- package/dist/templates/next-app/src/core/serverIoc/ServerIOC.ts +37 -10
- package/dist/templates/next-app/src/core/serverIoc/ServerIOCRegister.ts +9 -2
- package/dist/templates/next-app/src/i18n/loadMessages.ts +103 -0
- package/dist/templates/next-app/src/i18n/request.ts +3 -22
- package/dist/templates/next-app/src/pages/[locale]/about.tsx +61 -0
- package/dist/templates/next-app/src/pages/_app.tsx +50 -0
- package/dist/templates/next-app/src/pages/_document.tsx +13 -0
- package/dist/templates/next-app/src/{middleware.ts → proxy.ts} +2 -1
- package/dist/templates/next-app/src/server/AppErrorApi.ts +1 -1
- package/dist/templates/next-app/src/server/AppPageRouteParams.ts +107 -0
- package/dist/templates/next-app/src/server/AppSuccessApi.ts +1 -1
- package/dist/templates/next-app/src/server/NextApiServer.ts +62 -0
- package/dist/templates/next-app/src/server/PagesRouteParams.ts +146 -0
- package/dist/templates/next-app/src/server/PasswordEncrypt.ts +8 -2
- package/dist/templates/next-app/src/server/ServerAuth.ts +20 -5
- package/dist/templates/next-app/src/server/{sqlBridges/SupabaseBridge.ts → SupabaseBridge.ts} +50 -8
- package/dist/templates/next-app/src/server/UserCredentialToken.ts +8 -2
- package/dist/templates/next-app/src/server/controllers/AdminLocalesController.ts +86 -0
- package/dist/templates/next-app/src/server/controllers/AdminUserController.ts +42 -0
- package/dist/templates/next-app/src/server/controllers/LocalesController.ts +36 -0
- package/dist/templates/next-app/src/server/controllers/UserController.ts +86 -0
- package/dist/templates/next-app/src/server/port/AIControllerInterface.ts +8 -0
- package/dist/templates/next-app/src/server/port/AdminLocalesControllerInterface.ts +21 -0
- package/dist/templates/next-app/src/server/port/AdminUserControllerInterface.ts +11 -0
- package/dist/templates/next-app/src/server/port/LocalesControllerInterface.ts +10 -0
- package/dist/templates/next-app/src/server/port/{ParamsHandlerInterface.ts → RouteParamsnHandlerInterface.ts} +9 -2
- package/dist/templates/next-app/src/server/port/ServerInterface.ts +2 -2
- package/dist/templates/next-app/src/server/port/UserControllerInerface.ts +8 -0
- package/dist/templates/next-app/src/server/port/UserServiceInterface.ts +1 -1
- package/dist/templates/next-app/src/server/port/ValidatorInterface.ts +2 -2
- package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +31 -9
- package/dist/templates/next-app/src/server/repositorys/UserRepository.ts +15 -6
- package/dist/templates/next-app/src/server/services/AIService.ts +3 -1
- package/dist/templates/next-app/src/server/services/AdminAuthPlugin.ts +5 -2
- package/dist/templates/next-app/src/{base → server}/services/AdminLocalesService.ts +2 -2
- package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +29 -14
- package/dist/templates/next-app/src/server/services/ApiUserService.ts +6 -3
- package/dist/templates/next-app/src/server/services/UserService.ts +12 -3
- package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +24 -7
- package/dist/templates/next-app/src/server/validators/LoginValidator.ts +17 -5
- package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +17 -11
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/_default.css +0 -44
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/dark.css +0 -44
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/pink.css +0 -44
- package/dist/templates/next-app/src/styles/css/index.css +1 -1
- package/dist/templates/next-app/src/styles/css/scrollbar.css +34 -0
- package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +34 -11
- package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +69 -39
- package/dist/templates/next-app/src/uikit/components/ClientRootProvider.tsx +64 -0
- package/dist/templates/next-app/src/uikit/components/ClinetRenderProvider.tsx +42 -0
- package/dist/templates/next-app/src/uikit/components/IOCProvider.tsx +34 -0
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +7 -1
- package/dist/templates/next-app/src/uikit/components-app/AppBridge.tsx +17 -0
- package/dist/templates/next-app/src/uikit/components-app/AppRoutePage.tsx +112 -0
- package/dist/templates/next-app/src/uikit/{components → components-app}/LanguageSwitcher.tsx +15 -19
- package/dist/templates/next-app/src/uikit/{components → components-app}/ThemeSwitcher.tsx +53 -52
- package/dist/templates/next-app/src/uikit/components-pages/LanguageSwitcher.tsx +98 -0
- package/dist/templates/next-app/src/uikit/components-pages/PagesRoutePage.tsx +93 -0
- package/dist/templates/next-app/src/uikit/context/IOCContext.ts +16 -4
- package/dist/templates/next-app/src/uikit/hook/useStrictEffect.ts +32 -0
- package/dist/templates/next-app/tsconfig.json +3 -2
- package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +3 -1
- package/dist/templates/react-app/__tests__/__mocks__/MockAppConfig.ts +19 -19
- package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +8 -8
- package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +9 -9
- package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +1 -1
- package/dist/templates/react-app/__tests__/__mocks__/i18nextHttpBackend.ts +5 -5
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +9 -5
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +8 -4
- package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +4 -4
- package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +5 -5
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +3 -3
- package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +1 -1
- package/dist/templates/react-app/docs/en/components/chat-message-component.md +35 -29
- package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +18 -5
- package/dist/templates/react-app/docs/en/components/message-base-list-component.md +11 -12
- package/dist/templates/react-app/docs/en/request.md +1 -3
- package/dist/templates/react-app/docs/zh/components/chat-message-component.md +35 -29
- package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +18 -5
- package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +11 -12
- package/dist/templates/react-app/docs/zh/request.md +1 -3
- package/dist/templates/react-app/eslint.config.mjs +10 -5
- package/dist/templates/react-app/src/App.tsx +1 -1
- package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +2 -2
- package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +14 -11
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +10 -16
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +12 -10
- package/dist/templates/react-app/src/base/cases/AppConfig.ts +19 -19
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +28 -5
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +5 -2
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +16 -4
- package/dist/templates/react-app/src/base/cases/PublicAssetsPath.ts +1 -1
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +6 -3
- package/dist/templates/react-app/src/base/cases/RequestLogger.ts +17 -8
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +4 -6
- package/dist/templates/react-app/src/base/cases/ResourceState.ts +3 -3
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +3 -3
- package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +1 -1
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +2 -2
- package/dist/templates/react-app/src/base/port/IOCInterface.ts +4 -2
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +5 -5
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +7 -7
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +8 -8
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +4 -2
- package/dist/templates/react-app/src/base/services/BaseLayoutService.ts +3 -3
- package/dist/templates/react-app/src/base/services/I18nService.ts +24 -13
- package/dist/templates/react-app/src/base/services/IdentifierService.ts +21 -26
- package/dist/templates/react-app/src/base/services/RouteService.ts +8 -8
- package/dist/templates/react-app/src/base/services/UserBootstrap.ts +2 -2
- package/dist/templates/react-app/src/base/services/UserGatewayPlugin.ts +9 -5
- package/dist/templates/react-app/src/base/services/UserService.ts +10 -4
- package/dist/templates/react-app/src/core/bootstraps/BootstrapClient.ts +3 -1
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +5 -2
- package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +11 -4
- package/dist/templates/react-app/src/core/clientIoc/ClientIOCRegister.ts +5 -4
- package/dist/templates/react-app/src/pages/base/Layout.tsx +1 -1
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/_default.css +0 -44
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/dark.css +0 -44
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/pink.css +0 -44
- package/dist/templates/react-app/src/styles/css/index.css +1 -1
- package/dist/templates/react-app/src/styles/css/scrollbar.css +34 -0
- package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +2 -2
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +4 -4
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +8 -2
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +6 -6
- package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +1 -1
- package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +1 -3
- package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +4 -1
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +39 -16
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +4 -2
- package/package.json +3 -3
- package/dist/templates/next-app/src/server/PageParams.ts +0 -66
- package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +0 -80
- package/dist/templates/next-app/src/uikit/components/BaseLayout.tsx +0 -65
- package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +0 -58
- package/dist/templates/next-app/src/uikit/components/NextIntlProvider.tsx +0 -21
- package/dist/templates/react-app/makes/eslint-utils.mjs +0 -195
- /package/dist/templates/next-app/{src/app/[locale] → public}/favicon.ico +0 -0
- /package/dist/templates/next-app/src/uikit/{components → components-app}/LogoutButton.tsx +0 -0
|
@@ -17,15 +17,27 @@ export class InversifyContainer implements IOCContainerInterface {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @override
|
|
22
|
+
*/
|
|
23
|
+
public bind<T>(key: ServiceIdentifier<T>, value: T): void {
|
|
21
24
|
this.container.bind<T>(key).toConstantValue(value);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @override
|
|
29
|
+
*/
|
|
30
|
+
public get<K extends keyof IOCIdentifierMap>(
|
|
25
31
|
serviceIdentifier: K
|
|
26
32
|
): IOCIdentifierMap[K];
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @override
|
|
35
|
+
*/
|
|
36
|
+
public get<T>(serviceIdentifier: ServiceIdentifier<T>): T;
|
|
37
|
+
/**
|
|
38
|
+
* @override
|
|
39
|
+
*/
|
|
40
|
+
public get<T, K extends keyof IOCIdentifierMap>(
|
|
29
41
|
serviceIdentifier: ServiceIdentifier<T> | K
|
|
30
42
|
): T | IOCIdentifierMap[K] {
|
|
31
43
|
return this.container.get<T>(serviceIdentifier);
|
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import { injectable } from 'inversify';
|
|
1
|
+
import { inject, injectable } from 'inversify';
|
|
2
|
+
import type { useRouter } from '@/i18n/routing';
|
|
3
|
+
import { I } from '@config/IOCIdentifier';
|
|
2
4
|
import type { UIBridgeInterface } from '@qlover/corekit-bridge';
|
|
3
|
-
import type {
|
|
5
|
+
import type { LoggerInterface } from '@qlover/logger';
|
|
6
|
+
|
|
7
|
+
type AppRouterInstance = ReturnType<typeof useRouter>;
|
|
4
8
|
|
|
5
9
|
@injectable()
|
|
6
10
|
export class NavigateBridge implements UIBridgeInterface<AppRouterInstance> {
|
|
7
11
|
protected navigate: AppRouterInstance | null = null;
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
constructor(@inject(I.Logger) protected logger: LoggerInterface) {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @override
|
|
17
|
+
*/
|
|
18
|
+
public setUIBridge(ui: AppRouterInstance): void {
|
|
10
19
|
this.navigate = ui;
|
|
11
20
|
}
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @override
|
|
24
|
+
*/
|
|
25
|
+
public getUIBridge(): AppRouterInstance | null {
|
|
26
|
+
if (!this.navigate) {
|
|
27
|
+
this.logger.debug('NavigateBridge this.navigate is not set');
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
return this.navigate;
|
|
15
31
|
}
|
|
16
32
|
}
|
|
@@ -20,11 +20,14 @@ export interface RequestEncryptPluginProps<
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export class RequestEncryptPlugin implements ExecutorPlugin<RequestEncryptPluginProps> {
|
|
23
|
-
readonly pluginName = 'RequestEncryptPlugin';
|
|
23
|
+
public readonly pluginName = 'RequestEncryptPlugin';
|
|
24
24
|
|
|
25
25
|
constructor(protected encryptor: Encryptor<string, string>) {}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @override
|
|
29
|
+
*/
|
|
30
|
+
public onBefore(
|
|
28
31
|
context: ExecutorContext<RequestEncryptPluginProps>
|
|
29
32
|
): void | Promise<void> {
|
|
30
33
|
const { responseType, encryptProps } = context.parameters;
|
|
@@ -41,6 +44,9 @@ export class RequestEncryptPlugin implements ExecutorPlugin<RequestEncryptPlugin
|
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @override
|
|
49
|
+
*/
|
|
44
50
|
protected encryptData<T extends object>(
|
|
45
51
|
data: T,
|
|
46
52
|
encryptProps?: string | string[]
|
|
@@ -6,12 +6,12 @@ import type {
|
|
|
6
6
|
} from '@qlover/corekit-bridge';
|
|
7
7
|
|
|
8
8
|
export class ResourceState implements ResourceStateInterface {
|
|
9
|
-
searchParams: ResourceQuery = {
|
|
9
|
+
public searchParams: ResourceQuery = {
|
|
10
10
|
page: 1,
|
|
11
11
|
pageSize: 10,
|
|
12
12
|
orderBy: 'updated_at',
|
|
13
13
|
order: 1
|
|
14
14
|
};
|
|
15
|
-
initState = new RequestState<unknown>();
|
|
16
|
-
listState = new RequestState<PaginationInterface<unknown>>();
|
|
15
|
+
public initState = new RequestState<unknown>();
|
|
16
|
+
public listState = new RequestState<PaginationInterface<unknown>>();
|
|
17
17
|
}
|
|
@@ -13,27 +13,45 @@ export class RouterService implements RouterInterface {
|
|
|
13
13
|
protected uiBridge: UIBridgeInterface<AppRouterInstance>
|
|
14
14
|
) {}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @override
|
|
18
|
+
*/
|
|
19
|
+
public goto(href: RouterPathname): void {
|
|
20
|
+
this.uiBridge.getUIBridge()?.push(href as string);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
gotoHome(): void {
|
|
23
|
+
/**
|
|
24
|
+
* @override
|
|
25
|
+
*/
|
|
26
|
+
public gotoHome(): void {
|
|
25
27
|
this.goto('/');
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @override
|
|
32
|
+
*/
|
|
33
|
+
public gotoLogin(): void {
|
|
29
34
|
this.goto('/login');
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @override
|
|
39
|
+
*/
|
|
40
|
+
public replaceHome(): void {
|
|
41
|
+
this.uiBridge.getUIBridge()?.replace('/');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @override
|
|
46
|
+
*/
|
|
47
|
+
public setLocale(locale: string): void {
|
|
33
48
|
this.locale = locale;
|
|
34
49
|
}
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @override
|
|
53
|
+
*/
|
|
54
|
+
public getLocale(): string {
|
|
37
55
|
return this.locale;
|
|
38
56
|
}
|
|
39
57
|
}
|
|
@@ -18,6 +18,9 @@ export class StringEncryptor implements Encryptor<string, string> {
|
|
|
18
18
|
this.key = appConfig.stringEncryptorKey;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
21
24
|
protected encryptWithKey(str: string, key: string): string {
|
|
22
25
|
const result = [];
|
|
23
26
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -31,6 +34,9 @@ export class StringEncryptor implements Encryptor<string, string> {
|
|
|
31
34
|
return result.join('');
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @override
|
|
39
|
+
*/
|
|
34
40
|
protected decryptWithKey(str: string, key: string): string {
|
|
35
41
|
const result = [];
|
|
36
42
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -43,7 +49,10 @@ export class StringEncryptor implements Encryptor<string, string> {
|
|
|
43
49
|
return result.join('');
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
/**
|
|
53
|
+
* @override
|
|
54
|
+
*/
|
|
55
|
+
public encrypt(value: string): string {
|
|
47
56
|
try {
|
|
48
57
|
const encrypted = this.encryptWithKey(value, this.key);
|
|
49
58
|
return this.base64Serializer.serialize(encrypted);
|
|
@@ -53,7 +62,10 @@ export class StringEncryptor implements Encryptor<string, string> {
|
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
|
|
56
|
-
|
|
65
|
+
/**
|
|
66
|
+
* @override
|
|
67
|
+
*/
|
|
68
|
+
public decrypt(encryptedValue: string): string {
|
|
57
69
|
try {
|
|
58
70
|
// 1. 先用 base64 反序列化
|
|
59
71
|
const decoded = this.base64Serializer.deserialize(encryptedValue);
|
|
@@ -9,7 +9,7 @@ import type { useTranslations } from 'next-intl';
|
|
|
9
9
|
* @returns The translated i18n interface
|
|
10
10
|
*/
|
|
11
11
|
export class TranslateI18nInterface {
|
|
12
|
-
static translate<T extends PageI18nInterface | Record<string, string>>(
|
|
12
|
+
public static translate<T extends PageI18nInterface | Record<string, string>>(
|
|
13
13
|
source: T,
|
|
14
14
|
t: ReturnType<typeof useTranslations>
|
|
15
15
|
): T {
|
|
@@ -17,7 +17,10 @@ export class UserServiceApi implements UserServiceGateway<
|
|
|
17
17
|
> {
|
|
18
18
|
constructor(@inject(AppUserApi) protected appUserApi: AppUserApiInterface) {}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @override
|
|
22
|
+
*/
|
|
23
|
+
public getUserInfo(_params?: unknown): Promise<UserSchema | null> {
|
|
21
24
|
if (_params && isWebUserSchema(_params).success) {
|
|
22
25
|
return Promise.resolve(omit(_params, 'credential_token') as UserSchema);
|
|
23
26
|
}
|
|
@@ -25,13 +28,19 @@ export class UserServiceApi implements UserServiceGateway<
|
|
|
25
28
|
return Promise.resolve(null);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @override
|
|
33
|
+
*/
|
|
34
|
+
public refreshUserInfo<Params>(
|
|
29
35
|
_params?: Params | undefined
|
|
30
36
|
): Promise<UserSchema | null> {
|
|
31
37
|
return this.getUserInfo(_params);
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @override
|
|
42
|
+
*/
|
|
43
|
+
public async login(params: LoginValidatorData): Promise<UserCredential> {
|
|
35
44
|
const response = await this.appUserApi.login(params);
|
|
36
45
|
|
|
37
46
|
if (!response.data.success) {
|
|
@@ -41,7 +50,10 @@ export class UserServiceApi implements UserServiceGateway<
|
|
|
41
50
|
return response.data.data as UserCredential;
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @override
|
|
55
|
+
*/
|
|
56
|
+
public async register(params: LoginValidatorData): Promise<UserSchema> {
|
|
45
57
|
const response = await this.appUserApi.register(params);
|
|
46
58
|
|
|
47
59
|
if (!response.data.success) {
|
|
@@ -51,7 +63,10 @@ export class UserServiceApi implements UserServiceGateway<
|
|
|
51
63
|
return response.data.data as UserSchema;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
public async logout<P = unknown, Result = void>(params?: P): Promise<Result> {
|
|
55
70
|
const response = await this.appUserApi.logout(params);
|
|
56
71
|
|
|
57
72
|
if (!response.data.success) {
|
|
@@ -45,7 +45,12 @@ export class ZodColumnBuilder<
|
|
|
45
45
|
this.optionMap = optionMap ? merge(baseOptions, optionMap) : baseOptions;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
*/
|
|
51
|
+
public static zodType2RenderForm(
|
|
52
|
+
zod: ZodType
|
|
53
|
+
): ResourceTableFormType | undefined {
|
|
49
54
|
// @ts-expect-error - zod._def.typeName is not typed
|
|
50
55
|
const typeName = zod._def?.typeName as ZodFirstPartyTypeKind;
|
|
51
56
|
|
|
@@ -65,7 +70,10 @@ export class ZodColumnBuilder<
|
|
|
65
70
|
];
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @override
|
|
75
|
+
*/
|
|
76
|
+
public zod2BaseOption(
|
|
69
77
|
key: string,
|
|
70
78
|
zod: ZodType
|
|
71
79
|
): ResourceTableOption<z.infer<Input>> {
|
|
@@ -91,7 +99,10 @@ export class ZodColumnBuilder<
|
|
|
91
99
|
};
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @override
|
|
104
|
+
*/
|
|
105
|
+
public getBaseOptions(input: Input): OptionMap<Value, Input> {
|
|
95
106
|
return Object.entries(input.shape).reduce(
|
|
96
107
|
(acc, [key, zod]) => {
|
|
97
108
|
acc[key as keyof Input['shape']] = this.zod2BaseOption(
|
|
@@ -104,7 +115,10 @@ export class ZodColumnBuilder<
|
|
|
104
115
|
);
|
|
105
116
|
}
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
/**
|
|
119
|
+
* @override
|
|
120
|
+
*/
|
|
121
|
+
public bind(
|
|
108
122
|
key: keyof Input['shape'],
|
|
109
123
|
params?: Partial<ResourceTableOption<z.infer<Input>>>
|
|
110
124
|
): this {
|
|
@@ -115,7 +129,10 @@ export class ZodColumnBuilder<
|
|
|
115
129
|
return this;
|
|
116
130
|
}
|
|
117
131
|
|
|
118
|
-
|
|
132
|
+
/**
|
|
133
|
+
* @override
|
|
134
|
+
*/
|
|
135
|
+
public render<K extends keyof Input['shape']>(
|
|
119
136
|
key: K,
|
|
120
137
|
render: (
|
|
121
138
|
value: unknown,
|
|
@@ -129,10 +146,11 @@ export class ZodColumnBuilder<
|
|
|
129
146
|
|
|
130
147
|
/**
|
|
131
148
|
* Translate all i18n keys in options to actual text
|
|
149
|
+
* @override
|
|
132
150
|
* @param t - Translation function from next-intl
|
|
133
151
|
* @returns this for chaining
|
|
134
152
|
*/
|
|
135
|
-
translate(t: ReturnType<typeof useTranslations>): this {
|
|
153
|
+
public translate(t: ReturnType<typeof useTranslations>): this {
|
|
136
154
|
Object.values(this.optionMap).forEach((option) => {
|
|
137
155
|
const { tt } = option;
|
|
138
156
|
// Translate title if it's a string (i18n key)
|
|
@@ -167,11 +185,15 @@ export class ZodColumnBuilder<
|
|
|
167
185
|
|
|
168
186
|
/**
|
|
169
187
|
* Build a single option by key
|
|
188
|
+
* @override
|
|
170
189
|
* @param key - The key of the option to build
|
|
171
190
|
* @param params - Optional additional parameters to merge
|
|
172
191
|
* @returns The built option
|
|
173
192
|
*/
|
|
174
|
-
build(
|
|
193
|
+
public build(
|
|
194
|
+
key: string,
|
|
195
|
+
params?: unknown
|
|
196
|
+
): ResourceTableOption<z.infer<Input>> {
|
|
175
197
|
const option = this.optionMap[key as keyof Input['shape']];
|
|
176
198
|
if (!option) {
|
|
177
199
|
throw new Error(`Option with key "${key}" not found`);
|
|
@@ -190,10 +212,11 @@ export class ZodColumnBuilder<
|
|
|
190
212
|
|
|
191
213
|
/**
|
|
192
214
|
* Build all options
|
|
215
|
+
* @override
|
|
193
216
|
* @param params - Optional additional parameters (currently unused)
|
|
194
217
|
* @returns Array of all built options
|
|
195
218
|
*/
|
|
196
|
-
buildAll(_params?: unknown): ResourceTableOption<z.infer<Input>>[] {
|
|
219
|
+
public buildAll(_params?: unknown): ResourceTableOption<z.infer<Input>>[] {
|
|
197
220
|
return Object.values(this.optionMap);
|
|
198
221
|
}
|
|
199
222
|
}
|
|
@@ -12,3 +12,25 @@ export interface AppApiSuccessInterface<T = unknown> {
|
|
|
12
12
|
export type AppApiResult<T = unknown> =
|
|
13
13
|
| AppApiErrorInterface
|
|
14
14
|
| AppApiSuccessInterface<T>;
|
|
15
|
+
|
|
16
|
+
export function isAppApiSuccessInterface(
|
|
17
|
+
result: unknown
|
|
18
|
+
): result is AppApiSuccessInterface {
|
|
19
|
+
return (
|
|
20
|
+
typeof result === 'object' &&
|
|
21
|
+
result !== null &&
|
|
22
|
+
'success' in result &&
|
|
23
|
+
result.success === true
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isAppApiErrorInterface(
|
|
28
|
+
result: unknown
|
|
29
|
+
): result is AppApiErrorInterface {
|
|
30
|
+
return (
|
|
31
|
+
typeof result === 'object' &&
|
|
32
|
+
result !== null &&
|
|
33
|
+
'success' in result &&
|
|
34
|
+
result.success === false
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -10,17 +10,37 @@ export type SupportedNamespace = typeof i18nConfig.fallbackLng;
|
|
|
10
10
|
export type I18nServiceLocale = Locale;
|
|
11
11
|
|
|
12
12
|
export class I18nServiceState implements StoreStateInterface {
|
|
13
|
-
loading: boolean = false;
|
|
13
|
+
public loading: boolean = false;
|
|
14
14
|
constructor(public language: I18nServiceLocale) {}
|
|
15
15
|
}
|
|
16
16
|
export abstract class I18nServiceInterface
|
|
17
17
|
extends StoreInterface<I18nServiceState>
|
|
18
18
|
implements I18nServiceInterface
|
|
19
19
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
abstract
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @override
|
|
22
|
+
*/
|
|
23
|
+
public abstract t(key: string, params?: Record<string, unknown>): string;
|
|
24
|
+
/**
|
|
25
|
+
* @override
|
|
26
|
+
*/
|
|
27
|
+
public abstract changeLanguage(language: I18nServiceLocale): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* @override
|
|
30
|
+
*/
|
|
31
|
+
public abstract changeLoading(loading: boolean): void;
|
|
32
|
+
/**
|
|
33
|
+
* @override
|
|
34
|
+
*/
|
|
35
|
+
public abstract getCurrentLanguage(): Promise<I18nServiceLocale>;
|
|
36
|
+
/**
|
|
37
|
+
* @override
|
|
38
|
+
*/
|
|
39
|
+
public abstract isValidLanguage(
|
|
40
|
+
language: string
|
|
41
|
+
): language is I18nServiceLocale;
|
|
42
|
+
/**
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
public abstract getSupportedLanguages(): I18nServiceLocale[];
|
|
26
46
|
}
|
|
@@ -21,4 +21,13 @@ export interface IOCInterface<
|
|
|
21
21
|
create(
|
|
22
22
|
options: IocRegisterOptions
|
|
23
23
|
): IOCFunctionInterface<IdentifierMap, IOCContainer>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 该方法主要用于在应用启动前注册所有依赖
|
|
27
|
+
*
|
|
28
|
+
* 因为ssr渲染的原因可能需要在一些特定的环境下注册一些依赖
|
|
29
|
+
*
|
|
30
|
+
* @param options - 注册选项
|
|
31
|
+
*/
|
|
32
|
+
register(options?: IocRegisterOptions): void;
|
|
24
33
|
}
|
|
@@ -16,7 +16,7 @@ export class AdminPageEvent extends ResourceEvent {
|
|
|
16
16
|
super(namespace, resource, undefined, schemaFormRef);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
override onDeleted(_params: ResourceTableEventCommonParams): void {
|
|
19
|
+
public override onDeleted(_params: ResourceTableEventCommonParams): void {
|
|
20
20
|
this.uiDialog?.confirm({
|
|
21
21
|
title: 'Confirm Delete',
|
|
22
22
|
content: 'Are you sure you want to delete this item?',
|
|
@@ -5,7 +5,7 @@ export class AdminPageScheduler implements LifecycleInterface {
|
|
|
5
5
|
/**
|
|
6
6
|
* @override
|
|
7
7
|
*/
|
|
8
|
-
async created(parmas: {
|
|
8
|
+
public async created(parmas: {
|
|
9
9
|
resource: ResourceService<unknown>;
|
|
10
10
|
}): Promise<unknown> {
|
|
11
11
|
const { resource } = parmas;
|
|
@@ -28,7 +28,7 @@ export class AdminPageScheduler implements LifecycleInterface {
|
|
|
28
28
|
/**
|
|
29
29
|
* @override
|
|
30
30
|
*/
|
|
31
|
-
destroyed(parmas: { resource: ResourceService<unknown> }): void {
|
|
31
|
+
public destroyed(parmas: { resource: ResourceService<unknown> }): void {
|
|
32
32
|
const { resource } = parmas;
|
|
33
33
|
const store = resource.getStore();
|
|
34
34
|
|
|
@@ -38,5 +38,5 @@ export class AdminPageScheduler implements LifecycleInterface {
|
|
|
38
38
|
/**
|
|
39
39
|
* @override
|
|
40
40
|
*/
|
|
41
|
-
updated(): void {}
|
|
41
|
+
public updated(): void {}
|
|
42
42
|
}
|
|
@@ -9,7 +9,7 @@ import type { useTranslations } from 'next-intl';
|
|
|
9
9
|
type TranslationFunction = ReturnType<typeof useTranslations>;
|
|
10
10
|
|
|
11
11
|
export class I18nService extends I18nServiceInterface {
|
|
12
|
-
readonly pluginName = 'I18nService';
|
|
12
|
+
public readonly pluginName = 'I18nService';
|
|
13
13
|
protected pathname: string = '';
|
|
14
14
|
protected translator: TranslationFunction | null = null;
|
|
15
15
|
|
|
@@ -17,20 +17,28 @@ export class I18nService extends I18nServiceInterface {
|
|
|
17
17
|
super(() => new I18nServiceState(i18nConfig.fallbackLng));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @override
|
|
22
|
+
*/
|
|
23
|
+
public setPathname(pathname: string): void {
|
|
21
24
|
this.pathname = pathname;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @override
|
|
29
|
+
*/
|
|
30
|
+
public setTranslator(translator: TranslationFunction): void {
|
|
25
31
|
this.translator = translator;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* @override
|
|
30
36
|
*/
|
|
31
|
-
async onBefore(): Promise<void> {}
|
|
37
|
+
public async onBefore(): Promise<void> {}
|
|
32
38
|
|
|
33
|
-
override async changeLanguage(
|
|
39
|
+
public override async changeLanguage(
|
|
40
|
+
language: I18nServiceLocale
|
|
41
|
+
): Promise<void> {
|
|
34
42
|
try {
|
|
35
43
|
this.changeLoading(true);
|
|
36
44
|
|
|
@@ -46,23 +54,25 @@ export class I18nService extends I18nServiceInterface {
|
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
override changeLoading(loading: boolean): void {
|
|
57
|
+
public override changeLoading(loading: boolean): void {
|
|
50
58
|
this.emit({ ...this.state, loading });
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
override async getCurrentLanguage(): Promise<I18nServiceLocale> {
|
|
61
|
+
public override async getCurrentLanguage(): Promise<I18nServiceLocale> {
|
|
54
62
|
return this.state.language;
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
override isValidLanguage(
|
|
65
|
+
public override isValidLanguage(
|
|
66
|
+
language: string
|
|
67
|
+
): language is I18nServiceLocale {
|
|
58
68
|
return i18nConfig.supportedLngs.includes(language as I18nServiceLocale);
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
override getSupportedLanguages(): I18nServiceLocale[] {
|
|
71
|
+
public override getSupportedLanguages(): I18nServiceLocale[] {
|
|
62
72
|
return [...i18nConfig.supportedLngs];
|
|
63
73
|
}
|
|
64
74
|
|
|
65
|
-
override t(
|
|
75
|
+
public override t(
|
|
66
76
|
key: string,
|
|
67
77
|
params?: Record<string, string | number | Date>
|
|
68
78
|
): string {
|
|
@@ -14,7 +14,7 @@ export class ResourceService<
|
|
|
14
14
|
Store extends ResourceStore<ResourceStateInterface> =
|
|
15
15
|
ResourceStore<ResourceStateInterface>
|
|
16
16
|
> implements ResourceServiceInterface<T> {
|
|
17
|
-
readonly unionKey: string = 'id';
|
|
17
|
+
public readonly unionKey: string = 'id';
|
|
18
18
|
|
|
19
19
|
constructor(
|
|
20
20
|
readonly serviceName: string,
|
|
@@ -22,14 +22,17 @@ export class ResourceService<
|
|
|
22
22
|
readonly resourceApi: ResourceInterface<T>
|
|
23
23
|
) {}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @override
|
|
27
|
+
*/
|
|
28
|
+
public getStore(): Store {
|
|
26
29
|
return this.store;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
33
|
* @override
|
|
31
34
|
*/
|
|
32
|
-
async created(): Promise<unknown> {
|
|
35
|
+
public async created(): Promise<unknown> {
|
|
33
36
|
this.store.changeInitState(new RequestState(true));
|
|
34
37
|
|
|
35
38
|
try {
|
|
@@ -47,16 +50,19 @@ export class ResourceService<
|
|
|
47
50
|
/**
|
|
48
51
|
* @override
|
|
49
52
|
*/
|
|
50
|
-
destroyed(): void {
|
|
53
|
+
public destroyed(): void {
|
|
51
54
|
this.store.reset();
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
58
|
* @override
|
|
56
59
|
*/
|
|
57
|
-
updated(): void {}
|
|
60
|
+
public updated(): void {}
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
*/
|
|
65
|
+
public async search(
|
|
60
66
|
params: Partial<ResourceQuery>
|
|
61
67
|
): Promise<PaginationInterface<T>> {
|
|
62
68
|
this.store.changeListState(
|
|
@@ -84,11 +90,17 @@ export class ResourceService<
|
|
|
84
90
|
return this.store.state.listState.result! as PaginationInterface<T>;
|
|
85
91
|
}
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
/**
|
|
94
|
+
* @override
|
|
95
|
+
*/
|
|
96
|
+
public refresh(): Promise<unknown> {
|
|
88
97
|
return this.search(this.store.state.searchParams);
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
|
|
100
|
+
/**
|
|
101
|
+
* @override
|
|
102
|
+
*/
|
|
103
|
+
public async update(data: Partial<T>): Promise<unknown> {
|
|
92
104
|
const result = await this.resourceApi.update(data);
|
|
93
105
|
|
|
94
106
|
// 更新本地列表数据
|
|
@@ -109,13 +121,22 @@ export class ResourceService<
|
|
|
109
121
|
return result;
|
|
110
122
|
}
|
|
111
123
|
|
|
112
|
-
|
|
124
|
+
/**
|
|
125
|
+
* @override
|
|
126
|
+
*/
|
|
127
|
+
public create(data: T): Promise<unknown> {
|
|
113
128
|
return this.resourceApi.create(data);
|
|
114
129
|
}
|
|
115
|
-
|
|
130
|
+
/**
|
|
131
|
+
* @override
|
|
132
|
+
*/
|
|
133
|
+
public remove(data: T): Promise<unknown> {
|
|
116
134
|
return this.resourceApi.remove(data);
|
|
117
135
|
}
|
|
118
|
-
|
|
136
|
+
/**
|
|
137
|
+
* @override
|
|
138
|
+
*/
|
|
139
|
+
public export(data: T): Promise<unknown> {
|
|
119
140
|
return this.resourceApi.export(data);
|
|
120
141
|
}
|
|
121
142
|
}
|