@zat-design/sisyphus-react 3.13.18-beta.1 → 3.13.18-beta.10
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 +8 -2
- package/dist/less.esm.css +8 -2
- package/es/ProForm/components/base/DatePicker/index.js +16 -32
- package/es/ProForm/components/combination/Group/hooks/index.js +2 -7
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +41 -65
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +2 -2
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +57 -8
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +23 -3
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
- package/es/ProLayout/components/Layout/Menu/index.js +4 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +14 -8
- package/es/ProLayout/index.js +3 -1
- package/es/ProLayout/propTypes.d.ts +9 -0
- package/es/ProLayout/utils/index.d.ts +7 -0
- package/es/ProLayout/utils/index.js +31 -1
- package/lib/ProForm/components/base/DatePicker/index.js +16 -32
- package/lib/ProForm/components/combination/Group/hooks/index.js +2 -7
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
- package/lib/ProForm/components/combination/ProModalSelect/index.js +41 -65
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +2 -2
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +56 -7
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +22 -2
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
- package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +14 -8
- package/lib/ProLayout/index.js +3 -1
- package/lib/ProLayout/propTypes.d.ts +9 -0
- package/lib/ProLayout/utils/index.d.ts +7 -0
- package/lib/ProLayout/utils/index.js +30 -1
- package/package.json +1 -1
- package/es/ProForm/components/base/DatePicker/useDateLimit.d.ts +0 -9
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +0 -15
- package/lib/ProForm/components/base/DatePicker/useDateLimit.d.ts +0 -9
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +0 -22
@@ -13,7 +13,8 @@ var Menu = function Menu(props) {
|
|
13
13
|
pure = _ref.pure,
|
14
14
|
theme = _ref.theme,
|
15
15
|
sideMenuFooterRender = _ref.sideMenuFooterRender,
|
16
|
-
sideMenuHeaderRender = _ref.sideMenuHeaderRender
|
16
|
+
sideMenuHeaderRender = _ref.sideMenuHeaderRender,
|
17
|
+
onMenuClick = _ref.onMenuClick;
|
17
18
|
var menus = [];
|
18
19
|
var menuCls = classnames({
|
19
20
|
'pro-layout-menu': true,
|
@@ -39,6 +40,7 @@ var Menu = function Menu(props) {
|
|
39
40
|
height: headerHeight + (notice ? 32 : 0) + 48
|
40
41
|
},
|
41
42
|
theme: theme,
|
43
|
+
onMenuClick: onMenuClick,
|
42
44
|
style: {
|
43
45
|
display: collapsed ? 'block' : 'none'
|
44
46
|
}
|
@@ -51,6 +53,7 @@ var Menu = function Menu(props) {
|
|
51
53
|
collapsed: collapsed,
|
52
54
|
headerHeight: headerHeight
|
53
55
|
},
|
56
|
+
onMenuClick: onMenuClick,
|
54
57
|
style: {
|
55
58
|
display: collapsed ? 'none' : 'block',
|
56
59
|
height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0) + 48 || 0, "px)")
|
@@ -99,7 +99,7 @@
|
|
99
99
|
}
|
100
100
|
|
101
101
|
.pro-collapse-content {
|
102
|
-
padding: var(--zaui-space-size-
|
102
|
+
padding: var(--zaui-space-size-md, 16px) !important;
|
103
103
|
}
|
104
104
|
|
105
105
|
.pro-collapse-level2-collapse {
|
@@ -150,6 +150,9 @@
|
|
150
150
|
.@{ant-prefix}-collapse-expand-icon {
|
151
151
|
display: none;
|
152
152
|
}
|
153
|
+
.pro-collapse-content{
|
154
|
+
padding: var(--zaui-space-size-sm, 8px) 0 !important;
|
155
|
+
}
|
153
156
|
}
|
154
157
|
}
|
155
158
|
|
@@ -254,7 +257,11 @@
|
|
254
257
|
}
|
255
258
|
}
|
256
259
|
|
257
|
-
|
260
|
+
.pro-collapse-level3-no-collapse{
|
261
|
+
.@{ant-prefix}-collapse-header{
|
262
|
+
padding: 0 !important;
|
263
|
+
}
|
264
|
+
}
|
258
265
|
|
259
266
|
.@{ant-prefix}-collapse-header {
|
260
267
|
height: 48px !important;
|
@@ -332,10 +339,9 @@
|
|
332
339
|
background: #F8F8F8 !important;
|
333
340
|
}
|
334
341
|
}
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
342
|
+
// 当pro-collapse-content直接包含level3且不包含level2时,添加padding
|
343
|
+
.pro-collapse-level2 .pro-collapse-content:has(.pro-collapse-level3) {
|
344
|
+
padding: var(--zaui-space-size-md, 16px) !important;
|
345
|
+
padding-right: 0 !important;
|
346
|
+
}
|
341
347
|
}
|
package/es/ProLayout/index.js
CHANGED
@@ -30,7 +30,8 @@ var ProLayout = function ProLayout(props) {
|
|
30
30
|
pathPrefix = _props$pathPrefix === void 0 ? '' : _props$pathPrefix,
|
31
31
|
theme = props.theme,
|
32
32
|
target = props.target,
|
33
|
-
onCollapsedChange = props.onCollapsedChange
|
33
|
+
onCollapsedChange = props.onCollapsedChange,
|
34
|
+
onMenuClick = props.onMenuClick;
|
34
35
|
var _useSetState = useSetState({
|
35
36
|
notice: headerNotice || noticeIn,
|
36
37
|
menus: [],
|
@@ -95,6 +96,7 @@ var ProLayout = function ProLayout(props) {
|
|
95
96
|
} : menus,
|
96
97
|
notice: notice,
|
97
98
|
collapsed: collapsed,
|
99
|
+
onMenuClick: onMenuClick,
|
98
100
|
onToggle: function onToggle() {
|
99
101
|
toggle();
|
100
102
|
onCollapsedChange && onCollapsedChange(!collapsed);
|
@@ -180,6 +180,15 @@ export interface ProLayoutType {
|
|
180
180
|
* @default -
|
181
181
|
*/
|
182
182
|
onCollapsedChange?: (collapsed: boolean) => void;
|
183
|
+
/**
|
184
|
+
* @description 菜单点击回调事件,返回命中的菜单项数据和完整路径
|
185
|
+
* @default -
|
186
|
+
*/
|
187
|
+
onMenuClick?: (params: {
|
188
|
+
item: MenusType | null;
|
189
|
+
key: string;
|
190
|
+
keyPath: string[];
|
191
|
+
}) => void;
|
183
192
|
/**
|
184
193
|
* @description 规定在何处打开被链接文档
|
185
194
|
* @default "_self"
|
@@ -34,3 +34,10 @@ export declare const getPathNameKey: ({ menus, pathName, }: {
|
|
34
34
|
menus: any[];
|
35
35
|
pathName: string;
|
36
36
|
}) => any;
|
37
|
+
/**
|
38
|
+
* 根据key查找完整的菜单项数据
|
39
|
+
* @param menus 菜单数据数组
|
40
|
+
* @param key 要查找的菜单项key
|
41
|
+
* @returns 找到的菜单项数据或null
|
42
|
+
*/
|
43
|
+
export declare const findMenuItemByKey: (menus: any[], key: string) => any;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
3
4
|
import _isPlainObject from "lodash/isPlainObject";
|
@@ -159,4 +160,33 @@ export var getPathNameKey = function getPathNameKey(_ref) {
|
|
159
160
|
};
|
160
161
|
_menuDeep3(menus);
|
161
162
|
return result;
|
162
|
-
};
|
163
|
+
};
|
164
|
+
/**
|
165
|
+
* 根据key查找完整的菜单项数据
|
166
|
+
* @param menus 菜单数据数组
|
167
|
+
* @param key 要查找的菜单项key
|
168
|
+
* @returns 找到的菜单项数据或null
|
169
|
+
*/
|
170
|
+
var _findMenuItemByKey = function findMenuItemByKey(menus, key) {
|
171
|
+
// eslint-disable-next-line no-restricted-syntax
|
172
|
+
var _iterator = _createForOfIteratorHelper(menus),
|
173
|
+
_step;
|
174
|
+
try {
|
175
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
176
|
+
var item = _step.value;
|
177
|
+
if (String(item.id) === key) {
|
178
|
+
return item;
|
179
|
+
}
|
180
|
+
if (Array.isArray(item.children) && item.children.length) {
|
181
|
+
var found = _findMenuItemByKey(item.children, key);
|
182
|
+
if (found) return found;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
} catch (err) {
|
186
|
+
_iterator.e(err);
|
187
|
+
} finally {
|
188
|
+
_iterator.f();
|
189
|
+
}
|
190
|
+
return null;
|
191
|
+
};
|
192
|
+
export { _findMenuItemByKey as findMenuItemByKey };
|
@@ -8,10 +8,9 @@ exports.default = void 0;
|
|
8
8
|
require("antd/es/date-picker/style");
|
9
9
|
var _datePicker = _interopRequireDefault(require("antd/es/date-picker"));
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
12
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
13
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
14
|
-
var
|
13
|
+
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
15
14
|
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
16
15
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
17
16
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
@@ -32,18 +31,11 @@ var DatePicker = function DatePicker(props) {
|
|
32
31
|
viewEmpty = _ref.viewEmpty,
|
33
32
|
valueType = _ref.valueType;
|
34
33
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
|
35
|
-
var initialConfig = (0, _ProConfigProvider.useProConfig)('DatePicker');
|
36
|
-
var
|
34
|
+
var initialConfig = (0, _ProConfigProvider.useProConfig)('DatePicker') || {};
|
35
|
+
var nextFormat = format;
|
36
|
+
var nextClassName = (0, _classnames.default)((0, _defineProperty2.default)({
|
37
37
|
'full-form-item': true
|
38
38
|
}, className, !!className));
|
39
|
-
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
40
|
-
var tempFormat = Array.isArray(format) ? format : [format];
|
41
|
-
if ((0, _isFunction2.default)(format)) {
|
42
|
-
tempFormat = [];
|
43
|
-
}
|
44
|
-
var _format = (0, _uniq2.default)([].concat((0, _toConsumableArray2.default)(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
|
45
|
-
return !!formatKey;
|
46
|
-
});
|
47
39
|
if (isView) {
|
48
40
|
var value = rest.value;
|
49
41
|
var viewChildren = null;
|
@@ -54,38 +46,30 @@ var DatePicker = function DatePicker(props) {
|
|
54
46
|
} else if ((0, _isFunction2.default)(format)) {
|
55
47
|
viewChildren = format(value);
|
56
48
|
} else if ((0, _isString2.default)(value)) {
|
57
|
-
viewChildren = (0, _moment.default)(value).format(
|
49
|
+
viewChildren = (0, _moment.default)(value).format(format);
|
58
50
|
}
|
59
51
|
return (0, _jsxRuntime.jsx)(_Container.default, {
|
60
52
|
viewEmpty: viewEmpty,
|
61
53
|
children: viewChildren
|
62
54
|
});
|
63
55
|
}
|
64
|
-
var _defaultShowTime = {
|
65
|
-
format: 'HH:mm:ss'
|
66
|
-
};
|
67
56
|
// dateTime模式下默认开启time选择
|
68
|
-
var
|
57
|
+
var restProps = (0, _objectSpread2.default)({}, rest);
|
69
58
|
// showTime默认值受valueType属性影响
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
if (restProps.showTime === false) {
|
60
|
+
restProps.showTime = false;
|
61
|
+
} else if (valueType === 'dateTime') {
|
62
|
+
restProps.showTime = true;
|
63
|
+
nextFormat = 'YYYY-MM-DD HH:mm:ss';
|
74
64
|
}
|
75
65
|
// 字符串时间格式兼容
|
76
|
-
if ((0, _isString2.default)(
|
77
|
-
|
78
|
-
}
|
79
|
-
if (_rest.showTime === true) {
|
80
|
-
_rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
|
81
|
-
}
|
82
|
-
if ((0, _isObject2.default)(_rest.showTime)) {
|
83
|
-
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
66
|
+
if ((0, _isString2.default)(restProps.value)) {
|
67
|
+
restProps.value = (0, _moment.default)(restProps.value);
|
84
68
|
}
|
85
69
|
return (0, _jsxRuntime.jsx)(_datePicker.default, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialConfig), {}, {
|
86
|
-
format:
|
87
|
-
},
|
88
|
-
className:
|
70
|
+
format: nextFormat
|
71
|
+
}, (0, _omit2.default)(restProps, ['otherProps'])), {}, {
|
72
|
+
className: nextClassName
|
89
73
|
}));
|
90
74
|
};
|
91
75
|
var _default = exports.default = DatePicker;
|
@@ -173,14 +173,9 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
173
173
|
getValueProps: transform === null || transform === void 0 ? void 0 : transform.getValueProps,
|
174
174
|
fieldProps: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, column === null || column === void 0 ? void 0 : column.fieldProps), reactiveProps === null || reactiveProps === void 0 ? void 0 : reactiveProps.fieldProps), {}, {
|
175
175
|
onChange: handleChange,
|
176
|
-
onBlur: handleBlur
|
177
|
-
}, names ? {
|
178
|
-
value: form.getFieldValue(columnName)
|
179
|
-
} // 独立字段模式
|
180
|
-
: {
|
176
|
+
onBlur: handleBlur,
|
181
177
|
value: value === null || value === void 0 ? void 0 : value[index]
|
182
|
-
}
|
183
|
-
)
|
178
|
+
})
|
184
179
|
});
|
185
180
|
});
|
186
181
|
};
|
@@ -71,7 +71,7 @@ function useRequestList(service, options, useRequestOptions) {
|
|
71
71
|
queryBean: _condition !== null && _condition !== void 0 ? _condition : {}
|
72
72
|
}) : _condition;
|
73
73
|
return transformParams ? transformParams(tempParams) : tempParams;
|
74
|
-
}, [page, searchValues]);
|
74
|
+
}, [page, searchValues, _defaultParams, transformParams]);
|
75
75
|
// 调接口
|
76
76
|
var result = (0, _ahooks.useRequest)(service || defaultService, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, useRequestOptions), {}, {
|
77
77
|
defaultParams: [params]
|
@@ -107,9 +107,7 @@ function useRequestList(service, options, useRequestOptions) {
|
|
107
107
|
}, [onChange, searchValues]);
|
108
108
|
// 重置查询条件
|
109
109
|
var onReset = (0, _react.useCallback)(function () {
|
110
|
-
onSearch({
|
111
|
-
d: Date.now()
|
112
|
-
});
|
110
|
+
onSearch({});
|
113
111
|
}, [onSearch]);
|
114
112
|
var dataSource = (0, _react.useMemo)(function () {
|
115
113
|
if (data) {
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
7
7
|
});
|
8
8
|
exports.default = void 0;
|
9
|
-
require("antd/es/tooltip/style");
|
10
|
-
var _tooltip = _interopRequireDefault(require("antd/es/tooltip"));
|
11
9
|
require("antd/es/button/style");
|
12
10
|
var _button = _interopRequireDefault(require("antd/es/button"));
|
13
11
|
require("antd/es/input/style");
|
14
12
|
var _input = _interopRequireDefault(require("antd/es/input"));
|
13
|
+
require("antd/es/tooltip/style");
|
14
|
+
var _tooltip2 = _interopRequireDefault(require("antd/es/tooltip"));
|
15
15
|
require("antd/es/spin/style");
|
16
16
|
var _spin = _interopRequireDefault(require("antd/es/spin"));
|
17
17
|
require("antd/es/space/style");
|
@@ -27,8 +27,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
27
27
|
require("antd/es/form/style");
|
28
28
|
var _form = _interopRequireDefault(require("antd/es/form"));
|
29
29
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
30
|
+
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
30
31
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
31
32
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
33
|
+
var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
|
32
34
|
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
33
35
|
var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
|
34
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -43,7 +45,7 @@ var _view = _interopRequireDefault(require("../../../../assets/view.svg"));
|
|
43
45
|
var _useRequestList3 = _interopRequireDefault(require("./hooks/useRequestList"));
|
44
46
|
var _locale = _interopRequireDefault(require("../../../../locale"));
|
45
47
|
var _utils = require("./utils");
|
46
|
-
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne", "otherProps"],
|
48
|
+
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "mode", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "tooltip", "searchForm", "searchKey", "defaultOne", "otherProps"],
|
47
49
|
_excluded2 = ["onOk"],
|
48
50
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
49
51
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
@@ -56,6 +58,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
56
58
|
fieldNames = props.fieldNames,
|
57
59
|
_props$readOnly = props.readOnly,
|
58
60
|
readOnly = _props$readOnly === void 0 ? true : _props$readOnly,
|
61
|
+
_props$mode = props.mode,
|
62
|
+
mode = _props$mode === void 0 ? 'select' : _props$mode,
|
59
63
|
addonAfter = props.addonAfter,
|
60
64
|
configOption = props.configOption,
|
61
65
|
title = props.title,
|
@@ -68,11 +72,19 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
68
72
|
beforeOpen = props.beforeOpen,
|
69
73
|
afterOpen = props.afterOpen,
|
70
74
|
isTooltip = props.isTooltip,
|
75
|
+
tooltip = props.tooltip,
|
71
76
|
searchForm = props.searchForm,
|
72
77
|
searchKey = props.searchKey,
|
73
78
|
defaultOne = props.defaultOne,
|
74
79
|
otherProps = props.otherProps,
|
75
80
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
81
|
+
var _tooltip = tooltip !== null && tooltip !== void 0 ? tooltip : isTooltip;
|
82
|
+
var nextMode = (0, _react.useMemo)(function () {
|
83
|
+
if ((0, _isBoolean2.default)(readOnly) && readOnly === false) {
|
84
|
+
return 'input';
|
85
|
+
}
|
86
|
+
return mode;
|
87
|
+
}, [mode, readOnly]);
|
76
88
|
var contentForm = _form.default.useFormInstance();
|
77
89
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
78
90
|
throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
|
@@ -179,8 +191,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
179
191
|
transformParams: transformParams,
|
180
192
|
transformResponse: transformResponse
|
181
193
|
}, (0, _objectSpread5.default)({
|
182
|
-
|
183
|
-
ready: (initParams || defaultOne) && !readOnly || visible
|
194
|
+
ready: (initParams || defaultOne) && nextMode === 'input' || visible
|
184
195
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
185
196
|
data = _useRequestList2.data,
|
186
197
|
loading = _useRequestList2.loading,
|
@@ -211,7 +222,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
211
222
|
if (typeof data === 'string' || typeof data === 'number') {
|
212
223
|
return data;
|
213
224
|
}
|
214
|
-
if (
|
225
|
+
if ((0, _isObject2.default)(data)) {
|
215
226
|
return handleFormat((0, _objectSpread5.default)((0, _objectSpread5.default)({}, data), {}, {
|
216
227
|
value: data[valueKey],
|
217
228
|
label: data[labelKey]
|
@@ -248,7 +259,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
248
259
|
* @returns {any}
|
249
260
|
*/
|
250
261
|
var getRowKey = function getRowKey(record) {
|
251
|
-
if (
|
262
|
+
if ((0, _isFunction2.default)(rowKey)) {
|
252
263
|
return rowKey(record);
|
253
264
|
}
|
254
265
|
return record[rowKey];
|
@@ -270,7 +281,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
270
281
|
var handleChangeValue = function handleChangeValue(e) {
|
271
282
|
onChange(e.target.value);
|
272
283
|
preValue.current = e.target.value;
|
273
|
-
if (
|
284
|
+
if (nextMode === 'input') {
|
274
285
|
setState({
|
275
286
|
_value: e.target.value
|
276
287
|
});
|
@@ -528,7 +539,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
528
539
|
selectedRows: list,
|
529
540
|
selectedRowKeys: nextSelectRowKeys
|
530
541
|
});
|
531
|
-
} else if (
|
542
|
+
} else if (nextMode === 'input') {
|
532
543
|
// 当传入initParams且文本框非只读时,不调用接口获取初始化数据
|
533
544
|
setState({
|
534
545
|
_value: value,
|
@@ -616,13 +627,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
616
627
|
selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || [],
|
617
628
|
_value: undefined
|
618
629
|
});
|
619
|
-
} else if (
|
630
|
+
} else if ((0, _isArray2.default)(value)) {
|
620
631
|
setState({
|
621
632
|
selectedRowKeys: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || value,
|
622
633
|
selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || value,
|
623
634
|
_value: value
|
624
635
|
});
|
625
|
-
} else if (
|
636
|
+
} else if ((0, _isObject2.default)(value)) {
|
626
637
|
var initialValue = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, valueKey, value[valueKey]), labelKey, value[labelKey]);
|
627
638
|
setState({
|
628
639
|
selectedRowKeys: [value],
|
@@ -645,7 +656,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
645
656
|
nextState.selectedRowKeys = [];
|
646
657
|
nextState.selectedRows = [];
|
647
658
|
}
|
648
|
-
if (
|
659
|
+
if ((0, _isObject2.default)(value)) {
|
649
660
|
nextState.selectedRowKeys = [getRowKey(value)];
|
650
661
|
nextState.selectedRows = [value];
|
651
662
|
}
|
@@ -671,12 +682,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
671
682
|
(0, _utils.hideTooltipIfOpen)(fieldRef.current, visible);
|
672
683
|
}, [visible]);
|
673
684
|
(0, _react.useEffect)(function () {
|
674
|
-
if (value && !visible && isInit &&
|
685
|
+
if (value && !visible && isInit && nextMode === 'input') {
|
675
686
|
getInitValues();
|
676
687
|
}
|
677
688
|
}, [JSON.stringify(value), visible, isInit]);
|
678
689
|
(0, _ahooks.useDebounceEffect)(function () {
|
679
|
-
if (value && !visible &&
|
690
|
+
if (value && !visible && nextMode === 'select' && (!(0, _isEqual2.default)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
|
680
691
|
var _options$some;
|
681
692
|
preValue.current = value;
|
682
693
|
var _data3 = labelInValue ? value[valueKey] : value;
|
@@ -743,7 +754,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
743
754
|
});
|
744
755
|
}
|
745
756
|
}
|
746
|
-
if (
|
757
|
+
if (nextMode === 'input') {
|
747
758
|
if (labelInValue && _value && !(0, _isEqual2.default)(value, _value)) {
|
748
759
|
setState({
|
749
760
|
_value: value,
|
@@ -766,7 +777,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
766
777
|
width: '100%'
|
767
778
|
},
|
768
779
|
block: true,
|
769
|
-
children: [
|
780
|
+
children: [nextMode === 'select' ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0, _objectSpread5.default)({
|
770
781
|
value: value,
|
771
782
|
onChange: handleSelectValue,
|
772
783
|
disabled: disabled,
|
@@ -782,16 +793,21 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
782
793
|
}) : null,
|
783
794
|
onFocus: handleSelectFocus,
|
784
795
|
onSearch: handleSelectSearch,
|
796
|
+
tooltip: _tooltip,
|
785
797
|
style: {
|
786
798
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
787
799
|
}
|
788
|
-
}, restProps)) : (0, _jsxRuntime.jsx)(
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
800
|
+
}, restProps)) : (0, _jsxRuntime.jsx)(_tooltip2.default, {
|
801
|
+
title: _tooltip ? viewText : null,
|
802
|
+
placement: "topLeft",
|
803
|
+
children: (0, _jsxRuntime.jsx)(_input.default, (0, _objectSpread5.default)({
|
804
|
+
value: viewText,
|
805
|
+
onChange: handleChangeValue,
|
806
|
+
disabled: disabled,
|
807
|
+
autoComplete: "off",
|
808
|
+
allowClear: true
|
809
|
+
}, restProps))
|
810
|
+
}), isView || disabled ? null : (0, _jsxRuntime.jsx)(_button.default, {
|
795
811
|
icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
796
812
|
className: "viewSvg",
|
797
813
|
src: _view.default,
|
@@ -806,41 +822,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
806
822
|
children: customRender
|
807
823
|
});
|
808
824
|
}
|
809
|
-
(0, _ahooks.useDeepCompareEffect)(function () {
|
810
|
-
if (isTooltip && value) {
|
811
|
-
var dom = document.getElementById(uuid);
|
812
|
-
dom.addEventListener('mouseover', function (e) {
|
813
|
-
if (value && e.target.tagName === 'INPUT') {
|
814
|
-
setState({
|
815
|
-
open: true
|
816
|
-
});
|
817
|
-
}
|
818
|
-
});
|
819
|
-
dom.addEventListener('mouseout', function (e) {
|
820
|
-
if (e.target.tagName === 'INPUT') {
|
821
|
-
setState({
|
822
|
-
open: false
|
823
|
-
});
|
824
|
-
}
|
825
|
-
});
|
826
|
-
return function () {
|
827
|
-
dom.removeEventListener('mouseover', function (e) {
|
828
|
-
if (value && e.target.tagName === 'INPUT') {
|
829
|
-
setState({
|
830
|
-
open: true
|
831
|
-
});
|
832
|
-
}
|
833
|
-
});
|
834
|
-
dom.removeEventListener('mouseout', function (e) {
|
835
|
-
if (e.target.tagName === 'INPUT') {
|
836
|
-
setState({
|
837
|
-
open: false
|
838
|
-
});
|
839
|
-
}
|
840
|
-
});
|
841
|
-
};
|
842
|
-
}
|
843
|
-
}, [value, isTooltip]);
|
844
825
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
845
826
|
setState({
|
846
827
|
options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || []
|
@@ -878,14 +859,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
878
859
|
className: _className,
|
879
860
|
style: style,
|
880
861
|
ref: fieldRef,
|
881
|
-
children:
|
882
|
-
placement: "topLeft",
|
883
|
-
open: open,
|
884
|
-
title: viewText,
|
885
|
-
children: initRender
|
886
|
-
}) : initRender
|
862
|
+
children: initRender
|
887
863
|
}), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread5.default)((0, _objectSpread5.default)({
|
888
|
-
|
864
|
+
mode: "Modal",
|
889
865
|
title: title,
|
890
866
|
onOk: handleFinish,
|
891
867
|
// @ts-ignore
|
@@ -80,17 +80,21 @@ interface ProModalPropsType {
|
|
80
80
|
beforeOpen?: any;
|
81
81
|
/** 打开弹框后的回调函数 */
|
82
82
|
afterOpen?: any;
|
83
|
-
/** 是否启用tooltip提示 */
|
83
|
+
/** 废弃 是否启用tooltip提示 */
|
84
84
|
isTooltip?: boolean;
|
85
|
+
/** 是否启用tooltip提示 */
|
86
|
+
tooltip?: boolean;
|
85
87
|
/** 是否以"值-名称"形式展示 */
|
86
88
|
showCodeName?: boolean;
|
87
89
|
/** 查询表单实例,用于获取查询表单数据 */
|
88
90
|
searchForm?: FormInstance;
|
89
91
|
/** 模糊查询的字段名 */
|
90
92
|
searchKey?: string;
|
93
|
+
/** 展示形式 */
|
94
|
+
mode?: 'input' | 'select';
|
91
95
|
}
|
92
96
|
/** 模态框选择器属性类型(结合Select和Input属性) */
|
93
|
-
export declare type ProModalSelectPropsType = SelectProps & InputProps & ProModalPropsType;
|
97
|
+
export declare type ProModalSelectPropsType = Omit<SelectProps & InputProps, 'mode'> & ProModalPropsType;
|
94
98
|
/** 配置选项类型 */
|
95
99
|
export type ProModalSelectConfigType = ConfigOption;
|
96
100
|
/** 模态框属性类型 */
|
@@ -98,5 +102,5 @@ export type ProModalType = Omit<ProModalPropsType, 'configOption'> & {
|
|
98
102
|
configOption: ProModalSelectConfigType;
|
99
103
|
};
|
100
104
|
/** 模态框选择器类型(结合Select和Input属性) */
|
101
|
-
export type ProModalSelectType = SelectProps & InputProps & ProModalType;
|
105
|
+
export type ProModalSelectType = Omit<SelectProps & InputProps, 'mode'> & ProModalType;
|
102
106
|
export {};
|
@@ -53,7 +53,7 @@
|
|
53
53
|
}
|
54
54
|
}
|
55
55
|
|
56
|
-
// 新加适用于
|
56
|
+
// 新加适用于 _readOnly false
|
57
57
|
.@{ant-prefix}-input-affix-wrapper {
|
58
58
|
border-top-right-radius: 0;
|
59
59
|
border-bottom-right-radius: 0;
|
@@ -100,7 +100,7 @@
|
|
100
100
|
}
|
101
101
|
|
102
102
|
.@{ant-prefix}-input-affix-wrapper-status-error{
|
103
|
-
|
103
|
+
|
104
104
|
}
|
105
105
|
|
106
106
|
|