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.
Files changed (36) hide show
  1. package/README.md +133 -126
  2. package/dist/component/CSSFab/index.d.ts +61 -55
  3. package/dist/component/CSSFab/useTangoStyle.d.ts +1 -1
  4. package/dist/component/TBanner/index.d.ts +53 -50
  5. package/dist/component/TButton/index.d.ts +109 -107
  6. package/dist/component/TCard/index.d.ts +40 -0
  7. package/dist/component/TColorPicker/index.d.ts +42 -41
  8. package/dist/component/TDate/index.d.ts +42 -41
  9. package/dist/component/TDatePicker/index.d.ts +54 -49
  10. package/dist/component/TDrawer/index.d.ts +59 -58
  11. package/dist/component/TInput/index.d.ts +111 -81
  12. package/dist/component/TLayout/index.d.ts +136 -133
  13. package/dist/component/TLine/index.d.ts +36 -33
  14. package/dist/component/TMark/index.d.ts +41 -38
  15. package/dist/component/TModal/index.d.ts +107 -52
  16. package/dist/component/TNotice/index.d.ts +47 -30
  17. package/dist/component/TSearch/index.d.ts +56 -42
  18. package/dist/component/TSpace/index.d.ts +60 -59
  19. package/dist/component/TTable/index.d.ts +117 -76
  20. package/dist/component/TTooltip/index.d.ts +34 -31
  21. package/dist/component/TUpload/index.d.ts +74 -45
  22. package/dist/component/index.d.ts +167 -146
  23. package/dist/index.cjs +26 -8
  24. package/dist/index.d.cts +18 -18
  25. package/dist/index.d.ts +18 -18
  26. package/dist/index.js +3334 -2305
  27. package/dist/providers/NoticeProvider/NoticeProvider.d.ts +43 -19
  28. package/dist/providers/TangoI18nProvider/TangoI18nProvider.d.ts +27 -27
  29. package/dist/providers/ThemeProvider/ThemeProvider.d.ts +21 -21
  30. package/dist/scripts/check-peers.js +82 -82
  31. package/dist/styles/base.css +383 -353
  32. package/dist/styles/global.css +383 -353
  33. package/dist/styles/style.css +1 -1
  34. package/dist/styles/theme.css +13 -13
  35. package/dist/styles/utilities.css +1 -1
  36. package/package.json +68 -68
@@ -1,76 +1,117 @@
1
- import type { CSSProperties, ReactNode } from "react";
2
- import type { SxValue } from "../CSSFab";
3
-
4
- /** 列定义 */
5
- export interface TableColumn<T = Record<string, unknown>> {
6
- title: string;
7
- dataIndex: string;
8
- key?: string | number;
9
- width?: string | number;
10
- hide?: boolean;
11
- render?: (value: unknown, row: T, rowIndex: number) => ReactNode;
12
- }
13
-
14
- /** 分页配置 */
15
- export interface TablePagination {
16
- /** 翻页栏位置,默认 "bottom" */
17
- placement?: "top" | "bottom";
18
- /** 每页条数,默认 10 */
19
- pageSize?: number;
20
- /** 每页条数选项,默认 [10, 20, 50, 100] */
21
- pageSizeOptions?: number[];
22
- /** 是否显示总数,默认 true */
23
- showTotal?: boolean;
24
- /** 是否显示条/页切换,默认 true */
25
- showSizeChanger?: boolean;
26
- }
27
-
28
- /** i18n 覆盖字段 */
29
- export interface TableLocaleText {
30
- empty?: string;
31
- prev?: string;
32
- next?: string;
33
- page?: string;
34
- total?: string;
35
- perPage?: string;
36
- [key: string]: string | undefined;
37
- }
38
-
39
- export interface TableProps {
40
- /** 数据源 */
41
- dataSource?: Record<string, unknown>[];
42
- /** 列定义 */
43
- columns?: TableColumn[];
44
- /** sx 样式扩展 */
45
- sx?: SxValue;
46
- /** 行内样式 */
47
- style?: CSSProperties;
48
- /** 额外 CSS 类名 */
49
- className?: string;
50
- /** 分页配置,不传或 false 不分页 */
51
- pagination?: TablePagination | false | null;
52
- /** 隐藏列,支持 dataIndex 数组或单个字符串 */
53
- hide?: string[] | string;
54
- /** 行 className,支持函数 (row, rowIndex, rowParity) => string */
55
- rowClassName?: ((row: Record<string, unknown>, rowIndex: number, rowParity: "even" | "odd") => string) | string;
56
- /** 行 style,支持函数 (row, rowIndex, rowParity) => CSSProperties */
57
- rowStyle?: ((row: Record<string, unknown>, rowIndex: number, rowParity: "even" | "odd") => CSSProperties) | CSSProperties;
58
- /** 单元格 className,支持函数 (row, col, rowIndex, colIndex, rowParity, colParity) => string */
59
- cellClassName?:
60
- | ((row: Record<string, unknown>, col: TableColumn, rowIndex: number, colIndex: number, rowParity: "even" | "odd", colParity: "even" | "odd") => string)
61
- | string;
62
- /** 单元格 style,支持函数 */
63
- cellStyle?:
64
- | ((row: Record<string, unknown>, col: TableColumn, rowIndex: number, colIndex: number, rowParity: "even" | "odd", colParity: "even" | "odd") => CSSProperties)
65
- | CSSProperties;
66
- /** 自定义 hover 颜色(覆盖默认主题 hover) */
67
- hoverColor?: string;
68
- /** i18n key */
69
- i18nKey?: string;
70
- /** 覆盖内置文案 */
71
- localeText?: TableLocaleText;
72
- }
73
-
74
- declare function Table(props: TableProps): JSX.Element;
75
-
76
- export default Table;
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 TooltipPlacement = "top" | "bottom" | "left" | "right";
5
-
6
- export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
7
- /** 触发元素 */
8
- children?: ReactNode;
9
- /** 提示内容 */
10
- title?: ReactNode;
11
- /** 弹出方向 */
12
- placement?: TooltipPlacement;
13
- /** 受控模式:是否可见 */
14
- open?: boolean;
15
- /** 非受控默认是否可见 */
16
- defaultOpen?: boolean;
17
- /** 可见状态变化回调 */
18
- onOpenChange?: (open: boolean) => void;
19
- /** 是否禁用提示 */
20
- disabled?: boolean;
21
- /** 样式扩展 */
22
- sx?: SxValue;
23
- style?: CSSProperties;
24
- className?: string;
25
- }
26
-
27
- declare const Tooltip: React.ForwardRefExoticComponent<
28
- TooltipProps & React.RefAttributes<HTMLDivElement>
29
- >;
30
-
31
- export default Tooltip;
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, ReactNode } from "react";
2
-
3
- export interface UploadProps {
4
- /** 样式扩展(字符串/对象/slot) */
5
- sx?: string | object;
6
- /** 行内样式 */
7
- style?: CSSProperties;
8
- /** 额外 CSS 类名 */
9
- className?: string;
10
- /** 允许的文件类型(同 HTML accept 属性) */
11
- accept?: string;
12
- /** 是否多选 */
13
- multiple?: boolean;
14
- /** 文件变化回调 */
15
- onChange?: (files: File[]) => void;
16
- /** 上传前校验,返回 false 阻止,返回 LIST_IGNORE 不展示 */
17
- beforeUpload?: (file: File, fileList: File[]) => boolean | Promise<boolean | symbol | File | Blob | undefined>;
18
- /** 受控文件列表 */
19
- files?: File[];
20
- /** 是否显示文件列表 */
21
- showUploadList?: boolean;
22
- /** 多选时最大文件数 */
23
- maxCount?: number;
24
- /** 单文件最大体积(MB) */
25
- maxSize?: number;
26
- /** 选择按钮文字 */
27
- btnText?: string;
28
- /** 选择按钮样式 */
29
- btnStyle?: CSSProperties;
30
- /** 是否显示文件大小 */
31
- showSize?: boolean;
32
- /** 是否禁用 */
33
- disabled?: boolean;
34
- /** 子元素 */
35
- children?: ReactNode;
36
- }
37
-
38
- /** beforeUpload 返回此值时,文件不展示在列表中 */
39
- export const LIST_IGNORE: unique symbol;
40
-
41
- declare const Upload: ((props: UploadProps) => JSX.Element) & {
42
- LIST_IGNORE: typeof LIST_IGNORE;
43
- };
44
-
45
- export default Upload;
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;