@ccs-ui/rc-pro 1.0.0 → 1.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/es/auth/auth-button.d.ts +14 -0
- package/es/auth/auth-dropdown.d.ts +38 -0
- package/es/auth/index.d.ts +49 -0
- package/es/ccs.d.ts +25 -0
- package/es/ccs.js +4 -7
- package/es/color-picker/index.d.ts +15 -0
- package/es/config.d.ts +4 -0
- package/es/context/index.d.ts +46 -0
- package/es/date-picker/index.d.ts +21 -0
- package/es/drawer/buttons.d.ts +14 -0
- package/es/drawer/index.d.ts +10 -0
- package/es/drawer/open/content.d.ts +20 -0
- package/es/drawer/open/destory-fns.d.ts +2 -0
- package/es/drawer/open/form.d.ts +12 -0
- package/es/drawer/open/index.d.ts +18 -0
- package/es/full-screen/index.d.ts +6 -0
- package/es/hooks/use-event.d.ts +10 -0
- package/es/hooks/use-event.js +2 -0
- package/es/hooks/use-global.d.ts +4 -0
- package/es/hooks/use-once-event.d.ts +2 -0
- package/es/hooks/use-page.d.ts +8 -0
- package/es/hooks/use-tabs.d.ts +2 -0
- package/es/hooks/use-window.d.ts +4 -0
- package/es/index.d.ts +156 -0
- package/es/index.js +1 -1
- package/es/interval-button/index.d.ts +15 -0
- package/es/keep-alive-tabs/index.d.ts +11 -0
- package/es/keep-alive-tabs/page.d.ts +17 -0
- package/es/loading/index.d.ts +8 -0
- package/es/modal/buttons.d.ts +14 -0
- package/es/modal/index.d.ts +9 -0
- package/es/modal/open/destory-fns.d.ts +2 -0
- package/es/modal/open/drag.d.ts +2 -0
- package/es/modal/open/form.d.ts +12 -0
- package/es/modal/open/index.d.ts +19 -0
- package/es/pro-grid/context.d.ts +5 -0
- package/es/pro-grid/index.d.ts +27 -0
- package/es/pro-grid/useProGrid.d.ts +2 -0
- package/es/pro-table/index.d.ts +123 -0
- package/es/pro-table/search.d.ts +18 -0
- package/es/pro-tabs/index.d.ts +8 -0
- package/es/select/index.d.ts +25 -0
- package/es/table/index.d.ts +6 -0
- package/es/trigger/index.d.ts +60 -0
- package/es/types.d.ts +0 -0
- package/es/utils.d.ts +76 -0
- package/es/utils.js +5 -0
- package/es/virtual-list/index.d.ts +49 -0
- package/es/water-mark/index.d.ts +66 -0
- package/package.json +3 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type CcsAuthButtonProps = ButtonProps & {
|
|
4
|
+
auth: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
confirm?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 带权限的按钮组件、继承Ant Button所有属性
|
|
10
|
+
* @param CcsAuthButtonProps
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: ({ auth, text, confirm, onClick, ...restProps }: CcsAuthButtonProps) => React.JSX.Element;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MenuDividerType, MenuItemGroupType, MenuItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';
|
|
2
|
+
import { DropDownProps } from 'antd/lib/dropdown';
|
|
3
|
+
import { MenuInfo } from 'rc-menu/lib/interface';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
type ChildrenType = React.ReactNode;
|
|
6
|
+
type MenuItemAuthType = MenuItemType & {
|
|
7
|
+
auth?: string;
|
|
8
|
+
children?: DropdownMenuItemType[];
|
|
9
|
+
};
|
|
10
|
+
type SubMenuAuthType = SubMenuType & {
|
|
11
|
+
auth?: string;
|
|
12
|
+
children: DropdownMenuItemType[];
|
|
13
|
+
};
|
|
14
|
+
type MenuItemGroupAuthType = MenuItemGroupType & {
|
|
15
|
+
auth?: string;
|
|
16
|
+
children?: DropdownMenuItemType[];
|
|
17
|
+
};
|
|
18
|
+
type MenuDividerAuthType = MenuDividerType & {
|
|
19
|
+
auth?: string;
|
|
20
|
+
children?: DropdownMenuItemType[];
|
|
21
|
+
};
|
|
22
|
+
type DropdownMenuItemType = MenuItemAuthType | SubMenuAuthType | MenuItemGroupAuthType | MenuDividerAuthType;
|
|
23
|
+
interface CcsAuthDropdownProps extends Omit<DropDownProps, 'overlay' | 'children'> {
|
|
24
|
+
/** 权限标识 */
|
|
25
|
+
auth?: string;
|
|
26
|
+
/** dropdown 菜单数据 */
|
|
27
|
+
menus: DropdownMenuItemType[];
|
|
28
|
+
/** 自定义显示内容 */
|
|
29
|
+
children: ChildrenType;
|
|
30
|
+
/** 点击事件 */
|
|
31
|
+
onClick?: (info: MenuInfo) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 带权限的Dropdown组件
|
|
35
|
+
*/
|
|
36
|
+
declare const _default: ({ auth, menus, children, onClick, ...restProps }: CcsAuthDropdownProps) => React.ReactElement;
|
|
37
|
+
export default _default;
|
|
38
|
+
export { MenuItemAuthType, SubMenuAuthType, MenuItemGroupAuthType, MenuDividerAuthType, DropdownMenuItemType, CcsAuthDropdownProps, };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export interface ButtonItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
auth?: string;
|
|
7
|
+
type?: ButtonProps['type'];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
danger?: boolean;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
confirm?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CcsAuthGroupProps {
|
|
14
|
+
/** 按钮尺寸 */
|
|
15
|
+
size?: ButtonProps['size'];
|
|
16
|
+
/** 默认显示按钮数量 default:3 */
|
|
17
|
+
showCount?: number;
|
|
18
|
+
/** 全部显示成link样式 */
|
|
19
|
+
isLink?: boolean;
|
|
20
|
+
/** 按钮数据 */
|
|
21
|
+
items?: ButtonItem[];
|
|
22
|
+
/** 更多icon */
|
|
23
|
+
moreIcon?: ReactNode;
|
|
24
|
+
/** 更多文字 */
|
|
25
|
+
moreText?: string;
|
|
26
|
+
/** 点击事件 */
|
|
27
|
+
onClick?: (key: string) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface CcsAuthProps {
|
|
30
|
+
/** 权限标识 */
|
|
31
|
+
auth: string;
|
|
32
|
+
/** component children */
|
|
33
|
+
children: ReactElement;
|
|
34
|
+
}
|
|
35
|
+
export declare function ModalConfirm({ modalRef }: {
|
|
36
|
+
modalRef: any;
|
|
37
|
+
}): React.JSX.Element;
|
|
38
|
+
declare function CcsAuth({ auth, children }: CcsAuthProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
39
|
+
declare namespace CcsAuth {
|
|
40
|
+
var Group: typeof AuthGroup;
|
|
41
|
+
var Button: ({ auth, text, confirm, onClick, ...restProps }: ButtonProps & {
|
|
42
|
+
auth: string;
|
|
43
|
+
text?: string | undefined;
|
|
44
|
+
confirm?: string | undefined;
|
|
45
|
+
}) => React.JSX.Element;
|
|
46
|
+
var Dropdown: ({ auth, menus, children, onClick, ...restProps }: import("./auth-dropdown").CcsAuthDropdownProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
47
|
+
}
|
|
48
|
+
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick, }: CcsAuthGroupProps): React.JSX.Element | null;
|
|
49
|
+
export default CcsAuth;
|
package/es/ccs.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CcsGlobalConfigType } from './';
|
|
3
|
+
interface CcsCustomIconType {
|
|
4
|
+
name: 'TableFilter' | string;
|
|
5
|
+
node: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default class ccs {
|
|
8
|
+
/** 自定义按钮 */
|
|
9
|
+
static CustomIcon: CcsCustomIconType[];
|
|
10
|
+
/** 按钮权限 */
|
|
11
|
+
static UrlAuth: Record<string, string[]>;
|
|
12
|
+
/** 全局配置 */
|
|
13
|
+
static GlobalConfig: CcsGlobalConfigType;
|
|
14
|
+
/** 添加自定义icon */
|
|
15
|
+
static setCustomIcon(_icons: CcsCustomIconType[]): void;
|
|
16
|
+
/** 设置全局配置 */
|
|
17
|
+
static setGlobalConfig(e: CcsGlobalConfigType): void;
|
|
18
|
+
/** 添加权限数据 */
|
|
19
|
+
static setAuthList(e: string, auths: string[]): void;
|
|
20
|
+
/** 清空权限 */
|
|
21
|
+
static clearAuthList(): void;
|
|
22
|
+
/** 系统配置 */
|
|
23
|
+
static setDefaultConfig(config: any): any;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/es/ccs.js
CHANGED
|
@@ -21,13 +21,7 @@ var ccs = /*#__PURE__*/function () {
|
|
|
21
21
|
}
|
|
22
22
|
_createClass(ccs, null, [{
|
|
23
23
|
key: "setCustomIcon",
|
|
24
|
-
value: /**
|
|
25
|
-
|
|
26
|
-
/** 按钮权限 */
|
|
27
|
-
|
|
28
|
-
/** 全局配置 */
|
|
29
|
-
|
|
30
|
-
/** 添加自定义icon */
|
|
24
|
+
value: /** 添加自定义icon */
|
|
31
25
|
function setCustomIcon(_icons) {
|
|
32
26
|
console.log('_icons', _icons);
|
|
33
27
|
|
|
@@ -76,7 +70,10 @@ var ccs = /*#__PURE__*/function () {
|
|
|
76
70
|
}]);
|
|
77
71
|
return ccs;
|
|
78
72
|
}();
|
|
73
|
+
/** 自定义按钮 */
|
|
79
74
|
_defineProperty(ccs, "CustomIcon", []);
|
|
75
|
+
/** 按钮权限 */
|
|
80
76
|
_defineProperty(ccs, "UrlAuth", {});
|
|
77
|
+
/** 全局配置 */
|
|
81
78
|
_defineProperty(ccs, "GlobalConfig", {});
|
|
82
79
|
export { ccs as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface PropsType {
|
|
4
|
+
/** 指定选中项 */
|
|
5
|
+
value?: any;
|
|
6
|
+
/** 选择完成后的回调 */
|
|
7
|
+
onChange?: Function;
|
|
8
|
+
/** 内部样式 */
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 颜色选择组件
|
|
13
|
+
*/
|
|
14
|
+
declare const ColorPicker: ({ onChange, value, style }: PropsType) => React.JSX.Element;
|
|
15
|
+
export default ColorPicker;
|
package/es/config.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Store } from 'antd/es/form/interface';
|
|
2
|
+
import { Location } from 'history';
|
|
3
|
+
import { Tab } from 'rc-tabs/lib/interface';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { CcsUserDetailType } from '..';
|
|
6
|
+
interface TabProps {
|
|
7
|
+
/** 当前激活tab面板的key */
|
|
8
|
+
activeKey: string;
|
|
9
|
+
/** Tabs items */
|
|
10
|
+
items: Tab[];
|
|
11
|
+
/** tab间传递的参数 */
|
|
12
|
+
option: any;
|
|
13
|
+
}
|
|
14
|
+
interface TabsContextType extends TabProps {
|
|
15
|
+
option: any;
|
|
16
|
+
/** 改变tab间传递的参数 */
|
|
17
|
+
onChange: (tab: Partial<TabProps>) => void;
|
|
18
|
+
}
|
|
19
|
+
type PageContextType = {
|
|
20
|
+
/** ID */
|
|
21
|
+
id: string;
|
|
22
|
+
/** history Location */
|
|
23
|
+
location: Location;
|
|
24
|
+
/** 当前页面是否选中 */
|
|
25
|
+
isActive: boolean;
|
|
26
|
+
/** 销毁页面 */
|
|
27
|
+
onDestroy: (path: string) => void;
|
|
28
|
+
/** 获取按钮权限 */
|
|
29
|
+
onAuth: (code: string) => boolean;
|
|
30
|
+
};
|
|
31
|
+
interface GlobalContextPropsType {
|
|
32
|
+
userDetail: CcsUserDetailType;
|
|
33
|
+
children: React.ReactElement;
|
|
34
|
+
}
|
|
35
|
+
type GlobalContextType = Omit<GlobalContextPropsType, 'children'>;
|
|
36
|
+
interface FnContextType<T = Store> {
|
|
37
|
+
locationKey: string;
|
|
38
|
+
formInitialValues: T;
|
|
39
|
+
close: () => void;
|
|
40
|
+
}
|
|
41
|
+
declare const GlobalContext: React.Context<GlobalContextType>;
|
|
42
|
+
declare const DrawerAndModalContext: React.Context<FnContextType<any>>;
|
|
43
|
+
declare const PageContext: React.Context<PageContextType>;
|
|
44
|
+
declare const TabsContext: React.Context<TabsContextType>;
|
|
45
|
+
export type { TabProps, FnContextType, TabsContextType, GlobalContextPropsType, };
|
|
46
|
+
export { TabsContext, PageContext, GlobalContext, DrawerAndModalContext };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DatePickerProps } from 'antd';
|
|
2
|
+
import { PickerPanelDateProps } from 'antd/es/calendar/generateCalendar';
|
|
3
|
+
import { RangePickerProps } from 'antd/es/date-picker';
|
|
4
|
+
import { Dayjs } from 'dayjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
type CcsDatePickerProps = {
|
|
7
|
+
value?: string;
|
|
8
|
+
picker?: 'year' | 'month' | 'date';
|
|
9
|
+
onChange?: (e: string) => void;
|
|
10
|
+
} & Omit<PickerPanelDateProps<Dayjs>, 'value' | 'onChange' | 'picker'> & Omit<DatePickerProps, 'value' | 'onChange' | 'picker'>;
|
|
11
|
+
type CcsRangePickerProps = {
|
|
12
|
+
showTime?: boolean;
|
|
13
|
+
value?: [string, string];
|
|
14
|
+
picker?: 'year' | 'month' | 'date';
|
|
15
|
+
onChange?: (e: [string, string]) => void;
|
|
16
|
+
} & Omit<RangePickerProps, 'value' | 'onChange'>;
|
|
17
|
+
declare function CcsDatePicker({ value, onChange, ...restProps }: CcsDatePickerProps): React.JSX.Element;
|
|
18
|
+
declare namespace CcsDatePicker {
|
|
19
|
+
var RangPicker: ({ value, onChange, ...restProps }: CcsRangePickerProps) => React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default CcsDatePicker;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
/** 确定文字内容 */
|
|
5
|
+
okText?: string;
|
|
6
|
+
/** 确定按钮权限 */
|
|
7
|
+
okAuth?: string;
|
|
8
|
+
/** 加载中 */
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** 确定事件 */
|
|
11
|
+
onOk?: (value?: any) => void;
|
|
12
|
+
}
|
|
13
|
+
export default function DrawerButton({ children, okText, onOk, okAuth, loading, }: PropsType): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import DrawerBtns from './buttons';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import DrawerOpen from './open';
|
|
4
|
+
export declare const classPrefix = "ccs-drawer";
|
|
5
|
+
interface DrawerInterface {
|
|
6
|
+
Buttons: typeof DrawerBtns;
|
|
7
|
+
open: typeof DrawerOpen;
|
|
8
|
+
}
|
|
9
|
+
declare const Drawer: DrawerInterface;
|
|
10
|
+
export default Drawer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FormProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
interface PropsType {
|
|
4
|
+
/** url location key */
|
|
5
|
+
locationKey: string;
|
|
6
|
+
/** react children */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** ant form */
|
|
9
|
+
form?: FormProps;
|
|
10
|
+
/** close function */
|
|
11
|
+
close: () => void;
|
|
12
|
+
}
|
|
13
|
+
type ContextType = Pick<PropsType, 'children' | 'locationKey'>;
|
|
14
|
+
export declare function FnContext({ children, locationKey }: ContextType): React.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* 函数式打开无法获取全局context,需重新设置,但无法获取用户信息和history
|
|
17
|
+
* 为子组件添加form,子组件可以使用useFormInstance来获取form实例
|
|
18
|
+
*/
|
|
19
|
+
export default function FnContent({ form, children, locationKey, close, }: PropsType): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
interface PropsType {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
formProps: FormProps;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 添加form实例
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export default function DrawerForm({ children, formProps: { initialValues, labelCol, wrapperCol }, }: PropsType): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DrawerProps, FormProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type ConfigUpdate = DrawerProps | ((prevConfig: DrawerProps) => DrawerProps);
|
|
4
|
+
export type CcsDrawerProps = DrawerProps & {
|
|
5
|
+
/** 内容组件 */
|
|
6
|
+
content?: ReactNode;
|
|
7
|
+
/** 头部扩展 */
|
|
8
|
+
titleExtra?: ReactNode;
|
|
9
|
+
/** 返回文字 */
|
|
10
|
+
closeText?: string;
|
|
11
|
+
/** antd form */
|
|
12
|
+
form?: FormProps;
|
|
13
|
+
};
|
|
14
|
+
export default function DrawerFn(config: CcsDrawerProps): {
|
|
15
|
+
destroy: () => void;
|
|
16
|
+
update: (configUpdate: ConfigUpdate) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class EventInstance<T = any, ActionType = any> {
|
|
2
|
+
private subscriptions;
|
|
3
|
+
emit: (val: T, actionType?: ActionType) => void;
|
|
4
|
+
useSubscription: (callback: (val: T) => void, actionType?: ActionType) => T;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 组件消息订阅方式传值
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export default function Event<T = void, ActionType = any>(): EventInstance<T, ActionType>;
|
package/es/hooks/use-event.js
CHANGED
|
@@ -12,6 +12,7 @@ export var EventInstance = /*#__PURE__*/_createClass(function EventInstance() {
|
|
|
12
12
|
var _this = this;
|
|
13
13
|
_classCallCheck(this, EventInstance);
|
|
14
14
|
_defineProperty(this, "subscriptions", []);
|
|
15
|
+
// 发布通知
|
|
15
16
|
_defineProperty(this, "emit", function (val, actionType) {
|
|
16
17
|
_this.subscriptions.forEach(function (subscription) {
|
|
17
18
|
// 未传入actionType 全部执行
|
|
@@ -30,6 +31,7 @@ export var EventInstance = /*#__PURE__*/_createClass(function EventInstance() {
|
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
});
|
|
34
|
+
// 订阅
|
|
33
35
|
_defineProperty(this, "useSubscription", function (callback, actionType) {
|
|
34
36
|
var _this$subscriptions$f;
|
|
35
37
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { MenuProps } from 'antd';
|
|
2
|
+
import { ConfigProviderProps } from 'antd/lib/config-provider';
|
|
3
|
+
interface MenuTreeNodeData {
|
|
4
|
+
buttonUrlId: number;
|
|
5
|
+
createTime: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
menuCode: string;
|
|
8
|
+
menuDesc: string;
|
|
9
|
+
menuName: string;
|
|
10
|
+
menuType: number;
|
|
11
|
+
menuUrl: string;
|
|
12
|
+
parentMenuCode: string;
|
|
13
|
+
sortId: number;
|
|
14
|
+
state: number;
|
|
15
|
+
updateTime: string;
|
|
16
|
+
urlName: string;
|
|
17
|
+
urlPath: string;
|
|
18
|
+
}
|
|
19
|
+
interface MenuParentType {
|
|
20
|
+
key: string;
|
|
21
|
+
url: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
interface MenuTreeNode {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
nodeName: string;
|
|
27
|
+
icon: string;
|
|
28
|
+
leaf: boolean;
|
|
29
|
+
nodeData: MenuTreeNodeData;
|
|
30
|
+
children?: MenuTreeNode[];
|
|
31
|
+
topUrl?: string;
|
|
32
|
+
parents?: MenuParentType[];
|
|
33
|
+
}
|
|
34
|
+
interface CcsUserDetailType {
|
|
35
|
+
/** 头像 */
|
|
36
|
+
avatar?: string;
|
|
37
|
+
/** 用户名 */
|
|
38
|
+
workerName: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CcsGlobalConfigType {
|
|
41
|
+
/** app名称 */
|
|
42
|
+
AppName: string;
|
|
43
|
+
/** 主题色 */
|
|
44
|
+
BrandPrimary: string;
|
|
45
|
+
/** 菜单展开宽度 */
|
|
46
|
+
MenuExpandWidth: number;
|
|
47
|
+
/** 菜单收起宽度 */
|
|
48
|
+
MenuCollapsedWidth: number;
|
|
49
|
+
/** 启用tabs缓存页面 */
|
|
50
|
+
IsTabsPage: boolean;
|
|
51
|
+
/** 启用按钮权限 */
|
|
52
|
+
IsAuthButton: boolean;
|
|
53
|
+
/** ant 主题 */
|
|
54
|
+
theme: ConfigProviderProps['theme'];
|
|
55
|
+
/** 菜单类型,现在支持垂直、水平、和内嵌模式三种 */
|
|
56
|
+
MenuExpandMode: MenuProps['mode'];
|
|
57
|
+
/** 菜单始终收起状态? */
|
|
58
|
+
MenuCollapsed?: boolean;
|
|
59
|
+
/** 接口名称统一前缀 */
|
|
60
|
+
Api: string;
|
|
61
|
+
/** url上下文名称 */
|
|
62
|
+
Context: string;
|
|
63
|
+
/** 样式前缀 */
|
|
64
|
+
classPrefix?: string;
|
|
65
|
+
}
|
|
66
|
+
interface TableDataType<T> {
|
|
67
|
+
/** loading */
|
|
68
|
+
loading?: boolean;
|
|
69
|
+
/** 总条数 */
|
|
70
|
+
totalNum?: number;
|
|
71
|
+
/** 单页记录数 */
|
|
72
|
+
pageSize?: number;
|
|
73
|
+
/** 页码 */
|
|
74
|
+
pageNo?: number;
|
|
75
|
+
/** Array List 数据 */
|
|
76
|
+
result?: T[];
|
|
77
|
+
}
|
|
78
|
+
interface HttpResult<T = any> {
|
|
79
|
+
code: number;
|
|
80
|
+
success: boolean;
|
|
81
|
+
data: T;
|
|
82
|
+
msg: string;
|
|
83
|
+
}
|
|
84
|
+
interface PageType<T> {
|
|
85
|
+
hasNext: boolean;
|
|
86
|
+
totalNum: number;
|
|
87
|
+
pageNo: number;
|
|
88
|
+
pageSize: number;
|
|
89
|
+
result: T[];
|
|
90
|
+
}
|
|
91
|
+
interface HttpPageResult<T = any> extends Omit<HttpResult<T>, 'data'> {
|
|
92
|
+
data: PageType<T>;
|
|
93
|
+
}
|
|
94
|
+
interface HttpListResult<T = any> extends Omit<HttpResult<T>, 'data'> {
|
|
95
|
+
data: T[];
|
|
96
|
+
}
|
|
97
|
+
interface OrderProp {
|
|
98
|
+
ascending: boolean;
|
|
99
|
+
prop: string;
|
|
100
|
+
}
|
|
101
|
+
interface QueryLimit {
|
|
102
|
+
fetchSize: number;
|
|
103
|
+
startIndex: number;
|
|
104
|
+
}
|
|
105
|
+
interface PageQueryType<T = any> {
|
|
106
|
+
/** 查询的开始行数和取多少行,从0开始 */
|
|
107
|
+
limit?: QueryLimit;
|
|
108
|
+
/** 排序字段,一般前端不传,由后端指定 */
|
|
109
|
+
orderProps?: OrderProp[];
|
|
110
|
+
/** 页码 */
|
|
111
|
+
pageNo?: number;
|
|
112
|
+
/** 页长 */
|
|
113
|
+
pageSize?: number;
|
|
114
|
+
/** 查询条件 */
|
|
115
|
+
query: T;
|
|
116
|
+
}
|
|
117
|
+
interface ListQueryType<T = any> {
|
|
118
|
+
/** 查询的开始行数和取多少行,从0开始 */
|
|
119
|
+
limit?: QueryLimit;
|
|
120
|
+
/** 排序字段,一般前端不传,由后端指定 */
|
|
121
|
+
orderProps?: OrderProp[];
|
|
122
|
+
/** 查询条件 */
|
|
123
|
+
query: T;
|
|
124
|
+
}
|
|
125
|
+
type RecordType = Record<string, any>;
|
|
126
|
+
interface RouteHistoryType {
|
|
127
|
+
menuName: string;
|
|
128
|
+
pathName: string;
|
|
129
|
+
time: Date;
|
|
130
|
+
}
|
|
131
|
+
export { default as CcsAuth } from './auth';
|
|
132
|
+
export { default as CCS } from './ccs';
|
|
133
|
+
export { default as CcsColorPicker } from './color-picker';
|
|
134
|
+
export { default as CcsConfigProvider } from './config';
|
|
135
|
+
export { default as CcsDatePicker } from './date-picker';
|
|
136
|
+
export { default as CcsDrawer } from './drawer';
|
|
137
|
+
export { default as CcsFullScreenButton } from './full-screen';
|
|
138
|
+
export { default as useCcsGlobal } from './hooks/use-global';
|
|
139
|
+
export { default as useCcsOnceEvent } from './hooks/use-once-event';
|
|
140
|
+
export { default as useCcsPage } from './hooks/use-page';
|
|
141
|
+
export { default as useCcsTabs } from './hooks/use-tabs';
|
|
142
|
+
export { default as useCcsWindow } from './hooks/use-window';
|
|
143
|
+
export { default as CcsIntervalButton } from './interval-button';
|
|
144
|
+
export { default as CcsKeepAliveTabs } from './keep-alive-tabs';
|
|
145
|
+
export { default as CcsLoading } from './loading';
|
|
146
|
+
export { default as CcsModal } from './modal';
|
|
147
|
+
export { default as CcsProGrid } from './pro-grid';
|
|
148
|
+
export { default as CcsProTable } from './pro-table';
|
|
149
|
+
export { default as CcsProTabs } from './pro-tabs';
|
|
150
|
+
export { default as CcsApiSelect } from './select';
|
|
151
|
+
export { default as CcsTable } from './table';
|
|
152
|
+
export { default as CcsTrigger } from './trigger';
|
|
153
|
+
export { default as CcsUtils } from './utils';
|
|
154
|
+
export { default as CcsVirtualList } from './virtual-list';
|
|
155
|
+
export { default as CcsWaterMark } from './water-mark';
|
|
156
|
+
export type { PageType, HttpResult, RecordType, MenuTreeNode, PageQueryType, TableDataType, ListQueryType, HttpListResult, HttpPageResult, MenuTreeNodeData, CcsUserDetailType, RouteHistoryType, };
|
package/es/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export { default as CcsFullScreenButton } from "./full-screen";
|
|
|
10
10
|
export { default as useCcsGlobal } from "./hooks/use-global";
|
|
11
11
|
export { default as useCcsOnceEvent } from "./hooks/use-once-event";
|
|
12
12
|
export { default as useCcsPage } from "./hooks/use-page";
|
|
13
|
-
export { default as
|
|
13
|
+
export { default as useCcsTabs } from "./hooks/use-tabs";
|
|
14
14
|
export { default as useCcsWindow } from "./hooks/use-window";
|
|
15
15
|
export { default as CcsIntervalButton } from "./interval-button";
|
|
16
16
|
export { default as CcsKeepAliveTabs } from "./keep-alive-tabs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface PropsType extends ButtonProps {
|
|
4
|
+
/** 计时数 */
|
|
5
|
+
num: number;
|
|
6
|
+
/** 包含字符串`num`的文本内容 */
|
|
7
|
+
disabledText: string;
|
|
8
|
+
/** 缓存key */
|
|
9
|
+
cacheKey?: string;
|
|
10
|
+
}
|
|
11
|
+
export type IntervalInstance = {
|
|
12
|
+
start: () => void;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<IntervalInstance>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuTreeNode } from '../types';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface PropsType {
|
|
5
|
+
maxLen?: number;
|
|
6
|
+
menus: MenuTreeNode[];
|
|
7
|
+
className?: string;
|
|
8
|
+
history: any;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: ({ maxLen, history, menus, className }: PropsType) => React.JSX.Element;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Location } from 'history';
|
|
2
|
+
import React, { JSXElementConstructor, ReactElement } from 'react';
|
|
3
|
+
export interface CachePageProps {
|
|
4
|
+
/** 选中状态 */
|
|
5
|
+
active: boolean;
|
|
6
|
+
/** router location */
|
|
7
|
+
location: Location;
|
|
8
|
+
/** 时间戳 */
|
|
9
|
+
timestamp: number;
|
|
10
|
+
/** 按钮权限列表 */
|
|
11
|
+
urlAuthList: string[];
|
|
12
|
+
children: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
13
|
+
/** 销毁页面 */
|
|
14
|
+
onDestroy: (path: string) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.MemoExoticComponent<(props: CachePageProps) => React.JSX.Element>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
loadingTip?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const LoadingComponent: ({ loading, loadingTip, children, }: PropsType) => React.JSX.Element | null;
|
|
8
|
+
export default LoadingComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface PropsType {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
/** 确定文字内容 */
|
|
5
|
+
okText?: string;
|
|
6
|
+
/** 确定按钮权限 */
|
|
7
|
+
okAuth?: string;
|
|
8
|
+
/** 加载中 */
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** 确定事件 */
|
|
11
|
+
onOk?: (value?: any) => void;
|
|
12
|
+
}
|
|
13
|
+
export default function ModalButtons({ children, okText, okAuth, onOk, loading, }: PropsType): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
interface PropsType {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
formProps: FormProps;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 添加form实例
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export default function ModalForm({ children, formProps: { labelCol, wrapperCol, ...restProps }, }: PropsType): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormProps, ModalProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare const classPrefix = "ccs-modal";
|
|
4
|
+
type ConfigUpdate = ModalProps | ((prevConfig: ModalProps) => ModalProps);
|
|
5
|
+
export type CcsModalProps = ModalProps & {
|
|
6
|
+
/** 可拖拽 */
|
|
7
|
+
isDrag?: boolean;
|
|
8
|
+
/** 内容组件 */
|
|
9
|
+
content?: ReactNode;
|
|
10
|
+
/** 返回文字 */
|
|
11
|
+
closeText?: string;
|
|
12
|
+
/** antd form */
|
|
13
|
+
form?: FormProps;
|
|
14
|
+
};
|
|
15
|
+
export default function ModalOpen(config: CcsModalProps): {
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
update: (configUpdate: ConfigUpdate) => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface ClassProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
interface GridProps extends ClassProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
titleStyle?: CSSProperties;
|
|
10
|
+
titleExtra?: ReactNode;
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
hideTitle?: boolean;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
interface ColProps extends ClassProps {
|
|
16
|
+
title?: string;
|
|
17
|
+
titleStyle?: CSSProperties;
|
|
18
|
+
titleExtra?: ReactNode;
|
|
19
|
+
colSpan?: string | number;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
interface GridInstance extends FC<GridProps> {
|
|
23
|
+
Col: typeof GridCol;
|
|
24
|
+
}
|
|
25
|
+
declare const GridCol: ({ colSpan, children, title, titleStyle, titleExtra, className, style, }: ColProps) => React.JSX.Element;
|
|
26
|
+
declare const ProGrid: GridInstance;
|
|
27
|
+
export default ProGrid;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { TableProps } from 'antd';
|
|
2
|
+
import { Rule } from 'antd/es/form';
|
|
3
|
+
import React, { CSSProperties, MutableRefObject, ReactElement, ReactNode, ReactText } from 'react';
|
|
4
|
+
import './index.less';
|
|
5
|
+
type ParamType = Record<string, any>;
|
|
6
|
+
export type ShowDependType = {
|
|
7
|
+
name: string;
|
|
8
|
+
value: any;
|
|
9
|
+
};
|
|
10
|
+
type SearchEventType = 'search' | 'reset' | 'reload' | 'changePage' | 'initSearch';
|
|
11
|
+
interface SearchBeforeType extends ParamType {
|
|
12
|
+
query: ParamType;
|
|
13
|
+
}
|
|
14
|
+
interface TableDataType<T> {
|
|
15
|
+
/** loading */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** 总条数 */
|
|
18
|
+
totalNum?: number;
|
|
19
|
+
/** 单页记录数 */
|
|
20
|
+
pageSize?: number;
|
|
21
|
+
/** 页码 */
|
|
22
|
+
pageNo?: number;
|
|
23
|
+
/** Array List 数据 */
|
|
24
|
+
result?: T[];
|
|
25
|
+
}
|
|
26
|
+
export interface ProTableInstance<T = any> {
|
|
27
|
+
/** 获取form表单数据 */
|
|
28
|
+
formValues: Record<string, any>;
|
|
29
|
+
/** 获取当前表单数据 */
|
|
30
|
+
data: TableDataType<T>;
|
|
31
|
+
/** 查询数据,根据条件,从第一页开始显示 */
|
|
32
|
+
onSearch: () => void;
|
|
33
|
+
/** 刷新数据、根据条件,当前页 */
|
|
34
|
+
onReload: () => void;
|
|
35
|
+
/** 异步树、局部刷新方法 */
|
|
36
|
+
onPartialReload: (id: ReactText) => void;
|
|
37
|
+
/** 重置数据,清空选择 */
|
|
38
|
+
onReset: () => void;
|
|
39
|
+
/** 改变data 数据 */
|
|
40
|
+
onChangeData: React.Dispatch<React.SetStateAction<TableDataType<T>>>;
|
|
41
|
+
}
|
|
42
|
+
export interface FormItemType {
|
|
43
|
+
/** label 标题 */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** form name */
|
|
46
|
+
name: string;
|
|
47
|
+
/** form item element */
|
|
48
|
+
value: ReactElement;
|
|
49
|
+
/** 主条件 */
|
|
50
|
+
isMain?: boolean;
|
|
51
|
+
/** 数据依赖、依赖项对应的name数组 */
|
|
52
|
+
depends?: string[];
|
|
53
|
+
/** 显示依赖 */
|
|
54
|
+
showDepends?: ShowDependType[];
|
|
55
|
+
/** 必填规则 */
|
|
56
|
+
rules?: Rule[];
|
|
57
|
+
/** 格式化值 */
|
|
58
|
+
onFormat?: (e: any) => any;
|
|
59
|
+
}
|
|
60
|
+
interface CcsTableProps<T> extends TableProps<T> {
|
|
61
|
+
data?: TableDataType<T>;
|
|
62
|
+
/** request 方法 */
|
|
63
|
+
request?: (params: any) => void;
|
|
64
|
+
/** request 额外参数 */
|
|
65
|
+
requestParam?: ParamType;
|
|
66
|
+
/** 自定义渲染内容 */
|
|
67
|
+
render?: (data: T[]) => ReactNode;
|
|
68
|
+
/** 异步树、父级参数名称 */
|
|
69
|
+
asyncTree?: {
|
|
70
|
+
parentName: string;
|
|
71
|
+
};
|
|
72
|
+
/** class name */
|
|
73
|
+
className?: string;
|
|
74
|
+
/** useEventEmitter事件 */
|
|
75
|
+
event$?: any;
|
|
76
|
+
style?: CSSProperties;
|
|
77
|
+
}
|
|
78
|
+
export type ProTableInstanceRef<T = any> = MutableRefObject<ProTableInstance<T> | undefined> | React.RefObject<ProTableInstance<T>>;
|
|
79
|
+
export interface CcsProTableProps<T> {
|
|
80
|
+
/** api权限标识 */
|
|
81
|
+
auth?: string | 'ignore';
|
|
82
|
+
/** 标题 */
|
|
83
|
+
title?: string;
|
|
84
|
+
/** 是否初始查询,默认true */
|
|
85
|
+
init?: boolean;
|
|
86
|
+
/** loading */
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
/** 查询条件集合 */
|
|
89
|
+
formItems?: FormItemType[];
|
|
90
|
+
/** 执行search 后回调函数 */
|
|
91
|
+
searchEvent?: () => void;
|
|
92
|
+
/** 查询form 初始值 */
|
|
93
|
+
formInitValues?: ParamType;
|
|
94
|
+
/** 按钮 操作部分 */
|
|
95
|
+
toolbar?: ReactElement;
|
|
96
|
+
/** table 数据区域 */
|
|
97
|
+
table?: CcsTableProps<T>;
|
|
98
|
+
/** table style */
|
|
99
|
+
tableStyle?: CSSProperties;
|
|
100
|
+
/** 水印文字 */
|
|
101
|
+
watermark?: string;
|
|
102
|
+
/** ref 回调方法 */
|
|
103
|
+
proRef?: ProTableInstanceRef<T>;
|
|
104
|
+
/** class */
|
|
105
|
+
className?: string;
|
|
106
|
+
/** style */
|
|
107
|
+
style?: CSSProperties;
|
|
108
|
+
/** children */
|
|
109
|
+
children?: ReactNode;
|
|
110
|
+
/** 请求前格式化参数 */
|
|
111
|
+
onSearchBefore?: (params: SearchBeforeType, eventType?: SearchEventType) => SearchBeforeType;
|
|
112
|
+
/** 请求后格式化结果 */
|
|
113
|
+
onSearchAfter?: (data: any, eventType?: SearchEventType) => any;
|
|
114
|
+
}
|
|
115
|
+
export declare const classPrefix = "ccs-pl";
|
|
116
|
+
/**
|
|
117
|
+
* 布局组件 包括form、查询、toolbar、table 自动初始化数据
|
|
118
|
+
* @param CcsProTableType
|
|
119
|
+
* @param ref
|
|
120
|
+
* @returns
|
|
121
|
+
*/
|
|
122
|
+
declare const ProTable: <T extends object = any>(props: CcsProTableProps<T>) => React.JSX.Element;
|
|
123
|
+
export default ProTable;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventEmitter } from 'ahooks/lib/useEventEmitter';
|
|
2
|
+
import { FormInstance } from 'antd/lib/form';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { CcsProTableType } from './';
|
|
5
|
+
interface PropsType<T> extends Pick<CcsProTableType<T>, 'toolbar' | 'formItems' | 'formInitValues'> {
|
|
6
|
+
columns?: any;
|
|
7
|
+
/** 更多查询条件 */
|
|
8
|
+
hasMore?: boolean;
|
|
9
|
+
/** 弹框中显示 */
|
|
10
|
+
isInModalOrDrawer: boolean;
|
|
11
|
+
form: FormInstance<any>;
|
|
12
|
+
onReset: () => void;
|
|
13
|
+
onSearch: () => void;
|
|
14
|
+
event$: EventEmitter<any>;
|
|
15
|
+
}
|
|
16
|
+
/** 操作按钮、查询,重置、列筛选、 */
|
|
17
|
+
declare function SearchComponent<T>({ form, toolbar, columns, hasMore, formItems, formInitValues, isInModalOrDrawer, event$, onReset, onSearch, }: PropsType<T>): React.JSX.Element;
|
|
18
|
+
export default SearchComponent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HttpResult, RecordType } from '..';
|
|
4
|
+
type CacheType = {
|
|
5
|
+
/** 缓存key,同一个key将共享数据 */
|
|
6
|
+
cacheKey?: string;
|
|
7
|
+
/** 设置数据保持新鲜时间,在该时间内,我们认为数据是新鲜的,不会重新发起请求 */
|
|
8
|
+
staleTime?: number;
|
|
9
|
+
/** 设置数据缓存时间,超过该时间,我们会清空该条缓存数据 */
|
|
10
|
+
cacheTime?: number;
|
|
11
|
+
};
|
|
12
|
+
type CcsSelectProps = SelectProps & {
|
|
13
|
+
cache?: CacheType;
|
|
14
|
+
/** 依赖参数 */
|
|
15
|
+
defaultParams?: RecordType;
|
|
16
|
+
/** 查询请求 */
|
|
17
|
+
onQuery?: (dependParams?: RecordType) => Promise<HttpResult<any[]>>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 基于接口查询的select组件
|
|
21
|
+
* @param CcsSelectProps
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export default function CcsApiSelect({ onQuery, cache, defaultParams, ...restProps }: CcsSelectProps): React.JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CcsProTableProps } from '../types';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export type CcsTableProps<T> = Omit<CcsProTableProps<T>, 'request' | 'requestParam' | 'fillSpace'>;
|
|
5
|
+
declare const CustomTable: <T extends object = any>(props: CcsTableProps<T>) => React.JSX.Element;
|
|
6
|
+
export default CustomTable;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactElement } from 'react';
|
|
2
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface CcsTriggerChildrenProps<T = any> {
|
|
5
|
+
/** 选中值 */
|
|
6
|
+
value?: T;
|
|
7
|
+
/** 选择框loading状态 */
|
|
8
|
+
onLoading?: (loading: boolean) => void;
|
|
9
|
+
/** 关闭弹框 */
|
|
10
|
+
onVisible?: (visible: boolean) => void;
|
|
11
|
+
/** 选中值改变事件 */
|
|
12
|
+
onChange?: ({}: T) => void;
|
|
13
|
+
/** 选择框显示名称 */
|
|
14
|
+
onChangeLabel?: (text: string | undefined) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface CcsTriggerPropsType {
|
|
17
|
+
/** 下拉框宽度 */
|
|
18
|
+
width?: number;
|
|
19
|
+
/** 下拉框高度 */
|
|
20
|
+
height?: number;
|
|
21
|
+
/**
|
|
22
|
+
* @description input size:'small' | 'middle' | 'large'
|
|
23
|
+
* @default 'middle'
|
|
24
|
+
*/
|
|
25
|
+
size?: SizeType;
|
|
26
|
+
/**
|
|
27
|
+
* @description 禁用选择
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** 选择内容 */
|
|
32
|
+
children?: ReactElement;
|
|
33
|
+
/** Form.Item value */
|
|
34
|
+
value?: any;
|
|
35
|
+
/** style */
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
/** class */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** input placeholder */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 是否在首次显示前渲染弹出内容
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
forceRender?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @description popup挂载的html节点,默认:document.body、true:当前dom
|
|
48
|
+
* @default document.body
|
|
49
|
+
*/
|
|
50
|
+
popupContainer?: boolean;
|
|
51
|
+
/** Form.Item onChange */
|
|
52
|
+
onChange?: (value?: any) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 适用于Form.Item中的 trigger组件,其内容自行定义,遵循ant form 自定义组件规范
|
|
56
|
+
* @param CcsTriggerPropsType
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
declare const TriggerComponent: (props: CcsTriggerPropsType) => React.JSX.Element;
|
|
60
|
+
export default TriggerComponent;
|
package/es/types.d.ts
ADDED
|
File without changes
|
package/es/utils.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { HttpResult } from './';
|
|
3
|
+
interface DayjsType extends dayjs.Dayjs {
|
|
4
|
+
fromNow(withoutSuffix?: boolean): string;
|
|
5
|
+
from(compared: dayjs.ConfigType, withoutSuffix?: boolean): string;
|
|
6
|
+
toNow(withoutSuffix?: boolean): string;
|
|
7
|
+
to(compared: dayjs.ConfigType, withoutSuffix?: boolean): string;
|
|
8
|
+
}
|
|
9
|
+
export default class utils {
|
|
10
|
+
static isFunction(obj: any): obj is Function;
|
|
11
|
+
static getStroage(key: string): Promise<unknown>;
|
|
12
|
+
static setStroage(key: string, value: any): Promise<any>;
|
|
13
|
+
static removeStroage(key: string): Promise<void>;
|
|
14
|
+
static showLogWarning(message: string): void;
|
|
15
|
+
static showWarning(valid: boolean, message: string): void;
|
|
16
|
+
static isNode: boolean;
|
|
17
|
+
static isBrowser(): boolean;
|
|
18
|
+
static dayjs(date?: string | number | Date | dayjs.Dayjs | null | undefined): DayjsType;
|
|
19
|
+
/**
|
|
20
|
+
* 空判断
|
|
21
|
+
* @param val
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
static isEmpty: (val: unknown) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 非空
|
|
27
|
+
* @param val
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
static isNotEmpty: (val: unknown) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* json转base64
|
|
33
|
+
* @param value
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
static jsonToBase64(value: any): string;
|
|
37
|
+
/**
|
|
38
|
+
* base64转json
|
|
39
|
+
* @param value
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
static base64ToJson<T = any>(value: string): T | null;
|
|
43
|
+
/**
|
|
44
|
+
* JSON.parse
|
|
45
|
+
* @param value
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
static jsonParse<T = any>(value: string): T;
|
|
49
|
+
/**
|
|
50
|
+
* string to HEX
|
|
51
|
+
* @param {*} str
|
|
52
|
+
*/
|
|
53
|
+
static stringToHex(str: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* http result msg
|
|
56
|
+
* @param result
|
|
57
|
+
* @param successText
|
|
58
|
+
* @param failText
|
|
59
|
+
*/
|
|
60
|
+
static messageInfo(result: HttpResult, successText?: string, failText?: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* string to dayjs
|
|
63
|
+
* @param val
|
|
64
|
+
* @param formartType // YYYY-MM-DD HH:mm:ss https://dayjs.fenxianglu.cn/category/display.html#%E6%A0%BC%E5%BC%8F%E5%8C%96
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
static dayjsFmt(val: string | undefined, formartType?: string): dayjs.Dayjs | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* 确认提示框
|
|
70
|
+
* @param title
|
|
71
|
+
* @param content
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
static showConfirm: (title: string, content?: string) => Promise<unknown>;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
package/es/utils.js
CHANGED
|
@@ -180,6 +180,11 @@ _defineProperty(utils, "isNode", typeof process !== 'undefined' && process.versi
|
|
|
180
180
|
_defineProperty(utils, "isEmpty", function (val) {
|
|
181
181
|
return _empty(val);
|
|
182
182
|
});
|
|
183
|
+
/**
|
|
184
|
+
* 非空
|
|
185
|
+
* @param val
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
183
188
|
_defineProperty(utils, "isNotEmpty", function (val) {
|
|
184
189
|
return !utils.isEmpty(val);
|
|
185
190
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode, RefObject } from 'react';
|
|
2
|
+
interface Position {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RowRendererProps {
|
|
7
|
+
rowHeight: number;
|
|
8
|
+
index: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VirtualInstance {
|
|
11
|
+
scrollTop: (top: number) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface VirtualListProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
/** 容器高度 */
|
|
17
|
+
height?: number;
|
|
18
|
+
/** 记录条数 */
|
|
19
|
+
rowCount: number;
|
|
20
|
+
/** 行高 */
|
|
21
|
+
rowHeight: number;
|
|
22
|
+
/** 自动隐藏滚动条 default true */
|
|
23
|
+
autoHideScroll?: boolean;
|
|
24
|
+
/** 显示条数 */
|
|
25
|
+
overscanRowCount: number;
|
|
26
|
+
/** 条数改变定位顶部 */
|
|
27
|
+
rowCountChangeScrollTop?: boolean;
|
|
28
|
+
/** instance */
|
|
29
|
+
virtualRef?: RefObject<VirtualInstance>;
|
|
30
|
+
/** 渲染row */
|
|
31
|
+
rowRenderer: ({ rowHeight, index }: RowRendererProps) => ReactNode;
|
|
32
|
+
/** scroll event */
|
|
33
|
+
onScroll?: (position: Position) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface VirtualListItemProps extends Pick<VirtualListProps, 'rowHeight' | 'rowRenderer'> {
|
|
36
|
+
index: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ListItemProps {
|
|
39
|
+
prefix: ReactNode;
|
|
40
|
+
title: ReactNode;
|
|
41
|
+
extra?: ReactNode;
|
|
42
|
+
extraIcon?: ReactNode;
|
|
43
|
+
height: number;
|
|
44
|
+
className?: string;
|
|
45
|
+
description?: ReactNode;
|
|
46
|
+
onClick?: () => void;
|
|
47
|
+
}
|
|
48
|
+
declare const VirtualList: ({ height, rowCount, rowHeight, className, style, virtualRef, onScroll, rowRenderer, autoHideScroll, overscanRowCount, rowCountChangeScrollTop, }: VirtualListProps) => React.JSX.Element;
|
|
49
|
+
export default VirtualList;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type WaterMarkProps = {
|
|
3
|
+
/** 水印文字内容 */
|
|
4
|
+
content?: string;
|
|
5
|
+
/** 类名 */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** 样式 */
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
/** 水印样式 */
|
|
10
|
+
markStyle?: React.CSSProperties;
|
|
11
|
+
/** 水印类名 */
|
|
12
|
+
markClassName?: string;
|
|
13
|
+
/** 水印之间的水平间距 */
|
|
14
|
+
gapX?: number;
|
|
15
|
+
/** 水印之间的垂直间距 */
|
|
16
|
+
gapY?: number;
|
|
17
|
+
/** 追加的水印元素的z-index */
|
|
18
|
+
zIndex?: number;
|
|
19
|
+
/** 水印的宽度 */
|
|
20
|
+
width?: number;
|
|
21
|
+
/** 水印的高度 */
|
|
22
|
+
height?: number;
|
|
23
|
+
/** 水印在canvas 画布上绘制的垂直偏移量,正常情况下,水印绘制在中间位置, 即 offsetTop = gapY / 2 */
|
|
24
|
+
offsetTop?: number;
|
|
25
|
+
/** 水印在canvas 画布上绘制的水平偏移量, 正常情况下,水印绘制在中间位置, 即 offsetTop = gapX / 2 */
|
|
26
|
+
offsetLeft?: number;
|
|
27
|
+
/** 水印绘制时,旋转的角度,单位 ° */
|
|
28
|
+
rotate?: number;
|
|
29
|
+
/** ClassName 前缀 */
|
|
30
|
+
prefixCls?: string;
|
|
31
|
+
/** 高清印图片源, 为了高清屏幕显示,建议使用 2倍或3倍图,优先使用图片渲染水印。 */
|
|
32
|
+
image?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @description 文字颜色
|
|
35
|
+
* @default rgba(0,0,0,.15)
|
|
36
|
+
*/
|
|
37
|
+
fontColor?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @description 文字样式
|
|
40
|
+
* @default normal
|
|
41
|
+
*/
|
|
42
|
+
fontStyle?: 'none' | 'normal' | 'italic' | 'oblique';
|
|
43
|
+
/**
|
|
44
|
+
* @description 文字族
|
|
45
|
+
* @default sans-serif
|
|
46
|
+
*/
|
|
47
|
+
fontFamily?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description 文字粗细
|
|
50
|
+
* @default normal
|
|
51
|
+
*/
|
|
52
|
+
fontWeight?: 'normal' | 'light' | 'weight' | number;
|
|
53
|
+
/**
|
|
54
|
+
* @description 文字大小
|
|
55
|
+
* @default 16
|
|
56
|
+
*/
|
|
57
|
+
fontSize?: number | string;
|
|
58
|
+
children?: React.ReactElement;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 水印组件
|
|
62
|
+
* @param WaterMarkProps
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
declare const WaterMarkComponent: (props: WaterMarkProps) => React.JSX.Element;
|
|
66
|
+
export default WaterMarkComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
20
20
|
"prepare": "husky install && dumi setup",
|
|
21
21
|
"prepublishOnly": "father doctor && npm run build",
|
|
22
|
-
"publish-beta": "father build && npm publish --tag=beta && cnpm sync
|
|
22
|
+
"publish-beta": "father build && npm publish --tag=beta && cnpm sync@ccs-ui/rc-pro",
|
|
23
23
|
"publish-prod": "father build && npm publish && cnpm sync @ccs-ui/rc-pro",
|
|
24
24
|
"start": "npm run dev",
|
|
25
25
|
"sync": "cnpm sync @ccs-ui/rc-pro"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@ant-design/icons": "^5.1.4",
|
|
51
|
-
"@ccs-ui/rc-pro": "1.0.0
|
|
51
|
+
"@ccs-ui/rc-pro": "^1.0.0",
|
|
52
52
|
"ahooks": "^3.7.7",
|
|
53
53
|
"antd": "^5.5.2",
|
|
54
54
|
"classnames": "^2.3.2",
|