@zat-design/sisyphus-react 3.4.5-beta.12 → 3.4.5-beta.14

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.
@@ -1500,6 +1500,32 @@
1500
1500
  width: 48px;
1501
1501
  height: 24px;
1502
1502
  }
1503
+ .pro-step > .step-menu > .anticon > button {
1504
+ width: auto !important;
1505
+ height: auto !important;
1506
+ }
1507
+ .pro-step > .step-menu > .anticon > button > .menu-icon {
1508
+ width: auto !important;
1509
+ height: auto !important;
1510
+ font-size: var(--zaui-font-size-lg-title, 24px);
1511
+ fill: var(--zaui-brand, #006aff);
1512
+ }
1513
+ .pro-step > .step-menu > .anticon > button > .menu-icon > div {
1514
+ display: -webkit-box;
1515
+ display: -webkit-flex;
1516
+ display: -ms-flexbox;
1517
+ display: flex;
1518
+ -webkit-box-align: center;
1519
+ -webkit-align-items: center;
1520
+ -ms-flex-align: center;
1521
+ align-items: center;
1522
+ -webkit-box-pack: center;
1523
+ -webkit-justify-content: center;
1524
+ -ms-flex-pack: center;
1525
+ justify-content: center;
1526
+ width: 48px;
1527
+ height: 24px;
1528
+ }
1503
1529
  .pro-step > .step-menu > .menu-icon {
1504
1530
  font-size: var(--zaui-font-size-lg-title, 24px);
1505
1531
  fill: var(--zaui-brand, #006aff);
package/dist/less.esm.css CHANGED
@@ -1500,6 +1500,32 @@
1500
1500
  width: 48px;
1501
1501
  height: 24px;
1502
1502
  }
1503
+ .pro-step > .step-menu > .anticon > button {
1504
+ width: auto !important;
1505
+ height: auto !important;
1506
+ }
1507
+ .pro-step > .step-menu > .anticon > button > .menu-icon {
1508
+ width: auto !important;
1509
+ height: auto !important;
1510
+ font-size: var(--zaui-font-size-lg-title, 24px);
1511
+ fill: var(--zaui-brand, #006aff);
1512
+ }
1513
+ .pro-step > .step-menu > .anticon > button > .menu-icon > div {
1514
+ display: -webkit-box;
1515
+ display: -webkit-flex;
1516
+ display: -ms-flexbox;
1517
+ display: flex;
1518
+ -webkit-box-align: center;
1519
+ -webkit-align-items: center;
1520
+ -ms-flex-align: center;
1521
+ align-items: center;
1522
+ -webkit-box-pack: center;
1523
+ -webkit-justify-content: center;
1524
+ -ms-flex-pack: center;
1525
+ justify-content: center;
1526
+ width: 48px;
1527
+ height: 24px;
1528
+ }
1503
1529
  .pro-step > .step-menu > .menu-icon {
1504
1530
  font-size: var(--zaui-font-size-lg-title, 24px);
1505
1531
  fill: var(--zaui-brand, #006aff);
@@ -109,6 +109,14 @@ export var getDisabled = function getDisabled(_ref2) {
109
109
  if (isFunction(column === null || column === void 0 ? void 0 : column.disabled) || isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || isBoolean(column === null || column === void 0 ? void 0 : column.disabled) || isBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
110
110
  return false;
111
111
  }
112
+ // 判断FieldProps是否有disabled属性
113
+ if (isFunction(columnFieldProps)) {
114
+ var _columnFieldProps = columnFieldProps.apply(void 0, _toConsumableArray(params)),
115
+ disabled = _columnFieldProps.disabled;
116
+ if (isFunction(disabled) || isBoolean(disabled)) {
117
+ return false;
118
+ }
119
+ }
112
120
  return true;
113
121
  };
114
122
  if (globalControl) {
@@ -118,8 +126,22 @@ export var getDisabled = function getDisabled(_ref2) {
118
126
  if (isFunction(rowDisabled) && noColumnDisabled()) {
119
127
  return rowDisabled(params[1]);
120
128
  }
121
- if (isFunction(column === null || column === void 0 ? void 0 : column.disabled) || isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
122
- return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params))) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
129
+ if (isFunction(column === null || column === void 0 ? void 0 : column.disabled)) {
130
+ return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params)));
131
+ }
132
+ // 表单FieldProps为函数时
133
+ if (isFunction(columnFieldProps)) {
134
+ var _columnFieldProps2 = columnFieldProps.apply(void 0, _toConsumableArray(params)),
135
+ disabled = _columnFieldProps2.disabled;
136
+ if (isFunction(disabled)) {
137
+ return convertToBoolean(disabled.apply(void 0, _toConsumableArray(params)));
138
+ }
139
+ if (isBoolean(disabled)) {
140
+ return convertToBoolean(disabled);
141
+ }
142
+ }
143
+ if (isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
144
+ return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
123
145
  }
124
146
  return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled);
125
147
  };
@@ -6,12 +6,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
7
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
8
  var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { useExternal, useLocalStorageState } from 'ahooks';
9
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
10
+ import { useExternal, useLocalStorageState, useSetState, useDeepCompareLayoutEffect } from 'ahooks';
11
11
  import classNames from 'classnames';
12
12
  import { uniqBy } from 'lodash';
13
13
  import { ReactSVG } from 'react-svg';
14
- import { useEffect, useMemo } from 'react';
14
+ import { useEffect } from 'react';
15
15
  import { useProConfig } from '../ProConfigProvider';
16
16
  import { iconMap } from './config';
17
17
  import { onBeforeInjection } from './utils';
@@ -50,6 +50,12 @@ var ProIcon = function ProIcon(props) {
50
50
  actionMap = _config.actionMap,
51
51
  tooltip = _config.tooltip,
52
52
  reset = _objectWithoutProperties(_config, _excluded);
53
+ var _useSetState = useSetState({
54
+ IconInstance: _jsx(_Fragment, {})
55
+ }),
56
+ _useSetState2 = _slicedToArray(_useSetState, 2),
57
+ IconInstance = _useSetState2[0].IconInstance,
58
+ setState = _useSetState2[1];
53
59
  // 主题色 primaryColor 用于单应用或处于组件库文档内 qiankunPrimaryColor用于主子应用
54
60
  var _ref = antdTheme !== null && antdTheme !== void 0 ? antdTheme : {},
55
61
  _ref$primaryColor = _ref.primaryColor,
@@ -133,30 +139,38 @@ var ProIcon = function ProIcon(props) {
133
139
  }, reset), {}, {
134
140
  children: _jsx(_Tooltip, {
135
141
  title: iconText,
136
- children: !src ? _jsx("svg", _objectSpread(_objectSpread({}, svgProps), {}, {
137
- onClick: onClick,
138
- "aria-hidden": "true",
139
- children: _jsx("use", {
140
- xlinkHref: "#icon-".concat(_type)
141
- })
142
- })) : _jsx(ReactSVG, _objectSpread(_objectSpread({}, svgProps), {}, {
143
- // @ts-ignore
144
- onClick: onClick,
145
- "aria-hidden": "true",
146
- src: src,
147
- beforeInjection: function beforeInjection(svg) {
148
- onBeforeInjection({
149
- svg: svg,
150
- actionMap: actionMap,
151
- primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
152
- });
153
- }
154
- }))
142
+ children: _jsx(_Button, _objectSpread({
143
+ style: {
144
+ width: size,
145
+ height: size,
146
+ border: 'none',
147
+ borderRadius: 0,
148
+ padding: 0,
149
+ verticalAlign: 'baseline'
150
+ },
151
+ type: "text",
152
+ icon: !src ? _jsx("svg", _objectSpread(_objectSpread({}, svgProps), {}, {
153
+ onClick: onClick,
154
+ "aria-hidden": "true",
155
+ children: _jsx("use", {
156
+ xlinkHref: "#icon-".concat(_type)
157
+ })
158
+ })) : _jsx(ReactSVG, _objectSpread(_objectSpread({}, svgProps), {}, {
159
+ // @ts-ignore
160
+ onClick: onClick,
161
+ "aria-hidden": "true",
162
+ src: src,
163
+ beforeInjection: function beforeInjection(svg) {
164
+ onBeforeInjection({
165
+ svg: svg,
166
+ actionMap: actionMap,
167
+ primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
168
+ });
169
+ }
170
+ }))
171
+ }, buttonProps))
155
172
  })
156
173
  }));
157
- var _RenderIcon = useMemo(function () {
158
- return RenderIcon;
159
- }, [primaryColor, qiankunPrimaryColor]);
160
174
  useEffect(function () {
161
175
  // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
162
176
  if (actionMap && isQiankun) {
@@ -230,7 +244,12 @@ var ProIcon = function ProIcon(props) {
230
244
  }
231
245
  };
232
246
  }, []);
233
- return !isExtendButtonMode ? _RenderIcon : _jsx(_Tooltip, {
247
+ useDeepCompareLayoutEffect(function () {
248
+ setState({
249
+ IconInstance: RenderIcon
250
+ });
251
+ }, [_config, primaryColor, qiankunPrimaryColor, language, svgProps]);
252
+ return !isExtendButtonMode ? IconInstance : _jsx(_Tooltip, {
234
253
  title: tooltip,
235
254
  children: _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({
236
255
  type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
@@ -85,7 +85,7 @@ export interface ProIconProps {
85
85
  */
86
86
  mode?: ModeType;
87
87
  /**
88
- * @description mode button时 props
88
+ * @description mode button时 props 与antd Button接收props一致
89
89
  * @default 'link'
90
90
  */
91
91
  buttonProps?: ButtonProps;
@@ -63,7 +63,7 @@ export var Step = function Step(_ref) {
63
63
  src: catalogSvg,
64
64
  className: "menu-icon",
65
65
  actionMap: {}
66
- }), true && _jsx("div", {
66
+ }), onOff && _jsx("div", {
67
67
  children: locale === null || locale === void 0 ? void 0 : (_locale$ProStep = locale.ProStep) === null || _locale$ProStep === void 0 ? void 0 : _locale$ProStep.catalogue
68
68
  })]
69
69
  }), options.map(function (item) {
@@ -46,6 +46,23 @@
46
46
  height: 24px;
47
47
  }
48
48
  }
49
+ > button {
50
+ width: auto !important;
51
+ height: auto !important;
52
+ > .menu-icon {
53
+ width: auto !important;
54
+ height: auto !important;
55
+ font-size: var(--zaui-font-size-lg-title, 24px);
56
+ fill: var(--zaui-brand, #006aff);
57
+ > div {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 48px;
62
+ height: 24px;
63
+ }
64
+ }
65
+ }
49
66
  }
50
67
 
51
68
  > .menu-icon {
@@ -116,6 +116,14 @@ var getDisabled = exports.getDisabled = function getDisabled(_ref2) {
116
116
  if ((0, _lodash.isFunction)(column === null || column === void 0 ? void 0 : column.disabled) || (0, _lodash.isFunction)(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || (0, _lodash.isBoolean)(column === null || column === void 0 ? void 0 : column.disabled) || (0, _lodash.isBoolean)(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
117
117
  return false;
118
118
  }
119
+ // 判断FieldProps是否有disabled属性
120
+ if ((0, _lodash.isFunction)(columnFieldProps)) {
121
+ var _columnFieldProps = columnFieldProps.apply(void 0, (0, _toConsumableArray2.default)(params)),
122
+ disabled = _columnFieldProps.disabled;
123
+ if ((0, _lodash.isFunction)(disabled) || (0, _lodash.isBoolean)(disabled)) {
124
+ return false;
125
+ }
126
+ }
119
127
  return true;
120
128
  };
121
129
  if (globalControl) {
@@ -125,8 +133,22 @@ var getDisabled = exports.getDisabled = function getDisabled(_ref2) {
125
133
  if ((0, _lodash.isFunction)(rowDisabled) && noColumnDisabled()) {
126
134
  return rowDisabled(params[1]);
127
135
  }
128
- if ((0, _lodash.isFunction)(column === null || column === void 0 ? void 0 : column.disabled) || (0, _lodash.isFunction)(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
129
- return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, (0, _toConsumableArray2.default)(params))) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, (0, _toConsumableArray2.default)(params)));
136
+ if ((0, _lodash.isFunction)(column === null || column === void 0 ? void 0 : column.disabled)) {
137
+ return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, (0, _toConsumableArray2.default)(params)));
138
+ }
139
+ // 表单FieldProps为函数时
140
+ if ((0, _lodash.isFunction)(columnFieldProps)) {
141
+ var _columnFieldProps2 = columnFieldProps.apply(void 0, (0, _toConsumableArray2.default)(params)),
142
+ disabled = _columnFieldProps2.disabled;
143
+ if ((0, _lodash.isFunction)(disabled)) {
144
+ return convertToBoolean(disabled.apply(void 0, (0, _toConsumableArray2.default)(params)));
145
+ }
146
+ if ((0, _lodash.isBoolean)(disabled)) {
147
+ return convertToBoolean(disabled);
148
+ }
149
+ }
150
+ if ((0, _lodash.isFunction)(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
151
+ return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, (0, _toConsumableArray2.default)(params)));
130
152
  }
131
153
  return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled);
132
154
  };
@@ -54,6 +54,12 @@ var ProIcon = function ProIcon(props) {
54
54
  actionMap = _config.actionMap,
55
55
  tooltip = _config.tooltip,
56
56
  reset = (0, _objectWithoutProperties2.default)(_config, _excluded);
57
+ var _useSetState = (0, _ahooks.useSetState)({
58
+ IconInstance: (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {})
59
+ }),
60
+ _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
61
+ IconInstance = _useSetState2[0].IconInstance,
62
+ setState = _useSetState2[1];
57
63
  // 主题色 primaryColor 用于单应用或处于组件库文档内 qiankunPrimaryColor用于主子应用
58
64
  var _ref = antdTheme !== null && antdTheme !== void 0 ? antdTheme : {},
59
65
  _ref$primaryColor = _ref.primaryColor,
@@ -137,30 +143,38 @@ var ProIcon = function ProIcon(props) {
137
143
  }, reset), {}, {
138
144
  children: (0, _jsxRuntime.jsx)(_antd.Tooltip, {
139
145
  title: iconText,
140
- children: !src ? (0, _jsxRuntime.jsx)("svg", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
141
- onClick: onClick,
142
- "aria-hidden": "true",
143
- children: (0, _jsxRuntime.jsx)("use", {
144
- xlinkHref: "#icon-".concat(_type)
145
- })
146
- })) : (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
147
- // @ts-ignore
148
- onClick: onClick,
149
- "aria-hidden": "true",
150
- src: src,
151
- beforeInjection: function beforeInjection(svg) {
152
- (0, _utils.onBeforeInjection)({
153
- svg: svg,
154
- actionMap: actionMap,
155
- primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
156
- });
157
- }
158
- }))
146
+ children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)({
147
+ style: {
148
+ width: size,
149
+ height: size,
150
+ border: 'none',
151
+ borderRadius: 0,
152
+ padding: 0,
153
+ verticalAlign: 'baseline'
154
+ },
155
+ type: "text",
156
+ icon: !src ? (0, _jsxRuntime.jsx)("svg", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
157
+ onClick: onClick,
158
+ "aria-hidden": "true",
159
+ children: (0, _jsxRuntime.jsx)("use", {
160
+ xlinkHref: "#icon-".concat(_type)
161
+ })
162
+ })) : (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, svgProps), {}, {
163
+ // @ts-ignore
164
+ onClick: onClick,
165
+ "aria-hidden": "true",
166
+ src: src,
167
+ beforeInjection: function beforeInjection(svg) {
168
+ (0, _utils.onBeforeInjection)({
169
+ svg: svg,
170
+ actionMap: actionMap,
171
+ primaryColor: isQiankun ? qiankunPrimaryColor : primaryColor
172
+ });
173
+ }
174
+ }))
175
+ }, buttonProps))
159
176
  })
160
177
  }));
161
- var _RenderIcon = (0, _react.useMemo)(function () {
162
- return RenderIcon;
163
- }, [primaryColor, qiankunPrimaryColor]);
164
178
  (0, _react.useEffect)(function () {
165
179
  // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
166
180
  if (actionMap && isQiankun) {
@@ -234,7 +248,12 @@ var ProIcon = function ProIcon(props) {
234
248
  }
235
249
  };
236
250
  }, []);
237
- return !isExtendButtonMode ? _RenderIcon : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
251
+ (0, _ahooks.useDeepCompareLayoutEffect)(function () {
252
+ setState({
253
+ IconInstance: RenderIcon
254
+ });
255
+ }, [_config, primaryColor, qiankunPrimaryColor, language, svgProps]);
256
+ return !isExtendButtonMode ? IconInstance : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
238
257
  title: tooltip,
239
258
  children: (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
240
259
  type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
@@ -85,7 +85,7 @@ export interface ProIconProps {
85
85
  */
86
86
  mode?: ModeType;
87
87
  /**
88
- * @description mode button时 props
88
+ * @description mode button时 props 与antd Button接收props一致
89
89
  * @default 'link'
90
90
  */
91
91
  buttonProps?: ButtonProps;
@@ -71,7 +71,7 @@ var Step = exports.Step = function Step(_ref) {
71
71
  src: _catalog.default,
72
72
  className: "menu-icon",
73
73
  actionMap: {}
74
- }), true && (0, _jsxRuntime.jsx)("div", {
74
+ }), onOff && (0, _jsxRuntime.jsx)("div", {
75
75
  children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProStep = _locale.default.ProStep) === null || _locale$ProStep === void 0 ? void 0 : _locale$ProStep.catalogue
76
76
  })]
77
77
  }), options.map(function (item) {
@@ -46,6 +46,23 @@
46
46
  height: 24px;
47
47
  }
48
48
  }
49
+ > button {
50
+ width: auto !important;
51
+ height: auto !important;
52
+ > .menu-icon {
53
+ width: auto !important;
54
+ height: auto !important;
55
+ font-size: var(--zaui-font-size-lg-title, 24px);
56
+ fill: var(--zaui-brand, #006aff);
57
+ > div {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 48px;
62
+ height: 24px;
63
+ }
64
+ }
65
+ }
49
66
  }
50
67
 
51
68
  > .menu-icon {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.5-beta.12",
3
+ "version": "3.4.5-beta.14",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",