@regenbio/regenbio-components-react 1.4.20 → 1.4.21

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/.idea/modules.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <project version="4">
3
3
  <component name="ProjectModuleManager">
4
4
  <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/test-components.iml" filepath="$PROJECT_DIR$/.idea/test-components.iml" />
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/regenbio-components-react.iml" filepath="$PROJECT_DIR$/.idea/regenbio-components-react.iml" />
6
6
  </modules>
7
7
  </component>
8
8
  </project>
@@ -0,0 +1,25 @@
1
+ import type { UploadFile } from "antd";
2
+ import { DragEndEvent } from "@dnd-kit/core";
3
+ import { RbDraggableUploaderExtraProps, RbDraggableUploaderProps, RbDraggableUploadListItemProps } from "./type";
4
+ /**
5
+ * RB 拖动上传器Hook
6
+ * @param props 属性
7
+ */
8
+ export declare const useDraggableUploader: (props: RbDraggableUploaderProps & RbDraggableUploaderExtraProps) => {
9
+ fileList: any;
10
+ sensor: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").PointerSensorOptions>;
11
+ globalFunctions: any;
12
+ onDragEnd: ({ active, over }: DragEndEvent) => void;
13
+ onChange: (info: import("antd/es/upload").UploadChangeParam<UploadFile<any>>) => void;
14
+ };
15
+ /**
16
+ * RB 拖动列表项Hook
17
+ * @param props 属性
18
+ */
19
+ export declare const useDraggableListItem: (props: RbDraggableUploadListItemProps) => {
20
+ setNodeRef: (node: HTMLElement | null) => void;
21
+ style: React.CSSProperties;
22
+ isDragging: boolean;
23
+ attributes: import("@dnd-kit/core").DraggableAttributes;
24
+ listeners: import("@dnd-kit/core/dist/hooks/utilities").SyntheticListenerMap;
25
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { RbDraggableUploaderProps } from "./type";
3
+ /**
4
+ * RB 拖动上传器
5
+ *
6
+ * @param props
7
+ * @constructor
8
+ */
9
+ declare const RbDraggableUploader: React.FC<RbDraggableUploaderProps>;
10
+ export default RbDraggableUploader;
@@ -0,0 +1,92 @@
1
+ import * as React from "react";
2
+ import { LabelTooltipType } from "antd/es/form/FormItemLabel";
3
+ import type { Rule } from "rc-field-form/lib/interface";
4
+ import type { UploadFile } from "antd";
5
+ /**
6
+ * 可拖动列表参数
7
+ */
8
+ export type RbDraggableUploadListItemProps = {
9
+ /**
10
+ * 原节点
11
+ */
12
+ originNode: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
13
+ /**
14
+ * 文件
15
+ */
16
+ file: UploadFile<any>;
17
+ };
18
+ /**
19
+ * 扩展参数
20
+ */
21
+ export type RbDraggableUploaderExtraProps = {
22
+ /**
23
+ * 值
24
+ */
25
+ value: {
26
+ name: string;
27
+ guid: string;
28
+ }[];
29
+ /**
30
+ * 值改变监听
31
+ * @param value 新值
32
+ */
33
+ onChange: (value: {
34
+ name: string;
35
+ guid: string;
36
+ }[]) => void;
37
+ };
38
+ /**
39
+ * 可拖动上传器参数
40
+ */
41
+ export type RbDraggableUploaderProps = {
42
+ /**
43
+ * 展示字段名称
44
+ */
45
+ label: React.ReactNode;
46
+ /**
47
+ * 占位符
48
+ */
49
+ placeholder: React.ReactNode;
50
+ /**
51
+ * 气泡提示
52
+ */
53
+ tooltip?: LabelTooltipType;
54
+ /**
55
+ * 字段名称
56
+ */
57
+ name: string;
58
+ /**
59
+ * 规则
60
+ */
61
+ rules?: Rule[];
62
+ /**
63
+ * 请求头
64
+ */
65
+ headers?: {
66
+ /**
67
+ * 访问令牌
68
+ */
69
+ accessToken?: string;
70
+ /**
71
+ * 语言
72
+ */
73
+ locale?: string;
74
+ /**
75
+ * 客户端ID
76
+ */
77
+ clientId?: string;
78
+ };
79
+ /**
80
+ * 文件编码
81
+ */
82
+ fileCode: string;
83
+ /**
84
+ * 上传成功回调
85
+ */
86
+ afterSuccess?: () => void;
87
+ /**
88
+ * 上传失败回调
89
+ * @param msg 失败消息
90
+ */
91
+ afterFail?: (msg: string) => void;
92
+ };
@@ -1,4 +1,5 @@
1
1
  import { RbSingleImageUploaderExtraProps, RbSingleImageUploaderProps } from "./type";
2
+ import type { UploadFile } from "antd";
2
3
  /**
3
4
  * 单图片上传器Hook
4
5
  * @param props 属性
@@ -6,7 +7,10 @@ import { RbSingleImageUploaderExtraProps, RbSingleImageUploaderProps } from "./t
6
7
  declare const useSingleImageUploader: (props: RbSingleImageUploaderProps & RbSingleImageUploaderExtraProps) => {
7
8
  intl: any;
8
9
  globalFunctions: any;
9
- value: any;
10
- onFileChange: any;
10
+ loading: any;
11
+ imageUrl: any;
12
+ fileList: any;
13
+ handleRemove: () => boolean;
14
+ handleChange: (info: import("antd/es/upload").UploadChangeParam<UploadFile<any>>) => void;
11
15
  };
12
16
  export default useSingleImageUploader;
@@ -1,8 +1,7 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  import { RbSingleImageUploaderProps } from "./type";
3
3
  /**
4
4
  * RB 单图片上传器
5
- * 该层存在的意义在于捕获 Form 传递进来的 onChange 方法,让该组件能像原生组件一样运行
6
5
  *
7
6
  * @param props
8
7
  * @constructor
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { NamePath } from "rc-field-form/es/interface";
3
3
  import type { Rule } from "rc-field-form/lib/interface";
4
+ import { LabelTooltipType } from "antd/es/form/FormItemLabel";
4
5
  /**
5
6
  * 额外参数
6
7
  */
@@ -9,7 +10,7 @@ export type RbSingleImageUploaderExtraProps = {
9
10
  * 数据改变回调
10
11
  * @param value 数据
11
12
  */
12
- onChange?: (value: any) => void;
13
+ onChange: (value: any) => void;
13
14
  /**
14
15
  * 值
15
16
  */
@@ -23,6 +24,14 @@ export type RbSingleImageUploaderProps = {
23
24
  * 纯净模式
24
25
  */
25
26
  purity?: boolean;
27
+ /**
28
+ * 占位符
29
+ */
30
+ placeholder?: React.ReactNode;
31
+ /**
32
+ * 气泡提示
33
+ */
34
+ tooltip?: LabelTooltipType;
26
35
  /**
27
36
  * 字段名称
28
37
  */
package/build/index.d.ts CHANGED
@@ -27,6 +27,8 @@ import { RbMarkdownEditor, RbMarkdownConverter } from "./components/DataEntry/Ma
27
27
  import { RbMarkdownEditorProps } from "./components/DataEntry/MarkdownEditor/type";
28
28
  import RbSingleImageUploader from "./components/DataEntry/Uploader/SingleImageUploader";
29
29
  import { RbSingleImageUploaderProps } from "./components/DataEntry/Uploader/SingleImageUploader/type";
30
+ import RbDraggableUploader from "./components/DataEntry/Uploader/DraggableUploader";
31
+ import { RbDraggableUploaderProps } from "./components/DataEntry/Uploader/DraggableUploader/type";
30
32
  import { getRbInitialState, getRbAppLayout } from "./components/PageLayout/AppLayout";
31
33
  import { RbAppLayoutProps } from "./components/PageLayout/AppLayout/type";
32
34
  import { RbCurrentUser, RbCurrentTheme } from "./components/PageLayout/AppLayout/interface";
@@ -83,6 +85,8 @@ export { RbMarkdownConverter, RbMarkdownEditor };
83
85
  export type { RbMarkdownEditorProps };
84
86
  export { RbSingleImageUploader };
85
87
  export type { RbSingleImageUploaderProps };
88
+ export { RbDraggableUploader };
89
+ export type { RbDraggableUploaderProps };
86
90
  export { RbPageContainer };
87
91
  export type { RbPageContainerProps };
88
92
  export { RbRouteWrapper };
@@ -126,5 +130,6 @@ declare const _default: {
126
130
  RbAuthFrame: React.FC<RbAuthFrameProps>;
127
131
  RbBindFrame: React.FC<RbBindFrameProps>;
128
132
  RbGlobalContext: Context<RbGlobalStateType>;
133
+ RbDraggableUploader: React.FC<RbDraggableUploaderProps>;
129
134
  };
130
135
  export default _default;