Merge pull request #7259 from hsm-lv/feat-dataschema

feat:dataschema增加typeLabel
This commit is contained in:
hsm-lv 2023-06-26 14:06:14 +08:00 committed by GitHub
commit 597a257c98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -382,6 +382,7 @@ export type FunctionPropertyNames<T> = {
export type JSONSchema = JSONSchema7 & {
group?: string; // 分组
typeLabel?: string; // 类型说明
};
// export type Omit<T, K extends keyof T & any> = Pick<T, Exclude<keyof T, K>>;

View File

@ -1,6 +1,15 @@
import {JSONSchema} from '../types';
import {guid, keyToPath, mapTree} from './helper';
const TYPE_MAP: {[type: string]: string} = {
boolean: '布尔',
integer: '整数',
number: '数字',
string: '文本',
array: '数组',
object: '对象'
};
export class DataScope {
// 指向父级
parent?: DataScope;
@ -213,7 +222,7 @@ export class DataScope {
value: schema.title === '成员' ? '' : path.value,
path: schema.title === '成员' ? '' : path.label,
type: schema.type,
tag: schema.type,
tag: schema.typeLabel ?? TYPE_MAP[schema.type as string] ?? schema.type,
description: schema.description,
isMember,
disabled: schema.title === '成员'