@_tc/template-core 0.0.1-bate.43 → 0.0.1-bate.45
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/cjs/app/README.md +286 -0
- package/cjs/app/service/{bese.js → base.js} +3 -3
- package/cjs/app/service/project.js +2 -2
- package/cjs/bundler/utils.js +62 -4
- package/cjs/index.js +2 -2
- package/esm/app/README.md +286 -0
- package/esm/app/service/{bese.js → base.js} +3 -3
- package/esm/app/service/project.js +2 -2
- package/esm/bundler/utils.js +62 -4
- package/esm/index.js +2 -2
- package/fe/frontend/components/AsyncSelect/AsyncSelect.d.ts +8 -0
- package/fe/frontend/components/AsyncSelect/AsyncSelect.js +32 -0
- package/fe/frontend/components/AsyncSelect/index.d.ts +4 -0
- package/fe/frontend/components/AsyncSelect/index.js +3 -0
- package/fe/frontend/dash/Dashboard.js +12 -12
- package/fe/frontend/dash/dash.entry.js +26 -13
- package/fe/frontend/dash/types.d.ts +17 -0
- package/fe/frontend/dash/types.js +1 -0
- package/fe/frontend/extended/SchemaForm/data.d.ts +13 -0
- package/fe/frontend/extended/SchemaForm/data.js +8 -0
- package/fe/frontend/index.d.ts +3 -1
- package/fe/frontend/index.js +1 -0
- package/fe/frontend/typing/scalability.d.ts +47 -0
- package/fe/frontend/typing/scalability.js +1 -0
- package/fe/frontend/widgets/api/baseInfo.d.ts +1 -1
- package/fe/frontend/widgets/api/baseInfo.js +1 -1
- package/fe/frontend/widgets/common/menu.js +1 -1
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +1 -1
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +1 -1
- package/fe/frontend/widgets/hooks/useCurrentMenuData.js +3 -3
- package/fe/frontend/widgets/store/mode.d.ts +3 -3
- package/fe/frontend/widgets/store/mode.js +8 -8
- package/fe/model/types/data/search.d.ts +4 -4
- package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +5 -10
- package/fe/packages/ui/react/components/Form/SchemaForm/data.js +4 -2
- package/fe/packages/ui/react/components/Form/SchemaForm/index.d.ts +1 -1
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -1
- package/fe/packages/ui/react/i18n/useI18n.d.ts +4 -4
- package/fe/typings/type.d.ts +2 -3
- package/model/types/data/search.d.ts +4 -4
- package/package.json +1 -1
- package/types/typings/type.d.ts +2 -3
- /package/model/{types/test.d.ts → test.d.ts} +0 -0
- /package/types/app/service/{bese.d.ts → base.d.ts} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { FrameComponentPropsMap, FrameComponentsMap } from '../extended/SchemaForm/data';
|
|
2
|
+
import type { SelectProps } from '../../packages/ui/react';
|
|
3
|
+
/**
|
|
4
|
+
* 扩展 SchemaForm 字段类型
|
|
5
|
+
*
|
|
6
|
+
* 框架业务侧可以在这里扩展业务特定的表单组件类型。
|
|
7
|
+
* 消费方也可以在自己的项目中创建类似的声明文件继续扩展。
|
|
8
|
+
*/
|
|
9
|
+
declare module '../../packages/ui/react' {
|
|
10
|
+
namespace SchemaFormNamespace {
|
|
11
|
+
/**
|
|
12
|
+
* 扩展字段类型
|
|
13
|
+
*
|
|
14
|
+
* 示例:
|
|
15
|
+
* interface FieldTypes {
|
|
16
|
+
* businessSelect: true
|
|
17
|
+
* userPicker: true
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
interface FieldTypes extends FrameComponentsMap {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 扩展字段 Props 映射
|
|
24
|
+
*
|
|
25
|
+
* 示例:
|
|
26
|
+
* interface PropsMap {
|
|
27
|
+
* businessSelect: SelectProps & {
|
|
28
|
+
* requestUrl?: string
|
|
29
|
+
* valueField?: string
|
|
30
|
+
* labelField?: string
|
|
31
|
+
* }
|
|
32
|
+
* userPicker: {
|
|
33
|
+
* multiple?: boolean
|
|
34
|
+
* departmentId?: string
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
interface PropsMap extends FrameComponentPropsMap {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export type SchemaFormFrameSelectProps = SelectProps & {
|
|
43
|
+
requestUrl?: string;
|
|
44
|
+
valueField?: string;
|
|
45
|
+
labelField?: string;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=scalability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -26,6 +26,6 @@ export type ProjectInfo = {
|
|
|
26
26
|
key: string;
|
|
27
27
|
modelKey: string;
|
|
28
28
|
};
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const getProjectData: (key: string) => Promise<ProjectInfo | null>;
|
|
30
30
|
export {};
|
|
31
31
|
//# sourceMappingURL=baseInfo.d.ts.map
|
|
@@ -31,7 +31,7 @@ export const serializationUrl = (url, data) => `${url}?${new URLSearchParams(dat
|
|
|
31
31
|
const generateMenuItem = (item) => {
|
|
32
32
|
let data = undefined;
|
|
33
33
|
if (item.menuType === "module") {
|
|
34
|
-
const pk = modeStore.getState().
|
|
34
|
+
const pk = modeStore.getState().projectInfo?.key;
|
|
35
35
|
const query = {
|
|
36
36
|
[QK.pk]: pk,
|
|
37
37
|
};
|
|
@@ -42,6 +42,6 @@ interface SchemaStoreActions {
|
|
|
42
42
|
}) => void;
|
|
43
43
|
}
|
|
44
44
|
export declare const schemaStore: import("zustand").StoreApi<SchemaStoreState & SchemaStoreActions>;
|
|
45
|
-
export declare const useSchemaStore: import("../../../../../packages/ui/react
|
|
45
|
+
export declare const useSchemaStore: import("../../../../../packages/ui/react").StoreHook<import("zustand").StoreApi<SchemaStoreState & SchemaStoreActions>>;
|
|
46
46
|
export {};
|
|
47
47
|
//# sourceMappingURL=schemaStore.d.ts.map
|
|
@@ -5,7 +5,7 @@ import { leftSidebarBasePath } from "../../widgets/common/menu";
|
|
|
5
5
|
import { useModeStore } from "../../widgets/store/mode";
|
|
6
6
|
import { generateMenuItemData } from "../../widgets/common/generateMenuData";
|
|
7
7
|
const SidebarSlotPageTmp = () => {
|
|
8
|
-
const projInfo = useModeStore((s) => s.
|
|
8
|
+
const projInfo = useModeStore((s) => s.projectInfo);
|
|
9
9
|
const [menuItems, rawMenuData] = useMemo(() => {
|
|
10
10
|
if (projInfo) {
|
|
11
11
|
return [generateMenuItemData(projInfo.menu), projInfo.menu];
|
|
@@ -12,17 +12,17 @@ import { useParams } from "react-router-dom";
|
|
|
12
12
|
*/
|
|
13
13
|
const useCurrentMenuData = (useSibe = false) => {
|
|
14
14
|
const params = useParams();
|
|
15
|
-
const
|
|
15
|
+
const projectInfo = useModeStore((s) => s.projectInfo);
|
|
16
16
|
const menu = useMemo(() => {
|
|
17
17
|
const isSide = params[QK.sk];
|
|
18
18
|
const menuTypeIsTop = !!params[QK.k];
|
|
19
|
-
const menu = findMenuItem(
|
|
19
|
+
const menu = findMenuItem(projectInfo?.menu, menuTypeIsTop ? params[QK.k] : params[QK.sk]);
|
|
20
20
|
if (isSide && useSibe && menuTypeIsTop) {
|
|
21
21
|
const sMenu = findMenuItem(menu.sidebarConfig?.menu ?? [], params[QK.sk]);
|
|
22
22
|
return sMenu;
|
|
23
23
|
}
|
|
24
24
|
return menu;
|
|
25
|
-
}, [
|
|
25
|
+
}, [projectInfo?.menu, params]);
|
|
26
26
|
return { menu: menu };
|
|
27
27
|
};
|
|
28
28
|
export default useCurrentMenuData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ModelInfo, type ProjectInfo } from '../../widgets/api/baseInfo';
|
|
2
2
|
interface ModeState {
|
|
3
3
|
modeList: ModelInfo[];
|
|
4
|
-
|
|
4
|
+
projectInfo: ProjectInfo | null;
|
|
5
5
|
/**
|
|
6
6
|
* 是否初始化过
|
|
7
7
|
*/
|
|
@@ -9,11 +9,11 @@ interface ModeState {
|
|
|
9
9
|
}
|
|
10
10
|
interface ModeAction {
|
|
11
11
|
setModeList: (data: ModeState['modeList']) => void;
|
|
12
|
-
|
|
12
|
+
setProjectInfo: (data: ModeState['projectInfo']) => void;
|
|
13
13
|
initModeData: () => void;
|
|
14
14
|
}
|
|
15
15
|
type IStore = ModeState & ModeAction;
|
|
16
16
|
export declare const modeStore: import("zustand").StoreApi<IStore>;
|
|
17
|
-
export declare const useModeStore: import("../../../packages/ui/react
|
|
17
|
+
export declare const useModeStore: import("../../../packages/ui/react").StoreHook<import("zustand").StoreApi<IStore>>;
|
|
18
18
|
export {};
|
|
19
19
|
//# sourceMappingURL=mode.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getModelList,
|
|
1
|
+
import { getModelList, getProjectData } from '../../widgets/api/baseInfo';
|
|
2
2
|
import { deserializationUrlSearch } from '../../widgets/common/menu';
|
|
3
3
|
import { createStoreHook } from '../../../packages/ui/react/lib/createStoreHook';
|
|
4
4
|
import { createStore } from 'zustand';
|
|
@@ -6,30 +6,30 @@ import { setApiAuth } from '../common/auth';
|
|
|
6
6
|
// create Store 可在任意地方使用
|
|
7
7
|
export const modeStore = createStore((set, get) => ({
|
|
8
8
|
modeList: [],
|
|
9
|
-
|
|
9
|
+
projectInfo: null,
|
|
10
10
|
initData: false,
|
|
11
11
|
setModeList(modeList) {
|
|
12
12
|
set({ modeList });
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
set({
|
|
14
|
+
setProjectInfo(projectInfo) {
|
|
15
|
+
set({ projectInfo });
|
|
16
16
|
},
|
|
17
17
|
async initModeData() {
|
|
18
18
|
const fetchModeData = async () => {
|
|
19
19
|
const data = await getModelList();
|
|
20
20
|
return data;
|
|
21
21
|
};
|
|
22
|
-
const
|
|
22
|
+
const fetchProjectData = async () => {
|
|
23
23
|
const urls = deserializationUrlSearch(window.location.search);
|
|
24
24
|
const key = urls['projk'];
|
|
25
25
|
setApiAuth(key);
|
|
26
|
-
const data = await
|
|
26
|
+
const data = await getProjectData(key);
|
|
27
27
|
return data;
|
|
28
28
|
};
|
|
29
|
-
const [modeList,
|
|
29
|
+
const [modeList, projectInfo] = await Promise.all([fetchModeData(), fetchProjectData()]);
|
|
30
30
|
set({
|
|
31
31
|
modeList,
|
|
32
|
-
|
|
32
|
+
projectInfo,
|
|
33
33
|
initData: true,
|
|
34
34
|
});
|
|
35
35
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SchemaFormAllPropsMap, FormFieldType } from '../../../packages/ui/react';
|
|
2
2
|
export type SearchOption = {
|
|
3
|
-
[K in
|
|
3
|
+
[K in FormFieldType]: {
|
|
4
4
|
comType: K;
|
|
5
|
-
} &
|
|
6
|
-
}[
|
|
5
|
+
} & (K extends keyof SchemaFormAllPropsMap ? SchemaFormAllPropsMap[K] : unknown);
|
|
6
|
+
}[FormFieldType];
|
|
7
7
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -25,20 +25,15 @@ export declare namespace SchemaFormNamespace {
|
|
|
25
25
|
export type ExtendedFieldType = Extract<keyof SchemaFormNamespace.FieldTypes | keyof SchemaFormNamespace.PropsMap, string>;
|
|
26
26
|
export type SchemaFormAllFieldType = SchemaFormFieldType | ExtendedFieldType;
|
|
27
27
|
export type SchemaFormAllPropsMap = SchemaFormComponentPropsMap & SchemaFormNamespace.PropsMap;
|
|
28
|
-
export type SchemaFormComponent = React.LazyExoticComponent<React.ComponentType<any>>;
|
|
28
|
+
export type SchemaFormComponent = React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>;
|
|
29
29
|
export declare const componentsMap: Record<SchemaFormAllFieldType, SchemaFormComponent>;
|
|
30
|
-
export type
|
|
30
|
+
export type SchemaFormComponentsMap = Partial<Record<ExtendedFieldType, SchemaFormComponent>>;
|
|
31
31
|
export type FieldProps = {
|
|
32
|
-
[K in
|
|
32
|
+
[K in SchemaFormAllFieldType]: {
|
|
33
33
|
type: K;
|
|
34
|
-
fieldProps?:
|
|
34
|
+
fieldProps?: K extends keyof SchemaFormAllPropsMap ? SchemaFormAllPropsMap[K] : unknown;
|
|
35
35
|
};
|
|
36
|
-
}[
|
|
37
|
-
[K in ExtendedFieldType]: {
|
|
38
|
-
type: K;
|
|
39
|
-
fieldProps?: K extends keyof SchemaFormNamespace.PropsMap ? SchemaFormNamespace.PropsMap[K] : unknown;
|
|
40
|
-
};
|
|
41
|
-
}[ExtendedFieldType] | {
|
|
36
|
+
}[SchemaFormAllFieldType] | {
|
|
42
37
|
type?: 'input';
|
|
43
38
|
fieldProps?: InputProps;
|
|
44
39
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import consumerComponentsMap from '@tc/scalability/SchemaForm/data';
|
|
2
|
+
import frameComponentsMap from '@tc/scalability/SchemaForm/frameData';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
const baseComponentsMap = {
|
|
4
5
|
input: React.lazy(async () => ({ default: (await import('../../Input')).Input })),
|
|
@@ -12,5 +13,6 @@ const baseComponentsMap = {
|
|
|
12
13
|
// componentsMap 合并内置 + 业务层扩展,支持动态注册新字段类型
|
|
13
14
|
export const componentsMap = {
|
|
14
15
|
...baseComponentsMap,
|
|
15
|
-
...
|
|
16
|
+
...frameComponentsMap,
|
|
17
|
+
...consumerComponentsMap,
|
|
16
18
|
};
|
|
@@ -6,7 +6,7 @@ import { type FormProps } from '..';
|
|
|
6
6
|
import { type ButtonElementProps } from '../../Button';
|
|
7
7
|
import type { LabelLayout } from '../../Label';
|
|
8
8
|
import { type FieldProps, type SchemaFormAllFieldType } from './data';
|
|
9
|
-
export type { FieldProps,
|
|
9
|
+
export type { FieldProps, SchemaFormAllFieldType, SchemaFormAllPropsMap, SchemaFormComponent, SchemaFormComponentsMap, SchemaFormComponentPropsMap, SchemaFormFieldType, SchemaFormNamespace, } from './data';
|
|
10
10
|
export type FormFieldType = SchemaFormAllFieldType;
|
|
11
11
|
type BaseField<T> = {
|
|
12
12
|
[K in keyof T]: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useLanguage(): import("
|
|
1
|
+
export declare function useLanguage(): import("..").I18nStore;
|
|
2
2
|
//# sourceMappingURL=useLanguage.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { I18nInterpolationValues, I18nTranslateOptions } from '../../../common/i18n';
|
|
2
2
|
export declare const useI18nStore: import("..").StoreHook<{
|
|
3
|
-
getState: () => import("
|
|
4
|
-
getInitialState: () => import("
|
|
5
|
-
setState: (partial: Partial<import("
|
|
6
|
-
subscribe: (listener: import("
|
|
3
|
+
getState: () => import("..").I18nStore;
|
|
4
|
+
getInitialState: () => import("..").I18nStore;
|
|
5
|
+
setState: (partial: Partial<import("..").I18nStore> | ((state: import("..").I18nStore) => Partial<import("..").I18nStore>)) => void;
|
|
6
|
+
subscribe: (listener: import("..").I18nStoreListener) => () => void;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* React 组件内使用的翻译 hook。
|
package/fe/typings/type.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type MOmit<T, K extends keyof T> = Omit<T, K>;
|
|
2
|
-
export type UnionToTuple<T> = [
|
|
3
|
-
|
|
4
|
-
] extends [never] ? [] : ((t: T) => T) extends ((t: infer U) => infer U) ? [...UnionToTuple<Exclude<T, U>>, U] : never;
|
|
2
|
+
export type UnionToTuple<T> = [T] extends [never] ? [] : ((t: T) => T) extends (t: infer U) => infer U ? [...UnionToTuple<Exclude<T, U>>, U] : never;
|
|
3
|
+
export type MergeType<T extends unknown[]> = T extends [infer F, ...infer R] ? F & (R extends [] ? MergeType<R> : {}) : {};
|
|
5
4
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SchemaFormAllPropsMap, FormFieldType } from '../../../fe/packages/ui/react';
|
|
2
2
|
export type SearchOption = {
|
|
3
|
-
[K in
|
|
3
|
+
[K in FormFieldType]: {
|
|
4
4
|
comType: K;
|
|
5
|
-
} &
|
|
6
|
-
}[
|
|
5
|
+
} & (K extends keyof SchemaFormAllPropsMap ? SchemaFormAllPropsMap[K] : unknown);
|
|
6
|
+
}[FormFieldType];
|
|
7
7
|
//# sourceMappingURL=search.d.ts.map
|
package/package.json
CHANGED
package/types/typings/type.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export type MOmit<T, K extends keyof T> = Omit<T, K>;
|
|
2
|
-
export type UnionToTuple<T> = [
|
|
3
|
-
|
|
4
|
-
] extends [never] ? [] : ((t: T) => T) extends ((t: infer U) => infer U) ? [...UnionToTuple<Exclude<T, U>>, U] : never;
|
|
2
|
+
export type UnionToTuple<T> = [T] extends [never] ? [] : ((t: T) => T) extends (t: infer U) => infer U ? [...UnionToTuple<Exclude<T, U>>, U] : never;
|
|
3
|
+
export type MergeType<T extends unknown[]> = T extends [infer F, ...infer R] ? F & (R extends [] ? MergeType<R> : {}) : {};
|
|
File without changes
|
|
File without changes
|