@hi-ui/schema-fields 4.0.0-experimental.1
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/README.md +11 -0
- package/lib/cjs/base.js +125 -0
- package/lib/cjs/components/image-preview/index.js +63 -0
- package/lib/cjs/components/span/index.js +33 -0
- package/lib/cjs/components/upload-bridge/index.js +227 -0
- package/lib/cjs/components/upload-bridge/utils.js +73 -0
- package/lib/cjs/ctx.js +70 -0
- package/lib/cjs/editable/ctx.js +45 -0
- package/lib/cjs/editable/editable.js +141 -0
- package/lib/cjs/editable/index.js +62 -0
- package/lib/cjs/editable/readonly.js +36 -0
- package/lib/cjs/editable/simple.js +61 -0
- package/lib/cjs/editable/use-readonly.js +200 -0
- package/lib/cjs/extensible/selectable/index.js +114 -0
- package/lib/cjs/extensible/selectable/match-cascader.js +184 -0
- package/lib/cjs/fields/basic/cascader/index.js +98 -0
- package/lib/cjs/fields/basic/check-cascader/index.js +58 -0
- package/lib/cjs/fields/basic/check-select/index.js +89 -0
- package/lib/cjs/fields/basic/check-tree-select/index.js +61 -0
- package/lib/cjs/fields/basic/checkbox/index.js +84 -0
- package/lib/cjs/fields/basic/counter/index.js +40 -0
- package/lib/cjs/fields/basic/radio/index.js +44 -0
- package/lib/cjs/fields/basic/rating/index.js +40 -0
- package/lib/cjs/fields/basic/select/index.js +98 -0
- package/lib/cjs/fields/basic/slider/index.js +40 -0
- package/lib/cjs/fields/basic/switch/index.js +47 -0
- package/lib/cjs/fields/basic/textarea/index.js +40 -0
- package/lib/cjs/fields/basic/time-picker/index.js +45 -0
- package/lib/cjs/fields/basic/time-picker/index.scss.js +18 -0
- package/lib/cjs/fields/basic/tree-select/index.js +61 -0
- package/lib/cjs/fields/basic/upload/custom.js +29 -0
- package/lib/cjs/fields/basic/upload/index.js +48 -0
- package/lib/cjs/fields/enhance/number-range/index.js +39 -0
- package/lib/cjs/fields/semantic/date/index.js +82 -0
- package/lib/cjs/fields/semantic/image/index.js +65 -0
- package/lib/cjs/fields/semantic/image/upload.js +32 -0
- package/lib/cjs/fields/semantic/link/index.js +96 -0
- package/lib/cjs/fields/semantic/number/index.js +106 -0
- package/lib/cjs/fields/semantic/tag/index.js +164 -0
- package/lib/cjs/fields/semantic/tag/index.scss.js +18 -0
- package/lib/cjs/fields/semantic/text/index.js +61 -0
- package/lib/cjs/index.js +145 -0
- package/lib/cjs/utils/batch-dep-update.js +40 -0
- package/lib/cjs/utils/form-binding.js +40 -0
- package/lib/cjs/utils/label.js +34 -0
- package/lib/cjs/utils.js +35 -0
- package/lib/esm/base.js +111 -0
- package/lib/esm/components/image-preview/index.js +49 -0
- package/lib/esm/components/span/index.js +20 -0
- package/lib/esm/components/upload-bridge/index.js +214 -0
- package/lib/esm/components/upload-bridge/utils.js +66 -0
- package/lib/esm/ctx.js +55 -0
- package/lib/esm/editable/ctx.js +32 -0
- package/lib/esm/editable/editable.js +129 -0
- package/lib/esm/editable/index.js +44 -0
- package/lib/esm/editable/readonly.js +24 -0
- package/lib/esm/editable/simple.js +49 -0
- package/lib/esm/editable/use-readonly.js +193 -0
- package/lib/esm/extensible/selectable/index.js +101 -0
- package/lib/esm/extensible/selectable/match-cascader.js +179 -0
- package/lib/esm/fields/basic/cascader/index.js +83 -0
- package/lib/esm/fields/basic/check-cascader/index.js +44 -0
- package/lib/esm/fields/basic/check-select/index.js +75 -0
- package/lib/esm/fields/basic/check-tree-select/index.js +47 -0
- package/lib/esm/fields/basic/checkbox/index.js +70 -0
- package/lib/esm/fields/basic/counter/index.js +26 -0
- package/lib/esm/fields/basic/radio/index.js +30 -0
- package/lib/esm/fields/basic/rating/index.js +26 -0
- package/lib/esm/fields/basic/select/index.js +83 -0
- package/lib/esm/fields/basic/slider/index.js +26 -0
- package/lib/esm/fields/basic/switch/index.js +33 -0
- package/lib/esm/fields/basic/textarea/index.js +26 -0
- package/lib/esm/fields/basic/time-picker/index.js +31 -0
- package/lib/esm/fields/basic/time-picker/index.scss.js +13 -0
- package/lib/esm/fields/basic/tree-select/index.js +47 -0
- package/lib/esm/fields/basic/upload/custom.js +16 -0
- package/lib/esm/fields/basic/upload/index.js +34 -0
- package/lib/esm/fields/enhance/number-range/index.js +26 -0
- package/lib/esm/fields/semantic/date/index.js +67 -0
- package/lib/esm/fields/semantic/image/index.js +51 -0
- package/lib/esm/fields/semantic/image/upload.js +20 -0
- package/lib/esm/fields/semantic/link/index.js +82 -0
- package/lib/esm/fields/semantic/number/index.js +91 -0
- package/lib/esm/fields/semantic/tag/index.js +149 -0
- package/lib/esm/fields/semantic/tag/index.scss.js +13 -0
- package/lib/esm/fields/semantic/text/index.js +47 -0
- package/lib/esm/index.js +85 -0
- package/lib/esm/utils/batch-dep-update.js +35 -0
- package/lib/esm/utils/form-binding.js +34 -0
- package/lib/esm/utils/label.js +21 -0
- package/lib/esm/utils.js +27 -0
- package/lib/types/base.d.ts +44 -0
- package/lib/types/components/async-refill-placeholder/index.d.ts +7 -0
- package/lib/types/components/image-preview/index.d.ts +5 -0
- package/lib/types/components/span/index.d.ts +8 -0
- package/lib/types/components/upload-bridge/index.d.ts +5 -0
- package/lib/types/components/upload-bridge/type.d.ts +26 -0
- package/lib/types/components/upload-bridge/utils.d.ts +11 -0
- package/lib/types/ctx.d.ts +21 -0
- package/lib/types/editable/ctx.d.ts +5 -0
- package/lib/types/editable/editable.d.ts +18 -0
- package/lib/types/editable/index.d.ts +14 -0
- package/lib/types/editable/readonly.d.ts +8 -0
- package/lib/types/editable/simple.d.ts +8 -0
- package/lib/types/editable/type.d.ts +9 -0
- package/lib/types/editable/use-readonly.d.ts +26 -0
- package/lib/types/extensible/selectable/index.d.ts +31 -0
- package/lib/types/extensible/selectable/match-cascader.d.ts +19 -0
- package/lib/types/extensible/selectable/type.d.ts +16 -0
- package/lib/types/fields/basic/cascader/index.d.ts +10 -0
- package/lib/types/fields/basic/check-cascader/index.d.ts +11 -0
- package/lib/types/fields/basic/check-select/index.d.ts +34 -0
- package/lib/types/fields/basic/check-tree-select/index.d.ts +10 -0
- package/lib/types/fields/basic/checkbox/index.d.ts +19 -0
- package/lib/types/fields/basic/counter/index.d.ts +7 -0
- package/lib/types/fields/basic/radio/index.d.ts +7 -0
- package/lib/types/fields/basic/rating/index.d.ts +7 -0
- package/lib/types/fields/basic/select/index.d.ts +12 -0
- package/lib/types/fields/basic/slider/index.d.ts +7 -0
- package/lib/types/fields/basic/switch/index.d.ts +7 -0
- package/lib/types/fields/basic/textarea/index.d.ts +7 -0
- package/lib/types/fields/basic/time-picker/index.d.ts +8 -0
- package/lib/types/fields/basic/tree-select/index.d.ts +11 -0
- package/lib/types/fields/basic/upload/custom.d.ts +3 -0
- package/lib/types/fields/basic/upload/index.d.ts +8 -0
- package/lib/types/fields/enhance/number-range/index.d.ts +7 -0
- package/lib/types/fields/semantic/date/index.d.ts +15 -0
- package/lib/types/fields/semantic/image/index.d.ts +11 -0
- package/lib/types/fields/semantic/image/upload.d.ts +3 -0
- package/lib/types/fields/semantic/link/index.d.ts +31 -0
- package/lib/types/fields/semantic/number/index.d.ts +21 -0
- package/lib/types/fields/semantic/tag/index.d.ts +78 -0
- package/lib/types/fields/semantic/text/index.d.ts +13 -0
- package/lib/types/index.d.ts +108 -0
- package/lib/types/utils/batch-dep-update.d.ts +13 -0
- package/lib/types/utils/form-binding.d.ts +11 -0
- package/lib/types/utils/label.d.ts +11 -0
- package/lib/types/utils.d.ts +15 -0
- package/package.json +98 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProField } from '../../base';
|
|
3
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx } from '../../base';
|
|
4
|
+
import type { NormalFieldCtxType } from '../../utils';
|
|
5
|
+
import type { RefillPlaceholderProps } from './type';
|
|
6
|
+
export type * from './type';
|
|
7
|
+
export type ProSelectableFieldProps = {};
|
|
8
|
+
export declare class ProSelectableField extends ProField {
|
|
9
|
+
suffixEl: JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* 过滤掉原始参数中的自引用属性
|
|
12
|
+
* - 防止 immer 在处理数据时出现崩溃
|
|
13
|
+
* - 主要用在级联及树形选择组件中
|
|
14
|
+
*/
|
|
15
|
+
hookedSetSelectedRawOption(ctx: NormalFieldCtxType<AnyObject>, args: AnyArray): void;
|
|
16
|
+
protected getOptionTitle(ctx: ProFieldRenderCtx<AnyType> | ProFieldRenderEditableCtx<AnyType>, dataKey?: string): string | string[] | undefined;
|
|
17
|
+
getDftPlaceholder(ctx: NormalFieldCtxType<AnyObject>): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* 渲染字符串类型的已选结果
|
|
20
|
+
* - 用在单选、单选级联
|
|
21
|
+
*/
|
|
22
|
+
renderEditableForStringSelected(data: unknown, ctx: ProFieldRenderEditableCtx<AnyType>): JSX.Element | null;
|
|
23
|
+
/**
|
|
24
|
+
* 渲染字符串类型的首次回显元素
|
|
25
|
+
* - 用在单选、单选级联
|
|
26
|
+
*/
|
|
27
|
+
renderEditableForStringFirstRefill(data: unknown, ctx: ProFieldRenderEditableCtx<AnyType>, extra: {
|
|
28
|
+
dftRender: ProField['renderEditable'];
|
|
29
|
+
RefillComponent: (props: RefillPlaceholderProps) => React.ReactElement;
|
|
30
|
+
}): JSX.Element | null;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type MatchedCascaderOptsType = {
|
|
2
|
+
id: string | number;
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* 在嵌套选项数据中匹配多个路径
|
|
7
|
+
* @param values 二维数组,包含多个级联路径,例如 [['hubei', 'wuhan'], ['guangdong', 'shenzhen']]
|
|
8
|
+
* @param options 嵌套选项数据,包含 children 的树形结构
|
|
9
|
+
* @param extra 配置选项
|
|
10
|
+
* @returns 二维数组,保持输入的结构,每个路径对应一个匹配的选项链数组
|
|
11
|
+
*
|
|
12
|
+
* 边界条件处理:
|
|
13
|
+
* - 部分匹配:如果路径中某一层找不到,返回已匹配的部分(而不是空数组)
|
|
14
|
+
* - 缺失title:如果选项的title字段不存在,自动使用id字段作为默认值
|
|
15
|
+
* - 完全不匹配:如果第一层就找不到,返回空数组
|
|
16
|
+
*/
|
|
17
|
+
export declare function matchCascaderOpts(values: (string | number)[][], options: AnyArray, extra?: {
|
|
18
|
+
fieldNames?: Record<string, string>;
|
|
19
|
+
}): MatchedCascaderOptsType[][];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProField, ProFieldRenderEditableCtx } from '../../base';
|
|
2
|
+
import type { ProSelectableField } from './index';
|
|
3
|
+
export type RefillPlaceholderProps = {
|
|
4
|
+
/** 字段的值 */
|
|
5
|
+
value: unknown;
|
|
6
|
+
/** 选项数据 */
|
|
7
|
+
data: AnyArray;
|
|
8
|
+
/** 默认渲染函数 */
|
|
9
|
+
dftRender?: ProField['renderEditable'];
|
|
10
|
+
/** 字段名映射 */
|
|
11
|
+
fieldNames?: Record<string, string>;
|
|
12
|
+
/** 渲染上下文 */
|
|
13
|
+
ctx: ProFieldRenderEditableCtx<AnyObject>;
|
|
14
|
+
/** 字段的渲染实例 */
|
|
15
|
+
instance: ProSelectableField;
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CascaderProps } from '@hi-ui/cascader';
|
|
2
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
3
|
+
import { ProSelectableField, type RefillPlaceholderProps } from '../../../extensible/selectable';
|
|
4
|
+
import type { ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
5
|
+
export type ProCascaderProps = WithAsyncOptsDataProps<CascaderProps & {}>;
|
|
6
|
+
export declare class ProCascader extends ProSelectableField {
|
|
7
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCascaderProps>): JSX.Element;
|
|
8
|
+
renderEditable(data: string, ctx: ProFieldRenderEditableCtx<ProCascaderProps>): JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare function CascaderRefillPlaceholder(props: RefillPlaceholderProps): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CheckCascaderProps as HiUICheckCascaderProps } from '@hi-ui/check-cascader';
|
|
2
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
3
|
+
import { ProSelectableField } from '../../../extensible/selectable';
|
|
4
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
5
|
+
type CheckCascaderProps = Omit<HiUICheckCascaderProps, 'data'> & Pick<Partial<HiUICheckCascaderProps>, 'data'>;
|
|
6
|
+
export type ProCheckCascaderProps = WithAsyncOptsDataProps<CheckCascaderProps & {}>;
|
|
7
|
+
export declare class ProCheckCascader extends ProSelectableField {
|
|
8
|
+
dftFieldProps: ProCheckCascaderProps;
|
|
9
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckCascaderProps>): JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type CheckSelectProps } from '@hi-ui/check-select';
|
|
2
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
3
|
+
import { ProSelectableField } from '../../../extensible/selectable';
|
|
4
|
+
import { type ProTagProps } from '../../semantic/tag';
|
|
5
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
6
|
+
import type { NormalFieldCtxType } from '../../../utils';
|
|
7
|
+
export type ProCheckSelectProps = WithAsyncOptsDataProps<CheckSelectProps & {
|
|
8
|
+
/**
|
|
9
|
+
* 是否显示边框
|
|
10
|
+
* - 只读模式渲染为标签
|
|
11
|
+
*/
|
|
12
|
+
bordered?: ProTagProps['bordered'];
|
|
13
|
+
/**
|
|
14
|
+
* 标签颜色预设
|
|
15
|
+
* - 只读模式渲染为标签
|
|
16
|
+
*/
|
|
17
|
+
colorPreset?: ProTagProps['colorPreset'];
|
|
18
|
+
/**
|
|
19
|
+
* 标签属性
|
|
20
|
+
* - 只读模式渲染为标签
|
|
21
|
+
*/
|
|
22
|
+
tagProps?: ProTagProps;
|
|
23
|
+
}>;
|
|
24
|
+
export declare class ProCheckSelect extends ProSelectableField {
|
|
25
|
+
private tagRef;
|
|
26
|
+
render(data: string[], ctx: ProFieldRenderCtx<ProCheckSelectProps>): JSX.Element;
|
|
27
|
+
getSelfFieldProps(ctx: NormalFieldCtxType<ProCheckSelectProps>): {
|
|
28
|
+
fieldProps: ProCheckSelectProps;
|
|
29
|
+
tagProps: ProTagProps;
|
|
30
|
+
};
|
|
31
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckSelectProps>): JSX.Element;
|
|
32
|
+
getDftPlaceholder(ctx: NormalFieldCtxType<ProCheckSelectProps>): string | undefined;
|
|
33
|
+
renderEditable(data: string[], ctx: ProFieldRenderEditableCtx<ProCheckSelectProps>): JSX.Element;
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CheckTreeSelectProps } from '@hi-ui/check-tree-select';
|
|
2
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
3
|
+
import { ProSelectableField } from '../../../extensible/selectable';
|
|
4
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
5
|
+
export type ProCheckTreeSelectProps = WithAsyncOptsDataProps<CheckTreeSelectProps & {}>;
|
|
6
|
+
export declare class ProCheckTreeSelect extends ProSelectableField {
|
|
7
|
+
render(data: string[], ctx: ProFieldRenderCtx<ProCheckTreeSelectProps>): JSX.Element;
|
|
8
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckTreeSelectProps>): JSX.Element;
|
|
9
|
+
renderEditable(data: string[], ctx: ProFieldRenderEditableCtx<ProCheckTreeSelectProps>): JSX.Element;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CheckboxGroupProps } from '@hi-ui/checkbox';
|
|
2
|
+
import { type BasicGridOptsType } from '@hi-ui/schema-auto-grid';
|
|
3
|
+
import { type BoolConfig } from '@hi-ui/schema-utils';
|
|
4
|
+
import { ProField } from '../../../base';
|
|
5
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
6
|
+
export type ProCheckboxProps = CheckboxGroupProps & {
|
|
7
|
+
/** 网格配置 */
|
|
8
|
+
grid?: BoolConfig<BasicGridOptsType>;
|
|
9
|
+
};
|
|
10
|
+
export declare class ProCheckbox extends ProField {
|
|
11
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckboxProps>): JSX.Element;
|
|
12
|
+
renderNormalFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckboxProps>, extra: {
|
|
13
|
+
fieldProps: Omit<ProCheckboxProps, 'grid'>;
|
|
14
|
+
}): JSX.Element;
|
|
15
|
+
renderGridFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCheckboxProps>, extra: {
|
|
16
|
+
fieldProps: Omit<ProCheckboxProps, 'grid'>;
|
|
17
|
+
gridProps: ProCheckboxProps['grid'];
|
|
18
|
+
}): JSX.Element;
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CounterProps } from '@hi-ui/counter';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProCounterProps = CounterProps & {};
|
|
5
|
+
export declare class ProCounter extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProCounterProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RadioGroupProps } from '@hi-ui/radio';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProRadioProps = RadioGroupProps & {};
|
|
5
|
+
export declare class ProRadio extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProRadioProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RatingProps } from '@hi-ui/rating';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProRatingProps = RatingProps & {};
|
|
5
|
+
export declare class ProRating extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProRatingProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SelectProps } from '@hi-ui/select';
|
|
3
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
4
|
+
import { ProSelectableField, type RefillPlaceholderProps } from '../../../extensible/selectable';
|
|
5
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
6
|
+
export type ProSelectProps = WithAsyncOptsDataProps<SelectProps & {}>;
|
|
7
|
+
export declare class ProSelect extends ProSelectableField {
|
|
8
|
+
render(data: unknown, ctx: ProFieldRenderCtx<ProSelectProps>): React.ReactElement;
|
|
9
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProSelectProps>): JSX.Element;
|
|
10
|
+
renderEditable(data: string, ctx: ProFieldRenderEditableCtx<ProSelectProps>): JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export declare function SelectRefillPlaceholder(props: RefillPlaceholderProps): JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SliderProps } from '@hi-ui/slider';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProSliderProps = SliderProps & {};
|
|
5
|
+
export declare class ProSlider extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProSliderProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SwitchProps } from '@hi-ui/switch';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProSwitchProps = SwitchProps & {};
|
|
5
|
+
export declare class ProSwitch extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProSwitchProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TextAreaProps } from '@hi-ui/textarea';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProTextAreaProps = TextAreaProps & {};
|
|
5
|
+
export declare class ProTextArea extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProTextAreaProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TimePickerProps } from '@hi-ui/time-picker';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
export type ProTimePickerProps = TimePickerProps & {};
|
|
6
|
+
export declare class ProTimePicker extends ProField {
|
|
7
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProTimePickerProps>): JSX.Element;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TreeSelectProps } from '@hi-ui/tree-select';
|
|
3
|
+
import type { WithAsyncOptsDataProps } from '@hi-ui/schema-option-injector';
|
|
4
|
+
import { ProSelectableField } from '../../../extensible/selectable';
|
|
5
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
6
|
+
export type ProTreeSelectProps = WithAsyncOptsDataProps<TreeSelectProps & {}>;
|
|
7
|
+
export declare class ProTreeSelect extends ProSelectableField {
|
|
8
|
+
render(data: unknown, ctx: ProFieldRenderCtx<ProTreeSelectProps>): React.ReactElement;
|
|
9
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProTreeSelectProps>): JSX.Element;
|
|
10
|
+
renderEditable(data: string, ctx: ProFieldRenderEditableCtx<ProTreeSelectProps>): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProField } from '../../../base';
|
|
2
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
3
|
+
import { CommonUpload, type CommonUploadProps } from './custom';
|
|
4
|
+
export { CommonUpload, CommonUploadProps };
|
|
5
|
+
export type ProUploadProps = CommonUploadProps & {};
|
|
6
|
+
export declare class ProUpload extends ProField {
|
|
7
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProUploadProps>): JSX.Element;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NumberRangeProps } from '@hi-ui/number-range';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
export type ProNumberRangeProps = NumberRangeProps & {};
|
|
5
|
+
export declare class ProNumberRange extends ProField {
|
|
6
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProNumberRangeProps>): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { type DatePickerProps } from '@hi-ui/date-picker';
|
|
3
|
+
import { ProField } from '../../../base';
|
|
4
|
+
import type { ProFieldRenderFormItemCtx, ProFieldRenderCtx, ProFieldRenderEditableCtx } from '../../../base';
|
|
5
|
+
export type ProDateProps = Omit<DatePickerProps, 'format'> & {
|
|
6
|
+
format?: string | ((date: Dayjs) => string);
|
|
7
|
+
};
|
|
8
|
+
export declare class ProDate extends ProField {
|
|
9
|
+
dftFieldProps: ProDateProps;
|
|
10
|
+
render(data: string, ctx: ProFieldRenderCtx<ProDateProps>): JSX.Element;
|
|
11
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProDateProps>): JSX.Element;
|
|
12
|
+
protected getFormattedText(date: Dayjs, fieldProps: ProDateProps): string;
|
|
13
|
+
protected getEditablePlaceholder(data: string | number | Date, ctx: ProFieldRenderEditableCtx<ProDateProps>): string;
|
|
14
|
+
renderEditable(data: string, ctx: ProFieldRenderEditableCtx<ProDateProps>): JSX.Element;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ProField } from '../../../base';
|
|
2
|
+
import type { ProFieldRenderCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
3
|
+
import { ImageUpload, type ImageUploadProps } from './upload';
|
|
4
|
+
export type ProImageProps = UnknownObject & {
|
|
5
|
+
customImages?: (data: string[], ctx: ProFieldRenderCtx<ProImageProps>) => string[];
|
|
6
|
+
};
|
|
7
|
+
export { ImageUpload, ImageUploadProps };
|
|
8
|
+
export declare class ProImage extends ProField {
|
|
9
|
+
render(data: unknown, ctx: ProFieldRenderCtx<ProImageProps>): JSX.Element;
|
|
10
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ImageUploadProps>): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProField } from '../../../base';
|
|
2
|
+
import type { ProFieldRenderCtx } from '../../../base';
|
|
3
|
+
export type ProLinkProps = UnknownObject & {
|
|
4
|
+
/** 是否使用href跳转,默认使用Link组件跳转 */
|
|
5
|
+
isHref?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 链接字段,优先级低于 customLink
|
|
8
|
+
* @desc 支持路径字符串,例如 user.avatar
|
|
9
|
+
*/
|
|
10
|
+
linkField?: string;
|
|
11
|
+
/** 自定义链接地址,优先级高于 linkField */
|
|
12
|
+
customLink?: (data: string, ctx: CustomLinkCtx) => string;
|
|
13
|
+
/** 额外传递给Link组件的state,模型会自动将rowData注入 */
|
|
14
|
+
extraLinkState?: AnyObject;
|
|
15
|
+
};
|
|
16
|
+
export type CustomLinkCtx = ProFieldRenderCtx<ProLinkProps>;
|
|
17
|
+
export declare class ProLink extends ProField {
|
|
18
|
+
renderCtx: ProFieldRenderCtx<ProLinkProps>;
|
|
19
|
+
fieldProps: ProLinkProps;
|
|
20
|
+
render(data: string, ctx: ProFieldRenderCtx<ProLinkProps>): JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* renderHref
|
|
23
|
+
* @desc 是指固定的链接地址,直接跳转出系统 */
|
|
24
|
+
renderHref(href: string): JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* renderLink
|
|
27
|
+
* @desc 是指链接地址是动态的,需要根据数据进行拼接
|
|
28
|
+
* @desc 通常用于链接到系统其他页面 */
|
|
29
|
+
renderLink(data: unknown): JSX.Element;
|
|
30
|
+
getGoTo(data: unknown): any;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type NumberInputProps } from '@hi-ui/number-input';
|
|
2
|
+
import { ProField } from '../../../base';
|
|
3
|
+
import type { ProFieldRenderCtx, ProFieldRenderEditableCtx, ProFieldRenderFormItemCtx } from '../../../base';
|
|
4
|
+
import type { NormalFieldCtxType } from '../../../utils';
|
|
5
|
+
export type ProNumberProps = NumberInputProps & {
|
|
6
|
+
/**
|
|
7
|
+
* 指定数字变化的精度
|
|
8
|
+
* @desc 可编辑模式时,指定数字变化的精度
|
|
9
|
+
* @desc 内部使用 HiUI 的 formatter 方法实现四舍五入精度处理
|
|
10
|
+
* @desc 如需更复杂的格式化逻辑精度处理,请结合 NumberUtil 自行实现 formatter 方法
|
|
11
|
+
*/
|
|
12
|
+
precision?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class ProNumber extends ProField {
|
|
15
|
+
protected _getFieldProps(ctx: NormalFieldCtxType<ProNumberProps>): ProNumberProps;
|
|
16
|
+
render(data: unknown, ctx: ProFieldRenderCtx<ProNumberProps>): JSX.Element;
|
|
17
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProNumberProps>): JSX.Element;
|
|
18
|
+
protected getEditablePlaceholder(data: unknown): number | null;
|
|
19
|
+
renderEditable(data: unknown, ctx: ProFieldRenderEditableCtx<ProNumberProps>): JSX.Element;
|
|
20
|
+
toFormatted(data: number, ctx: NormalFieldCtxType<ProNumberProps>): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TagProps } from '@hi-ui/tag';
|
|
3
|
+
import { ProField, type ProFieldRenderCtx } from '../../../base';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
type ColorPreset = {
|
|
6
|
+
back: TagProps['background'];
|
|
7
|
+
fore: TagProps['color'];
|
|
8
|
+
};
|
|
9
|
+
export declare const colorPreset: {
|
|
10
|
+
blue: {
|
|
11
|
+
back: string;
|
|
12
|
+
fore: string;
|
|
13
|
+
};
|
|
14
|
+
yellow: {
|
|
15
|
+
back: string;
|
|
16
|
+
fore: string;
|
|
17
|
+
};
|
|
18
|
+
green: {
|
|
19
|
+
back: string;
|
|
20
|
+
fore: string;
|
|
21
|
+
};
|
|
22
|
+
red: {
|
|
23
|
+
back: string;
|
|
24
|
+
fore: string;
|
|
25
|
+
};
|
|
26
|
+
orange: {
|
|
27
|
+
back: string;
|
|
28
|
+
fore: string;
|
|
29
|
+
};
|
|
30
|
+
purple: {
|
|
31
|
+
back: string;
|
|
32
|
+
fore: string;
|
|
33
|
+
};
|
|
34
|
+
/** 蓝绿色 */ cyan: {
|
|
35
|
+
back: string;
|
|
36
|
+
fore: string;
|
|
37
|
+
};
|
|
38
|
+
/** 天蓝色 */ skyblue: {
|
|
39
|
+
back: string;
|
|
40
|
+
fore: string;
|
|
41
|
+
};
|
|
42
|
+
/** 深紫色 */ darkPurple: {
|
|
43
|
+
back: string;
|
|
44
|
+
fore: string;
|
|
45
|
+
};
|
|
46
|
+
/** 蓝灰色 */ blueGray: {
|
|
47
|
+
back: string;
|
|
48
|
+
fore: string;
|
|
49
|
+
};
|
|
50
|
+
/** 中灰色 */ midGray: {
|
|
51
|
+
back: string;
|
|
52
|
+
fore: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type BuiltinColorEnum = Required<TagProps>['type'];
|
|
56
|
+
type SCMColorEnumPreset = keyof typeof colorPreset;
|
|
57
|
+
export declare const ColorEnumPreset: SCMColorEnumPreset[];
|
|
58
|
+
export type ProTagProps = TagProps & {
|
|
59
|
+
/** 是否显示边框 */
|
|
60
|
+
bordered?: boolean;
|
|
61
|
+
colorPreset: Record<string, LiteralUnion<BuiltinColorEnum | SCMColorEnumPreset> | ColorPreset>;
|
|
62
|
+
/** 文本映射
|
|
63
|
+
* - 例如:字段值为0/1,想要显示为 否/是
|
|
64
|
+
* - 可以配置为:textMap: { 0: '否', 1: '是' } 或 textMap: new Map([[0, '否'], [1, '是']])
|
|
65
|
+
* - Map 中 key 的类型可以是任意类型
|
|
66
|
+
* - Map 中 value 的类型需要是有效的 React 子元素类型,例如:string、number、React.ReactNode 等
|
|
67
|
+
*/
|
|
68
|
+
textMap?: Record<string, string | number | React.ReactNode> | Map<unknown, string | number | React.ReactNode>;
|
|
69
|
+
};
|
|
70
|
+
export declare class ProTag extends ProField {
|
|
71
|
+
render(data: string | string[], ctx: ProFieldRenderCtx<ProTagProps>): JSX.Element;
|
|
72
|
+
renderTag(dataArray: string[], ctx: ProFieldRenderCtx<ProTagProps>): JSX.Element;
|
|
73
|
+
getTagProps(props: ProTagProps): Omit<ProTagProps, "bordered" | "colorPreset">;
|
|
74
|
+
getType(preset: ValueOf<ProTagProps['colorPreset']>): "default" | "yellow" | "purple" | "skyblue" | "primary" | "success" | "warning" | "danger" | "ultramarine" | "rosered" | undefined;
|
|
75
|
+
getColor(preset: ValueOf<ProTagProps['colorPreset']>): ColorPreset | undefined;
|
|
76
|
+
getText(data: string, textMap: ProTagProps['textMap']): {};
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type InputProps } from '@hi-ui/input';
|
|
3
|
+
import { ProField } from '../../../base';
|
|
4
|
+
import type { ProFieldRenderFormItemCtx, ProFieldProps, ProFieldRenderCtx } from '../../../base';
|
|
5
|
+
export declare const DumbInput: (props: InputProps & React.RefAttributes<HTMLInputElement | null>) => React.ReactElement;
|
|
6
|
+
export type ProTextProps = ProFieldProps & InputProps & {
|
|
7
|
+
/** 使用 HiUI 原始 Input 组件 */
|
|
8
|
+
useRawInput?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare class ProText extends ProField {
|
|
11
|
+
render(data: string, ctx: ProFieldRenderCtx<ProTextProps>): JSX.Element;
|
|
12
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<ProTextProps>): JSX.Element;
|
|
13
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/// <reference types="@hi-ui/utility-types/global" />
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { FieldMapType } from './base';
|
|
5
|
+
import { ProCascader, type ProCascaderProps } from './fields/basic/cascader';
|
|
6
|
+
import { ProCheckCascader, type ProCheckCascaderProps } from './fields/basic/check-cascader';
|
|
7
|
+
import { ProCheckSelect, type ProCheckSelectProps } from './fields/basic/check-select';
|
|
8
|
+
import { ProCheckTreeSelect, type ProCheckTreeSelectProps } from './fields/basic/check-tree-select';
|
|
9
|
+
import { ProCheckbox, type ProCheckboxProps } from './fields/basic/checkbox';
|
|
10
|
+
import { ProCounter, type ProCounterProps } from './fields/basic/counter';
|
|
11
|
+
import { ProDate, type ProDateProps } from './fields/semantic/date';
|
|
12
|
+
import { ProImage, type ProImageProps } from './fields/semantic/image';
|
|
13
|
+
import { ProLink, type ProLinkProps } from './fields/semantic/link';
|
|
14
|
+
import { ProNumber, type ProNumberProps } from './fields/semantic/number';
|
|
15
|
+
import { ProRadio, type ProRadioProps } from './fields/basic/radio';
|
|
16
|
+
import { ProRating, type ProRatingProps } from './fields/basic/rating';
|
|
17
|
+
import { ProSelect, type ProSelectProps } from './fields/basic/select';
|
|
18
|
+
import { ProSlider, type ProSliderProps } from './fields/basic/slider';
|
|
19
|
+
import { ProSwitch, type ProSwitchProps } from './fields/basic/switch';
|
|
20
|
+
import { ProTag, type ProTagProps } from './fields/semantic/tag';
|
|
21
|
+
import { ProText, type ProTextProps } from './fields/semantic/text';
|
|
22
|
+
import { ProTextArea, type ProTextAreaProps } from './fields/basic/textarea';
|
|
23
|
+
import { ProTimePicker, type ProTimePickerProps } from './fields/basic/time-picker';
|
|
24
|
+
import { ProTreeSelect, type ProTreeSelectProps } from './fields/basic/tree-select';
|
|
25
|
+
import { ProUpload, type ProUploadProps } from './fields/basic/upload';
|
|
26
|
+
import { ProNumberRange, type ProNumberRangeProps } from './fields/enhance/number-range';
|
|
27
|
+
export { ProCascader, type ProCascaderProps } from './fields/basic/cascader';
|
|
28
|
+
export { ProCheckCascader, type ProCheckCascaderProps } from './fields/basic/check-cascader';
|
|
29
|
+
export { ProCheckSelect, type ProCheckSelectProps } from './fields/basic/check-select';
|
|
30
|
+
export { ProCheckTreeSelect, type ProCheckTreeSelectProps } from './fields/basic/check-tree-select';
|
|
31
|
+
export { ProCheckbox, type ProCheckboxProps } from './fields/basic/checkbox';
|
|
32
|
+
export { ProCounter, type ProCounterProps } from './fields/basic/counter';
|
|
33
|
+
export { ProDate, type ProDateProps } from './fields/semantic/date';
|
|
34
|
+
export { ProImage, type ProImageProps, type ImageUploadProps } from './fields/semantic/image';
|
|
35
|
+
export { ProLink, type ProLinkProps } from './fields/semantic/link';
|
|
36
|
+
export { ProNumber, type ProNumberProps } from './fields/semantic/number';
|
|
37
|
+
export { ProRadio, type ProRadioProps } from './fields/basic/radio';
|
|
38
|
+
export { ProRating, type ProRatingProps } from './fields/basic/rating';
|
|
39
|
+
export { ProSelect, type ProSelectProps } from './fields/basic/select';
|
|
40
|
+
export { ProSlider, type ProSliderProps } from './fields/basic/slider';
|
|
41
|
+
export { ProSwitch, type ProSwitchProps } from './fields/basic/switch';
|
|
42
|
+
export { ProTag, type ProTagProps } from './fields/semantic/tag';
|
|
43
|
+
export { ProText, type ProTextProps } from './fields/semantic/text';
|
|
44
|
+
export { ProTextArea, type ProTextAreaProps } from './fields/basic/textarea';
|
|
45
|
+
export { ProTimePicker, type ProTimePickerProps } from './fields/basic/time-picker';
|
|
46
|
+
export { ProTreeSelect, type ProTreeSelectProps } from './fields/basic/tree-select';
|
|
47
|
+
export { ProUpload, type ProUploadProps } from './fields/basic/upload';
|
|
48
|
+
export { ProNumberRange, type ProNumberRangeProps } from './fields/enhance/number-range';
|
|
49
|
+
export declare const ProFieldMap: {
|
|
50
|
+
cascader: typeof ProCascader;
|
|
51
|
+
'check-cascader': typeof ProCheckCascader;
|
|
52
|
+
'check-select': typeof ProCheckSelect;
|
|
53
|
+
'check-tree-select': typeof ProCheckTreeSelect;
|
|
54
|
+
checkbox: typeof ProCheckbox;
|
|
55
|
+
counter: typeof ProCounter;
|
|
56
|
+
date: typeof ProDate;
|
|
57
|
+
image: typeof ProImage;
|
|
58
|
+
link: typeof ProLink;
|
|
59
|
+
number: typeof ProNumber;
|
|
60
|
+
radio: typeof ProRadio;
|
|
61
|
+
rating: typeof ProRating;
|
|
62
|
+
select: typeof ProSelect;
|
|
63
|
+
slider: typeof ProSlider;
|
|
64
|
+
switch: typeof ProSwitch;
|
|
65
|
+
tag: typeof ProTag;
|
|
66
|
+
text: typeof ProText;
|
|
67
|
+
textarea: typeof ProTextArea;
|
|
68
|
+
'time-picker': typeof ProTimePicker;
|
|
69
|
+
'tree-select': typeof ProTreeSelect;
|
|
70
|
+
upload: typeof ProUpload;
|
|
71
|
+
'number-range': typeof ProNumberRange;
|
|
72
|
+
};
|
|
73
|
+
export type BuiltinFieldMapType = typeof ProFieldMap;
|
|
74
|
+
export type ProFieldMapType = FieldMapType & BuiltinFieldMapType;
|
|
75
|
+
export type ProFieldsProps = {
|
|
76
|
+
cascader: ProCascaderProps;
|
|
77
|
+
'check-cascader': ProCheckCascaderProps;
|
|
78
|
+
'check-select': ProCheckSelectProps;
|
|
79
|
+
'check-tree-select': ProCheckTreeSelectProps;
|
|
80
|
+
checkbox: ProCheckboxProps;
|
|
81
|
+
counter: ProCounterProps;
|
|
82
|
+
date: ProDateProps;
|
|
83
|
+
image: ProImageProps;
|
|
84
|
+
link: ProLinkProps;
|
|
85
|
+
number: ProNumberProps;
|
|
86
|
+
radio: ProRadioProps;
|
|
87
|
+
rating: ProRatingProps;
|
|
88
|
+
select: ProSelectProps;
|
|
89
|
+
slider: ProSliderProps;
|
|
90
|
+
switch: ProSwitchProps;
|
|
91
|
+
tag: ProTagProps;
|
|
92
|
+
text: ProTextProps;
|
|
93
|
+
textarea: ProTextAreaProps;
|
|
94
|
+
'time-picker': ProTimePickerProps;
|
|
95
|
+
'tree-select': ProTreeSelectProps;
|
|
96
|
+
upload: ProUploadProps;
|
|
97
|
+
'number-range': ProNumberRangeProps;
|
|
98
|
+
};
|
|
99
|
+
export declare function BuiltinFieldMapProvider(props: React.PropsWithChildren<unknown>): JSX.Element;
|
|
100
|
+
export * from './base';
|
|
101
|
+
export * from './components/span';
|
|
102
|
+
export * from './ctx';
|
|
103
|
+
export * from './utils';
|
|
104
|
+
export * from './components/image-preview';
|
|
105
|
+
export * from './components/upload-bridge';
|
|
106
|
+
export { DumbInput } from './fields/semantic/text';
|
|
107
|
+
export { colorPreset, ColorEnumPreset } from './fields/semantic/tag';
|
|
108
|
+
export * from './editable';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type BatchUpdatePayloadType<TData extends AnyObject> = {
|
|
2
|
+
_IS_BATCH_UPDATE_: true;
|
|
3
|
+
values: Partial<TData>;
|
|
4
|
+
};
|
|
5
|
+
export declare class BatchDepUpdate {
|
|
6
|
+
static update<TData extends AnyObject>(values: Partial<TData>): {
|
|
7
|
+
_IS_BATCH_UPDATE_: true;
|
|
8
|
+
values: Partial<TData>;
|
|
9
|
+
};
|
|
10
|
+
static isBatch<TData extends AnyObject>(value: unknown): value is BatchUpdatePayloadType<TData>;
|
|
11
|
+
static getValues<TData extends AnyObject>(key: FieldPath, value: unknown): Partial<TData>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormBindingProps } from '@hi-ui/schema-core';
|
|
2
|
+
type AnyFormBindingProps = Partial<Omit<FormBindingProps, 'onChange'> & {
|
|
3
|
+
onChange: (...args: AnyType[]) => void;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function wrapFormBinding<T extends Partial<AnyFormBindingProps>>(formBinding: FormBindingProps, fieldProps: T): {
|
|
6
|
+
value: AnyType;
|
|
7
|
+
onChange: (...args: AnyType[]) => void;
|
|
8
|
+
onBlur: (...args: AnyType[]) => void;
|
|
9
|
+
invalid?: boolean | string;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldConfigType, EnhancedFormRefType, ListItemActionCtxType } from '@hi-ui/schema-core';
|
|
3
|
+
export type FormItemLabelCtxType = {
|
|
4
|
+
formRef: EnhancedFormRefType;
|
|
5
|
+
};
|
|
6
|
+
export type FormListItemLabelCtxType = FormItemLabelCtxType & ListItemActionCtxType;
|
|
7
|
+
export type OtherCustomLabelCtxType = {};
|
|
8
|
+
export type CustomLabelUsedBy = 'FormItem' | 'FormListItem' | 'Other' | undefined;
|
|
9
|
+
export type GetLabelCtxType<T extends CustomLabelUsedBy = CustomLabelUsedBy> = T extends 'FormItem' ? FormItemLabelCtxType : T extends 'FormListItem' ? FormListItemLabelCtxType : T extends 'Other' ? OtherCustomLabelCtxType : undefined;
|
|
10
|
+
export type CustomLabelFn<T extends CustomLabelUsedBy = CustomLabelUsedBy> = (ctx: GetLabelCtxType<T>) => React.ReactNode;
|
|
11
|
+
export declare function getLabel<T extends CustomLabelUsedBy = CustomLabelUsedBy>(field: FieldConfigType, ctx?: GetLabelCtxType<T>): any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { wrapFormBinding } from './utils/form-binding';
|
|
2
|
+
import type { FormItemProps } from '@hi-ui/schema-core';
|
|
3
|
+
import type { ProFieldRenderCtx, ProFieldRenderFormItemCtx } from './base';
|
|
4
|
+
export { wrapFormBinding };
|
|
5
|
+
export * from './utils/label';
|
|
6
|
+
export * from './utils/batch-dep-update';
|
|
7
|
+
/**
|
|
8
|
+
* 普适的字段上下文类型,用于获取字段属性
|
|
9
|
+
* @desc 包含字段本身的属性,以及可选的表单绑定属性
|
|
10
|
+
*/
|
|
11
|
+
export type NormalFieldCtxType<FieldProps extends AnyObject> = Pick<ProFieldRenderCtx<FieldProps>, 'field'> & Partial<Pick<ProFieldRenderFormItemCtx<FieldProps>, 'formBinding'>>;
|
|
12
|
+
export declare function getFieldProps<FieldProps extends AnyObject>(dftProps: FieldProps, ctx: NormalFieldCtxType<FieldProps>): FieldProps;
|
|
13
|
+
export declare function getWrapperProps<WrapperProps extends AnyObject>(dftProps: WrapperProps, ctx: Pick<ProFieldRenderCtx<AnyObject, WrapperProps>, 'field'>): WrapperProps;
|
|
14
|
+
export type GetFormItemPropsCtxType = Pick<ProFieldRenderCtx, 'field'>;
|
|
15
|
+
export declare function getFormItemProps(dftProps: FormItemProps, ctx: GetFormItemPropsCtxType): FormItemProps;
|