ith-ui-react-antd 0.1.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 +21 -0
- package/dist/IthUiClient.d.ts +20 -0
- package/dist/IthUiProvider.d.ts +51 -0
- package/dist/ThComponents.d.ts +31 -0
- package/dist/componentManifest.d.ts +29 -0
- package/dist/components/AreaPicker.d.ts +44 -0
- package/dist/components/AreaPickerAdapter.d.ts +16 -0
- package/dist/components/BusinessDialog.d.ts +25 -0
- package/dist/components/BusinessUpload.d.ts +56 -0
- package/dist/components/BusinessUploadAdapter.d.ts +21 -0
- package/dist/components/ColumnSettings.d.ts +33 -0
- package/dist/components/EntityPicker.d.ts +61 -0
- package/dist/components/EntityPickerAdapter.d.ts +11 -0
- package/dist/components/FilePreview.d.ts +43 -0
- package/dist/components/MultipartUpload.d.ts +43 -0
- package/dist/components/RichTextEditor.d.ts +35 -0
- package/dist/components/RichTextUploadAdapter.d.ts +35 -0
- package/dist/components/SearchScheme.d.ts +49 -0
- package/dist/components/Title.d.ts +7 -0
- package/dist/exceljs.min-Do-buHwJ.js +23041 -0
- package/dist/index-xw7L-1_7.js +25274 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +41 -0
- package/dist/migrationCatalog.d.ts +8 -0
- package/dist/style.css +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ith-ui-react-antd
|
|
2
|
+
|
|
3
|
+
ITH 新一代 React + Ant Design + TypeScript 业务组件库。
|
|
4
|
+
|
|
5
|
+
## 当前组件(11 个对外 `Th*` 组件)
|
|
6
|
+
|
|
7
|
+
- `ThDialog`:公司统一弹窗/抽屉、全屏和操作栏。
|
|
8
|
+
- `ThEditor`、`ThEditorHtml`:富文本编辑与只读展示。
|
|
9
|
+
- `ThSelectPage`:分页弹窗单选/多选。
|
|
10
|
+
- `ThRegion`:异步地区级联。
|
|
11
|
+
- `ThUploadFile`、`ThUploadImg`:附件与图片上传。
|
|
12
|
+
- `ThUploadBig`:大文件 MD5、秒传、断点分片、进度与合并流程。
|
|
13
|
+
- `ThDownload`:文件预览、水印与下载。
|
|
14
|
+
- `ThSearchDescPlan`:更多条件与查询方案。
|
|
15
|
+
- `ThColumnSelect`:列显示、顺序、宽度、冻结、导出和打印设置。
|
|
16
|
+
|
|
17
|
+
内部仍复用职责明确的实现模块,但 npm 对外组件名和表单 JSON 统一使用原来的 `Th*` 名称。
|
|
18
|
+
|
|
19
|
+
## 应用统一配置
|
|
20
|
+
|
|
21
|
+
旧组件库使用可变的 `IthUI.config` 单例。React 版本改为 Provider:应用只传一次 Token、请求头、接口基址和默认端点,组件 Props 仍可覆盖全局设置。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LegacyAreaRequestOptions } from './components/AreaPickerAdapter';
|
|
2
|
+
import { LegacyEntityRequestOptions } from './components/EntityPickerAdapter';
|
|
3
|
+
import { LegacyRichTextUploadOptions } from './components/RichTextUploadAdapter';
|
|
4
|
+
import { EntityRecord } from './components/EntityPicker';
|
|
5
|
+
export declare function useIthUiClient(): {
|
|
6
|
+
config: import('./IthUiProvider').IthUiConfig;
|
|
7
|
+
createAreaRequest: (options?: LegacyAreaRequestOptions) => (parentValue: import('.').AreaValue | null, context: import('.').AreaLoadContext) => Promise<import('.').AreaOption[]>;
|
|
8
|
+
createEntityRequest: <T extends EntityRecord>(options: LegacyEntityRequestOptions<T>) => ({ keyword, page, pageSize, query, filters, signal }: import('.').EntityPickerRequestParams) => Promise<import('.').EntityPickerRequestResult<T>>;
|
|
9
|
+
createUploadAdapter: (options?: {
|
|
10
|
+
url?: string;
|
|
11
|
+
headers?: HeadersInit;
|
|
12
|
+
}) => (file: File, signal: AbortSignal, data: Record<string, unknown>) => Promise<import('.').LegacyUploadResponse>;
|
|
13
|
+
createMultipartUploadAdapter: () => import('.').MultipartUploadAdapter;
|
|
14
|
+
createRichTextUploadAdapters: (options?: LegacyRichTextUploadOptions) => {
|
|
15
|
+
uploadImage: (file: File, signal: AbortSignal) => Promise<import('.').RichTextUploadResult>;
|
|
16
|
+
uploadVideo: (file: File, signal: AbortSignal) => Promise<import('.').RichTextUploadResult>;
|
|
17
|
+
uploadAttachment: (file: File, signal: AbortSignal) => Promise<import('.').RichTextUploadResult>;
|
|
18
|
+
};
|
|
19
|
+
createPreviewHandler: () => (file: import('.').UploadedAsset) => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type IthTokenResolver = string | null | undefined | (() => string | null | undefined | Promise<string | null | undefined>);
|
|
3
|
+
export type IthHeadersResolver = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
4
|
+
export interface IthUiEndpoints {
|
|
5
|
+
area?: string;
|
|
6
|
+
upload?: string;
|
|
7
|
+
nodeUpload?: string;
|
|
8
|
+
multipartDirect?: string;
|
|
9
|
+
multipartVerify?: string;
|
|
10
|
+
multipartChunk?: string;
|
|
11
|
+
multipartMerge?: string;
|
|
12
|
+
richTextUpload?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IthUiPreviewConfig {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
onlinePreview?: string;
|
|
17
|
+
previewWay?: boolean;
|
|
18
|
+
target?: '_blank' | '_self';
|
|
19
|
+
}
|
|
20
|
+
export interface IthUiUploadRule {
|
|
21
|
+
accept?: string;
|
|
22
|
+
maxSizeMB?: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface IthUiConfig {
|
|
26
|
+
baseUrl?: string;
|
|
27
|
+
token?: IthTokenResolver;
|
|
28
|
+
tokenHeader?: string;
|
|
29
|
+
headers?: IthHeadersResolver;
|
|
30
|
+
credentials?: RequestCredentials;
|
|
31
|
+
fetcher?: typeof fetch;
|
|
32
|
+
endpoints?: IthUiEndpoints;
|
|
33
|
+
preview?: IthUiPreviewConfig;
|
|
34
|
+
upload?: {
|
|
35
|
+
file?: IthUiUploadRule;
|
|
36
|
+
image?: IthUiUploadRule;
|
|
37
|
+
multipart?: IthUiUploadRule & {
|
|
38
|
+
useChunkMB?: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
locale?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IthUiProviderProps {
|
|
44
|
+
config: IthUiConfig;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export declare function IthUiProvider({ config, children }: IthUiProviderProps): import("react").JSX.Element;
|
|
48
|
+
export declare function useIthUiConfig(): IthUiConfig;
|
|
49
|
+
export declare function resolveIthToken(config: IthUiConfig): Promise<string | null | undefined>;
|
|
50
|
+
export declare function resolveIthHeaders(config: IthUiConfig): Promise<Headers>;
|
|
51
|
+
export declare function resolveIthUrl(config: IthUiConfig, path: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AreaPickerProps } from './components/AreaPicker';
|
|
2
|
+
import { BusinessDialogProps } from './components/BusinessDialog';
|
|
3
|
+
import { BusinessUploadProps } from './components/BusinessUpload';
|
|
4
|
+
import { ColumnSettingsProps } from './components/ColumnSettings';
|
|
5
|
+
import { EntityPickerProps, EntityRecord } from './components/EntityPicker';
|
|
6
|
+
import { FilePreviewProps } from './components/FilePreview';
|
|
7
|
+
import { MultipartUploadProps } from './components/MultipartUpload';
|
|
8
|
+
import { RichTextEditorProps } from './components/RichTextEditor';
|
|
9
|
+
import { SearchSchemeProps } from './components/SearchScheme';
|
|
10
|
+
export type ThRegionProps = AreaPickerProps;
|
|
11
|
+
export declare function ThRegion({ requestChildren, ...props }: ThRegionProps): import("react").JSX.Element;
|
|
12
|
+
export type ThDialogProps = BusinessDialogProps;
|
|
13
|
+
export declare function ThDialog(props: ThDialogProps): import("react").JSX.Element;
|
|
14
|
+
export type ThUploadFileProps = Omit<BusinessUploadProps, 'variant'>;
|
|
15
|
+
export declare function ThUploadFile({ mode, ...props }: ThUploadFileProps): import("react").JSX.Element;
|
|
16
|
+
export type ThUploadImgProps = Omit<BusinessUploadProps, 'variant'>;
|
|
17
|
+
export declare function ThUploadImg({ mode, ...props }: ThUploadImgProps): import("react").JSX.Element;
|
|
18
|
+
export type ThUploadBigProps = MultipartUploadProps;
|
|
19
|
+
export declare function ThUploadBig(props: ThUploadBigProps): import("react").JSX.Element;
|
|
20
|
+
export type ThSelectPageProps<T extends EntityRecord> = EntityPickerProps<T>;
|
|
21
|
+
export declare function ThSelectPage<T extends EntityRecord>(props: ThSelectPageProps<T>): import("react").JSX.Element;
|
|
22
|
+
export type ThEditorProps = RichTextEditorProps;
|
|
23
|
+
export declare function ThEditor(props: ThEditorProps): import("react").JSX.Element;
|
|
24
|
+
export type ThEditorHtmlProps = Omit<RichTextEditorProps, 'readOnly'>;
|
|
25
|
+
export declare function ThEditorHtml(props: ThEditorHtmlProps): import("react").JSX.Element;
|
|
26
|
+
export type ThSearchDescPlanProps = SearchSchemeProps;
|
|
27
|
+
export declare function ThSearchDescPlan(props: ThSearchDescPlanProps): import("react").JSX.Element;
|
|
28
|
+
export type ThColumnSelectProps<RecordType extends Record<string, unknown> = Record<string, unknown>> = ColumnSettingsProps<RecordType>;
|
|
29
|
+
export declare function ThColumnSelect<RecordType extends Record<string, unknown> = Record<string, unknown>>(props: ThColumnSelectProps<RecordType>): import("react").JSX.Element;
|
|
30
|
+
export type ThDownloadProps = FilePreviewProps;
|
|
31
|
+
export declare function ThDownload(props: ThDownloadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type IthComponentCategory = 'data-entry' | 'data-display' | 'feedback' | 'navigation' | 'advanced';
|
|
2
|
+
export type IthValueType = 'string' | 'string[]' | 'object' | 'object[]' | 'html' | 'void';
|
|
3
|
+
export type IthPropertyEditor = 'input' | 'number' | 'switch' | 'select' | 'tags' | 'json' | 'code' | 'endpoint';
|
|
4
|
+
export interface IthPropertyOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number | boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IthComponentProperty {
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
editor: IthPropertyEditor;
|
|
12
|
+
group?: 'basic' | 'data' | 'behavior' | 'appearance' | 'permission';
|
|
13
|
+
defaultValue?: unknown;
|
|
14
|
+
options?: IthPropertyOption[];
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IthComponentManifestItem {
|
|
18
|
+
key: string;
|
|
19
|
+
title: string;
|
|
20
|
+
category: IthComponentCategory;
|
|
21
|
+
valueType: IthValueType;
|
|
22
|
+
legacy: string[];
|
|
23
|
+
dataSource: 'none' | 'options' | 'endpoint' | 'adapter';
|
|
24
|
+
events: string[];
|
|
25
|
+
properties: IthComponentProperty[];
|
|
26
|
+
}
|
|
27
|
+
/** 表单设计器可直接消费的、无 React 节点和函数的组件定义。 */
|
|
28
|
+
export declare const componentManifest: IthComponentManifestItem[];
|
|
29
|
+
export declare const componentManifestMap: Record<string, IthComponentManifestItem>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export type AreaValue = string | number;
|
|
3
|
+
export interface AreaOption {
|
|
4
|
+
value: AreaValue;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isLeaf?: boolean;
|
|
8
|
+
searchText?: string;
|
|
9
|
+
raw?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface AreaLoadContext {
|
|
12
|
+
level: number;
|
|
13
|
+
path: AreaOption[];
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
export interface AreaChangeInfo {
|
|
17
|
+
valueArr: AreaValue[];
|
|
18
|
+
textArr: string[];
|
|
19
|
+
options: AreaOption[];
|
|
20
|
+
}
|
|
21
|
+
export interface AreaPickerProps {
|
|
22
|
+
value?: AreaValue[];
|
|
23
|
+
defaultValue?: AreaValue[];
|
|
24
|
+
onChange?: (value: AreaValue[], info: AreaChangeInfo) => void;
|
|
25
|
+
requestChildren?: (parentValue: AreaValue | null, context: AreaLoadContext) => Promise<AreaOption[]>;
|
|
26
|
+
/** 兼容早期 React 版本;根节点仍通过 options 提供。 */
|
|
27
|
+
options?: AreaOption[];
|
|
28
|
+
loadChildren?: (parentValue: AreaValue) => Promise<AreaOption[]>;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
tabTitle?: string;
|
|
31
|
+
joinChart?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
allowClear?: boolean;
|
|
34
|
+
anyLevel?: boolean;
|
|
35
|
+
level?: number;
|
|
36
|
+
textModel?: boolean;
|
|
37
|
+
className?: string;
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
size?: 'small' | 'middle' | 'large';
|
|
40
|
+
panelWidth?: number;
|
|
41
|
+
searchable?: boolean;
|
|
42
|
+
levelNames?: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare function AreaPicker({ value, defaultValue, onChange, requestChildren, options, loadChildren, placeholder, tabTitle, joinChart, disabled, allowClear, anyLevel, level, textModel, className, style, size, panelWidth, searchable, levelNames, }: AreaPickerProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AreaLoadContext, AreaOption, AreaValue } from './AreaPicker';
|
|
2
|
+
export interface LegacyAreaRecord {
|
|
3
|
+
id: AreaValue;
|
|
4
|
+
name: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
isLeaf?: boolean;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface LegacyAreaRequestOptions {
|
|
10
|
+
url?: string;
|
|
11
|
+
getToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
12
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
13
|
+
fetcher?: typeof fetch;
|
|
14
|
+
}
|
|
15
|
+
/** 将旧版 /sys/area?pId= 接口转换为 AreaPicker 的逐层数据源。 */
|
|
16
|
+
export declare function createLegacyAreaRequest({ url, getToken, headers, fetcher, }?: LegacyAreaRequestOptions): (parentValue: AreaValue | null, context: AreaLoadContext) => Promise<AreaOption[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type BusinessDialogMode = 'dialog' | 'drawer';
|
|
3
|
+
export interface BusinessDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
mode?: BusinessDialogMode;
|
|
9
|
+
onModeChange?: (mode: BusinessDialogMode) => void;
|
|
10
|
+
size?: number | string;
|
|
11
|
+
fullscreen?: boolean;
|
|
12
|
+
showClose?: boolean;
|
|
13
|
+
showFooter?: boolean;
|
|
14
|
+
closeText?: ReactNode;
|
|
15
|
+
footer?: ReactNode;
|
|
16
|
+
footerLeading?: ReactNode;
|
|
17
|
+
headerExtra?: ReactNode;
|
|
18
|
+
mask?: boolean;
|
|
19
|
+
maskClosable?: boolean;
|
|
20
|
+
keyboard?: boolean;
|
|
21
|
+
destroyOnHidden?: boolean;
|
|
22
|
+
bodyClassName?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function BusinessDialog({ open, onOpenChange, title, children, mode, onModeChange, size, fullscreen, showClose, showFooter, closeText, footer, footerLeading, headerExtra, mask, maskClosable, keyboard, destroyOnHidden, bodyClassName, className, }: BusinessDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { UploadFile, UploadProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type UploadStatusValue = -1 | 0 | 1 | 2;
|
|
4
|
+
export interface UploadedAsset {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
type?: 'file';
|
|
7
|
+
id: string;
|
|
8
|
+
uid?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
status?: 'success';
|
|
12
|
+
size?: number;
|
|
13
|
+
mimeType?: string;
|
|
14
|
+
response?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface LegacyUploadResponse {
|
|
17
|
+
code: number;
|
|
18
|
+
msg?: string;
|
|
19
|
+
ext?: {
|
|
20
|
+
fileId?: string;
|
|
21
|
+
fileName?: string;
|
|
22
|
+
url?: string;
|
|
23
|
+
};
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface UploadModuleConfig {
|
|
27
|
+
fileType?: string;
|
|
28
|
+
fileNumber?: number;
|
|
29
|
+
fileSize?: number;
|
|
30
|
+
nodeFileId?: string;
|
|
31
|
+
remark?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export interface BusinessUploadProps extends Omit<UploadProps, 'accept' | 'beforeUpload' | 'customRequest' | 'fileList' | 'maxCount' | 'onChange' | 'onPreview' | 'onRemove'> {
|
|
34
|
+
variant?: 'file' | 'image';
|
|
35
|
+
mode?: 'button' | 'drag' | 'picture-card';
|
|
36
|
+
value?: UploadedAsset[];
|
|
37
|
+
defaultValue?: UploadedAsset[];
|
|
38
|
+
onValueChange?: (files: UploadedAsset[]) => void;
|
|
39
|
+
upload?: (file: File, signal: AbortSignal, data: Record<string, unknown>) => Promise<UploadedAsset | LegacyUploadResponse>;
|
|
40
|
+
uploadData?: Record<string, unknown>;
|
|
41
|
+
accept?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
maxSizeMB?: number;
|
|
44
|
+
moduleConfig?: UploadModuleConfig;
|
|
45
|
+
showTip?: boolean;
|
|
46
|
+
enableSingleMode?: boolean;
|
|
47
|
+
previewEnabled?: boolean;
|
|
48
|
+
onPreviewAsset?: (file: UploadedAsset) => void;
|
|
49
|
+
onlinePreview?: string;
|
|
50
|
+
previewWay?: boolean;
|
|
51
|
+
onUploadStatusChange?: (status: UploadStatusValue) => void;
|
|
52
|
+
onUploadError?: (error: unknown) => void;
|
|
53
|
+
rawResponse?: boolean;
|
|
54
|
+
onResponse?: (files: UploadFile[]) => void;
|
|
55
|
+
}
|
|
56
|
+
export declare function BusinessUpload({ variant, mode, value, defaultValue, onValueChange, upload, uploadData, accept, limit, maxSizeMB, moduleConfig, showTip, enableSingleMode, previewEnabled, onPreviewAsset, onlinePreview, previewWay, onUploadStatusChange, onUploadError, rawResponse, onResponse, multiple, disabled, children, ...props }: BusinessUploadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LegacyUploadResponse, UploadedAsset } from './BusinessUpload';
|
|
2
|
+
import { MultipartUploadAdapter } from './MultipartUpload';
|
|
3
|
+
export interface LegacyUploadAdapterOptions {
|
|
4
|
+
url?: string;
|
|
5
|
+
getToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
6
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
7
|
+
}
|
|
8
|
+
export declare function createLegacyUploadAdapter(options?: LegacyUploadAdapterOptions): (file: File, signal: AbortSignal, data: Record<string, unknown>) => Promise<LegacyUploadResponse>;
|
|
9
|
+
export interface LegacyPreviewOptions {
|
|
10
|
+
onlinePreview: string;
|
|
11
|
+
previewWay?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function createLegacyPreviewHandler({ onlinePreview, previewWay }: LegacyPreviewOptions): (file: UploadedAsset) => void;
|
|
14
|
+
interface LegacyMultipartOptions extends LegacyUploadAdapterOptions {
|
|
15
|
+
directUrl?: string;
|
|
16
|
+
verifyUrl?: string;
|
|
17
|
+
chunkUrl?: string;
|
|
18
|
+
mergeUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function createLegacyMultipartUploadAdapter(options?: LegacyMultipartOptions): MultipartUploadAdapter;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type ColumnFixed = 'left' | 'right' | false;
|
|
2
|
+
export interface ManagedColumn<RecordType extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
dataIndex?: string;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
width?: number;
|
|
8
|
+
fixed?: ColumnFixed;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
excludeFromExport?: boolean;
|
|
11
|
+
renderExport?: (value: unknown, row: RecordType) => unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ColumnSettingsPersistence<RecordType extends Record<string, unknown> = Record<string, unknown>> {
|
|
14
|
+
load: (key: string) => Promise<ManagedColumn<RecordType>[] | null> | ManagedColumn<RecordType>[] | null;
|
|
15
|
+
save: (key: string, columns: ManagedColumn<RecordType>[]) => Promise<void> | void;
|
|
16
|
+
reset: (key: string) => Promise<void> | void;
|
|
17
|
+
}
|
|
18
|
+
export interface ColumnSettingsProps<RecordType extends Record<string, unknown> = Record<string, unknown>> {
|
|
19
|
+
columns: ManagedColumn<RecordType>[];
|
|
20
|
+
onChange: (columns: ManagedColumn<RecordType>[]) => void;
|
|
21
|
+
currentData?: RecordType[];
|
|
22
|
+
selectedData?: RecordType[];
|
|
23
|
+
loadAll?: (limit: number) => Promise<RecordType[]>;
|
|
24
|
+
cacheKey?: string;
|
|
25
|
+
persistence?: ColumnSettingsPersistence<RecordType>;
|
|
26
|
+
enableWidth?: boolean;
|
|
27
|
+
maxExportRows?: number;
|
|
28
|
+
fileName?: string;
|
|
29
|
+
compact?: boolean;
|
|
30
|
+
onExport?: (rows: RecordType[], columns: ManagedColumn<RecordType>[], fileName: string) => Promise<void> | void;
|
|
31
|
+
onPrint?: (rows: RecordType[], columns: ManagedColumn<RecordType>[]) => Promise<void> | void;
|
|
32
|
+
}
|
|
33
|
+
export declare function ColumnSettings<RecordType extends Record<string, unknown> = Record<string, unknown>>({ columns, onChange, currentData, selectedData, loadAll, cacheKey, persistence, enableWidth, maxExportRows, fileName, compact, onExport, onPrint }: ColumnSettingsProps<RecordType>): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ColumnsType } from 'antd/es/table/interface';
|
|
2
|
+
import { Key, ReactNode } from 'react';
|
|
3
|
+
export type EntityRecord = Record<string, unknown>;
|
|
4
|
+
export type EntityQuery = Record<string, unknown>;
|
|
5
|
+
export interface EntityPickerRequestParams {
|
|
6
|
+
keyword: string;
|
|
7
|
+
page: number;
|
|
8
|
+
pageSize: number;
|
|
9
|
+
query: EntityQuery;
|
|
10
|
+
filters: EntityQuery;
|
|
11
|
+
signal: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
export interface EntityPickerRequestResult<T extends EntityRecord> {
|
|
14
|
+
rows: T[];
|
|
15
|
+
total: number;
|
|
16
|
+
}
|
|
17
|
+
export interface EntityFilterRenderContext {
|
|
18
|
+
query: EntityQuery;
|
|
19
|
+
setQuery: (next: EntityQuery | ((current: EntityQuery) => EntityQuery)) => void;
|
|
20
|
+
search: () => void;
|
|
21
|
+
reset: () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface EntitySelectDialogProps<T extends EntityRecord> {
|
|
24
|
+
open: boolean;
|
|
25
|
+
onOpenChange: (open: boolean) => void;
|
|
26
|
+
value?: T[];
|
|
27
|
+
onConfirm?: (value: T[]) => void;
|
|
28
|
+
request: (params: EntityPickerRequestParams) => Promise<EntityPickerRequestResult<T>>;
|
|
29
|
+
columns: ColumnsType<T>;
|
|
30
|
+
rowKey: keyof T | ((record: T) => Key);
|
|
31
|
+
multiple?: boolean;
|
|
32
|
+
title?: ReactNode;
|
|
33
|
+
size?: number | string;
|
|
34
|
+
filters?: EntityQuery;
|
|
35
|
+
defaultQuery?: EntityQuery;
|
|
36
|
+
showFilterHeader?: boolean;
|
|
37
|
+
showSearchMore?: boolean;
|
|
38
|
+
renderLeft?: (context: EntityFilterRenderContext) => ReactNode;
|
|
39
|
+
renderFilters?: (context: EntityFilterRenderContext) => ReactNode;
|
|
40
|
+
renderMoreFilters?: (context: EntityFilterRenderContext) => ReactNode;
|
|
41
|
+
disabledKeys?: Key[];
|
|
42
|
+
isRowDisabled?: (record: T) => boolean;
|
|
43
|
+
decorateData?: (rows: T[]) => T[];
|
|
44
|
+
immediateSingleSelect?: boolean;
|
|
45
|
+
autoClose?: boolean;
|
|
46
|
+
confirmLoading?: boolean;
|
|
47
|
+
onReset?: () => void;
|
|
48
|
+
pageSizeOptions?: number[];
|
|
49
|
+
tableScrollY?: number | string;
|
|
50
|
+
}
|
|
51
|
+
export declare function EntitySelectDialog<T extends EntityRecord>({ open, onOpenChange, value, onConfirm, request, columns, rowKey, multiple, title, size, filters, defaultQuery, showFilterHeader, showSearchMore, renderLeft, renderFilters, renderMoreFilters, disabledKeys, isRowDisabled, decorateData, immediateSingleSelect, autoClose, confirmLoading, onReset, pageSizeOptions, tableScrollY, }: EntitySelectDialogProps<T>): import("react").JSX.Element;
|
|
52
|
+
export interface EntityPickerProps<T extends EntityRecord> extends Omit<EntitySelectDialogProps<T>, 'open' | 'onOpenChange' | 'onConfirm'> {
|
|
53
|
+
value?: T[];
|
|
54
|
+
onChange?: (value: T[]) => void;
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
allowClear?: boolean;
|
|
58
|
+
displayField?: keyof T | ((record: T) => ReactNode);
|
|
59
|
+
onOpenChange?: (open: boolean) => void;
|
|
60
|
+
}
|
|
61
|
+
export declare function EntityPicker<T extends EntityRecord>({ value, onChange, placeholder, disabled, allowClear, displayField, onOpenChange, ...dialogProps }: EntityPickerProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityPickerRequestParams, EntityPickerRequestResult, EntityRecord } from './EntityPicker';
|
|
2
|
+
export interface LegacyEntityRequestOptions<T extends EntityRecord> {
|
|
3
|
+
url: string;
|
|
4
|
+
method?: 'get' | 'post';
|
|
5
|
+
getToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
6
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
7
|
+
fetcher?: typeof fetch;
|
|
8
|
+
decorateData?: (rows: T[]) => T[];
|
|
9
|
+
}
|
|
10
|
+
/** 适配旧 ThSelectPage 的 offset/limit、GET/POST 及 rows/ext 返回结构。 */
|
|
11
|
+
export declare function createLegacyEntityRequest<T extends EntityRecord>({ url, method, getToken, headers, fetcher, decorateData, }: LegacyEntityRequestOptions<T>): ({ keyword, page, pageSize, query, filters, signal }: EntityPickerRequestParams) => Promise<EntityPickerRequestResult<T>>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export interface PreviewFile {
|
|
3
|
+
id?: string | number;
|
|
4
|
+
url: string;
|
|
5
|
+
name: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
previewUrl?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface FileWatermark {
|
|
11
|
+
text: string;
|
|
12
|
+
angle?: number;
|
|
13
|
+
color?: string;
|
|
14
|
+
opacity?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface FileActionContext {
|
|
17
|
+
file: PreviewFile;
|
|
18
|
+
files: PreviewFile[];
|
|
19
|
+
watermark?: FileWatermark;
|
|
20
|
+
params?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface FilePreviewProps {
|
|
23
|
+
file: PreviewFile;
|
|
24
|
+
files?: PreviewFile[];
|
|
25
|
+
width?: number | string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
className?: string;
|
|
28
|
+
preview?: boolean;
|
|
29
|
+
download?: boolean;
|
|
30
|
+
watermark?: FileWatermark;
|
|
31
|
+
previewTarget?: 'overlay' | 'blank';
|
|
32
|
+
resolvePreviewUrl?: (context: FileActionContext) => string | Promise<string>;
|
|
33
|
+
beforePreview?: (context: FileActionContext) => boolean | void | Promise<boolean | void>;
|
|
34
|
+
beforeDownload?: (context: FileActionContext) => boolean | void | Promise<boolean | void>;
|
|
35
|
+
downloadFile?: (context: FileActionContext, signal: AbortSignal) => Promise<Blob | void>;
|
|
36
|
+
downloadParams?: Record<string, unknown>;
|
|
37
|
+
onPreview?: (context: FileActionContext) => void;
|
|
38
|
+
onDownload?: (context: FileActionContext) => void;
|
|
39
|
+
onSuccess?: (context: FileActionContext) => void;
|
|
40
|
+
onError?: (error: Error, context: FileActionContext) => void;
|
|
41
|
+
extra?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export declare function FilePreview({ file, files, width, style, className, preview, download, watermark, previewTarget, resolvePreviewUrl, beforePreview, beforeDownload, downloadFile, downloadParams, onPreview, onDownload, onSuccess, onError, extra, }: FilePreviewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { UploadedAsset } from './BusinessUpload';
|
|
2
|
+
export interface MultipartVerifyResult {
|
|
3
|
+
shouldUpload: boolean;
|
|
4
|
+
uploadedList?: string[];
|
|
5
|
+
url?: string;
|
|
6
|
+
fileId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MultipartChunkParams {
|
|
9
|
+
chunk: Blob;
|
|
10
|
+
hash: string;
|
|
11
|
+
index: number;
|
|
12
|
+
fileHash: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
onProgress: (loaded: number, total: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface MultipartUploadAdapter {
|
|
18
|
+
directUpload: (file: File, signal: AbortSignal, onProgress: (loaded: number, total: number) => void) => Promise<UploadedAsset>;
|
|
19
|
+
verifyUpload: (filename: string, fileHash: string, signal: AbortSignal) => Promise<MultipartVerifyResult>;
|
|
20
|
+
uploadChunk: (params: MultipartChunkParams) => Promise<void>;
|
|
21
|
+
mergeChunks: (params: {
|
|
22
|
+
size: number;
|
|
23
|
+
fileHash: string;
|
|
24
|
+
filename: string;
|
|
25
|
+
signal: AbortSignal;
|
|
26
|
+
}) => Promise<UploadedAsset>;
|
|
27
|
+
}
|
|
28
|
+
export interface MultipartUploadProps {
|
|
29
|
+
value?: UploadedAsset[];
|
|
30
|
+
defaultValue?: UploadedAsset[];
|
|
31
|
+
onValueChange?: (files: UploadedAsset[]) => void;
|
|
32
|
+
adapter: MultipartUploadAdapter;
|
|
33
|
+
accept?: string;
|
|
34
|
+
limit?: number;
|
|
35
|
+
maxSizeMB?: number;
|
|
36
|
+
useChunkMB?: number;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
previewEnabled?: boolean;
|
|
39
|
+
onPreviewAsset?: (file: UploadedAsset) => void;
|
|
40
|
+
onlinePreview?: string;
|
|
41
|
+
previewWay?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function MultipartUpload({ value, defaultValue, onValueChange, adapter, accept, limit, maxSizeMB, useChunkMB, disabled, previewEnabled, onPreviewAsset, onlinePreview, previewWay, }: MultipartUploadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
export interface RichTextUploadResult {
|
|
3
|
+
url: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
export type RichTextToolbarKey = 'heading' | 'fontFamily' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'strike' | 'textColor' | 'highlight' | 'align' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'code' | 'horizontalRule' | 'link' | 'table' | 'image' | 'video' | 'attachment' | 'clear' | 'undo' | 'redo' | 'fullscreen';
|
|
9
|
+
export interface RichTextEditorProps {
|
|
10
|
+
value?: string;
|
|
11
|
+
onChange?: (html: string) => void;
|
|
12
|
+
onFocus?: () => void;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
onReady?: (editor: Editor) => void;
|
|
15
|
+
onUploadStatusChange?: (status: 'idle' | 'uploading' | 'success' | 'error', file?: File) => void;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
minHeight?: number;
|
|
18
|
+
maxHeight?: number;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
autoFocus?: boolean;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
showWordCount?: boolean;
|
|
24
|
+
toolbarItems?: RichTextToolbarKey[];
|
|
25
|
+
excludeToolbarItems?: RichTextToolbarKey[];
|
|
26
|
+
uploadImage?: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
27
|
+
uploadVideo?: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
28
|
+
uploadAttachment?: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
29
|
+
allowedImageTypes?: string[];
|
|
30
|
+
allowedVideoTypes?: string[];
|
|
31
|
+
maxImageSizeMB?: number;
|
|
32
|
+
maxVideoSizeMB?: number;
|
|
33
|
+
maxAttachmentSizeMB?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function RichTextEditor({ value, onChange, onFocus, onBlur, onReady, onUploadStatusChange, placeholder, minHeight, maxHeight, disabled, readOnly, autoFocus, maxLength, showWordCount, toolbarItems, excludeToolbarItems, uploadImage, uploadVideo, uploadAttachment, allowedImageTypes, allowedVideoTypes, maxImageSizeMB, maxVideoSizeMB, maxAttachmentSizeMB, }: RichTextEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RichTextUploadResult } from './RichTextEditor';
|
|
2
|
+
export type RichTextUploadType = 'IMAGE' | 'VIDEO' | 'FILE';
|
|
3
|
+
export interface LegacyRichTextUploadResponse {
|
|
4
|
+
code?: number | string;
|
|
5
|
+
msg?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
ext?: {
|
|
8
|
+
url?: string;
|
|
9
|
+
fileName?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
};
|
|
13
|
+
data?: {
|
|
14
|
+
url?: string;
|
|
15
|
+
fileName?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface LegacyRichTextUploadOptions {
|
|
21
|
+
url?: string;
|
|
22
|
+
fieldName?: string;
|
|
23
|
+
tokenHeader?: string;
|
|
24
|
+
getToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
25
|
+
actionData?: Record<string, unknown>;
|
|
26
|
+
credentials?: RequestCredentials;
|
|
27
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
28
|
+
fetcher?: typeof fetch;
|
|
29
|
+
}
|
|
30
|
+
export declare function createLegacyRichTextUploadAdapter(type: RichTextUploadType, options?: LegacyRichTextUploadOptions): (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
31
|
+
export declare function createLegacyRichTextUploadAdapters(options?: LegacyRichTextUploadOptions): {
|
|
32
|
+
uploadImage: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
33
|
+
uploadVideo: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
34
|
+
uploadAttachment: (file: File, signal: AbortSignal) => Promise<RichTextUploadResult>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SearchRelation = 'and' | 'or';
|
|
3
|
+
export type SearchFieldType = 'input' | 'select' | 'multiSelect' | 'date' | 'dateRange';
|
|
4
|
+
export type SearchValue = unknown;
|
|
5
|
+
export interface SearchOption {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
}
|
|
9
|
+
export interface SearchTerm {
|
|
10
|
+
fieldJava: string;
|
|
11
|
+
fieldLabel: string;
|
|
12
|
+
component?: SearchFieldType;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
options?: SearchOption[];
|
|
15
|
+
defaultValue?: SearchValue;
|
|
16
|
+
bitVague?: 0 | 1;
|
|
17
|
+
}
|
|
18
|
+
export interface SearchCondition {
|
|
19
|
+
id: string;
|
|
20
|
+
fieldJava: string;
|
|
21
|
+
conditionValue: string;
|
|
22
|
+
fieldValue: SearchValue;
|
|
23
|
+
}
|
|
24
|
+
export interface SearchSchemeValue {
|
|
25
|
+
schemeId: string;
|
|
26
|
+
schemeName: string;
|
|
27
|
+
relation: SearchRelation;
|
|
28
|
+
where: SearchCondition[];
|
|
29
|
+
}
|
|
30
|
+
export interface SearchPayload {
|
|
31
|
+
queryBizCode: string;
|
|
32
|
+
threlation: SearchRelation;
|
|
33
|
+
wrappers: Record<string, {
|
|
34
|
+
conditionValue: string;
|
|
35
|
+
fieldValue: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchSchemeProps {
|
|
39
|
+
terms: SearchTerm[];
|
|
40
|
+
queryBizCode: string;
|
|
41
|
+
mode?: 'more' | 'scheme';
|
|
42
|
+
schemes?: SearchSchemeValue[];
|
|
43
|
+
defaultExpanded?: boolean;
|
|
44
|
+
onSearch?: (payload: SearchPayload) => void;
|
|
45
|
+
onSaveScheme?: (scheme: SearchSchemeValue) => void;
|
|
46
|
+
onDeleteScheme?: (schemeId: string) => void;
|
|
47
|
+
renderField?: (term: SearchTerm, value: SearchValue, onChange: (value: SearchValue) => void) => ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export declare function SearchScheme({ terms, queryBizCode, mode, schemes, defaultExpanded, onSearch, onSaveScheme, onDeleteScheme, renderField, }: SearchSchemeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ThTitleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
text?: ReactNode;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
variant?: 'line' | 'soft' | 'badge' | 'solid' | 'outline' | 'corner' | 'pill' | 'ribbon' | 'marker' | 'split' | 'centered' | 'tab' | 'accent' | 'rail' | 'chapter';
|
|
6
|
+
}
|
|
7
|
+
export declare function ThTitle({ text, children, variant, className, ...rest }: ThTitleProps): import("react").JSX.Element;
|