@zat-design/sisyphus-react 4.7.0-beta.2 → 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.
@@ -1,4 +1,5 @@
1
1
  @import '../../style/variables.less';
2
+ @import './variables.less';
2
3
  @import '../components/Layout/index.less';
3
4
  @import '../components/ProCollapse/style/index.less';
4
5
  @import '../components/ProFooter/style/index.less';
@@ -6,6 +7,12 @@
6
7
  @import '../components/TabsManager/style/index.less';
7
8
 
8
9
  .pro-layout {
10
+ --pro-layout-menu-fold-width: @pro-layout-menu-fold-width;
11
+
12
+ &.pro-layout-show-collapsed-menu-label {
13
+ --pro-layout-menu-fold-width: @pro-layout-menu-label-width;
14
+ }
15
+
9
16
  display: flex;
10
17
  flex-direction: column;
11
18
  min-height: 100vh;
@@ -138,6 +145,10 @@
138
145
  color: #fff;
139
146
  }
140
147
 
148
+ h2 {
149
+ color: var(--zaui-base-bg, #ffffff);
150
+ }
151
+
141
152
  &::before {
142
153
  position: absolute;
143
154
  top: 4px;
@@ -174,6 +185,16 @@
174
185
  }
175
186
  }
176
187
 
188
+ .pro-layout-menu-fold-show-label .pro-layout-menu-fold-list li {
189
+ &.active::before,
190
+ &:hover::before {
191
+ top: 0;
192
+ left: 8px;
193
+ width: calc(100% - 16px);
194
+ height: 56px;
195
+ }
196
+ }
197
+
177
198
  .pro-layout-menu-collapsed {
178
199
  background: #f7f9fd;
179
200
  border-right: none;
@@ -291,7 +312,7 @@
291
312
  .pro-layout-tabs-bar-wrapper {
292
313
  // 与 pro-layout-content 对齐:同样的左右边距,无内边距让 tab 从左侧直接对齐
293
314
  margin-right: var(--zaui-space-size-md, 16px);
294
- margin-left: 48px;
315
+ margin-left: @pro-layout-menu-fold-size;
295
316
  padding: 0;
296
317
  // 滚动时固定在 header 和 notice 正下方
297
318
  position: sticky;
@@ -314,7 +335,7 @@
314
335
 
315
336
  // 菜单展开时与内容区同步右移
316
337
  &.tabs-menu-open {
317
- margin-left: 220px;
338
+ margin-left: @pro-layout-menu-open-width;
318
339
  }
319
340
 
320
341
  // Tab 存在时展开
@@ -337,7 +358,7 @@
337
358
  margin-top: 0;
338
359
  margin-right: var(--zaui-space-size-md, 16px);
339
360
  margin-bottom: 0;
340
- margin-left: 48px;
361
+ margin-left: @pro-layout-menu-fold-size;
341
362
  padding: 0 var(--zaui-space-size-md, 16px);
342
363
  background: #ffffff;
343
364
  border-top: 1px solid rgb(235 236 238);
@@ -0,0 +1,4 @@
1
+ @pro-layout-menu-fold-width: 48px;
2
+ @pro-layout-menu-label-width: 72px;
3
+ @pro-layout-menu-fold-size: var(--pro-layout-menu-fold-width, @pro-layout-menu-fold-width);
4
+ @pro-layout-menu-open-width: 220px;
@@ -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
- extraTipText && /* @__PURE__ */ jsx("div", { className: "upload-tip-txt", children: typeof extraTipText === "function" ? extraTipText() : extraTipText })
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: headerRender() }),
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: footerRender() })
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
- return /* @__PURE__ */ jsxs(Space, { orientation: "vertical", size: 8, className: "pro-upload-image", children: [
153
- headerRender(),
154
- /* @__PURE__ */ jsxs("div", { className: "pro-upload-image", children: [
155
- /* @__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 && (centerRender ? isFunction(centerRender) ? centerRender() : centerRender : /* @__PURE__ */ jsxs(
156
- "div",
157
- {
158
- className: `pro-upload-image-inner ${disabled ? "pro-upload-image-disabled" : ""} `,
159
- children: [
160
- /* @__PURE__ */ jsx(PlusOutlined, {}),
161
- /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: (_b = (_a = locale) == null ? void 0 : _a.ProUpload) == null ? void 0 : _b.buttonText })
162
- ]
163
- }
164
- )) }) }) }),
165
- showExampleContent && !isView && /* @__PURE__ */ jsx(
166
- Example,
167
- {
168
- className: "image-example",
169
- exampleTitle,
170
- exampleContent,
171
- exampleModalProps
172
- }
173
- ),
174
- extraTipText && /* @__PURE__ */ jsx("div", { className: "upload-tip-txt", children: extraTipText })
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
  {
@@ -4,6 +4,11 @@
4
4
  // 将拖拽项的内部层级限制在上传组件内,避免覆盖相邻字段的下拉浮层。
5
5
  isolation: isolate;
6
6
 
7
+ > .pro-upload-image {
8
+ // 图片布局不参与文本基线对齐,避免顶部出现额外行盒留白。
9
+ vertical-align: top;
10
+ }
11
+
7
12
  // display: inline-flex;
8
13
 
9
14
  // 拖拽上传
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.7.0-beta.2",
3
+ "version": "4.7.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",