@zjpcy/simple-design 1.2.2 → 1.2.10

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 (58) hide show
  1. package/dist/cjs/index.css +1 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/es/Button/Button.js +1 -1
  4. package/dist/es/Checkbox/index.js +1 -0
  5. package/dist/es/Drawer/index.js +1 -0
  6. package/dist/es/Grid/index.js +1 -0
  7. package/dist/es/Grid/styles.js +1 -0
  8. package/dist/es/Hooks/useClickOutside.js +1 -0
  9. package/dist/es/Input/InputBase.js +1 -1
  10. package/dist/es/Input/Password.js +1 -0
  11. package/dist/es/Input/Textarea.js +1 -0
  12. package/dist/es/Input/index.js +1 -1
  13. package/dist/es/Layout/LayoutContext.js +1 -0
  14. package/dist/es/Layout/index.js +1 -0
  15. package/dist/es/Layout/styles.js +1 -0
  16. package/dist/es/Menu/index.js +1 -1
  17. package/dist/es/Popconfirm/index.js +1 -0
  18. package/dist/es/Progress/index.js +1 -0
  19. package/dist/es/Table/SortableRow.js +1 -0
  20. package/dist/es/Table/index.js +1 -1
  21. package/dist/es/Tag/index.js +1 -0
  22. package/dist/es/index.css +1 -1
  23. package/dist/es/index.js +1 -1
  24. package/dist/types/components/Button/Button.d.ts +3 -2
  25. package/dist/types/components/Drawer/index.d.ts +6 -0
  26. package/dist/types/components/Drawer/styles.d.ts +0 -0
  27. package/dist/types/components/Drawer/types.d.ts +71 -0
  28. package/dist/types/components/Grid/index.d.ts +14 -0
  29. package/dist/types/components/Grid/styles.d.ts +22 -0
  30. package/dist/types/components/Grid/types.d.ts +49 -0
  31. package/dist/types/components/Input/AutoComplete.d.ts +0 -0
  32. package/dist/types/components/Input/InputBase.d.ts +2 -0
  33. package/dist/types/components/Input/Password.d.ts +11 -0
  34. package/dist/types/components/Input/Textarea.d.ts +51 -0
  35. package/dist/types/components/Input/index.d.ts +6 -2
  36. package/dist/types/components/Layout/LayoutContext.d.ts +15 -0
  37. package/dist/types/components/Layout/index.d.ts +86 -0
  38. package/dist/types/components/Layout/styles.d.ts +40 -0
  39. package/dist/types/components/Layout/types.d.ts +112 -0
  40. package/dist/types/components/Menu/index.d.ts +8 -1
  41. package/dist/types/components/Menu/styles.d.ts +7 -0
  42. package/dist/types/components/Menu/types.d.ts +56 -7
  43. package/dist/types/components/Popconfirm/index.d.ts +6 -0
  44. package/dist/types/components/Popconfirm/styles.d.ts +0 -0
  45. package/dist/types/components/Popconfirm/types.d.ts +28 -0
  46. package/dist/types/components/Progress/index.d.ts +6 -0
  47. package/dist/types/components/Progress/styles.d.ts +0 -0
  48. package/dist/types/components/Progress/types.d.ts +38 -0
  49. package/dist/types/components/Table/SortableRow.d.ts +26 -0
  50. package/dist/types/components/Table/index.d.ts +5 -1
  51. package/dist/types/components/Tag/index.d.ts +6 -0
  52. package/dist/types/components/Tag/styles.d.ts +52 -0
  53. package/dist/types/components/Tag/types.d.ts +46 -0
  54. package/dist/types/components/index.d.ts +12 -2
  55. package/package.json +1 -1
  56. package/dist/es/Navigation/index.js +0 -1
  57. package/dist/types/components/Navigation/index.d.ts +0 -5
  58. package/dist/types/components/Navigation/types.d.ts +0 -43
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+ export type ProgressType = 'line' | 'circle' | 'dashboard';
3
+ export type ProgressStatus = 'success' | 'exception' | 'active' | 'normal';
4
+ export interface ProgressProps {
5
+ /** 百分比 */
6
+ percent?: number;
7
+ /** 类型 */
8
+ type?: ProgressType;
9
+ /** 状态 */
10
+ status?: ProgressStatus;
11
+ /** 是否显示百分比文字 */
12
+ showInfo?: boolean;
13
+ /** 自定义显示文字 */
14
+ format?: (percent?: number, successPercent?: number) => ReactNode;
15
+ /** 成功进度条颜色 */
16
+ strokeColor?: string;
17
+ /** 背景颜色 */
18
+ trailColor?: string;
19
+ /** 线条粗细 */
20
+ strokeWidth?: number;
21
+ /** 线条宽度,type=line 时生效 */
22
+ size?: 'small' | 'default' | 'large';
23
+ /** 是否开启动画 */
24
+ transition?: boolean;
25
+ /** 是否开启仪表盘样式 */
26
+ gapDegree?: number;
27
+ /** 仪表盘缺口位置 */
28
+ gapPosition?: 'top' | 'bottom' | 'left' | 'right';
29
+ /** 前缀图标 */
30
+ icon?: ReactNode;
31
+ /** 前缀文字 */
32
+ prefix?: string;
33
+ /** 后缀文字 */
34
+ suffix?: string;
35
+ className?: string;
36
+ style?: React.CSSProperties;
37
+ }
38
+ export default ProgressProps;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Column } from './index';
3
+ interface SortableRowProps {
4
+ id: string;
5
+ record: any;
6
+ rowIndex: number;
7
+ columns: Column[];
8
+ columnWidths: number[];
9
+ fixedLeftColumns: Column[];
10
+ fixedRightColumns: Column[];
11
+ normalColumns: Column[];
12
+ allColumns: Column[];
13
+ editingCell: {
14
+ rowIndex: number;
15
+ colKey: string;
16
+ } | null;
17
+ editingValue: string;
18
+ handleEdit: (rowIndex: number, colKey: string, value: any) => void;
19
+ handleSave: (record: any, column: Column) => void;
20
+ handleCancel: () => void;
21
+ setEditingValue: (value: string) => void;
22
+ renderTableCell: (column: Column, record: any, rowIndex: number, colIndex: number, colGroup: Column[]) => React.ReactNode;
23
+ children?: React.ReactNode;
24
+ }
25
+ declare const SortableRow: React.FC<SortableRowProps>;
26
+ export default SortableRow;
@@ -44,6 +44,10 @@ interface TableProps {
44
44
  loadingText?: ReactNode;
45
45
  /** 加载延迟时间(毫秒),设置后loading状态会在指定时间后自动取消 */
46
46
  loadingDelay?: number;
47
+ /** 是否开启行拖拽功能 */
48
+ draggable?: boolean;
49
+ /** 拖拽结束时的回调函数,返回新的数据顺序 */
50
+ onDragEnd?: (newData: any[]) => void;
47
51
  }
48
- declare const Table: ({ dataSource, columns, bordered, scroll, rowKey, className, pagination, empty, loading, loadingText, loadingDelay }: TableProps) => import("react/jsx-runtime").JSX.Element;
52
+ declare const Table: ({ dataSource, columns, bordered, scroll, rowKey, className, pagination, empty, loading, loadingText, loadingDelay, draggable, onDragEnd, }: TableProps) => import("react/jsx-runtime").JSX.Element;
49
53
  export default Table;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { TagProps } from './types';
3
+ import './Tag.css';
4
+ declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLSpanElement>>;
5
+ export default Tag;
6
+ export type { TagProps, TagSize } from './types';
@@ -0,0 +1,52 @@
1
+ import { CSSProperties } from 'react';
2
+ import { TagSize } from './types';
3
+ /**
4
+ * 获取标签尺寸对应的样式
5
+ */
6
+ export declare const getTagSizeStyle: (size: TagSize) => CSSProperties;
7
+ /**
8
+ * 获取标签颜色样式
9
+ */
10
+ export declare const getTagColorStyle: (backgroundColor?: string, color?: string) => CSSProperties;
11
+ /**
12
+ * 预设标签颜色
13
+ */
14
+ export declare const presetTagColors: {
15
+ readonly red: {
16
+ readonly backgroundColor: "#fff2f0";
17
+ readonly color: "#ff4d4f";
18
+ };
19
+ readonly orange: {
20
+ readonly backgroundColor: "#fff7e6";
21
+ readonly color: "#fa8c16";
22
+ };
23
+ readonly gold: {
24
+ readonly backgroundColor: "#fffbe6";
25
+ readonly color: "#faad14";
26
+ };
27
+ readonly green: {
28
+ readonly backgroundColor: "#f6ffed";
29
+ readonly color: "#52c41a";
30
+ };
31
+ readonly cyan: {
32
+ readonly backgroundColor: "#e6fffb";
33
+ readonly color: "#13c2c2";
34
+ };
35
+ readonly blue: {
36
+ readonly backgroundColor: "#e6f7ff";
37
+ readonly color: "#1890ff";
38
+ };
39
+ readonly purple: {
40
+ readonly backgroundColor: "#f9f0ff";
41
+ readonly color: "#722ed1";
42
+ };
43
+ readonly pink: {
44
+ readonly backgroundColor: "#fff0f6";
45
+ readonly color: "#eb2f96";
46
+ };
47
+ readonly gray: {
48
+ readonly backgroundColor: "#f5f5f5";
49
+ readonly color: "#666";
50
+ };
51
+ };
52
+ export type PresetTagColor = keyof typeof presetTagColors;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ export type TagSize = 'small' | 'medium' | 'large';
3
+ export interface TagProps {
4
+ /**
5
+ * 标签内容
6
+ */
7
+ children?: React.ReactNode;
8
+ /**
9
+ * 自定义类名
10
+ */
11
+ className?: string;
12
+ /**
13
+ * 自定义样式
14
+ */
15
+ style?: React.CSSProperties;
16
+ /**
17
+ * 标签尺寸
18
+ * @default 'medium'
19
+ */
20
+ size?: TagSize;
21
+ /**
22
+ * 自定义背景色
23
+ */
24
+ backgroundColor?: string;
25
+ /**
26
+ * 自定义字体颜色
27
+ */
28
+ color?: string;
29
+ /**
30
+ * 前缀图标,可以是 Icon 组件的 type 字符串或自定义 React 节点
31
+ */
32
+ icon?: string | React.ReactNode;
33
+ /**
34
+ * 是否可关闭
35
+ * @default false
36
+ */
37
+ closable?: boolean;
38
+ /**
39
+ * 关闭时的回调
40
+ */
41
+ onClose?: (e: React.MouseEvent) => void;
42
+ /**
43
+ * 点击标签时的回调
44
+ */
45
+ onClick?: (e: React.MouseEvent) => void;
46
+ }
@@ -7,7 +7,7 @@ export { default as Divider } from './Divider';
7
7
  export { default as Empty } from './Empty';
8
8
  export { default as Flex } from './Flex';
9
9
  export { default as Icon } from './Icon';
10
- export { default as Input } from './Input';
10
+ export { default as Input, Textarea } from './Input';
11
11
  export { default as Marquee } from './Marquee';
12
12
  export { default as Message, MessageProvider, useMessage, message } from './Message';
13
13
  export { default as Modal } from './Modal';
@@ -27,7 +27,6 @@ export { default as i18n } from '../i18n/index';
27
27
  export { default as Dropdown } from './Dropdown';
28
28
  export { default as Menu } from './Menu';
29
29
  export { default as Pagination } from './Pagination';
30
- export { default as Navigation } from './Navigation';
31
30
  export { default as Rate } from './Rate';
32
31
  export { default as Slider } from './Slider';
33
32
  export { default as Steps } from './Steps';
@@ -35,5 +34,16 @@ export { default as Switch } from './Switch';
35
34
  export { default as Tabs } from './Tabs';
36
35
  export { default as Transfer } from './Transfer';
37
36
  export { default as Label } from './Label';
37
+ export { default as Layout } from './Layout';
38
38
  export { default as Tooltip } from './Tooltip';
39
39
  export { default as Form } from './Form';
40
+ export { default as Grid, Row, Col } from './Grid';
41
+ export { default as Drawer } from './Drawer';
42
+ export type { DrawerProps, DrawerPlacement } from './Drawer';
43
+ export { default as Checkbox } from './Checkbox';
44
+ export { default as Tag } from './Tag';
45
+ export type { TagProps, TagSize } from './Tag';
46
+ export { default as Popconfirm } from './Popconfirm';
47
+ export type { PopconfirmProps, PopconfirmPlacement } from './Popconfirm';
48
+ export { default as Progress } from './Progress';
49
+ export type { ProgressProps, ProgressType, ProgressStatus } from './Progress';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjpcy/simple-design",
3
- "version": "1.2.02",
3
+ "version": "1.2.10",
4
4
  "description": "IDP Studio Design System - React Component Library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -1 +0,0 @@
1
- import{__assign as n,__spreadArray as e}from"../node_modules/tslib/tslib.es6.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import a,{useCallback as r,useState as c,useRef as l,useMemo as d,useEffect as s,startTransition as u}from"react";import v from"../Input/index.js";import h from"../Button/Button.js";var m=a.memo(function(n){var e,a=n.item,c=n.level,l=n.collapsed,d=n.mode,s=n.openKeySet,u=n.selectedKey,v=n.onItemClick,h=n.onToggleOpen,p=!!a.childrens&&a.childrens.length>0,f=s.has(a.key),g=u===a.key,y="horizontal"===d,k=0===c,N=r(function(n){n.stopPropagation(),v(a,a.key),!p||l&&!y||h(a.key,k)},[a,v,h,p,l,y,k]),w=y&&k||l?12:12+16*c,C=f&&(!l||y);return i("div",{className:"navigation-item-wrapper",children:[t("div",{className:"navigation-item ".concat(g?"selected":""," ").concat(a.disabled?"disabled":""),style:{paddingLeft:w},title:l?a.name:void 0,onClick:N,children:i("div",{className:"navigation-item-content",children:[a.icon&&t("span",{className:"navigation-item-icon",children:a.icon}),!l&&i(o,{children:[t("span",{className:"navigation-item-name",children:a.name}),a.description&&t("span",{className:"navigation-item-description",children:a.description})]}),p&&!l&&(!y||!k)&&t("span",{className:"navigation-item-arrow ".concat(C?"open":""),children:"▼"}),p&&y&&k&&t("span",{className:"navigation-item-arrow horizontal ".concat(C?"open":""),children:"▼"})]})}),p&&!l&&C&&t("div",{className:"navigation-children open".concat(y&&k?" horizontal":""),children:null===(e=a.childrens)||void 0===e?void 0:e.map(function(n){return t(m,{item:n,level:c+1,collapsed:l,mode:d,openKeySet:s,selectedKey:u,onItemClick:v,onToggleOpen:h},n.key)})})]})}),p=function(a){var p=a.items,f=a.selectedKey,g=a.collapsed,y=a.defaultOpenKeys,k=void 0===y?[]:y,N=a.mode,w=void 0===N?"vertical":N,C=a.closeOnOutsideClick,K=void 0===C||C,b=a.header,I=a.footer,L=a.onChange,S=a.onCollapseChange,D=a.className,M=void 0===D?"":D,O=a.style,z=a.width,j=void 0===z?280:z,E=a.collapsedWidth,P=void 0===E?48:E,x=a.animationDuration,T=void 0===x?300:x,B=c(k),A=B[0],W=B[1],_=c(""),q=_[0],F=_[1],G=c(null!=g&&g),H=G[0],J=G[1],Q=c(""),R=Q[0],U=Q[1],V=l(""),X=l(null),Y="horizontal"===w,Z=r(function(e,i){if(!i.trim())return e;var t=i.toLowerCase();return e.reduce(function(e,o){var a,r,c=o.key.toLowerCase().includes(t),l=o.name.toLowerCase().includes(t),d=null===(a=o.description)||void 0===a?void 0:a.toLowerCase().includes(t);return o.childrens&&o.childrens.length>0&&(r=Z(o.childrens,i)),(c||l||d||r&&r.length>0)&&e.push(n(n({},o),{childrens:r})),e},[])},[]),$=d(function(){return Z(p,R)},[p,R,Z]),nn=d(function(){var n=new Map,i=new Map,t=function(o,a){void 0===a&&(a=[]),o.forEach(function(o){var r=e(e([],a,!0),[o.key],!1);i.set(o.key,r),n.set(o.key,r[0]),o.childrens&&o.childrens.length>0&&t(o.childrens,r)})};return t(p),{rootMap:n,pathMap:i}},[p]),en=nn.rootMap,tn=nn.pathMap;s(function(){void 0!==f&&(V.current=f,F(f))},[f]),s(function(){void 0!==g&&J(g)},[g]);var on=r(function(n){return en.get(n)||n},[en]),an=d(function(){return!Y&&(void 0!==g?g:H)},[g,H,Y]),rn=d(function(){return new Set(A)},[A]),cn=d(function(){return(void 0!==f?f:q)||V.current},[f,q]),ln=d(function(){return cn?an?on(cn):cn:""},[an,on,cn]),dn=d(function(){if(!cn)return[];var n=tn.get(cn);return n?n.slice(0,-1):[]},[tn,cn]);s(function(){!cn||an||Y||W(function(n){var e=!1,i=new Set(n);return dn.forEach(function(n){i.has(n)||(i.add(n),e=!0)}),e?Array.from(i):n})},[cn,an,dn,Y]);var sn=r(function(n,i){u(function(){W(function(t){return Y&&i?t.includes(n)?[]:[n]:t.includes(n)?t.filter(function(e){return e!==n}):e(e([],t,!0),[n],!1)})})},[Y]),un=r(function(){var n=!an;void 0===g&&J(n),null==S||S(n)},[an,g,S]),vn=r(function(n){if(!n.disabled){V.current=n.key;var e=!!n.childrens&&n.childrens.length>0;Y&&!e&&W([]),void 0===f?(u(function(){F(n.key)}),null==L||L(n,n.key)):null==L||L(n,n.key)}},[f,L,Y,tn]),hn=d(function(){return Y?"100%":an?P:j},[an,j,P,Y]);return s(function(){if(Y&&K){var n=function(n){var e=n.target;X.current&&e&&!X.current.contains(e)&&W([])};return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}},[Y,K]),i("div",{ref:X,className:"idp-navigation ".concat(M," ").concat(an?"collapsed":""," ").concat(Y?"horizontal":""),style:n({width:hn,transition:"width ".concat(T,"ms ease")},O),children:[!Y&&null!==b&&!1!==b&&t("div",{className:"navigation-header",children:null!=b?b:t(o,{children:an?t(h,{onClick:un,className:"navigation-collapse-button",variant:"secondary",children:"→"}):i(o,{children:[i("div",{className:"navigation-header-row",children:[t("h2",{className:"navigation-title",children:"IDP Design"}),t(h,{onClick:un,className:"navigation-collapse-button",variant:"secondary",children:"←"})]}),t("div",{className:"navigation-search",children:t(v.Search,{placeholder:"搜索组件...",value:R,onChange:function(n){return U(n.target.value)},clear:!0})})]})})}),t("div",{className:"navigation-list",children:$.length>0?$.map(function(n){return t(m,{item:n,level:0,collapsed:an,mode:w,openKeySet:rn,selectedKey:ln,onItemClick:vn,onToggleOpen:sn},n.key)}):t("div",{className:"navigation-empty",children:t("span",{children:"未找到匹配的组件"})})}),!an&&!Y&&null!==I&&!1!==I&&t("div",{className:"navigation-footer",children:null!=I?I:i(o,{children:[t("p",{children:"IDP Design v1.0.0"}),t("p",{children:"IDP Studio"})]})})]})};export{p as default};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { NavigationProps } from './types';
3
- import './Navigation.css';
4
- declare const Navigation: React.FC<NavigationProps>;
5
- export default Navigation;
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- export interface NavigationItem {
3
- key: string;
4
- name: string;
5
- description?: string;
6
- icon?: React.ReactNode;
7
- childrens?: NavigationItem[];
8
- disabled?: boolean;
9
- }
10
- export type NavigationMode = 'vertical' | 'horizontal';
11
- export interface NavigationProps {
12
- items: NavigationItem[];
13
- selectedKey?: string;
14
- collapsed?: boolean;
15
- defaultOpenKeys?: string[];
16
- mode?: NavigationMode;
17
- closeOnOutsideClick?: boolean;
18
- header?: React.ReactNode;
19
- footer?: React.ReactNode;
20
- onChange?: (item: NavigationItem, key: string) => void;
21
- onCollapseChange?: (collapsed: boolean) => void;
22
- className?: string;
23
- style?: React.CSSProperties;
24
- width?: number;
25
- collapsedWidth?: number;
26
- animationDuration?: number;
27
- }
28
- export interface NavigationState {
29
- openKeys: string[];
30
- selectedKey: string;
31
- collapsed: boolean;
32
- }
33
- export interface NavigationContextType {
34
- openKeys: string[];
35
- selectedKey: string;
36
- collapsed: boolean;
37
- keyRef: React.RefObject<string>;
38
- clickNodeRef: React.RefObject<NavigationItem | null>;
39
- toggleOpenKey: (key: string) => void;
40
- setSelectedKey: (key: string) => void;
41
- toggleCollapsed: () => void;
42
- }
43
- export {};