@_tc/template-core 0.2.0-bate.4 → 0.2.0-bate.6
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/AGENT_README.md +13 -3
- package/README.md +43 -4
- package/fe/frontend/src/common/language.d.ts +13 -1
- package/fe/frontend/src/common/language.js +24 -3
- package/fe/frontend/src/common/request.js +1 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +15 -2
- package/fe/frontend/src/index.d.ts +5 -3
- package/fe/frontend/src/index.js +5 -2
- package/model/frontend/src/common/language.d.ts +13 -1
- package/package.json +1 -1
package/AGENT_README.md
CHANGED
|
@@ -19,7 +19,7 @@ TemplateCore 是一个 TypeScript + Koa + React 的后台框架包。它提供
|
|
|
19
19
|
| --- | --- |
|
|
20
20
|
| `@_tc/template-core` | `serverStart`、`baseFn`、Koa/Controller/Service 类型。 |
|
|
21
21
|
| `@_tc/template-core/bundler` | `buildFE()`、`buildBE()`。 |
|
|
22
|
-
| `@_tc/template-core/fe` |
|
|
22
|
+
| `@_tc/template-core/fe` | 前端初始化、动态组件渲染辅助、请求方法、Dashboard/Schema 类型、token 工具、共享状态、业务前端组件。 |
|
|
23
23
|
| `@_tc/template-core/fe/common/request` | 请求实例、请求方法和请求类型的显式子路径。 |
|
|
24
24
|
| `@_tc/template-core/fe/rc` | React UI 组件和 SchemaForm 组件。 |
|
|
25
25
|
| `@_tc/template-core/fe/tailwind_ui.css` | 内置前端/UI 全局样式。 |
|
|
@@ -367,15 +367,23 @@ import '@_tc/template-core/fe/tailwind_ui.css'
|
|
|
367
367
|
|
|
368
368
|
```ts
|
|
369
369
|
import {
|
|
370
|
+
addLanguage,
|
|
371
|
+
addLanguageResources,
|
|
370
372
|
clearRafTimer,
|
|
371
373
|
api,
|
|
374
|
+
clearAuthToken,
|
|
372
375
|
get,
|
|
376
|
+
getAuthToken,
|
|
377
|
+
localKeyMap,
|
|
373
378
|
post,
|
|
379
|
+
renderImportComponent,
|
|
374
380
|
request,
|
|
375
381
|
rafSetInterval,
|
|
376
382
|
rafSetTimeout,
|
|
377
383
|
schemaEventBus,
|
|
378
384
|
schemaStore,
|
|
385
|
+
setAuthToken,
|
|
386
|
+
setLanguage,
|
|
379
387
|
useSchemaStore,
|
|
380
388
|
LanguageSwitch,
|
|
381
389
|
ThemeSwitch,
|
|
@@ -407,11 +415,13 @@ import { Button, DataTable, Form, Input, Modal, Select } from '@_tc/template-cor
|
|
|
407
415
|
- RAF 计时器:`rafSetTimeout`、`rafSetInterval`、`rafClearTimeout`、`rafClearInterval`、`clearRafTimer`。
|
|
408
416
|
- 请求类型:`BaseResponse`、`PageParams`、`PageResponse`、`RequestConfig`、`ResponseConfig`、`AxiosError`。
|
|
409
417
|
- 请求 header:自动添加 `s_t`、`s_sign`、`projk`;存在短 token 时添加 `Authorization: Bearer ${token}`。
|
|
418
|
+
- 默认会先设置 `Content-Type: application/json`;如果是上传文件、`FormData` 或其他内容类型,请在请求配置里显式覆盖。
|
|
419
|
+
- Token 工具:`getAuthToken()`、`setAuthToken()`、`clearAuthToken()`、`localKeyMap`;`getAuthToken()` 是同步函数,读取前无需 `await`。
|
|
410
420
|
- 本地 key:短 token 是 `localStorage.auth_token`,项目 key 是 `localStorage.p_J_k`;刷新 token header 默认名是 `RT`。
|
|
411
|
-
-
|
|
421
|
+
- 组件加载辅助:`renderImportComponent(import('./Page'))` 会用 `React.lazy` + `Suspense` 渲染动态组件。
|
|
412
422
|
- Schema 通信:`schemaEventBus`、`eventsInfo`、`merge`。
|
|
413
423
|
- 共享状态:`modeStore`、`schemaStore`、`apiFreezerStore` 及对应 hooks。
|
|
414
|
-
- 多语言:`
|
|
424
|
+
- 多语言:`addLanguageResources()` / `addResources()` 追加某语种文案,`addLanguage()` 新增语种,`setLanguage()` 切换语言,配置文案可写 `$i18n::...`。
|
|
415
425
|
- 主题:`ThemeSwitch` 会同步根节点 `dark` class 和 `localStorage`。
|
|
416
426
|
- `Input type="password"` 会自动显示密码显隐按钮;`allowClear` 不作用于密码输入。
|
|
417
427
|
- RAF 计时器只在浏览器环境可用,不适合 Node 侧调用。
|
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ http://localhost:9000/dash?projk=demo
|
|
|
182
182
|
| --- | --- |
|
|
183
183
|
| `@_tc/template-core` | 服务启动、基础 Controller/Service、Koa 类型 |
|
|
184
184
|
| `@_tc/template-core/bundler` | 构建入口,提供前端资源构建 `buildFE` 和消费方 Node/backend 构建 `buildBE` |
|
|
185
|
-
| `@_tc/template-core/fe` |
|
|
185
|
+
| `@_tc/template-core/fe` | 前端初始化、动态组件渲染辅助、Dash 路由扩展、请求方法、SchemaPage 事件、token 工具、共享状态和内置前端组件 |
|
|
186
186
|
| `@_tc/template-core/fe/rc` | UI/SchemaForm 组件和类型 |
|
|
187
187
|
| `@_tc/template-core/fe/rc/hooks` | React hooks 汇总入口 |
|
|
188
188
|
| `@_tc/template-core/fe/tailwind_ui.css` | 前端全局样式入口,源码对应 `frontend/src/main.css` |
|
|
@@ -311,18 +311,33 @@ VS Code 建议安装官方 Tailwind CSS IntelliSense 插件,并在工作区 `.
|
|
|
311
311
|
import {
|
|
312
312
|
api,
|
|
313
313
|
apiFreezerStore,
|
|
314
|
+
addLanguage,
|
|
315
|
+
addLanguageResources,
|
|
316
|
+
addResources,
|
|
314
317
|
AsyncSelect,
|
|
318
|
+
clearAuthToken,
|
|
315
319
|
eventsInfo,
|
|
320
|
+
getCurrentLanguage,
|
|
321
|
+
getFallbackLanguage,
|
|
316
322
|
FreezeState,
|
|
317
323
|
get,
|
|
324
|
+
getSupportedLanguages,
|
|
325
|
+
getAuthToken,
|
|
318
326
|
LanguageSwitch,
|
|
327
|
+
localKeyMap,
|
|
319
328
|
merge,
|
|
320
329
|
modeStore,
|
|
321
330
|
post,
|
|
331
|
+
renderImportComponent,
|
|
322
332
|
request,
|
|
323
333
|
schemaEventBus,
|
|
324
334
|
schemaStore,
|
|
335
|
+
setFallbackLanguage,
|
|
336
|
+
setLanguage,
|
|
337
|
+
setResources,
|
|
338
|
+
setAuthToken,
|
|
325
339
|
ThemeSwitch,
|
|
340
|
+
t,
|
|
326
341
|
useApiFreezer,
|
|
327
342
|
useModeStore,
|
|
328
343
|
useSchemaStore,
|
|
@@ -353,29 +368,34 @@ import type {
|
|
|
353
368
|
| --- | --- |
|
|
354
369
|
| 应用启动 | `initApp` |
|
|
355
370
|
| 内置前端组件 | `AsyncSelect`、`LanguageSwitch`、`ThemeSwitch` |
|
|
371
|
+
| 组件加载辅助 | `renderImportComponent` |
|
|
356
372
|
| Dash 扩展类型 | `DashRoutesExtender`、`DashRoutesContext`、`DashComponentsMap`、`DashHeaderUserAreaProps`、`DashRouteGuard` |
|
|
357
373
|
| SchemaPage 类型 | `CallComComponentsMap`、`CallComRenderer` |
|
|
358
374
|
| SchemaForm 类型 | `FormFieldSchema`、`SchemaFormComponentsMap`、`SchemaFormNamespace`、`SelectProps` |
|
|
359
375
|
| 请求方法 | `api`、`request`、`get`、`post`、`put`、`patch`、`del` |
|
|
360
376
|
| 请求类型 | `BaseResponse`、`PageParams`、`PageResponse`、`RequestConfig`、`ResponseConfig`、`AxiosError` |
|
|
377
|
+
| Token 工具 | `getAuthToken`、`setAuthToken`、`clearAuthToken`、`localKeyMap` |
|
|
378
|
+
| 多语言工具 | `getText`、`t`、`addLanguage`、`addLanguageResources`、`addResources`、`setLanguage`、`setFallbackLanguage`、`setResources`、`getCurrentLanguage`、`getFallbackLanguage`、`getSupportedLanguages` |
|
|
361
379
|
| 请求冻结 | `apiFreezerStore`、`useApiFreezer`、`FreezeState`、`ApiFreezerRequestMatcher` |
|
|
362
380
|
| 事件工具 | `eventsInfo`、`merge` |
|
|
363
381
|
| 共享状态 | `modeStore`、`useModeStore`、`schemaStore`、`useSchemaStore`、`schemaEventBus` |
|
|
364
382
|
|
|
365
383
|
`modeStore` 管项目模型和当前项目数据,`schemaStore` 管当前 Schema 页面的 schema/cache,`schemaEventBus` 用来在 Search、Table、CallCom 之间通信。
|
|
366
384
|
|
|
385
|
+
`renderImportComponent` 封装了 `React.lazy` + `Suspense`,默认会用页面骨架屏作为 fallback。`getAuthToken()`、`setAuthToken()` 和 `clearAuthToken()` 用于读写或清理本地短 token,`localKeyMap` 暴露对应的本地存储 key 常量。
|
|
386
|
+
|
|
367
387
|
只使用请求层时,也可以从 `@_tc/template-core/fe/common/request` 导入 `api`、请求方法和请求类型;这是发布包显式子路径,不要下钻到 `frontend/src/common/request`。
|
|
368
388
|
|
|
369
389
|
### 前端多语言
|
|
370
390
|
|
|
371
|
-
TemplateCore 前端通过 `@_tc/template-core/fe` 暴露 i18n
|
|
391
|
+
TemplateCore 前端通过 `@_tc/template-core/fe` 暴露 i18n 能力。框架内置中文、英文资源,项目可以继续追加自己的资源或新增语种。
|
|
372
392
|
|
|
373
393
|
**追加自定义语言资源**:
|
|
374
394
|
|
|
375
395
|
```ts
|
|
376
|
-
import {
|
|
396
|
+
import { addLanguageResources } from '@_tc/template-core/fe'
|
|
377
397
|
|
|
378
|
-
|
|
398
|
+
addLanguageResources('zh-CN', {
|
|
379
399
|
business: {
|
|
380
400
|
product: {
|
|
381
401
|
menu: '商品管理',
|
|
@@ -398,6 +418,24 @@ i18nStore.getState().addResources('en-US', {
|
|
|
398
418
|
})
|
|
399
419
|
```
|
|
400
420
|
|
|
421
|
+
**新增语种并切换**:
|
|
422
|
+
|
|
423
|
+
```ts
|
|
424
|
+
import { addLanguage, setLanguage } from '@_tc/template-core/fe'
|
|
425
|
+
|
|
426
|
+
addLanguage('ja-JP', {
|
|
427
|
+
business: {
|
|
428
|
+
product: {
|
|
429
|
+
menu: '商品管理',
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
})
|
|
433
|
+
|
|
434
|
+
setLanguage('ja-JP')
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
`addLanguageResources()` / `addResources()` 默认会深合并同语种文案;传 `{ merge: false }` 可以替换该语种资源。`setResources(resources, { merge: true })` 可批量合并多语种资源。`LanguageSwitch` 默认会把已注册语种加入选项;需要自定义展示文案时仍可传入 `options`。
|
|
438
|
+
|
|
401
439
|
资源注册时不写 `$i18n::` 前缀,配置中使用时才写:
|
|
402
440
|
|
|
403
441
|
```ts
|
|
@@ -535,6 +573,7 @@ applyThemeMode('dark', true)
|
|
|
535
573
|
- `timeout`:15000ms(15秒)
|
|
536
574
|
- `credentials`:`'include'`,支持跨域携带 cookie
|
|
537
575
|
- `window._signKey`:由服务端页面模板从 `app.config.signKey` 注入
|
|
576
|
+
- 默认会先设置 `Content-Type: application/json`;如果是上传文件、`FormData` 或其他内容类型,请在请求配置里显式覆盖
|
|
538
577
|
|
|
539
578
|
**请求拦截器**:
|
|
540
579
|
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import type { I18nInterpolationValues, I18nTranslateOptions } from "../../../packages/react/ui/i18n/index";
|
|
1
|
+
import type { I18nAddResourcesOptions, I18nDictionary, I18nInterpolationValues, I18nLanguage, I18nResources, I18nSetResourcesOptions, I18nTranslateOptions } from "../../../packages/react/ui/i18n/index";
|
|
2
|
+
export declare const addLanguageResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
3
|
+
export declare const addResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
4
|
+
export declare const addLanguage: (language: I18nLanguage, messages?: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
5
|
+
export declare const setLanguage: (language: I18nLanguage) => void;
|
|
6
|
+
export declare const setFallbackLanguage: (language: I18nLanguage) => void;
|
|
7
|
+
export declare const setResources: (resources: I18nResources, options?: I18nSetResourcesOptions) => void;
|
|
8
|
+
export declare const getCurrentLanguage: () => string;
|
|
9
|
+
export declare const getFallbackLanguage: () => string;
|
|
10
|
+
export declare const getI18nResources: () => Partial<Record<string, I18nDictionary>>;
|
|
11
|
+
export declare const getSupportedLanguages: () => string[];
|
|
2
12
|
export declare const getText: (key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string;
|
|
13
|
+
export declare const t: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
14
|
+
export type { I18nAddResourcesOptions, I18nDictionary, I18nInterpolationValues, I18nLanguage, I18nResources, I18nSetResourcesOptions, I18nTranslateOptions, };
|
|
@@ -2,11 +2,32 @@ import { frontendI18nResources, i18nKeyPrefix } from "../language/index.js";
|
|
|
2
2
|
import { i18n, i18nStore } from "../../../packages/common/i18n/index.js";
|
|
3
3
|
import "../../../packages/react/ui/i18n/index.js";
|
|
4
4
|
//#region frontend/src/common/language.ts
|
|
5
|
-
|
|
6
|
-
i18nStore.getState().addResources(
|
|
5
|
+
var addLanguageResources = (language, messages, options) => {
|
|
6
|
+
i18nStore.getState().addResources(language, messages, options);
|
|
7
|
+
};
|
|
8
|
+
var addResources = addLanguageResources;
|
|
9
|
+
var addLanguage = (language, messages = {}, options) => {
|
|
10
|
+
addLanguageResources(language, messages, options);
|
|
11
|
+
};
|
|
12
|
+
var setLanguage = (language) => {
|
|
13
|
+
i18nStore.getState().setLanguage(language);
|
|
14
|
+
};
|
|
15
|
+
var setFallbackLanguage = (language) => {
|
|
16
|
+
i18nStore.getState().setFallbackLanguage(language);
|
|
17
|
+
};
|
|
18
|
+
var setResources = (resources, options) => {
|
|
19
|
+
i18nStore.getState().setResources(resources, options);
|
|
20
|
+
};
|
|
21
|
+
var getCurrentLanguage = () => i18nStore.getState().language;
|
|
22
|
+
var getFallbackLanguage = () => i18nStore.getState().fallbackLanguage;
|
|
23
|
+
var getI18nResources = () => i18nStore.getState().resources;
|
|
24
|
+
var getSupportedLanguages = () => Object.keys(getI18nResources());
|
|
25
|
+
addLanguageResources("zh-CN", frontendI18nResources["zh-CN"] ?? {});
|
|
26
|
+
addLanguageResources("en-US", frontendI18nResources["en-US"] ?? {});
|
|
7
27
|
var getText = (key, fillingData, options) => {
|
|
8
28
|
if (key.includes("$i18n::")) return i18n(key.replace(i18nKeyPrefix, ""), fillingData, options);
|
|
9
29
|
return key;
|
|
10
30
|
};
|
|
31
|
+
var t = i18n;
|
|
11
32
|
//#endregion
|
|
12
|
-
export { getText };
|
|
33
|
+
export { addLanguage, addLanguageResources, addResources, getCurrentLanguage, getFallbackLanguage, getI18nResources, getSupportedLanguages, getText, setFallbackLanguage, setLanguage, setResources, t };
|
|
@@ -100,6 +100,7 @@ api.interceptors.request.use(async (config) => {
|
|
|
100
100
|
const aauto = getApiAuth();
|
|
101
101
|
const time = (/* @__PURE__ */ new Date()).getTime();
|
|
102
102
|
config.headers = {
|
|
103
|
+
"Content-Type": "application/json",
|
|
103
104
|
...config.headers,
|
|
104
105
|
s_t: time + "",
|
|
105
106
|
s_sign: md5(`${window["_signKey"]}_${time}`),
|
|
@@ -2,7 +2,7 @@ import { frontendLangKeys } from "../../language/index.js";
|
|
|
2
2
|
import { i18nStore } from "../../../../packages/common/i18n/index.js";
|
|
3
3
|
import { useI18nStore } from "../../../../packages/react/ui/i18n/useI18n.js";
|
|
4
4
|
import "../../../../packages/react/ui/i18n/index.js";
|
|
5
|
-
import { getText } from "../../common/language.js";
|
|
5
|
+
import { getSupportedLanguages, getText } from "../../common/language.js";
|
|
6
6
|
import { cn } from "../../../../packages/react/ui/lib/utils.js";
|
|
7
7
|
import { Button } from "../../../../packages/react/ui/components/Button/Button.js";
|
|
8
8
|
import { Dropdown } from "../../../../packages/react/ui/components/Dropdown/Dropdown.js";
|
|
@@ -20,10 +20,23 @@ var getDefaultLanguageOptions = () => [{
|
|
|
20
20
|
value: "en-US",
|
|
21
21
|
searchText: "en-US English"
|
|
22
22
|
}];
|
|
23
|
+
var getLanguageOptions = () => {
|
|
24
|
+
const baseOptions = getDefaultLanguageOptions();
|
|
25
|
+
const seen = new Set(baseOptions.map((option) => option.value));
|
|
26
|
+
return [...baseOptions, ...getSupportedLanguages().filter((language) => !seen.has(language)).map((language) => ({
|
|
27
|
+
label: language,
|
|
28
|
+
value: language,
|
|
29
|
+
searchText: language
|
|
30
|
+
}))];
|
|
31
|
+
};
|
|
23
32
|
var LanguageSwitch = ({ value, defaultValue, options, onChange, className, buttonClassName, placeholder, disabled, loading, clearable: _clearable, searchable: _searchable, placement = "bottom-end", getPopupContainer = "parent", ...props }) => {
|
|
24
33
|
const rootRef = useRef(null);
|
|
25
34
|
const currentLanguage = useI18nStore((state) => state.language);
|
|
26
|
-
const mergedOptions = useMemo(() => options ??
|
|
35
|
+
const mergedOptions = useMemo(() => options ?? getLanguageOptions(), [
|
|
36
|
+
currentLanguage,
|
|
37
|
+
options,
|
|
38
|
+
useI18nStore((state) => state.resources)
|
|
39
|
+
]);
|
|
27
40
|
const selectedLanguage = value ?? currentLanguage ?? defaultValue;
|
|
28
41
|
const selectedOption = mergedOptions.find((option) => option.value === selectedLanguage);
|
|
29
42
|
const displayText = selectedOption?.label ?? placeholder ?? getText(frontendLangKeys.languageSwitchPlaceholder);
|
|
@@ -4,14 +4,16 @@ export * from "./main";
|
|
|
4
4
|
export type { CallComComponentsMap, CallComRenderer } from "./defaultPages/SchemaPage/schemaType";
|
|
5
5
|
export * from "./components/index";
|
|
6
6
|
export type { FormFieldSchema, SchemaFormComponentsMap, SchemaFormNamespace, SelectProps } from "../../packages/react/ui/index";
|
|
7
|
-
export {
|
|
8
|
-
export type { AxiosError, BaseResponse, PageParams, PageResponse, RequestConfig, ResponseConfig } from "./common/request";
|
|
7
|
+
export { renderImportComponent } from "./common/importComponent";
|
|
9
8
|
export { clearRafTimer, rafClearInterval, rafClearTimeout, rafSetInterval, rafSetTimeout } from "./common/rafTimer";
|
|
10
9
|
export type { RafTimerCallback, RafTimerId } from "./common/rafTimer";
|
|
10
|
+
export { api, del, FetchAxios, get, patch, post, put, request } from "./common/request";
|
|
11
|
+
export type { AxiosError, BaseResponse, PageParams, PageResponse, RequestConfig, ResponseConfig, } from "./common/request";
|
|
11
12
|
export { applyThemeMode, getCurrentThemeMode, getStoredThemeMode, initThemeMode, persistThemeMode, themeSwitchStorageKey, } from "./common/theme";
|
|
12
13
|
export type { ThemeSwitchMode } from "./common/theme";
|
|
14
|
+
export { clearAuthToken, getAuthToken, localKeyMap, setAuthToken } from "./common/auth/index";
|
|
15
|
+
export * from "./common/language";
|
|
13
16
|
export * from "./defaultPages/SchemaPage/data/eventInfo";
|
|
14
17
|
export { merge } from "./defaultPages/SchemaPage/utils/permissions";
|
|
15
18
|
export * from "./exportStore";
|
|
16
19
|
export { i18n, i18nStore } from "../../packages/react/ui/i18n/index";
|
|
17
|
-
export { getAuthToken, localKeyMap, setAuthToken } from "./common/auth/index";
|
package/fe/frontend/src/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { getAuthToken, localKeyMap, setAuthToken } from "./common/auth/index.js";
|
|
1
|
+
import { clearAuthToken, getAuthToken, localKeyMap, setAuthToken } from "./common/auth/index.js";
|
|
2
2
|
import { i18n, i18nStore } from "../../packages/common/i18n/index.js";
|
|
3
3
|
import "../../packages/react/ui/i18n/index.js";
|
|
4
|
+
import { addLanguage, addLanguageResources, addResources, getCurrentLanguage, getFallbackLanguage, getI18nResources, getSupportedLanguages, getText, setFallbackLanguage, setLanguage, setResources, t } from "./common/language.js";
|
|
4
5
|
import { FreezeState, apiFreezerStore, useApiFreezer } from "./stores/apiFreezer.js";
|
|
6
|
+
import FetchAxios from "../../packages/common/http/index.js";
|
|
5
7
|
import { api, del, get, patch, post, put, request } from "./common/request.js";
|
|
6
8
|
import { modeStore, useModeStore } from "./stores/mode.js";
|
|
7
9
|
import HeaderView from "./components/BasePage/HeaderView.js";
|
|
10
|
+
import { renderImportComponent } from "./common/importComponent.js";
|
|
8
11
|
import { applyThemeMode, getCurrentThemeMode, getStoredThemeMode, initThemeMode, persistThemeMode, themeSwitchStorageKey } from "./common/theme.js";
|
|
9
12
|
import { generateRouter } from "./components/Router/index.js";
|
|
10
13
|
import { schemaEventBus } from "./stores/schemaEventBus.js";
|
|
@@ -18,4 +21,4 @@ import ThemeSwitch_default from "./components/ThemeSwitch/index.js";
|
|
|
18
21
|
import "./components/index.js";
|
|
19
22
|
import { eventsInfo } from "./defaultPages/SchemaPage/data/eventInfo.js";
|
|
20
23
|
import { merge } from "./defaultPages/SchemaPage/utils/permissions.js";
|
|
21
|
-
export { AsyncSelect_default as AsyncSelect, FreezeState, HeaderView, LanguageSwitch_default as LanguageSwitch, ThemeSwitch_default as ThemeSwitch, api, apiFreezerStore, applyThemeMode, clearRafTimer, del, eventsInfo, generateRouter, get, getAuthToken, getCurrentThemeMode, getStoredThemeMode, i18n, i18nStore, initApp, initThemeMode, localKeyMap, merge, modeStore, patch, persistThemeMode, post, put, rafClearInterval, rafClearTimeout, rafSetInterval, rafSetTimeout, request, schemaEventBus, schemaStore, setAuthToken, themeSwitchStorageKey, useApiFreezer, useModeStore, useSchemaStore };
|
|
24
|
+
export { AsyncSelect_default as AsyncSelect, FetchAxios, FreezeState, HeaderView, LanguageSwitch_default as LanguageSwitch, ThemeSwitch_default as ThemeSwitch, addLanguage, addLanguageResources, addResources, api, apiFreezerStore, applyThemeMode, clearAuthToken, clearRafTimer, del, eventsInfo, generateRouter, get, getAuthToken, getCurrentLanguage, getCurrentThemeMode, getFallbackLanguage, getI18nResources, getStoredThemeMode, getSupportedLanguages, getText, i18n, i18nStore, initApp, initThemeMode, localKeyMap, merge, modeStore, patch, persistThemeMode, post, put, rafClearInterval, rafClearTimeout, rafSetInterval, rafSetTimeout, renderImportComponent, request, schemaEventBus, schemaStore, setAuthToken, setFallbackLanguage, setLanguage, setResources, t, themeSwitchStorageKey, useApiFreezer, useModeStore, useSchemaStore };
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import type { I18nInterpolationValues, I18nTranslateOptions } from "../../../../fe/packages/react/ui/i18n/index";
|
|
1
|
+
import type { I18nAddResourcesOptions, I18nDictionary, I18nInterpolationValues, I18nLanguage, I18nResources, I18nSetResourcesOptions, I18nTranslateOptions } from "../../../../fe/packages/react/ui/i18n/index";
|
|
2
|
+
export declare const addLanguageResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
3
|
+
export declare const addResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
4
|
+
export declare const addLanguage: (language: I18nLanguage, messages?: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
5
|
+
export declare const setLanguage: (language: I18nLanguage) => void;
|
|
6
|
+
export declare const setFallbackLanguage: (language: I18nLanguage) => void;
|
|
7
|
+
export declare const setResources: (resources: I18nResources, options?: I18nSetResourcesOptions) => void;
|
|
8
|
+
export declare const getCurrentLanguage: () => string;
|
|
9
|
+
export declare const getFallbackLanguage: () => string;
|
|
10
|
+
export declare const getI18nResources: () => Partial<Record<string, I18nDictionary>>;
|
|
11
|
+
export declare const getSupportedLanguages: () => string[];
|
|
2
12
|
export declare const getText: (key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string;
|
|
13
|
+
export declare const t: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
14
|
+
export type { I18nAddResourcesOptions, I18nDictionary, I18nInterpolationValues, I18nLanguage, I18nResources, I18nSetResourcesOptions, I18nTranslateOptions, };
|
package/package.json
CHANGED