tango-ui-cw 1.0.10 → 1.2.0
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 +133 -126
- package/dist/component/CSSFab/index.d.ts +61 -55
- package/dist/component/CSSFab/useTangoStyle.d.ts +1 -1
- package/dist/component/TBanner/index.d.ts +53 -50
- package/dist/component/TButton/index.d.ts +109 -107
- package/dist/component/TCard/index.d.ts +40 -0
- package/dist/component/TColorPicker/index.d.ts +42 -41
- package/dist/component/TDate/index.d.ts +42 -41
- package/dist/component/TDatePicker/index.d.ts +54 -49
- package/dist/component/TDrawer/index.d.ts +59 -58
- package/dist/component/TInput/index.d.ts +111 -81
- package/dist/component/TLayout/index.d.ts +136 -133
- package/dist/component/TLine/index.d.ts +36 -33
- package/dist/component/TMark/index.d.ts +41 -38
- package/dist/component/TModal/index.d.ts +107 -52
- package/dist/component/TNotice/index.d.ts +47 -30
- package/dist/component/TSearch/index.d.ts +56 -42
- package/dist/component/TSpace/index.d.ts +60 -59
- package/dist/component/TTable/index.d.ts +117 -76
- package/dist/component/TTooltip/index.d.ts +34 -31
- package/dist/component/TUpload/index.d.ts +74 -45
- package/dist/component/index.d.ts +167 -146
- package/dist/index.cjs +26 -8
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +3334 -2305
- package/dist/providers/NoticeProvider/NoticeProvider.d.ts +43 -19
- package/dist/providers/TangoI18nProvider/TangoI18nProvider.d.ts +27 -27
- package/dist/providers/ThemeProvider/ThemeProvider.d.ts +21 -21
- package/dist/scripts/check-peers.js +82 -82
- package/dist/styles/base.css +383 -353
- package/dist/styles/global.css +383 -353
- package/dist/styles/style.css +1 -1
- package/dist/styles/theme.css +13 -13
- package/dist/styles/utilities.css +1 -1
- package/package.json +68 -68
|
@@ -1,76 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export interface
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
/** Table sx slot 名列表 */
|
|
2
|
+
export type TableSlotNames = readonly ["root", "wrapper", "thead", "headerCell", "body", "row", "cell", "empty", "pagination", "loading", "footer"];
|
|
3
|
+
|
|
4
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
5
|
+
import type { SxValue } from "../CSSFab";
|
|
6
|
+
|
|
7
|
+
/** 列定义 */
|
|
8
|
+
export interface TableColumn<T = Record<string, unknown>> {
|
|
9
|
+
title: string;
|
|
10
|
+
dataIndex: string;
|
|
11
|
+
key?: string | number;
|
|
12
|
+
width?: string | number;
|
|
13
|
+
hide?: boolean;
|
|
14
|
+
// added by clayw on 20260623
|
|
15
|
+
/** 是否开启数字排序,默认 false */
|
|
16
|
+
sortable?: boolean;
|
|
17
|
+
// added by clayw on 20260623
|
|
18
|
+
/** 是否固定列,最后一列 fixed=true 固定右侧,其余固定左侧,默认 false */
|
|
19
|
+
fixed?: boolean;
|
|
20
|
+
render?: (value: unknown, row: T, rowIndex: number) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 分页配置 */
|
|
24
|
+
export interface TablePagination {
|
|
25
|
+
/** 翻页栏位置,默认 "bottom" */
|
|
26
|
+
placement?: "top" | "bottom";
|
|
27
|
+
/** 每页条数,默认 10 */
|
|
28
|
+
pageSize?: number;
|
|
29
|
+
/** 每页条数选项,默认 [10, 20, 50, 100] */
|
|
30
|
+
pageSizeOptions?: number[];
|
|
31
|
+
/** 是否显示总数,默认 true */
|
|
32
|
+
showTotal?: boolean;
|
|
33
|
+
/** 是否显示条/页切换,默认 true */
|
|
34
|
+
showSizeChanger?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// added by clayw on 20260624
|
|
38
|
+
/** 行选择配置 */
|
|
39
|
+
export interface TableRowSelection<T = Record<string, unknown>> {
|
|
40
|
+
/** 选择类型,仅支持 checkbox */
|
|
41
|
+
type?: "checkbox";
|
|
42
|
+
/** 受控选中的行 key 列表 */
|
|
43
|
+
selectedRowKeys?: (string | number)[];
|
|
44
|
+
/** 选择变化回调 */
|
|
45
|
+
onChange?: (selectedRowKeys: (string | number)[], selectedRows: T[]) => void;
|
|
46
|
+
/** 是否固定选择列,默认 true(横向滚动时选择列始终可见);设为 false 取消固定 */
|
|
47
|
+
fixed?: boolean;
|
|
48
|
+
/** 选择列宽度,默认 50 */
|
|
49
|
+
width?: string | number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** i18n 覆盖字段 */
|
|
53
|
+
export interface TableLocaleText {
|
|
54
|
+
empty?: string;
|
|
55
|
+
prev?: string;
|
|
56
|
+
next?: string;
|
|
57
|
+
page?: string;
|
|
58
|
+
total?: string;
|
|
59
|
+
perPage?: string;
|
|
60
|
+
// added by clayw on 20260624
|
|
61
|
+
/** 行选择 footer 计数模板,支持 {total} 和 {selected} 占位 */
|
|
62
|
+
selectedSummary?: string;
|
|
63
|
+
/** 全选复选框 aria-label */
|
|
64
|
+
selectAll?: string;
|
|
65
|
+
/** 行选择复选框 aria-label */
|
|
66
|
+
selectRow?: string;
|
|
67
|
+
[key: string]: string | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface TableProps {
|
|
71
|
+
/** 数据源 */
|
|
72
|
+
dataSource?: Record<string, unknown>[];
|
|
73
|
+
/** 列定义 */
|
|
74
|
+
columns?: TableColumn[];
|
|
75
|
+
/** sx 样式扩展 */
|
|
76
|
+
sx?: SxValue;
|
|
77
|
+
/** 行内样式 */
|
|
78
|
+
style?: CSSProperties;
|
|
79
|
+
/** 额外 CSS 类名 */
|
|
80
|
+
className?: string;
|
|
81
|
+
/** 分页配置,不传或 false 不分页 */
|
|
82
|
+
pagination?: TablePagination | false | null;
|
|
83
|
+
/** 隐藏列,支持 dataIndex 数组或单个字符串 */
|
|
84
|
+
hide?: string[] | string;
|
|
85
|
+
/** 行 className,支持函数 (row, rowIndex, rowParity) => string */
|
|
86
|
+
rowClassName?: ((row: Record<string, unknown>, rowIndex: number, rowParity: "even" | "odd") => string) | string;
|
|
87
|
+
/** 行 style,支持函数 (row, rowIndex, rowParity) => CSSProperties */
|
|
88
|
+
rowStyle?: ((row: Record<string, unknown>, rowIndex: number, rowParity: "even" | "odd") => CSSProperties) | CSSProperties;
|
|
89
|
+
/** 单元格 className,支持函数 (row, col, rowIndex, colIndex, rowParity, colParity) => string */
|
|
90
|
+
cellClassName?:
|
|
91
|
+
| ((row: Record<string, unknown>, col: TableColumn, rowIndex: number, colIndex: number, rowParity: "even" | "odd", colParity: "even" | "odd") => string)
|
|
92
|
+
| string;
|
|
93
|
+
/** 单元格 style,支持函数 */
|
|
94
|
+
cellStyle?:
|
|
95
|
+
| ((row: Record<string, unknown>, col: TableColumn, rowIndex: number, colIndex: number, rowParity: "even" | "odd", colParity: "even" | "odd") => CSSProperties)
|
|
96
|
+
| CSSProperties;
|
|
97
|
+
/** 自定义 hover 颜色(覆盖默认主题 hover) */
|
|
98
|
+
hoverColor?: string;
|
|
99
|
+
// added by clayw on 20260624
|
|
100
|
+
/** 加载状态,默认自动模式:dataSource 为空时显示骨架屏;传 true 强制骨架屏;传 false 关闭骨架屏 */
|
|
101
|
+
loading?: boolean;
|
|
102
|
+
// added by clayw on 20260624
|
|
103
|
+
/** 行选择配置 */
|
|
104
|
+
rowSelection?: TableRowSelection;
|
|
105
|
+
// added by clayw on 20260624
|
|
106
|
+
/** 行事件,参考 AntD 写法:(record, rowIndex) => ({ onClick: event => {}, onDoubleClick: event => {} }) */
|
|
107
|
+
onRow?: (record: Record<string, unknown>, rowIndex: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
108
|
+
/** i18n key */
|
|
109
|
+
i18nKey?: string;
|
|
110
|
+
/** 覆盖内置文案 */
|
|
111
|
+
localeText?: TableLocaleText;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare function Table(props: TableProps): JSX.Element;
|
|
115
|
+
|
|
116
|
+
export default Table;
|
|
117
|
+
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import type { SxValue } from "../CSSFab";
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type TooltipSlotNames = readonly ["root", "tooltip"];
|
|
5
|
+
export type TooltipPlacement = "top" | "bottom" | "left" | "right";
|
|
6
|
+
|
|
7
|
+
export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
8
|
+
/** 触发元素 */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** 提示内容 */
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** 弹出方向 */
|
|
13
|
+
placement?: TooltipPlacement;
|
|
14
|
+
/** 受控模式:是否可见 */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/** 非受控默认是否可见 */
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
/** 可见状态变化回调 */
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
/** 是否禁用提示 */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** z-index 层叠顺序,默认 50 */
|
|
23
|
+
zIndex?: number;
|
|
24
|
+
/** 样式扩展 */
|
|
25
|
+
sx?: SxValue;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare const Tooltip: React.ForwardRefExoticComponent<
|
|
31
|
+
TooltipProps & React.RefAttributes<HTMLDivElement>
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export default Tooltip;
|
|
@@ -1,45 +1,74 @@
|
|
|
1
|
-
import type { CSSProperties
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
/** Upload sx slot 名列表 */
|
|
4
|
+
export type UploadSlotNames = readonly ["root", "button", "list", "item", "dragger", "preview"];
|
|
5
|
+
|
|
6
|
+
// added by clayw on 20260624: Upload i18n 文案类型
|
|
7
|
+
export interface UploadLocaleText {
|
|
8
|
+
/** 选择按钮文字 */
|
|
9
|
+
btnText?: string;
|
|
10
|
+
/** 拖拽区域提示文字 */
|
|
11
|
+
dragPlaceholder?: string;
|
|
12
|
+
/** 拖拽悬停时提示文字 */
|
|
13
|
+
dragActivePlaceholder?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface UploadProps {
|
|
17
|
+
/** 样式扩展(字符串/对象/slot) */
|
|
18
|
+
sx?: string | object;
|
|
19
|
+
/** 行内样式 */
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
/** 额外 CSS 类名 */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** 允许的文件类型(同 HTML accept 属性) */
|
|
24
|
+
accept?: string;
|
|
25
|
+
/** 是否多选 */
|
|
26
|
+
multiple?: boolean;
|
|
27
|
+
/** 文件变化回调 */
|
|
28
|
+
onChange?: (files: File[]) => void;
|
|
29
|
+
/** 上传前校验,返回 false 阻止,返回 LIST_IGNORE 不展示 */
|
|
30
|
+
beforeUpload?: (file: File, fileList: File[]) => boolean | Promise<boolean | symbol | File | Blob | undefined>;
|
|
31
|
+
/** 受控文件列表 */
|
|
32
|
+
files?: File[];
|
|
33
|
+
/** 是否显示文件列表 */
|
|
34
|
+
showUploadList?: boolean;
|
|
35
|
+
/** 多选时最大文件数 */
|
|
36
|
+
maxCount?: number;
|
|
37
|
+
/** 单文件最大体积(MB) */
|
|
38
|
+
maxSize?: number;
|
|
39
|
+
/** 选择按钮文字(覆盖 i18n 默认) */
|
|
40
|
+
btnText?: string;
|
|
41
|
+
/** 选择按钮样式 */
|
|
42
|
+
btnStyle?: CSSProperties;
|
|
43
|
+
/** 是否显示文件大小 */
|
|
44
|
+
showSize?: boolean;
|
|
45
|
+
/** 是否禁用 */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
// added by clayw on 20260624: 拖拽上传新增 props
|
|
48
|
+
/** 是否启用拖拽上传(启用后渲染拖拽区域代替按钮) */
|
|
49
|
+
draggable?: boolean;
|
|
50
|
+
/** 拖拽区域提示文字(覆盖 i18n 默认) */
|
|
51
|
+
dragPlaceholder?: string;
|
|
52
|
+
/** 拖拽文件悬停时提示文字(覆盖 i18n 默认) */
|
|
53
|
+
dragActivePlaceholder?: string;
|
|
54
|
+
// added by clayw on 20260624: i18n 文案覆盖
|
|
55
|
+
/** i18n 文案覆盖,优先级高于 prop 和 i18n Provider */
|
|
56
|
+
localeText?: UploadLocaleText;
|
|
57
|
+
// added by clayw on 20260624: 预览 + loading 新增 props
|
|
58
|
+
/** 是否显示图片缩略图预览(原生 img 实现,后续可用 Image 组件替换) */
|
|
59
|
+
preview?: boolean;
|
|
60
|
+
/** 是否显示上传中状态(按钮模式传 Button loading,拖拽模式显示 spinner overlay) */
|
|
61
|
+
loading?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** beforeUpload 返回此值时,文件不展示在列表中 */
|
|
65
|
+
export const LIST_IGNORE: unique symbol;
|
|
66
|
+
|
|
67
|
+
// added by clayw on 20260624: Upload i18n key 类型
|
|
68
|
+
export type UploadI18nKey = "upload.btnText" | "upload.dragPlaceholder" | "upload.dragActivePlaceholder";
|
|
69
|
+
|
|
70
|
+
declare const Upload: ((props: UploadProps) => JSX.Element) & {
|
|
71
|
+
LIST_IGNORE: typeof LIST_IGNORE;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Upload;
|