@zhanxp/station-ui 0.1.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 +49 -0
- package/dist/components/em-box/index.d.ts +24 -0
- package/dist/components/em-button/index.d.ts +9 -0
- package/dist/components/em-drawer/index.d.ts +11 -0
- package/dist/components/em-grid/index.d.ts +10 -0
- package/dist/components/em-input/index.d.ts +13 -0
- package/dist/components/em-modal/index.d.ts +11 -0
- package/dist/components/em-pagination/index.d.ts +10 -0
- package/dist/components/em-select/index.d.ts +33 -0
- package/dist/components/em-table/index.d.ts +31 -0
- package/dist/components/ui/Dialog.d.ts +23 -0
- package/dist/components/ui/Loading.d.ts +6 -0
- package/dist/components/ui/Toast.d.ts +9 -0
- package/dist/index.d.ts +23 -0
- package/dist/station-ui.js +3230 -0
- package/dist/station-ui.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/utils.d.ts +3 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @station/ui
|
|
2
|
+
|
|
3
|
+
Station 数据工作站通用 UI 组件库。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 配置 registry(项目 .npmrc)
|
|
9
|
+
@station:registry=http://maven.xxxxx.com/repository/npm-hosted/
|
|
10
|
+
|
|
11
|
+
# 安装
|
|
12
|
+
npm install @station/ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// 引入样式(入口文件中引入一次)
|
|
19
|
+
import '@station/ui/style.css'
|
|
20
|
+
|
|
21
|
+
// 使用组件
|
|
22
|
+
import { EmTable, EmPagination, EmGrid, EmBox, toast, confirm } from '@station/ui'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 发布
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd packages/station-ui
|
|
29
|
+
|
|
30
|
+
# 构建
|
|
31
|
+
npm run build
|
|
32
|
+
|
|
33
|
+
# 登录 Nexus(首次)
|
|
34
|
+
npm login --registry=http://maven.xxxxx.com/repository/npm-hosted/
|
|
35
|
+
|
|
36
|
+
# 发布
|
|
37
|
+
npm publish
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 组件列表
|
|
41
|
+
|
|
42
|
+
- `EmTable` — 数据表格(基于 TanStack Table + Virtual,支持排序、固定列、树形展开、虚拟滚动)
|
|
43
|
+
- `EmPagination` — 分页器
|
|
44
|
+
- `EmGrid` — 工具栏容器(toolbar + body + footer)
|
|
45
|
+
- `EmBox` — 面板容器(带标题、主题色、标签页)
|
|
46
|
+
- `Loading` — 加载指示器
|
|
47
|
+
- `toast` / `ToastContainer` — 消息提示
|
|
48
|
+
- `alert` / `AlertContainer` — 弹窗提示
|
|
49
|
+
- `confirm` / `ConfirmContainer` — 确认对话框
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface TabItem {
|
|
2
|
+
title: string;
|
|
3
|
+
active?: boolean;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
interface EmBoxProps {
|
|
7
|
+
theme?: 'default' | 'primary' | 'info' | 'danger' | 'warning' | 'success' | 'simple';
|
|
8
|
+
title?: string;
|
|
9
|
+
showClose?: boolean;
|
|
10
|
+
noPadding?: boolean;
|
|
11
|
+
fixtop?: number;
|
|
12
|
+
bodyStyle?: React.CSSProperties;
|
|
13
|
+
tabs?: TabItem[];
|
|
14
|
+
header?: React.ReactNode;
|
|
15
|
+
tools?: React.ReactNode;
|
|
16
|
+
breadcrumb?: React.ReactNode;
|
|
17
|
+
footer?: React.ReactNode;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
onTabClick?: (item: TabItem) => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export default function EmBox({ theme, title, showClose, noPadding, fixtop, bodyStyle, tabs, header, tools, breadcrumb, footer, children, onClose, onTabClick, className, }: EmBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EmButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: 'primary' | 'default' | 'danger' | 'text';
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const EmButton: import('react').ForwardRefExoticComponent<EmButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export default EmButton;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface EmDrawerProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
title?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
footer?: React.ReactNode;
|
|
7
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
8
|
+
maskClosable?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function EmDrawer({ open, onClose, title, children, footer, size, maskClosable, className, }: EmDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface EmGridProps {
|
|
2
|
+
actions?: React.ReactNode;
|
|
3
|
+
search?: React.ReactNode;
|
|
4
|
+
footer?: React.ReactNode;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
noPadding?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function EmGrid({ actions, search, footer, children, className, noPadding, }: EmGridProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode, ChangeEvent } from 'react';
|
|
2
|
+
export interface EmInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'onChange' | 'size'> {
|
|
3
|
+
label?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
prefix?: ReactNode;
|
|
6
|
+
suffix?: ReactNode;
|
|
7
|
+
allowClear?: boolean;
|
|
8
|
+
showCount?: boolean;
|
|
9
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
onPressEnter?: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const EmInput: import('react').ForwardRefExoticComponent<EmInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export default EmInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface EmModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
title?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
footer?: React.ReactNode;
|
|
7
|
+
maskClosable?: boolean;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function EmModal({ open, onClose, title, children, footer, maskClosable, size, className, }: EmModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface EmPaginationProps {
|
|
2
|
+
total: number;
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
pageSizes?: number[];
|
|
6
|
+
onChange: (page: number) => void;
|
|
7
|
+
onPageSizeChange?: (size: number) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function EmPagination({ total, pageIndex, pageSize, pageSizes, onChange, onPageSizeChange, className, }: EmPaginationProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface EmSelectOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface EmSelectSingleProps {
|
|
8
|
+
label?: string;
|
|
9
|
+
value?: string | number;
|
|
10
|
+
options: EmSelectOption[];
|
|
11
|
+
onChange: (value: string | number) => void;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
mode?: undefined;
|
|
18
|
+
}
|
|
19
|
+
interface EmSelectMultipleProps {
|
|
20
|
+
label?: string;
|
|
21
|
+
value?: (string | number)[];
|
|
22
|
+
options: EmSelectOption[];
|
|
23
|
+
onChange: (value: (string | number)[]) => void;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
mode: 'multiple';
|
|
30
|
+
}
|
|
31
|
+
export type EmSelectProps = EmSelectSingleProps | EmSelectMultipleProps;
|
|
32
|
+
export default function EmSelect(props: EmSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ColumnDef, SortingState } from '@tanstack/react-table';
|
|
2
|
+
export interface EmTableColumn<T> {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
width?: number;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
fixed?: 'left' | 'right';
|
|
8
|
+
sortable?: boolean;
|
|
9
|
+
align?: 'left' | 'center' | 'right';
|
|
10
|
+
render?: (value: unknown, row: T, index: number) => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface EmTableProps<T extends Record<string, unknown>> {
|
|
13
|
+
columns: EmTableColumn<T>[];
|
|
14
|
+
data: T[];
|
|
15
|
+
rowKey?: string;
|
|
16
|
+
childrenKey?: string;
|
|
17
|
+
height?: number;
|
|
18
|
+
estimateRowHeight?: number;
|
|
19
|
+
bordered?: boolean;
|
|
20
|
+
striped?: boolean;
|
|
21
|
+
emptyText?: string;
|
|
22
|
+
selectable?: boolean;
|
|
23
|
+
onSelectionChange?: (selectedRows: T[]) => void;
|
|
24
|
+
onSortChange?: (sorting: SortingState) => void;
|
|
25
|
+
onRowClick?: (row: T) => void;
|
|
26
|
+
rowClassName?: string | ((row: T, index: number) => string);
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
export default function EmTable<T extends Record<string, unknown>>({ columns, data, rowKey, childrenKey, height, estimateRowHeight, bordered, striped, emptyText, selectable, onSelectionChange, onSortChange, onRowClick, rowClassName, loading, className, }: EmTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export type { ColumnDef, SortingState };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface AlertOptions {
|
|
2
|
+
title?: string;
|
|
3
|
+
message: string;
|
|
4
|
+
confirmText?: string;
|
|
5
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
6
|
+
}
|
|
7
|
+
export declare function alert(message: string, title?: string, type?: AlertOptions['type']): Promise<void>;
|
|
8
|
+
export declare namespace alert {
|
|
9
|
+
var success: (msg: string, title?: string) => Promise<void>;
|
|
10
|
+
var error: (msg: string, title?: string) => Promise<void>;
|
|
11
|
+
var warning: (msg: string, title?: string) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function AlertContainer(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface ConfirmOptions {
|
|
15
|
+
title?: string;
|
|
16
|
+
message: string;
|
|
17
|
+
confirmText?: string;
|
|
18
|
+
cancelText?: string;
|
|
19
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
20
|
+
}
|
|
21
|
+
export declare function confirm(message: string, title?: string, type?: ConfirmOptions['type']): Promise<boolean>;
|
|
22
|
+
export declare function ConfirmContainer(): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
2
|
+
export declare function toast(message: string, type?: ToastType, duration?: number): number;
|
|
3
|
+
export declare namespace toast {
|
|
4
|
+
var success: (msg: string, duration?: number) => number;
|
|
5
|
+
var error: (msg: string, duration?: number) => number;
|
|
6
|
+
var warning: (msg: string, duration?: number) => number;
|
|
7
|
+
var info: (msg: string, duration?: number) => number;
|
|
8
|
+
}
|
|
9
|
+
export declare function ToastContainer(): import('react').ReactPortal | null;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { default as EmTable } from './components/em-table';
|
|
2
|
+
export type { EmTableColumn, EmTableProps } from './components/em-table';
|
|
3
|
+
export { default as EmPagination } from './components/em-pagination';
|
|
4
|
+
export type { EmPaginationProps } from './components/em-pagination';
|
|
5
|
+
export { default as EmGrid } from './components/em-grid';
|
|
6
|
+
export { default as EmBox } from './components/em-box';
|
|
7
|
+
export type { TabItem as EmBoxTabItem } from './components/em-box';
|
|
8
|
+
export { default as EmModal } from './components/em-modal';
|
|
9
|
+
export type { EmModalProps } from './components/em-modal';
|
|
10
|
+
export { default as EmDrawer } from './components/em-drawer';
|
|
11
|
+
export type { EmDrawerProps } from './components/em-drawer';
|
|
12
|
+
export { default as EmButton } from './components/em-button';
|
|
13
|
+
export type { EmButtonProps } from './components/em-button';
|
|
14
|
+
export { default as EmInput } from './components/em-input';
|
|
15
|
+
export type { EmInputProps } from './components/em-input';
|
|
16
|
+
export { default as EmSelect } from './components/em-select';
|
|
17
|
+
export type { EmSelectOption, EmSelectProps } from './components/em-select';
|
|
18
|
+
export { Loading } from './components/ui/Loading';
|
|
19
|
+
export type { LoadingProps } from './components/ui/Loading';
|
|
20
|
+
export { toast, ToastContainer } from './components/ui/Toast';
|
|
21
|
+
export type { ToastType } from './components/ui/Toast';
|
|
22
|
+
export { alert, AlertContainer, confirm, ConfirmContainer } from './components/ui/Dialog';
|
|
23
|
+
export { cn } from './utils';
|