@zat-design/sisyphus-react 4.3.0 → 4.3.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.
@@ -75,33 +75,36 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
75
75
  confirm?: boolean | import("antd").ModalFuncProps | import("../../../render/propsType").FunctionArgs<any, boolean | import("antd").ModalFuncProps>;
76
76
  show?: boolean | ReactiveFunction<any, boolean>;
77
77
  component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
78
- id?: string;
79
78
  className?: string;
80
- hidden?: boolean;
81
79
  style?: React.CSSProperties;
80
+ trim?: boolean;
81
+ normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
82
82
  children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
83
+ hidden?: boolean;
84
+ id?: string;
83
85
  onReset?: () => void;
84
86
  prefixCls?: string;
85
87
  rootClassName?: string;
86
- status?: "" | "warning" | "error" | "success" | "validating";
87
88
  vertical?: boolean;
89
+ htmlFor?: string;
90
+ layout?: import("antd/es/form/Form").FormItemLayout;
91
+ help?: React.ReactNode;
92
+ preserve?: boolean;
93
+ trigger?: string;
88
94
  isView?: boolean;
95
+ status?: "" | "warning" | "error" | "success" | "validating";
96
+ validateTrigger?: string | false | string[];
89
97
  colon?: boolean;
90
- htmlFor?: string;
91
98
  labelAlign?: import("antd/es/form/interface").FormLabelAlign;
92
99
  labelCol?: import("antd").ColProps;
93
100
  getValueFromEvent?: (...args: import("@rc-component/form/lib/interface").EventArgs) => any;
94
- normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
95
101
  shouldUpdate?: import("@rc-component/form/lib/Field").ShouldUpdate<any>;
96
- trigger?: string;
97
- validateTrigger?: string | false | string[];
98
102
  validateDebounce?: number;
99
103
  valuePropName?: string;
100
104
  getValueProps?: ((value: any) => Record<string, unknown>) & ((value: any) => Record<string, unknown>);
101
105
  messageVariables?: Record<string, string>;
102
106
  initialValue?: any;
103
107
  onMetaChange?: (meta: import("@rc-component/form/lib/Field").MetaEvent) => void;
104
- preserve?: boolean;
105
108
  isListField?: boolean;
106
109
  isList?: boolean;
107
110
  noStyle?: boolean;
@@ -109,9 +112,7 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
109
112
  icons: import("antd/es/form/FormItem").FeedbackIcons;
110
113
  };
111
114
  validateStatus?: "" | "warning" | "error" | "success" | "validating";
112
- layout?: import("antd/es/form/Form").FormItemLayout;
113
115
  wrapperCol?: import("antd").ColProps;
114
- help?: React.ReactNode;
115
116
  fieldId?: string;
116
117
  valueType?: import("../../../render/propsType").ProFormValueType;
117
118
  switchValue?: [any, any];
@@ -121,7 +122,6 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
121
122
  index?: number;
122
123
  }) => string | React.ReactElement<any, any>;
123
124
  viewType?: import("../../../render/propsType").ViewType;
124
- trim?: boolean;
125
125
  upperCase?: boolean;
126
126
  toISOString?: boolean;
127
127
  toCSTString?: boolean;
@@ -2,7 +2,7 @@ import { useContext } from 'react';
2
2
  import { Popover, Tooltip } from 'antd';
3
3
  import classnames from 'classnames';
4
4
  import { Link as RouterLink } from 'react-router-dom';
5
- import { Icon } from "../../index";
5
+ import ProIcon from "../../../../../ProIcon";
6
6
  import SideMenu from "../SideMenu";
7
7
  import { LayoutContext } from "../../../../index";
8
8
  import { getUrlParams, getPathNameKey, findMenuItemByKey } from "../../../../utils";
@@ -79,9 +79,11 @@ const FoldMenu = props => {
79
79
  className: "pro-layout-icon",
80
80
  src: pathNamePrefix === url ? imgActiveUrl || imgUrl : imgUrl,
81
81
  alt: "icon"
82
- }) : /*#__PURE__*/_jsx(Icon, {
82
+ }) : /*#__PURE__*/_jsx(ProIcon, {
83
83
  type: icon || '',
84
- iconfontUrl: iconfontUrl || ''
84
+ size: "20px",
85
+ buttonIcon: false,
86
+ color: currentKeyIdPath.includes(id) ? '#fff' : undefined
85
87
  }), /*#__PURE__*/_jsx("h2", {
86
88
  children: name
87
89
  })]
@@ -25,6 +25,13 @@
25
25
  color: #fff;
26
26
  }
27
27
 
28
+ .anticon {
29
+ flex: 0 0 20px;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ }
34
+
28
35
  h2 {
29
36
  display: none;
30
37
  flex-grow: 1;
@@ -8,7 +8,7 @@ import { Link as RouterLink } from 'react-router-dom';
8
8
  import { LayoutContext } from "../../../../index";
9
9
  import { getIdsByPathName, findMenuItemByKey } from "../../../../utils";
10
10
  import { canOpenAsTab } from "../../../TabsManager/utils";
11
- import { Icon } from "../../index";
11
+ import ProIcon from "../../../../../ProIcon";
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const Link = RouterLink;
14
14
  const OpenMenu = props => {
@@ -68,9 +68,10 @@ const OpenMenu = props => {
68
68
  className: "pro-layout-icon",
69
69
  src: selectKeyIdPath[0] === String(item.id) ? item.imgActiveUrl || item.imgUrl : item.imgUrl,
70
70
  alt: "icon"
71
- }) : item.icon && isFirstMenu ? /*#__PURE__*/_jsx(Icon, {
71
+ }) : item.icon && isFirstMenu ? /*#__PURE__*/_jsx(ProIcon, {
72
72
  type: item.icon || '',
73
- iconfontUrl: dataSource?.iconfontUrl || ''
73
+ size: "20px",
74
+ buttonIcon: false
74
75
  }) : /*#__PURE__*/_jsx("span", {
75
76
  className: classnames({
76
77
  'pro-layout-icon': true,
@@ -186,8 +187,7 @@ const OpenMenu = props => {
186
187
  }
187
188
  },
188
189
  style: {
189
- height: dataSource.sideMenu ? 'auto' : `calc(100vh - ${dataSource?.height || 0}px)`,
190
- color: 'red'
190
+ height: dataSource.sideMenu ? 'auto' : `calc(100vh - ${dataSource?.height || 0}px)`
191
191
  }
192
192
  }), /*#__PURE__*/_jsx(Link, {
193
193
  to: router,
@@ -65,6 +65,15 @@
65
65
  }
66
66
  }
67
67
 
68
+ // ProIcon 渲染为 .anticon 包裹层,需单独处理间距和颜色锁定
69
+ .@{ant-prefix}-menu-title-content div .anticon {
70
+ flex: 0 0 20px;
71
+ width: 20px;
72
+ height: 20px;
73
+ margin-right: 12px;
74
+ color: var(--zaui-text, #343434) !important;
75
+ }
76
+
68
77
  .pro-layout-icon {
69
78
  color: var(--zaui-text, #343434) !important;
70
79
  fill: currentcolor;
@@ -3,6 +3,16 @@ import classnames from 'classnames';
3
3
  import OpenMenu from "./OpenMenu";
4
4
  import FoldMenu from "./FoldMenu"; // 折叠后菜单
5
5
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const iconfontCache = new Set();
7
+ const loadIconfontScript = url => {
8
+ if (!url || iconfontCache.has(url)) return;
9
+ if (typeof document === 'undefined') return;
10
+ const script = document.createElement('script');
11
+ script.setAttribute('src', url);
12
+ iconfontCache.add(url);
13
+ document.body.appendChild(script);
14
+ };
15
+
6
16
  // 菜单宽度配置
7
17
  const MENU_CONFIG = {
8
18
  TRANSITION_DURATION: 300,
@@ -33,6 +43,9 @@ const Menu = props => {
33
43
  hasTriggered: false
34
44
  });
35
45
  const [isOpenMenuTextVisible, setIsOpenMenuTextVisible] = useState(false);
46
+ useEffect(() => {
47
+ loadIconfontScript(iconfontUrl);
48
+ }, [iconfontUrl]);
36
49
 
37
50
  // 提取清理逻辑
38
51
  const cleanupAnimation = useCallback(() => {
@@ -1,4 +1,3 @@
1
1
  export { default as Header } from './Header';
2
2
  export { default as Notice } from './Notice';
3
3
  export { default as Menu } from './Menu';
4
- export { default as Icon } from './Icon';
@@ -1,4 +1,3 @@
1
1
  export { default as Header } from "./Header";
2
2
  export { default as Notice } from "./Notice";
3
- export { default as Menu } from "./Menu";
4
- export { default as Icon } from "./Icon";
3
+ export { default as Menu } from "./Menu";
@@ -1,4 +1,3 @@
1
1
  @import './Header/style/index.less';
2
- @import './Icon/style/index.less';
3
2
  @import './Menu/style/index.less';
4
3
  @import './Notice/style/index.less';
@@ -170,6 +170,7 @@
170
170
  margin-left: 0;
171
171
  background: #e7e8ee;
172
172
  transition: none;
173
+ border-color: #e7e8ee;
173
174
  &.@{ant-prefix}-tabs-tab-active {
174
175
  background: #ffffff;
175
176
  border-top: 2px solid var(--zaui-brand, #006aff);
@@ -191,6 +191,10 @@ const ProLayout = props => {
191
191
  });
192
192
  const noticeHeight = notice ? 32 : 0;
193
193
 
194
+ // pure 模式下 Header 不渲染,有效头部高度为 0
195
+ const isPureHeader = typeof pure === 'boolean' ? pure : !!pure?.topMenu;
196
+ const effectiveHeaderHeight = isPureHeader ? 0 : headerHeight;
197
+
194
198
  // 为Header组件创建专门的props对象
195
199
  const headerProps = {
196
200
  headerHeight,
@@ -238,7 +242,7 @@ const ProLayout = props => {
238
242
  }),
239
243
  style: {
240
244
  '--header-bg-image': `url(${headerBg})`,
241
- '--pro-layout-header-height': `${headerHeight}px`
245
+ '--pro-layout-header-height': `${effectiveHeaderHeight}px`
242
246
  },
243
247
  children: [/*#__PURE__*/_jsx(Header, {
244
248
  ...headerProps
@@ -248,7 +252,7 @@ const ProLayout = props => {
248
252
  ref: setTabsBarEl,
249
253
  className: `pro-layout-tabs-bar-wrapper${hasTabs ? ' tabs-visible' : ''}${collapsed ? ' tabs-menu-open' : ''}`,
250
254
  style: {
251
- marginTop: headerHeight + noticeHeight
255
+ marginTop: effectiveHeaderHeight + noticeHeight
252
256
  }
253
257
  }), /*#__PURE__*/_jsxs("div", {
254
258
  className: contentCls,
@@ -365,6 +365,7 @@
365
365
  .pro-layout-content {
366
366
  margin: 0 !important;
367
367
  background: #fff;
368
+ border-top: none;
368
369
  }
369
370
  }
370
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "es",
@@ -1,10 +0,0 @@
1
- import type { FC } from 'react';
2
- import React from 'react';
3
- export interface IconProps {
4
- type: string;
5
- iconfontUrl: string;
6
- style?: any;
7
- onClick?: React.MouseEventHandler<SVGSVGElement>;
8
- }
9
- declare const Icon: FC<IconProps>;
10
- export default Icon;
@@ -1,34 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- const customCache = new Set();
4
- const Icon = props => {
5
- // @ts-ignore
6
- const {
7
- type,
8
- onClick,
9
- style,
10
- iconfontUrl = '//at.alicdn.com/t/font_3000529_v88n7r0v7ae.js'
11
- } = props;
12
- const loadSymbol = scriptUrl => {
13
- if (typeof document !== 'undefined' && typeof window !== 'undefined' && typeof document.createElement === 'function' && typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl)) {
14
- const script = document.createElement('script');
15
- script.setAttribute('src', scriptUrl);
16
- script.setAttribute('data-namespace', scriptUrl);
17
- customCache.add(scriptUrl);
18
- document.body.appendChild(script);
19
- }
20
- };
21
- useEffect(() => {
22
- loadSymbol(iconfontUrl);
23
- }, []);
24
- return /*#__PURE__*/_jsx("svg", {
25
- className: "pro-layout-icon",
26
- "aria-hidden": "true",
27
- onClick: onClick,
28
- style: style,
29
- children: /*#__PURE__*/_jsx("use", {
30
- xlinkHref: `#icon-${type}`
31
- })
32
- });
33
- };
34
- export default Icon;
@@ -1,2 +0,0 @@
1
- import Icon from './Icon';
2
- export default Icon;
@@ -1,2 +0,0 @@
1
- import Icon from "./Icon";
2
- export default Icon;
@@ -1,7 +0,0 @@
1
- .pro-layout-icon {
2
- width: 20px;
3
- height: 20px;
4
- overflow: hidden;
5
- vertical-align: middle;
6
- fill: currentcolor;
7
- }