@zat-design/sisyphus-react 4.3.0 → 4.3.1-beta.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,
@@ -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';
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-beta.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
- }