@zat-design/sisyphus-react 3.6.0 → 3.6.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.
- package/dist/index.esm.css +10 -0
- package/dist/less.esm.css +10 -0
- package/es/ProEditTable/utils/config.js +6 -2
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +4 -1
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProForm/components/render/RenderFields.js +0 -6
- package/es/ProForm/index.js +7 -4
- package/es/ProForm/propsType.d.ts +4 -0
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +5 -2
- package/es/ProForm/utils/useForm.d.ts +7 -1
- package/es/ProForm/utils/useForm.js +59 -6
- package/es/ProTooltip/index.js +14 -14
- package/es/ProTooltip/style/index.less +8 -0
- package/es/ProTreeModal/components/List.js +108 -17
- package/es/ProTreeModal/components/Tree.js +4 -2
- package/es/ProTreeModal/index.js +25 -20
- package/es/ProTreeModal/style/index.less +6 -0
- package/lib/ProEditTable/utils/config.js +6 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/combination/ProNumberRange/index.js +4 -1
- package/lib/ProForm/components/render/Render.js +1 -1
- package/lib/ProForm/components/render/RenderFields.js +0 -6
- package/lib/ProForm/index.js +7 -4
- package/lib/ProForm/propsType.d.ts +4 -0
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +5 -2
- package/lib/ProForm/utils/useForm.d.ts +7 -1
- package/lib/ProForm/utils/useForm.js +59 -6
- package/lib/ProTooltip/index.js +14 -14
- package/lib/ProTooltip/style/index.less +8 -0
- package/lib/ProTreeModal/components/List.js +106 -15
- package/lib/ProTreeModal/components/Tree.js +4 -2
- package/lib/ProTreeModal/index.js +24 -19
- package/lib/ProTreeModal/style/index.less +6 -0
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2141,6 +2141,12 @@
|
|
|
2141
2141
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
|
2142
2142
|
text-align: right;
|
|
2143
2143
|
}
|
|
2144
|
+
.ant-table-cell-fix-right {
|
|
2145
|
+
z-index: 999 !important;
|
|
2146
|
+
}
|
|
2147
|
+
.ant-table-cell-fix-left {
|
|
2148
|
+
z-index: 999 !important;
|
|
2149
|
+
}
|
|
2144
2150
|
.pro-tooltip {
|
|
2145
2151
|
cursor: pointer;
|
|
2146
2152
|
}
|
|
@@ -3473,6 +3479,10 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3473
3479
|
width: 0;
|
|
3474
3480
|
height: 0;
|
|
3475
3481
|
}
|
|
3482
|
+
.pro-tree-modal-box .pro-tree-modal-tree-warp ::-webkit-scrollbar {
|
|
3483
|
+
width: 16px;
|
|
3484
|
+
height: auto;
|
|
3485
|
+
}
|
|
3476
3486
|
.pro-tree-modal-cascader-box {
|
|
3477
3487
|
width: 592px;
|
|
3478
3488
|
}
|
package/dist/less.esm.css
CHANGED
|
@@ -2141,6 +2141,12 @@
|
|
|
2141
2141
|
.pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
|
|
2142
2142
|
text-align: right;
|
|
2143
2143
|
}
|
|
2144
|
+
.ant-table-cell-fix-right {
|
|
2145
|
+
z-index: 999 !important;
|
|
2146
|
+
}
|
|
2147
|
+
.ant-table-cell-fix-left {
|
|
2148
|
+
z-index: 999 !important;
|
|
2149
|
+
}
|
|
2144
2150
|
.pro-tooltip {
|
|
2145
2151
|
cursor: pointer;
|
|
2146
2152
|
}
|
|
@@ -3473,6 +3479,10 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3473
3479
|
width: 0;
|
|
3474
3480
|
height: 0;
|
|
3475
3481
|
}
|
|
3482
|
+
.pro-tree-modal-box .pro-tree-modal-tree-warp ::-webkit-scrollbar {
|
|
3483
|
+
width: 16px;
|
|
3484
|
+
height: auto;
|
|
3485
|
+
}
|
|
3476
3486
|
.pro-tree-modal-cascader-box {
|
|
3477
3487
|
width: 592px;
|
|
3478
3488
|
}
|
|
@@ -204,9 +204,13 @@ export var actions = {
|
|
|
204
204
|
top: insertType === 'before' ? -10000 : 10000,
|
|
205
205
|
behavior: 'smooth'
|
|
206
206
|
});
|
|
207
|
-
|
|
207
|
+
if (!virtualKey) {
|
|
208
|
+
_context2.next = 15;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
_context2.next = 15;
|
|
208
212
|
return form.validateFields([name]);
|
|
209
|
-
case
|
|
213
|
+
case 15:
|
|
210
214
|
case "end":
|
|
211
215
|
return _context2.stop();
|
|
212
216
|
}
|
|
@@ -709,7 +709,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
709
709
|
} : queryBean;
|
|
710
710
|
var nextParams = transformParams ? transformParams(params) : params;
|
|
711
711
|
run(nextParams);
|
|
712
|
-
},
|
|
712
|
+
}, 1000),
|
|
713
713
|
style: {
|
|
714
714
|
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
|
715
715
|
}
|
|
@@ -129,7 +129,10 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
129
129
|
case 'amount':
|
|
130
130
|
valueProps = {
|
|
131
131
|
formatter: function formatter(value) {
|
|
132
|
-
return
|
|
132
|
+
return typeof value === 'number' || value ? Number(value).toLocaleString('zh-CN', {
|
|
133
|
+
minimumFractionDigits: precision !== null && precision !== void 0 ? precision : null,
|
|
134
|
+
maximumFractionDigits: precision !== null && precision !== void 0 ? precision : 9
|
|
135
|
+
}) : value;
|
|
133
136
|
},
|
|
134
137
|
parser: function parser(value) {
|
|
135
138
|
return value.replace(/\$\s?|(,*)/g, '');
|
|
@@ -383,7 +383,7 @@ var Render = function Render(props) {
|
|
|
383
383
|
if (originComponent) {
|
|
384
384
|
delete childProps.otherProps;
|
|
385
385
|
}
|
|
386
|
-
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? ( /*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
|
386
|
+
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? ( /*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, [].concat(lastComponentPropsFilter, ['debounceWait']))), {}, {
|
|
387
387
|
otherProps: _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
388
388
|
show: show,
|
|
389
389
|
disabled: lastDisabled,
|
|
@@ -186,12 +186,6 @@ var RenderFields = function RenderFields(props) {
|
|
|
186
186
|
globalControl: globalControl,
|
|
187
187
|
formDisabled: formDisabled
|
|
188
188
|
};
|
|
189
|
-
if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
|
|
190
|
-
setTimeout(function () {
|
|
191
|
-
form.resetFields([column === null || column === void 0 ? void 0 : column.name]);
|
|
192
|
-
}, 200);
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
189
|
return _jsx(FieldProvider, {
|
|
196
190
|
value: otherProps,
|
|
197
191
|
children: _jsx(Render, {
|
package/es/ProForm/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import _Space from "antd/es/space";
|
|
|
11
11
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl", "scrollToError"];
|
|
14
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl", "scrollToError", "optimize"];
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
17
17
|
import classnames from 'classnames';
|
|
@@ -67,6 +67,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
67
67
|
globalControl = props.globalControl,
|
|
68
68
|
_props$scrollToError = props.scrollToError,
|
|
69
69
|
scrollToError = _props$scrollToError === void 0 ? true : _props$scrollToError,
|
|
70
|
+
_props$optimize = props.optimize,
|
|
71
|
+
optimize = _props$optimize === void 0 ? false : _props$optimize,
|
|
70
72
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
71
73
|
var _useProConfig = useProConfig(),
|
|
72
74
|
state = _useProConfig.state,
|
|
@@ -74,7 +76,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
74
76
|
var config = state.ProForm,
|
|
75
77
|
forms = state.forms;
|
|
76
78
|
var _useForm = useForm((_forms$formKey = forms[formKey]) !== null && _forms$formKey !== void 0 ? _forms$formKey : originForm, {
|
|
77
|
-
scrollToError: scrollToError
|
|
79
|
+
scrollToError: scrollToError,
|
|
80
|
+
optimize: optimize
|
|
78
81
|
}),
|
|
79
82
|
_useForm2 = _slicedToArray(_useForm, 1),
|
|
80
83
|
form = _useForm2[0];
|
|
@@ -167,7 +170,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
167
170
|
// 暂时通过'-'区分组合组件字段和普通字段
|
|
168
171
|
var keys = Object.keys(changedValue);
|
|
169
172
|
if (!keys.length) {
|
|
170
|
-
onValuesChange(filterInternalFields(changedValue), form.getFieldsValue());
|
|
173
|
+
onValuesChange(filterInternalFields(changedValue, optimize), form.getFieldsValue());
|
|
171
174
|
} else {
|
|
172
175
|
var values = keys.map(function (key) {
|
|
173
176
|
if (key.includes('-')) {
|
|
@@ -179,7 +182,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
179
182
|
}
|
|
180
183
|
return {};
|
|
181
184
|
});
|
|
182
|
-
onValuesChange(filterInternalFields(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values)))), form.getFieldsValue());
|
|
185
|
+
onValuesChange(filterInternalFields(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), optimize), form.getFieldsValue());
|
|
183
186
|
}
|
|
184
187
|
};
|
|
185
188
|
// 包装一层兼容 names 改变
|
|
@@ -76,6 +76,10 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
76
76
|
required?: boolean | boolean[];
|
|
77
77
|
originalDiffTip?: boolean;
|
|
78
78
|
scrollToError?: boolean;
|
|
79
|
+
/** 性能模式,谨慎使用,默认不开启
|
|
80
|
+
* 1. 开启不过滤names的中间态值
|
|
81
|
+
*/
|
|
82
|
+
optimize?: boolean;
|
|
79
83
|
}
|
|
80
84
|
export interface Transform<T = any> {
|
|
81
85
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
|
@@ -28,7 +28,7 @@ export declare const isUpperCase: (type: string, upperCase: boolean) => any;
|
|
|
28
28
|
export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
|
|
29
29
|
export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
|
|
30
30
|
export declare const splitNameStr: (name: string) => string[][];
|
|
31
|
-
export declare const filterInternalFields: (values: any) => any;
|
|
31
|
+
export declare const filterInternalFields: (values: any, optimize?: boolean) => any;
|
|
32
32
|
export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
|
|
33
33
|
export declare const isNullValue: (value: any) => boolean;
|
|
34
34
|
/**
|
|
@@ -4,8 +4,8 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
|
-
import _, { isObject, isFunction, cloneDeep, get, set, omit, isNaN } from 'lodash';
|
|
8
7
|
import moment from 'moment';
|
|
8
|
+
import _, { isObject, isFunction, cloneDeep, get, set, omit, isNaN } from 'lodash';
|
|
9
9
|
export var getLayout = function getLayout(params) {
|
|
10
10
|
var _params$span = params.span,
|
|
11
11
|
span = _params$span === void 0 ? 8 : _params$span,
|
|
@@ -121,7 +121,10 @@ export var splitNameStr = function splitNameStr(name) {
|
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
123
|
// 过滤掉字段名中包含 '-' 的字段
|
|
124
|
-
export var filterInternalFields = function filterInternalFields(values) {
|
|
124
|
+
export var filterInternalFields = function filterInternalFields(values, optimize) {
|
|
125
|
+
if (optimize) {
|
|
126
|
+
return values;
|
|
127
|
+
}
|
|
125
128
|
var nextValues = values;
|
|
126
129
|
// fix: braft-editor对象不可遍历 Moment不过滤
|
|
127
130
|
if ((values === null || values === void 0 ? void 0 : values._immutable) || moment.isMoment(values)) {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
3
|
+
import { ValuedNotifyInfo } from 'rc-field-form/es/interface';
|
|
2
4
|
type ModifiedFormInstance<T> = FormInstance<T> & {
|
|
3
5
|
isModified?: boolean;
|
|
6
|
+
/** 默认清空设置值的报错状态 */
|
|
7
|
+
setFieldValue: (name: NamePath, value: any, info?: ValuedNotifyInfo) => void;
|
|
8
|
+
_init?: boolean;
|
|
4
9
|
};
|
|
5
10
|
interface FormInstanceOption {
|
|
6
11
|
scrollToError?: boolean;
|
|
12
|
+
optimize?: boolean;
|
|
7
13
|
}
|
|
8
|
-
export declare const useForm: <T>(originForm
|
|
14
|
+
export declare const useForm: <T>(originForm?: FormInstanceOption | ModifiedFormInstance<T>, options?: FormInstanceOption) => [ModifiedFormInstance<T>];
|
|
9
15
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -7,22 +8,32 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
7
8
|
import { filterInternalFields } from './index';
|
|
8
9
|
import { handleScrollToError } from '../../ProEditTable/utils/tools';
|
|
9
10
|
export var useForm = function useForm(originForm, options) {
|
|
10
|
-
|
|
11
|
+
// 如果没有form实例可以直接把options放在第一个参数位置
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
var _originForm = (originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
|
14
|
+
var _options =
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
options || originForm && !(originForm === null || originForm === void 0 ? void 0 : originForm._init) ? originForm : undefined;
|
|
17
|
+
var _ref = _options || {},
|
|
11
18
|
_ref$scrollToError = _ref.scrollToError,
|
|
12
|
-
scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError
|
|
13
|
-
|
|
19
|
+
scrollToError = _ref$scrollToError === void 0 ? true : _ref$scrollToError,
|
|
20
|
+
optimize = _ref.optimize;
|
|
21
|
+
var _Form$useForm = _Form.useForm(_originForm),
|
|
14
22
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
15
23
|
form = _Form$useForm2[0];
|
|
16
24
|
var getFieldsValue = form.getFieldsValue,
|
|
17
25
|
validateFields = form.validateFields,
|
|
18
|
-
isModified = form.isModified
|
|
26
|
+
isModified = form.isModified,
|
|
27
|
+
setFields = form.setFields,
|
|
28
|
+
getFieldsError = form.getFieldsError,
|
|
29
|
+
setFieldsValue = form.setFieldsValue;
|
|
19
30
|
if (isModified) return [form];
|
|
20
31
|
// @ts-ignore
|
|
21
32
|
var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
|
|
22
33
|
// 全部查询
|
|
23
34
|
if (nameList !== true) {
|
|
24
35
|
var values = getFieldsValue(nameList || true, filterFunc);
|
|
25
|
-
return filterInternalFields(values);
|
|
36
|
+
return filterInternalFields(values, optimize);
|
|
26
37
|
}
|
|
27
38
|
return getFieldsValue(nameList, filterFunc);
|
|
28
39
|
};
|
|
@@ -70,7 +81,7 @@ export var useForm = function useForm(originForm, options) {
|
|
|
70
81
|
// delete rest[0].recursive;
|
|
71
82
|
_context.next = 11;
|
|
72
83
|
return validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
|
|
73
|
-
return filterInternalFields(values);
|
|
84
|
+
return filterInternalFields(values, optimize);
|
|
74
85
|
});
|
|
75
86
|
case 11:
|
|
76
87
|
return _context.abrupt("return", _context.sent);
|
|
@@ -102,6 +113,48 @@ export var useForm = function useForm(originForm, options) {
|
|
|
102
113
|
return _ref2.apply(this, arguments);
|
|
103
114
|
};
|
|
104
115
|
}();
|
|
116
|
+
var _setFieldValue = function _setFieldValue(name, value, info) {
|
|
117
|
+
if (info) {
|
|
118
|
+
setFields([_objectSpread({
|
|
119
|
+
name: name,
|
|
120
|
+
value: value
|
|
121
|
+
}, info)]);
|
|
122
|
+
} else {
|
|
123
|
+
setFields([{
|
|
124
|
+
name: name,
|
|
125
|
+
value: value,
|
|
126
|
+
errors: [],
|
|
127
|
+
warnings: []
|
|
128
|
+
}]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var _setFieldsValue = function _setFieldsValue(values) {
|
|
132
|
+
var errors = getFieldsError();
|
|
133
|
+
var errorNames = errors.reduce(function (acc, entry) {
|
|
134
|
+
if (entry.errors.length > 0) {
|
|
135
|
+
acc.push(entry.name[0]);
|
|
136
|
+
}
|
|
137
|
+
return acc;
|
|
138
|
+
}, []) || [];
|
|
139
|
+
if (errorNames.length) {
|
|
140
|
+
errorNames.forEach(function (errorName) {
|
|
141
|
+
// 只处理names的报错
|
|
142
|
+
if (errorName.includes('-')) {
|
|
143
|
+
setFields([{
|
|
144
|
+
name: errorName,
|
|
145
|
+
errors: [],
|
|
146
|
+
warnings: []
|
|
147
|
+
}]);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
setFieldsValue(values);
|
|
151
|
+
} else {
|
|
152
|
+
setFieldsValue(values);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
form.getFieldsValue = _getFieldsValue;
|
|
156
|
+
form.setFieldValue = _setFieldValue;
|
|
157
|
+
form.setFieldsValue = _setFieldsValue;
|
|
105
158
|
form.getFieldsValue = _getFieldsValue;
|
|
106
159
|
form.validateFields = _validateFields;
|
|
107
160
|
form.isModified = true;
|
package/es/ProTooltip/index.js
CHANGED
|
@@ -67,12 +67,12 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
67
67
|
} : {};
|
|
68
68
|
var AutoMixinSingle = function AutoMixinSingle() {
|
|
69
69
|
return isShowToolTip && line === 1 ? _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
70
|
-
title: text
|
|
71
|
-
}, restProps), {}, {
|
|
72
|
-
overlayStyle: overlayStyle,
|
|
70
|
+
title: text,
|
|
73
71
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
74
72
|
return triggerNode.parentNode;
|
|
75
|
-
}
|
|
73
|
+
}
|
|
74
|
+
}, restProps), {}, {
|
|
75
|
+
overlayStyle: overlayStyle,
|
|
76
76
|
children: _jsx("div", _objectSpread(_objectSpread({}, specialProps), {}, {
|
|
77
77
|
style: _objectSpread(_objectSpread({}, multiStyle), {}, {
|
|
78
78
|
width: localWidth,
|
|
@@ -102,12 +102,12 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
102
102
|
};
|
|
103
103
|
var AutoMixinMulti = function AutoMixinMulti() {
|
|
104
104
|
return isShowToolTip && line > 1 ? _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
105
|
-
title: text
|
|
106
|
-
}, restProps), {}, {
|
|
107
|
-
overlayStyle: overlayStyle,
|
|
105
|
+
title: text,
|
|
108
106
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
109
107
|
return triggerNode.parentNode;
|
|
110
|
-
}
|
|
108
|
+
}
|
|
109
|
+
}, restProps), {}, {
|
|
110
|
+
overlayStyle: overlayStyle,
|
|
111
111
|
children: _jsx("div", _objectSpread(_objectSpread({}, specialProps), {}, {
|
|
112
112
|
style: _objectSpread(_objectSpread({}, multiStyle), {}, {
|
|
113
113
|
width: localWidth,
|
|
@@ -253,11 +253,11 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
253
253
|
width: localWidth
|
|
254
254
|
}),
|
|
255
255
|
children: isResponsiveWidth && isShowToolTip ? _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
256
|
-
title: text
|
|
257
|
-
}, restProps), {}, {
|
|
256
|
+
title: text,
|
|
258
257
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
259
258
|
return triggerNode.parentNode;
|
|
260
|
-
}
|
|
259
|
+
}
|
|
260
|
+
}, restProps), {}, {
|
|
261
261
|
children: _jsx("div", {
|
|
262
262
|
className: isMultiLine ? 'multiLine' : 'singleLine',
|
|
263
263
|
style: _objectSpread(_objectSpread({}, multiStyle), {}, {
|
|
@@ -274,11 +274,11 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
274
274
|
ref: childRef,
|
|
275
275
|
children: content
|
|
276
276
|
}) : mode === 'default' ? _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
277
|
-
title: text
|
|
278
|
-
}, restProps), {}, {
|
|
277
|
+
title: text,
|
|
279
278
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
280
279
|
return triggerNode.parentNode;
|
|
281
|
-
}
|
|
280
|
+
}
|
|
281
|
+
}, restProps), {}, {
|
|
282
282
|
children: _jsx("div", {
|
|
283
283
|
className: isMultiLine ? 'multiLine' : 'singleLine',
|
|
284
284
|
style: _objectSpread(_objectSpread({}, multiStyle), {}, {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
@root-entry-name: 'default';
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
|
+
.@{ant-prefix}-table-cell-fix-right {
|
|
5
|
+
z-index: 999 !important;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.@{ant-prefix}-table-cell-fix-left {
|
|
9
|
+
z-index: 999 !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
.pro-tooltip {
|
|
5
13
|
cursor: pointer;
|
|
6
14
|
|
|
@@ -7,10 +7,10 @@ import _Checkbox from "antd/es/checkbox";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
/* eslint-disable brace-style */
|
|
10
|
-
import { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
10
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
11
11
|
import { DndContext } from '@dnd-kit/core';
|
|
12
12
|
import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
13
|
-
import { useDeepCompareEffect, useSetState } from 'ahooks';
|
|
13
|
+
import { useDeepCompareEffect, useSetState, useVirtualList } from 'ahooks';
|
|
14
14
|
import SearchTitle from './SearchTitle';
|
|
15
15
|
import CloseIcon from './CloseIcon';
|
|
16
16
|
import SortableItem from './SortableItem';
|
|
@@ -32,8 +32,14 @@ function List(props, ref) {
|
|
|
32
32
|
handleFilterClose = props.handleFilterClose,
|
|
33
33
|
optionRender = props.optionRender,
|
|
34
34
|
handleDragEndChange = props.handleDragEndChange;
|
|
35
|
+
var containerRef = useRef(null);
|
|
36
|
+
var wrapperRef = useRef(null);
|
|
37
|
+
var originalList = useMemo(function () {
|
|
38
|
+
return treeData;
|
|
39
|
+
}, [treeData]);
|
|
35
40
|
var fieldNameLabel = fieldNames.label;
|
|
36
41
|
var fieldNameValue = fieldNames.value;
|
|
42
|
+
var isCASCADER = modeType === CASCADER;
|
|
37
43
|
var _useSetState = useSetState({
|
|
38
44
|
checkedList: []
|
|
39
45
|
}),
|
|
@@ -101,6 +107,33 @@ function List(props, ref) {
|
|
|
101
107
|
}));
|
|
102
108
|
}
|
|
103
109
|
};
|
|
110
|
+
function getLineHeight(string, width) {
|
|
111
|
+
// 创建临时元素
|
|
112
|
+
var temp = document.createElement('div');
|
|
113
|
+
temp.style.position = 'absolute';
|
|
114
|
+
temp.style.visibility = 'hidden';
|
|
115
|
+
temp.style.right = '-10000px';
|
|
116
|
+
temp.style.width = "".concat(width, "px"); // 设置宽度
|
|
117
|
+
temp.style.whiteSpace = 'normal'; // 保持换行
|
|
118
|
+
temp.innerHTML = string.replace(/\n/g, '<br>'); // 替换换行符
|
|
119
|
+
document.body.appendChild(temp); // 添加到DOM中以获取计算后的高度
|
|
120
|
+
// 清理
|
|
121
|
+
var len = Math.floor(temp.getBoundingClientRect().height / 20);
|
|
122
|
+
document.body.removeChild(temp);
|
|
123
|
+
return len * 20;
|
|
124
|
+
}
|
|
125
|
+
var _useVirtualList = useVirtualList(originalList, {
|
|
126
|
+
containerTarget: containerRef,
|
|
127
|
+
wrapperTarget: wrapperRef,
|
|
128
|
+
itemHeight: function itemHeight(index, item) {
|
|
129
|
+
var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel]) : "".concat(isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel]);
|
|
130
|
+
return Math.floor(getLineHeight(title, 406)) + 12;
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
_useVirtualList2 = _slicedToArray(_useVirtualList, 1),
|
|
134
|
+
list = _useVirtualList2[0];
|
|
135
|
+
// 是否为多列模式
|
|
136
|
+
var isRowCols = mode === 'render' && span && span !== 24;
|
|
104
137
|
// 开启 draggable 拖拽模式
|
|
105
138
|
if (draggable) {
|
|
106
139
|
return _jsx("div", {
|
|
@@ -128,9 +161,56 @@ function List(props, ref) {
|
|
|
128
161
|
})
|
|
129
162
|
});
|
|
130
163
|
}
|
|
131
|
-
var isCASCADER = modeType === CASCADER;
|
|
132
164
|
// 编辑状态
|
|
133
|
-
if (
|
|
165
|
+
if (!isRowCols) {
|
|
166
|
+
return _jsx(_Fragment, {
|
|
167
|
+
children: _jsx(_Checkbox.Group, {
|
|
168
|
+
disabled: disabled,
|
|
169
|
+
style: {
|
|
170
|
+
width: '100%'
|
|
171
|
+
},
|
|
172
|
+
value: checkedValues,
|
|
173
|
+
children: _jsx("div", {
|
|
174
|
+
ref: containerRef,
|
|
175
|
+
style: {
|
|
176
|
+
height: '432px',
|
|
177
|
+
overflow: 'auto',
|
|
178
|
+
width: '100%'
|
|
179
|
+
},
|
|
180
|
+
children: _jsx("div", {
|
|
181
|
+
ref: wrapperRef,
|
|
182
|
+
children: _jsx(_Row, {
|
|
183
|
+
children: list.map(function (_item) {
|
|
184
|
+
var item = _item.data;
|
|
185
|
+
var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel]) : "".concat(isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel]);
|
|
186
|
+
var content = optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, {
|
|
187
|
+
label: title,
|
|
188
|
+
searchStr: searchStr
|
|
189
|
+
});
|
|
190
|
+
return _jsx(_Col, {
|
|
191
|
+
span: span || 24,
|
|
192
|
+
className: !span || span === 24 ? 'pro-tree-modal-checkbox-content' : '',
|
|
193
|
+
style: {
|
|
194
|
+
marginBottom: span ? 16 : 12
|
|
195
|
+
},
|
|
196
|
+
children: _jsx(_Checkbox, {
|
|
197
|
+
onChange: function onChange(e) {
|
|
198
|
+
return handleOnChange(e, item[fieldNameValue]);
|
|
199
|
+
},
|
|
200
|
+
value: item[fieldNameValue],
|
|
201
|
+
disabled: item.disabled,
|
|
202
|
+
children: content
|
|
203
|
+
})
|
|
204
|
+
}, item[fieldNameValue]);
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// 编辑状态
|
|
213
|
+
if (isRowCols) {
|
|
134
214
|
return _jsx(_Fragment, {
|
|
135
215
|
children: _jsx(_Checkbox.Group, {
|
|
136
216
|
disabled: disabled,
|
|
@@ -167,19 +247,30 @@ function List(props, ref) {
|
|
|
167
247
|
}
|
|
168
248
|
// 预览状态
|
|
169
249
|
return _jsx(_Fragment, {
|
|
170
|
-
children:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
250
|
+
children: _jsx("div", {
|
|
251
|
+
ref: containerRef,
|
|
252
|
+
style: {
|
|
253
|
+
height: '432px',
|
|
254
|
+
overflow: 'auto'
|
|
255
|
+
},
|
|
256
|
+
children: _jsx("div", {
|
|
257
|
+
ref: wrapperRef,
|
|
258
|
+
children: list.map(function (_item) {
|
|
259
|
+
var item = _item.data;
|
|
260
|
+
var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]) : item[fieldNameLabel];
|
|
261
|
+
return _jsxs("div", {
|
|
262
|
+
className: "pro-tree-modal-checkbox-content",
|
|
263
|
+
children: [_jsx("div", {
|
|
264
|
+
className: "pro-tree-modal-checkbox-content-look",
|
|
265
|
+
children: optionRender ? optionRender(item, searchStr) : title
|
|
266
|
+
}), disabled ? null : _jsx(CloseIcon, {
|
|
267
|
+
onClick: function onClick() {
|
|
268
|
+
return handleFilterClose(item[fieldNameValue]);
|
|
269
|
+
}
|
|
270
|
+
})]
|
|
271
|
+
}, item[fieldNames.value]);
|
|
272
|
+
})
|
|
273
|
+
})
|
|
183
274
|
})
|
|
184
275
|
});
|
|
185
276
|
}
|
|
@@ -191,7 +191,8 @@ function List(props, ref) {
|
|
|
191
191
|
selectable: false,
|
|
192
192
|
onCheck: onCheck,
|
|
193
193
|
checkedKeys: checkedValues,
|
|
194
|
-
checkStrictly: checkStrictly
|
|
194
|
+
checkStrictly: checkStrictly,
|
|
195
|
+
height: 432
|
|
195
196
|
})
|
|
196
197
|
});
|
|
197
198
|
}
|
|
@@ -213,7 +214,8 @@ function List(props, ref) {
|
|
|
213
214
|
autoExpandParent: true,
|
|
214
215
|
selectable: false,
|
|
215
216
|
treeData: treeViewData,
|
|
216
|
-
blockNode: true
|
|
217
|
+
blockNode: true,
|
|
218
|
+
height: 432
|
|
217
219
|
})
|
|
218
220
|
});
|
|
219
221
|
}
|
package/es/ProTreeModal/index.js
CHANGED
|
@@ -15,12 +15,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
15
15
|
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
16
16
|
* @Date: 2024-06-04 10:01:18
|
|
17
17
|
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
18
|
-
* @LastEditTime: 2024-06-
|
|
18
|
+
* @LastEditTime: 2024-06-25 17:56:33
|
|
19
19
|
* @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
|
|
20
20
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
21
21
|
*/
|
|
22
22
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
23
|
-
import { useDeepCompareEffect, useSetState, useRequest as useRequestFunc } from 'ahooks';
|
|
23
|
+
import { useDeepCompareEffect, useSetState, useRequest as useRequestFunc, useDebounceFn } from 'ahooks';
|
|
24
24
|
import { cloneDeep, isFunction } from 'lodash';
|
|
25
25
|
import { ReactSVG } from 'react-svg';
|
|
26
26
|
import classNames from 'classnames';
|
|
@@ -475,23 +475,26 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
475
475
|
checkAll: false
|
|
476
476
|
});
|
|
477
477
|
};
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
478
|
+
var _useDebounceFn = useDebounceFn(function (str) {
|
|
479
|
+
if (modeType === LIST || modeType === CASCADER) {
|
|
480
|
+
var isCASCADER = modeType === CASCADER;
|
|
481
|
+
var data = state.flatTreeData.filter(function (item) {
|
|
482
|
+
var title = isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel];
|
|
483
|
+
return title.includes(str);
|
|
484
|
+
});
|
|
485
|
+
setState({
|
|
486
|
+
treeData: !str ? state.originalTreeData : data
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
}, {
|
|
490
|
+
wait: 300
|
|
491
|
+
}),
|
|
492
|
+
onSearch = _useDebounceFn.run;
|
|
493
|
+
var handleSetSearchStr = function handleSetSearchStr(str) {
|
|
494
|
+
setState({
|
|
495
|
+
searchStr: str
|
|
496
|
+
});
|
|
497
|
+
onSearch(str);
|
|
495
498
|
};
|
|
496
499
|
/**
|
|
497
500
|
* 指定模式下的操作
|
|
@@ -744,7 +747,9 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
744
747
|
value: state.searchStr,
|
|
745
748
|
placeholder: placeholder || (locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal10 = locale.ProTreeModal) === null || _locale$ProTreeModal10 === void 0 ? void 0 : _locale$ProTreeModal10.input),
|
|
746
749
|
className: "pro-tree-modal-search",
|
|
747
|
-
onChange:
|
|
750
|
+
onChange: function onChange(e) {
|
|
751
|
+
return handleSetSearchStr(e.target.value);
|
|
752
|
+
},
|
|
748
753
|
prefix: _jsx(ReactSVG, {
|
|
749
754
|
className: "viewSvg",
|
|
750
755
|
src: searchSVG
|