@zjpcy/simple-design 1.2.1 → 1.2.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.
@@ -0,0 +1,87 @@
1
+ import { CSSProperties, ReactNode, MutableRefObject } from 'react';
2
+ export interface FormProps {
3
+ children?: ReactNode;
4
+ className?: string;
5
+ style?: CSSProperties;
6
+ layout?: 'horizontal' | 'vertical' | 'inline';
7
+ labelSpan?: number;
8
+ wrapperSpan?: number;
9
+ initialValues?: Record<string, any>;
10
+ onFinish?: (values: Record<string, any>) => void;
11
+ onFinishFailed?: (errorInfo: any) => void;
12
+ colon?: boolean;
13
+ requiredMark?: boolean | 'optional';
14
+ styles?: {
15
+ wrapper?: CSSProperties;
16
+ item?: CSSProperties;
17
+ label?: CSSProperties;
18
+ };
19
+ formRef?: MutableRefObject<FormInstance | null>;
20
+ form?: FormInstance;
21
+ }
22
+ export interface FormItemProps {
23
+ name?: string;
24
+ label?: ReactNode;
25
+ required?: boolean;
26
+ rules?: Rule[];
27
+ className?: string;
28
+ style?: CSSProperties;
29
+ help?: ReactNode;
30
+ validateStatus?: 'success' | 'warning' | 'error' | 'validating';
31
+ colon?: boolean;
32
+ labelSpan?: number;
33
+ wrapperSpan?: number;
34
+ hidden?: boolean;
35
+ tooltip?: ReactNode;
36
+ extra?: ReactNode;
37
+ styles?: {
38
+ wrapper?: CSSProperties;
39
+ label?: CSSProperties;
40
+ input?: CSSProperties;
41
+ error?: CSSProperties;
42
+ help?: CSSProperties;
43
+ };
44
+ children?: ReactNode;
45
+ }
46
+ export interface Rule {
47
+ required?: boolean;
48
+ message?: string;
49
+ pattern?: RegExp;
50
+ min?: number;
51
+ max?: number;
52
+ len?: number;
53
+ type?: 'string' | 'number' | 'boolean' | 'method' | 'regexp' | 'integer' | 'float' | 'array' | 'object' | 'enum' | 'date' | 'url' | 'hex' | 'email';
54
+ validator?: (rule: Rule, value: any) => Promise<void> | void;
55
+ whitespace?: boolean;
56
+ enum?: any[];
57
+ }
58
+ export interface FormContextType {
59
+ layout: 'horizontal' | 'vertical' | 'inline';
60
+ labelSpan?: number;
61
+ wrapperSpan?: number;
62
+ colon: boolean;
63
+ requiredMark: boolean | 'optional';
64
+ values: Record<string, any>;
65
+ errors: Record<string, string>;
66
+ setFieldValue: (name: string, value: any) => void;
67
+ getFieldValue: (name: string) => any;
68
+ setFieldValueList: (values: Record<string, any>) => void;
69
+ validateField: (name: string) => Promise<void>;
70
+ validateFields: (names?: string[]) => Promise<Record<string, any>>;
71
+ resetFields: (names?: string[]) => void;
72
+ }
73
+ export interface FormInstance {
74
+ getFieldValue: (name: string) => any;
75
+ getFieldsValue: (names?: string[]) => Record<string, any>;
76
+ setFieldValue: (name: string, value: any) => void;
77
+ setFieldsValue: (values: Record<string, any>) => void;
78
+ setFields: (fields: {
79
+ name: string;
80
+ errors?: string[];
81
+ value?: any;
82
+ }[]) => void;
83
+ resetFields: (names?: string[]) => void;
84
+ validateFields: (names?: string[]) => Promise<Record<string, any>>;
85
+ submit: () => void;
86
+ destroy: () => void;
87
+ }
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import './Input.css';
3
3
  export interface InputProps {
4
- type?: 'text';
4
+ type?: 'text' | 'password';
5
5
  placeholder?: string;
6
6
  width?: string | number;
7
7
  className?: string;
8
8
  style?: React.CSSProperties;
9
9
  value?: string;
10
+ defaultValue?: string;
10
11
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
12
  onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
12
13
  onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
@@ -6,7 +6,7 @@ export interface ModalProps {
6
6
  headerHeight?: number | string;
7
7
  footerHeight?: number | string;
8
8
  confirmLoading?: boolean;
9
- direction?: 'center' | 'top-right' | 'bottom-right' | 'normal';
9
+ direction?: 'center' | 'top-right' | 'bottom-right' | 'bottom-left' | 'normal';
10
10
  top?: number;
11
11
  footer?: null | React.ReactNode;
12
12
  bordered?: boolean;
@@ -9,6 +9,12 @@ export interface Column {
9
9
  fixed?: boolean | 'start' | 'end';
10
10
  /** 限制单元格内容显示的最大行数,超出时显示省略号 */
11
11
  maxLines?: number;
12
+ /** 是否显示提示气泡框 */
13
+ tooltip?: boolean;
14
+ /** 是否可编辑 */
15
+ editable?: boolean;
16
+ /** 编辑完成时的回调 */
17
+ onSave?: (record: any, value: any) => void;
12
18
  render?: (value: any, record: any, index: number) => ReactNode;
13
19
  [key: string]: any;
14
20
  }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import './Tooltip.css';
3
+ export interface TooltipProps {
4
+ children: React.ReactElement;
5
+ title?: React.ReactNode;
6
+ placement?: 'top' | 'bottom' | 'left' | 'right';
7
+ trigger?: 'hover' | 'click';
8
+ delay?: number;
9
+ open?: boolean;
10
+ backgroundColor?: string;
11
+ style?: React.CSSProperties;
12
+ className?: string;
13
+ }
14
+ declare const Tooltip: React.FC<TooltipProps>;
15
+ export default Tooltip;
@@ -0,0 +1,2 @@
1
+ export { default } from './Tooltip';
2
+ export type { TooltipProps } from './Tooltip';
@@ -35,3 +35,5 @@ export { default as Switch } from './Switch';
35
35
  export { default as Tabs } from './Tabs';
36
36
  export { default as Transfer } from './Transfer';
37
37
  export { default as Label } from './Label';
38
+ export { default as Tooltip } from './Tooltip';
39
+ export { default as Form } from './Form';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjpcy/simple-design",
3
- "version": "1.2.01",
3
+ "version": "1.2.3",
4
4
  "description": "IDP Studio Design System - React Component Library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",