@zat-design/sisyphus-react 4.7.0 → 4.7.1
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/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProForm/components/combination/FormList/components/LineFields.js +1 -1
- package/es/ProForm/components/combination/FormList/style/index.less +5 -0
- package/es/ProForm/components/render/Render.js +11 -1
- package/es/ProUpload/components/ButtonRender.js +4 -2
- package/es/ProUpload/components/DragRender.js +6 -3
- package/es/ProUpload/components/ImageRender.js +31 -24
- package/es/ProUpload/style/index.less +5 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.js +8 -1
- package/package.json +1 -1
|
@@ -65,7 +65,7 @@ const LineFields = (props) => {
|
|
|
65
65
|
...listeners,
|
|
66
66
|
className: "pro-form-list-drag-handle",
|
|
67
67
|
ref: setActivatorNodeRef,
|
|
68
|
-
children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size:
|
|
68
|
+
children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size: 16 })
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
71
|
/* @__PURE__ */ jsx(Row, { className: "pro-form-list-fields", gutter: isLess ? 0 : 24, children: /* @__PURE__ */ jsx(
|
|
@@ -35,12 +35,17 @@
|
|
|
35
35
|
|
|
36
36
|
.pro-form-list-drag-handle {
|
|
37
37
|
display: flex;
|
|
38
|
+
flex-shrink: 0;
|
|
38
39
|
align-items: center;
|
|
39
40
|
height: 32px;
|
|
40
41
|
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
41
42
|
padding: 0;
|
|
42
43
|
padding-right: @zaui-space-size-sm;
|
|
43
44
|
border: none;
|
|
45
|
+
|
|
46
|
+
.pro-icon {
|
|
47
|
+
cursor: move;
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
> .pro-form-list-fields {
|
|
@@ -279,7 +279,17 @@ const Render = (props) => {
|
|
|
279
279
|
const internalItemRender = {
|
|
280
280
|
mark: "pro_table_render",
|
|
281
281
|
render: (inputProps, doms) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
282
|
-
/* @__PURE__ */ jsx(
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
Space,
|
|
284
|
+
{
|
|
285
|
+
size: 0,
|
|
286
|
+
style: {
|
|
287
|
+
marginTop: 8,
|
|
288
|
+
marginBottom: type === "ProUpload" && lastComponentProps.uploadType === "image" ? 8 : void 0
|
|
289
|
+
},
|
|
290
|
+
children: formItemProps.above
|
|
291
|
+
}
|
|
292
|
+
),
|
|
283
293
|
/* @__PURE__ */ jsxs(
|
|
284
294
|
"div",
|
|
285
295
|
{
|
|
@@ -5,6 +5,7 @@ import { SortableContext, rectSortingStrategy } from "@dnd-kit/sortable";
|
|
|
5
5
|
import { CloudUploadOutlined } from "@ant-design/icons";
|
|
6
6
|
import { FileItem } from "./FileItem";
|
|
7
7
|
import { DraggableUploadListItem } from "./DraggableUploadListItem";
|
|
8
|
+
import { isEmptyReactNode } from "../../utils";
|
|
8
9
|
import locale from "../../locale";
|
|
9
10
|
const ButtonRender = (props) => {
|
|
10
11
|
var _a, _b;
|
|
@@ -46,13 +47,14 @@ const ButtonRender = (props) => {
|
|
|
46
47
|
) });
|
|
47
48
|
}
|
|
48
49
|
};
|
|
50
|
+
const tipText = typeof extraTipText === "function" ? extraTipText() : extraTipText;
|
|
49
51
|
return /* @__PURE__ */ jsxs("div", { className: "pro-upload-button", children: [
|
|
50
52
|
/* @__PURE__ */ jsx(DndContext, { sensors: [sensor], onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: fileList.map((i) => i.uid), strategy: rectSortingStrategy, children: /* @__PURE__ */ jsx(Upload, { ...buttonUploadProps, children: !isView && /* @__PURE__ */ jsxs("div", { className: "pro-upload-button-inner", children: [
|
|
51
53
|
/* @__PURE__ */ jsxs(Button, { ...buttonProps, disabled: disabled || isView, children: [
|
|
52
54
|
/* @__PURE__ */ jsx(CloudUploadOutlined, {}),
|
|
53
55
|
buttonText
|
|
54
56
|
] }),
|
|
55
|
-
afterRender ? /* @__PURE__ */ jsx(
|
|
57
|
+
!isEmptyReactNode(afterRender) ? /* @__PURE__ */ jsx(
|
|
56
58
|
"div",
|
|
57
59
|
{
|
|
58
60
|
className: "pro-upload-button-inner-right",
|
|
@@ -61,7 +63,7 @@ const ButtonRender = (props) => {
|
|
|
61
63
|
}
|
|
62
64
|
) : null
|
|
63
65
|
] }) }) }) }),
|
|
64
|
-
|
|
66
|
+
!isEmptyReactNode(tipText) && /* @__PURE__ */ jsx("div", { className: "upload-tip-txt", children: tipText })
|
|
65
67
|
] });
|
|
66
68
|
};
|
|
67
69
|
var ButtonRender_default = ButtonRender;
|
|
@@ -6,6 +6,7 @@ import { SortableContext, rectSortingStrategy } from "@dnd-kit/sortable";
|
|
|
6
6
|
import { CloudUploadOutlined } from "@ant-design/icons";
|
|
7
7
|
import { DragSingleFileItem, FileItem, getFileExt, getFileIcon } from "./FileItem";
|
|
8
8
|
import { DraggableUploadListItem } from "./DraggableUploadListItem";
|
|
9
|
+
import { isEmptyReactNode } from "../../utils";
|
|
9
10
|
import locale from "../../locale";
|
|
10
11
|
const { Dragger } = Upload;
|
|
11
12
|
const DragRender = (props) => {
|
|
@@ -88,9 +89,11 @@ const DragRender = (props) => {
|
|
|
88
89
|
disabled,
|
|
89
90
|
openFileDialogOnClick: !showDraggerSingleRender
|
|
90
91
|
};
|
|
92
|
+
const header = headerRender();
|
|
93
|
+
const footer = footerRender();
|
|
91
94
|
return /* @__PURE__ */ jsxs("div", { className: "pro-upload-dragger", children: [
|
|
92
95
|
/* @__PURE__ */ jsxs("div", { className: "pro-upload-handle-box", children: [
|
|
93
|
-
/* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-header", children:
|
|
96
|
+
!isEmptyReactNode(header) && /* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-header", children: header }),
|
|
94
97
|
/* @__PURE__ */ jsx(Dragger, { ...dragUploadProps, children: /* @__PURE__ */ jsxs("div", { className: "drag-upload-inner", ref: refReSelect, children: [
|
|
95
98
|
!showDraggerSingleRender && /* @__PURE__ */ jsxs("div", { className: "upload-dragger-control", children: [
|
|
96
99
|
/* @__PURE__ */ jsxs("div", { className: "dragger-txt-line1", children: [
|
|
@@ -108,11 +111,11 @@ const DragRender = (props) => {
|
|
|
108
111
|
":",
|
|
109
112
|
extExt.length > 0 ? extExt.join("、") : `${(_h = (_g = locale) == null ? void 0 : _g.ProUpload) == null ? void 0 : _h.draggerLimitless}`
|
|
110
113
|
] }),
|
|
111
|
-
customTextRender && /* @__PURE__ */ jsx("p", { className: "file-ext", children: customTextRender })
|
|
114
|
+
!isEmptyReactNode(customTextRender) && /* @__PURE__ */ jsx("p", { className: "file-ext", children: customTextRender })
|
|
112
115
|
] }),
|
|
113
116
|
/* @__PURE__ */ jsx("div", { className: "dragger-file-show", children: showDraggerSingleRender && draggerSingleRender(fileList[0]) })
|
|
114
117
|
] }) }),
|
|
115
|
-
/* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-footer", children:
|
|
118
|
+
!isEmptyReactNode(footer) && /* @__PURE__ */ jsx("div", { className: "pro-upload-dragger-footer", children: footer })
|
|
116
119
|
] }),
|
|
117
120
|
/* @__PURE__ */ jsx("div", { className: "pro-upload-file-list", children: /* @__PURE__ */ jsx(DndContext, { sensors: [sensor], onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: fileList.map((i) => i.uid), strategy: rectSortingStrategy, children: maxCount > 1 && fileList.map((file) => {
|
|
118
121
|
return /* @__PURE__ */ jsx(DraggableUploadListItem, { file, children: /* @__PURE__ */ jsx(
|
|
@@ -9,6 +9,7 @@ import { PlusOutlined } from "@ant-design/icons";
|
|
|
9
9
|
import { Example } from "./Example";
|
|
10
10
|
import { getFileExt, getFileIcon } from "./FileItem";
|
|
11
11
|
import { DraggableUploadListItem } from "./DraggableUploadListItem";
|
|
12
|
+
import { isEmptyReactNode } from "../../utils";
|
|
12
13
|
import lookSvg from "../../assets/look.svg";
|
|
13
14
|
import deleteSvg from "../../assets/delete.svg";
|
|
14
15
|
import downloadSvg from "../../assets/download.svg";
|
|
@@ -149,31 +150,37 @@ const ImageRender = (props) => {
|
|
|
149
150
|
) });
|
|
150
151
|
}
|
|
151
152
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
153
|
+
const footer = footerRender();
|
|
154
|
+
const hasFooter = !isEmptyReactNode(footer);
|
|
155
|
+
const hasCenterRender = typeof centerRender === "function" || !isEmptyReactNode(centerRender);
|
|
156
|
+
const tipText = typeof extraTipText === "function" ? extraTipText() : extraTipText;
|
|
157
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
158
|
+
/* @__PURE__ */ jsxs(Space, { orientation: "vertical", size: 8, className: "pro-upload-image", children: [
|
|
159
|
+
headerRender(),
|
|
160
|
+
/* @__PURE__ */ jsxs("div", { className: "pro-upload-image", children: [
|
|
161
|
+
/* @__PURE__ */ jsx(DndContext, { sensors: [sensor], onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: fileList.map((i) => i.uid), strategy: rectSortingStrategy, children: /* @__PURE__ */ jsx(Upload, { ...imageUploadProps, children: fileList.length < maxCount && !isView && (hasCenterRender ? isFunction(centerRender) ? centerRender() : centerRender : /* @__PURE__ */ jsxs(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
className: `pro-upload-image-inner ${disabled ? "pro-upload-image-disabled" : ""} `,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
167
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: (_b = (_a = locale) == null ? void 0 : _a.ProUpload) == null ? void 0 : _b.buttonText })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
)) }) }) }),
|
|
171
|
+
showExampleContent && !isView && /* @__PURE__ */ jsx(
|
|
172
|
+
Example,
|
|
173
|
+
{
|
|
174
|
+
className: "image-example",
|
|
175
|
+
exampleTitle,
|
|
176
|
+
exampleContent,
|
|
177
|
+
exampleModalProps
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
!isEmptyReactNode(tipText) && /* @__PURE__ */ jsx("div", { className: "upload-tip-txt", children: tipText })
|
|
181
|
+
] }),
|
|
182
|
+
hasFooter && /* @__PURE__ */ jsx("div", { className: "pro-upload-image-footer", children: footer })
|
|
175
183
|
] }),
|
|
176
|
-
/* @__PURE__ */ jsx("div", { className: "pro-upload-image-footer", children: footerRender() }),
|
|
177
184
|
/* @__PURE__ */ jsx(
|
|
178
185
|
Modal,
|
|
179
186
|
{
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export declare const customEqualForFunction: (value: any, other: any) => boolean;
|
|
2
3
|
/**
|
|
3
4
|
* 兼容 React17/18 的 startTransition。
|
|
@@ -10,6 +11,8 @@ export declare function compatStartTransition(cb: () => void): void;
|
|
|
10
11
|
* 空值 或者 仅包含空值的数组视为空
|
|
11
12
|
*/
|
|
12
13
|
export declare const isEmpty: (value: any, emptyValue?: string) => boolean;
|
|
14
|
+
/** 判断 React 节点是否没有可渲染内容,保留数字 0 */
|
|
15
|
+
export declare const isEmptyReactNode: (value: React.ReactNode) => boolean;
|
|
13
16
|
/**
|
|
14
17
|
* 生成用于 UI 元素的随机短 ID(非安全用途)
|
|
15
18
|
*/
|
package/es/utils/index.js
CHANGED
|
@@ -32,6 +32,12 @@ const isEmpty = (value, emptyValue) => {
|
|
|
32
32
|
}
|
|
33
33
|
return false;
|
|
34
34
|
};
|
|
35
|
+
const isEmptyReactNode = (value) => {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
return value.every(isEmptyReactNode);
|
|
38
|
+
}
|
|
39
|
+
return value === void 0 || value === null || typeof value === "boolean" || value === "";
|
|
40
|
+
};
|
|
35
41
|
const generateId = () => Math.random().toString(36).slice(-6);
|
|
36
42
|
const isEllipsisActive = (element) => {
|
|
37
43
|
if (!element)
|
|
@@ -47,5 +53,6 @@ export {
|
|
|
47
53
|
customEqualForFunction,
|
|
48
54
|
generateId,
|
|
49
55
|
isEllipsisActive,
|
|
50
|
-
isEmpty
|
|
56
|
+
isEmpty,
|
|
57
|
+
isEmptyReactNode
|
|
51
58
|
};
|