@quantlife/qlui 0.0.1 → 0.0.3
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/dist/components/ui/multi-select.d.ts +24 -0
- package/dist/components/ui/standard-table.d.ts +31 -2
- package/dist/components/ui/tag.d.ts +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3590 -19527
- package/dist/qlui.css +1 -1
- package/dist/stories/multi-select.stories.d.ts +9 -0
- package/dist/stories/standard-table.stories.d.ts +2 -0
- package/dist/stories/tag.stories.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface MultiSelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** 多选下拉(antd Select mode="multiple" 迁移承接)
|
|
8
|
+
* - 触发器:Badge 展示已选项(超过 maxBadgeCount 折叠 +N)
|
|
9
|
+
* - 下拉:cmdk 本地搜索 + 勾选多选,不随选择关闭
|
|
10
|
+
* - 触控目标 ≥44px:选项 min-h-11
|
|
11
|
+
*/
|
|
12
|
+
export interface MultiSelectProps {
|
|
13
|
+
options: MultiSelectOption[];
|
|
14
|
+
value?: string[];
|
|
15
|
+
onChange?: (value: string[]) => void;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
searchPlaceholder?: string;
|
|
18
|
+
emptyText?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 触发器最多完整展示的 Badge 数,超出折叠 +N(默认 3) */
|
|
21
|
+
maxBadgeCount?: number;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function MultiSelect({ options, value, onChange, placeholder, searchPlaceholder, emptyText, disabled, maxBadgeCount, className, }: MultiSelectProps): React.JSX.Element;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type ColumnDef } from "@tanstack/react-table";
|
|
3
|
+
/** 列级扩展 meta:桌面次要列可 md 以下隐藏;移动卡片模式可隐藏或自定义渲染 */
|
|
4
|
+
declare module "@tanstack/react-table" {
|
|
5
|
+
interface ColumnMeta<TData extends import("@tanstack/react-table").RowData, TValue> {
|
|
6
|
+
/** 响应式:true 时 md(768px) 以下隐藏该列(次要列降级) */
|
|
7
|
+
hideBelowMd?: boolean;
|
|
8
|
+
/** 移动卡片模式:不进入卡片字段 */
|
|
9
|
+
cardHidden?: boolean;
|
|
10
|
+
/** 移动卡片模式:自定义卡片字段渲染(缺省取 cell) */
|
|
11
|
+
cardCell?: (row: TData) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
3
14
|
export interface StandardTableProps<TData> {
|
|
4
15
|
columns: ColumnDef<TData, unknown>[];
|
|
5
16
|
data: TData[];
|
|
@@ -12,6 +23,24 @@ export interface StandardTableProps<TData> {
|
|
|
12
23
|
renderExpanded?: (row: TData) => React.ReactNode;
|
|
13
24
|
pageSize?: number;
|
|
14
25
|
className?: string;
|
|
26
|
+
/** 加载态:表格半透明 + 加载指示 */
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
/** 空态文案 */
|
|
29
|
+
emptyDescription?: React.ReactNode;
|
|
30
|
+
/** 服务端分页:manualPagination=true 时不本地分页,翻页回调 onPageChange */
|
|
31
|
+
manualPagination?: boolean;
|
|
32
|
+
/** 服务端分页:总页数(manualPagination 必传) */
|
|
33
|
+
pageCount?: number;
|
|
34
|
+
/** 受控当前页(0 基) */
|
|
35
|
+
pageIndex?: number;
|
|
36
|
+
/** 翻页/换页回调(服务端分页取参重查) */
|
|
37
|
+
onPaginationChange?: (pageIndex: number, pageSize: number) => void;
|
|
38
|
+
/** 分页区左侧插槽(常用:共 N 条) */
|
|
39
|
+
paginationExtra?: React.ReactNode;
|
|
40
|
+
/** 移动端(<768px)卡片降级:默认自动按列生成字段卡;false 强制表格横向滚动 */
|
|
41
|
+
mobileCard?: boolean;
|
|
42
|
+
/** 移动端卡片自定义渲染(优先于自动字段卡) */
|
|
43
|
+
renderMobileCard?: (row: TData) => React.ReactNode;
|
|
15
44
|
}
|
|
16
|
-
/** 通用数据表(@tanstack/react-table
|
|
17
|
-
export declare function StandardTable<TData>({ columns, data, searchable, searchPlaceholder, enableSorting, renderExpanded, pageSize, className, }: StandardTableProps<TData>): React.JSX.Element;
|
|
45
|
+
/** 通用数据表(@tanstack/react-table 封装:排序/筛选/分页/展开行/服务端分页/移动卡片降级) */
|
|
46
|
+
export declare function StandardTable<TData>({ columns, data, searchable, searchPlaceholder, enableSorting, renderExpanded, pageSize, className, loading, emptyDescription, manualPagination, pageCount, pageIndex, onPaginationChange, paginationExtra, mobileCard, renderMobileCard, }: StandardTableProps<TData>): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TagProps extends React.ComponentProps<"span"> {
|
|
3
|
+
/** 预设语义色(antd Tag color 兼容);非预设字符串按自定义色渲染文字 */
|
|
4
|
+
color?: "default" | "success" | "processing" | "error" | "warning" | (string & {});
|
|
5
|
+
bordered?: boolean;
|
|
6
|
+
closable?: boolean;
|
|
7
|
+
onClose?: (e: React.MouseEvent<HTMLSpanElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
/** 标签(antd Tag 迁移承接:语义色/描边/可关闭) */
|
|
10
|
+
export declare function Tag({ className, color, bordered, closable, onClose, children, style, ...props }: TagProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./components/ui/tabs";
|
|
|
26
26
|
export * from "./components/ui/textarea";
|
|
27
27
|
export * from "./components/ui/tooltip";
|
|
28
28
|
export * from "./components/ui/combobox";
|
|
29
|
+
export * from "./components/ui/multi-select";
|
|
29
30
|
export * from "./components/ui/command";
|
|
30
31
|
export * from "./components/ui/date-picker";
|
|
31
32
|
export * from "./components/ui/form";
|
|
@@ -39,6 +40,7 @@ export * from "./components/ui/steps";
|
|
|
39
40
|
export * from "./components/ui/timeline";
|
|
40
41
|
export * from "./components/ui/descriptions";
|
|
41
42
|
export * from "./components/ui/empty";
|
|
43
|
+
export * from "./components/ui/tag";
|
|
42
44
|
export * from "./components/ui/segmented";
|
|
43
45
|
export * from "./components/ui/statistic";
|
|
44
46
|
export * from "./components/ui/action-buttons";
|