@zat-design/sisyphus-react 3.4.13 → 3.5.0-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/LICENSE +201 -21
- package/dist/index.esm.css +62 -1
- package/dist/less.esm.css +61 -0
- package/es/ProEditTable/components/DndWrapper/index.js +1 -0
- package/es/ProEditTable/index.d.ts +1 -1
- package/es/ProEditTable/index.js +8 -3
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/style/index.less +1 -0
- package/es/ProEditTable/utils/index.js +10 -38
- package/es/ProEditTable/utils/tools.d.ts +3 -0
- package/es/ProEditTable/utils/tools.js +33 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +28 -7
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
- package/es/ProForm/index.js +3 -3
- package/es/ProForm/style/index.less +1 -0
- package/es/ProForm/utils/useForm.d.ts +5 -1
- package/es/ProForm/utils/useForm.js +24 -14
- package/es/ProForm/utils/valueType.d.ts +0 -6
- package/es/ProForm/utils/valueType.js +30 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/es/ProLayout/index.js +6 -2
- package/es/ProLayout/propTypes.d.ts +4 -0
- package/es/ProSelect/index.js +52 -45
- package/es/ProSelect/index.less +6 -0
- package/es/ProTable/components/DndWrapper/index.d.ts +15 -0
- package/es/ProTable/components/DndWrapper/index.js +94 -0
- package/es/ProTable/components/index.d.ts +1 -0
- package/es/ProTable/components/index.js +2 -1
- package/es/ProTable/index.d.ts +3 -0
- package/es/ProTable/index.js +177 -74
- package/es/ProTable/propsType.d.ts +5 -1
- package/es/ProTable/style/index.less +90 -0
- package/es/ProTree/components/ProTreeSelect/index.js +6 -2
- package/es/ProTree/utils.d.ts +1 -1
- package/es/ProTree/utils.js +1 -1
- package/es/ProTreeModal/index.js +10 -4
- package/es/ProTreeModal/style/index.less +1 -0
- package/es/style/theme/antd.less +1 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +1 -0
- package/lib/ProEditTable/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +8 -3
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/style/index.less +1 -0
- package/lib/ProEditTable/utils/index.js +9 -37
- package/lib/ProEditTable/utils/tools.d.ts +3 -0
- package/lib/ProEditTable/utils/tools.js +34 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/combination/ProNumberRange/index.js +28 -7
- package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
- package/lib/ProForm/index.js +2 -2
- package/lib/ProForm/style/index.less +1 -0
- package/lib/ProForm/utils/useForm.d.ts +5 -1
- package/lib/ProForm/utils/useForm.js +24 -14
- package/lib/ProForm/utils/valueType.d.ts +0 -6
- package/lib/ProForm/utils/valueType.js +30 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/lib/ProLayout/index.js +6 -2
- package/lib/ProLayout/propTypes.d.ts +4 -0
- package/lib/ProSelect/index.js +54 -45
- package/lib/ProSelect/index.less +6 -0
- package/lib/ProTable/components/DndWrapper/index.d.ts +15 -0
- package/lib/ProTable/components/DndWrapper/index.js +101 -0
- package/lib/ProTable/components/index.d.ts +1 -0
- package/lib/ProTable/components/index.js +15 -1
- package/lib/ProTable/index.d.ts +3 -0
- package/lib/ProTable/index.js +173 -70
- package/lib/ProTable/propsType.d.ts +5 -1
- package/lib/ProTable/style/index.less +90 -0
- package/lib/ProTree/components/ProTreeSelect/index.js +6 -2
- package/lib/ProTree/utils.d.ts +1 -1
- package/lib/ProTree/utils.js +1 -1
- package/lib/ProTreeModal/index.js +10 -4
- package/lib/ProTreeModal/style/index.less +1 -0
- package/lib/style/theme/antd.less +1 -1
- package/package.json +2 -2
|
@@ -17,6 +17,7 @@ var formatAmount = tools.formatAmount,
|
|
|
17
17
|
formatPercent = tools.formatPercent,
|
|
18
18
|
formatPerMill = tools.formatPerMill;
|
|
19
19
|
var ProNumberRange = function ProNumberRange(props) {
|
|
20
|
+
var _valueProps, _valueProps2, _valueProps3, _valueProps4;
|
|
20
21
|
var _props$value = props.value,
|
|
21
22
|
value = _props$value === void 0 ? [] : _props$value,
|
|
22
23
|
_props$onChange = props.onChange,
|
|
@@ -134,8 +135,26 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
134
135
|
}
|
|
135
136
|
};
|
|
136
137
|
break;
|
|
138
|
+
// 百分比
|
|
139
|
+
case 'percentage':
|
|
140
|
+
valueProps = {
|
|
141
|
+
min: 0,
|
|
142
|
+
max: 100,
|
|
143
|
+
step: 1
|
|
144
|
+
};
|
|
145
|
+
break;
|
|
146
|
+
// 千分比
|
|
147
|
+
case 'permillage':
|
|
148
|
+
valueProps = {
|
|
149
|
+
min: 0,
|
|
150
|
+
max: 1000,
|
|
151
|
+
step: 1
|
|
152
|
+
};
|
|
153
|
+
break;
|
|
137
154
|
default:
|
|
138
|
-
valueProps = {
|
|
155
|
+
valueProps = {
|
|
156
|
+
max: 999999999999
|
|
157
|
+
};
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
/**
|
|
@@ -157,15 +176,16 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
157
176
|
className: "range-left",
|
|
158
177
|
value: (value === null || value === void 0 ? void 0 : value[0]) || range[0],
|
|
159
178
|
placeholder: "".concat(locale.ProForm.inputPlaceholder),
|
|
160
|
-
min: min,
|
|
161
|
-
max: (value === null || value === void 0 ? void 0 : value[1]) || max || range[1],
|
|
162
179
|
precision: precision,
|
|
163
180
|
disabled: getDisabled(disabled, 0),
|
|
164
181
|
onChange: function onChange(e) {
|
|
165
182
|
firstHandleChange(e);
|
|
166
183
|
},
|
|
167
184
|
addonBefore: addonBefore
|
|
168
|
-
}, valueProps),
|
|
185
|
+
}, valueProps), {}, {
|
|
186
|
+
min: min || ((_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.min),
|
|
187
|
+
max: (value === null || value === void 0 ? void 0 : value[1]) || range[1] || max || ((_valueProps2 = valueProps) === null || _valueProps2 === void 0 ? void 0 : _valueProps2.max)
|
|
188
|
+
}, childProps === null || childProps === void 0 ? void 0 : childProps[0])), _jsx(_Input, {
|
|
169
189
|
className: classnames({
|
|
170
190
|
'range-split': true,
|
|
171
191
|
'range-split-disabled': !!disabled
|
|
@@ -176,15 +196,16 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
176
196
|
className: "range-right",
|
|
177
197
|
value: (value === null || value === void 0 ? void 0 : value[1]) || range[1],
|
|
178
198
|
placeholder: "".concat(locale.ProForm.inputPlaceholder),
|
|
179
|
-
min: (value === null || value === void 0 ? void 0 : value[0]) || min || range[0],
|
|
180
|
-
max: max,
|
|
181
199
|
precision: precision,
|
|
182
200
|
disabled: getDisabled(disabled, 1),
|
|
183
201
|
onChange: function onChange(e) {
|
|
184
202
|
lastHandleChange(e);
|
|
185
203
|
},
|
|
186
204
|
addonAfter: addonAfter
|
|
187
|
-
}, valueProps),
|
|
205
|
+
}, valueProps), {}, {
|
|
206
|
+
max: max || ((_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.max),
|
|
207
|
+
min: (value === null || value === void 0 ? void 0 : value[0]) || range[0] || min || ((_valueProps4 = valueProps) === null || _valueProps4 === void 0 ? void 0 : _valueProps4.min)
|
|
208
|
+
}, childProps === null || childProps === void 0 ? void 0 : childProps[1]))]
|
|
188
209
|
});
|
|
189
210
|
};
|
|
190
211
|
export default ProNumberRange;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProFormOtherProps } from '../../../propsType';
|
|
3
|
-
export type ValueTypeEnum = 'percentage' | 'permillage' | 'thousandth';
|
|
4
3
|
export interface ProNumberRangeProps {
|
|
5
4
|
/**
|
|
6
5
|
* @description 组件的值,[最小值,最大值]
|
|
@@ -46,7 +45,7 @@ export interface ProNumberRangeProps {
|
|
|
46
45
|
* @description 值类型,回显时区分金额与百分比
|
|
47
46
|
* @default '-'
|
|
48
47
|
*/
|
|
49
|
-
valueType?:
|
|
48
|
+
valueType?: 'percentage' | 'permillage' | 'thousandth';
|
|
50
49
|
/**
|
|
51
50
|
* @description 空值查看时默认展示内容
|
|
52
51
|
* @default '-'
|
package/es/ProForm/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { isObject, isString, merge } from 'lodash';
|
|
|
20
20
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
21
21
|
import RenderFields from './components/render/RenderFields';
|
|
22
22
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
23
|
-
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
23
|
+
import { getLayout, splitNameStr, useControlled, initialValuesToNames, filterInternalFields } from './utils/index';
|
|
24
24
|
import { useForm } from './utils/useForm';
|
|
25
25
|
import { useFieldProps } from './utils/useFieldProps';
|
|
26
26
|
import locale from '../locale';
|
|
@@ -163,7 +163,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
163
163
|
// 暂时通过'-'区分组合组件字段和普通字段
|
|
164
164
|
var keys = Object.keys(changedValue);
|
|
165
165
|
if (!keys.length) {
|
|
166
|
-
onValuesChange(changedValue, form.getFieldsValue());
|
|
166
|
+
onValuesChange(filterInternalFields(changedValue), form.getFieldsValue());
|
|
167
167
|
} else {
|
|
168
168
|
var values = keys.map(function (key) {
|
|
169
169
|
if (key.includes('-')) {
|
|
@@ -175,7 +175,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
175
175
|
}
|
|
176
176
|
return {};
|
|
177
177
|
});
|
|
178
|
-
onValuesChange(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), form.getFieldsValue());
|
|
178
|
+
onValuesChange(filterInternalFields(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values)))), form.getFieldsValue());
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
// 包装一层兼容 names 改变
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
|
|
2
|
+
type ModifiedFormInstance<T> = FormInstance<T> & {
|
|
3
|
+
isModified?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const useForm: <T>(originForm: ModifiedFormInstance<T>) => [ModifiedFormInstance<T>];
|
|
6
|
+
export {};
|
|
@@ -4,13 +4,16 @@ import "antd/es/form/style";
|
|
|
4
4
|
import _Form from "antd/es/form";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import { filterInternalFields } from './index';
|
|
7
|
+
import { handleScrollToError } from '../../ProEditTable/utils/tools';
|
|
7
8
|
export var useForm = function useForm(originForm) {
|
|
8
9
|
var _Form$useForm = _Form.useForm(originForm),
|
|
9
10
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
10
11
|
form = _Form$useForm2[0];
|
|
11
12
|
var getFieldsValue = form.getFieldsValue,
|
|
12
13
|
validateFields = form.validateFields,
|
|
13
|
-
setFieldsValue = form.setFieldsValue
|
|
14
|
+
setFieldsValue = form.setFieldsValue,
|
|
15
|
+
isModified = form.isModified;
|
|
16
|
+
if (isModified) return [form];
|
|
14
17
|
// @ts-ignore
|
|
15
18
|
var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
|
|
16
19
|
// 全部查询
|
|
@@ -38,7 +41,6 @@ export var useForm = function useForm(originForm) {
|
|
|
38
41
|
_form$getInternalHook,
|
|
39
42
|
getFields,
|
|
40
43
|
fieldsList,
|
|
41
|
-
_error$errorFields,
|
|
42
44
|
_error$errorFields$,
|
|
43
45
|
_args = arguments;
|
|
44
46
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -52,7 +54,7 @@ export var useForm = function useForm(originForm) {
|
|
|
52
54
|
isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
|
|
53
55
|
validateNames = []; // 前缀校验模式
|
|
54
56
|
if (!isRecursive) {
|
|
55
|
-
_context.next =
|
|
57
|
+
_context.next = 12;
|
|
56
58
|
break;
|
|
57
59
|
}
|
|
58
60
|
// @ts-ignore
|
|
@@ -66,28 +68,35 @@ export var useForm = function useForm(originForm) {
|
|
|
66
68
|
});
|
|
67
69
|
// @ts-ignore
|
|
68
70
|
delete rest[0].recursive;
|
|
69
|
-
|
|
71
|
+
_context.next = 11;
|
|
72
|
+
return validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
|
|
70
73
|
return filterInternalFields(values);
|
|
71
|
-
})
|
|
72
|
-
case
|
|
73
|
-
return _context.abrupt("return",
|
|
74
|
+
});
|
|
75
|
+
case 11:
|
|
76
|
+
return _context.abrupt("return", _context.sent);
|
|
77
|
+
case 12:
|
|
78
|
+
_context.next = 14;
|
|
79
|
+
return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
|
74
80
|
return nameList ? values : _getFieldsValue();
|
|
75
|
-
})
|
|
76
|
-
case
|
|
77
|
-
_context.
|
|
81
|
+
});
|
|
82
|
+
case 14:
|
|
83
|
+
return _context.abrupt("return", _context.sent);
|
|
84
|
+
case 17:
|
|
85
|
+
_context.prev = 17;
|
|
78
86
|
_context.t0 = _context["catch"](0);
|
|
79
|
-
if (_context.t0
|
|
80
|
-
form
|
|
87
|
+
if (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields) {
|
|
88
|
+
form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
|
81
89
|
block: 'center',
|
|
82
90
|
behavior: 'smooth'
|
|
83
91
|
});
|
|
84
92
|
}
|
|
93
|
+
handleScrollToError();
|
|
85
94
|
throw _context.t0;
|
|
86
|
-
case
|
|
95
|
+
case 22:
|
|
87
96
|
case "end":
|
|
88
97
|
return _context.stop();
|
|
89
98
|
}
|
|
90
|
-
}, _callee, null, [[0,
|
|
99
|
+
}, _callee, null, [[0, 17]]);
|
|
91
100
|
}));
|
|
92
101
|
return function _validateFields(_x) {
|
|
93
102
|
return _ref.apply(this, arguments);
|
|
@@ -95,6 +104,7 @@ export var useForm = function useForm(originForm) {
|
|
|
95
104
|
}();
|
|
96
105
|
form.getFieldsValue = _getFieldsValue;
|
|
97
106
|
form.validateFields = _validateFields;
|
|
107
|
+
form.isModified = true;
|
|
98
108
|
// form.setFieldsValue = _setFieldsValue;
|
|
99
109
|
return [form];
|
|
100
110
|
};
|
|
@@ -34,9 +34,6 @@ declare const _default: {
|
|
|
34
34
|
type: any;
|
|
35
35
|
valueType: any;
|
|
36
36
|
}) => {
|
|
37
|
-
normalize?: undefined;
|
|
38
|
-
getValueProps?: undefined;
|
|
39
|
-
} | {
|
|
40
37
|
normalize: (value: any) => any;
|
|
41
38
|
getValueProps: (value: any) => {
|
|
42
39
|
value: any;
|
|
@@ -47,9 +44,6 @@ declare const _default: {
|
|
|
47
44
|
type: any;
|
|
48
45
|
valueType: any;
|
|
49
46
|
}) => {
|
|
50
|
-
normalize?: undefined;
|
|
51
|
-
getValueProps?: undefined;
|
|
52
|
-
} | {
|
|
53
47
|
normalize: (value: any) => any;
|
|
54
48
|
getValueProps: (value: any) => {
|
|
55
49
|
value: any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import Big from 'big.js';
|
|
3
|
+
import { isEqual } from 'lodash';
|
|
3
4
|
import { transforms } from '@zat-design/utils';
|
|
4
5
|
var transformDate = transforms.transformDate,
|
|
5
6
|
transformSwitch = transforms.transformSwitch;
|
|
@@ -13,8 +14,35 @@ var transformRatio = function transformRatio(_ref) {
|
|
|
13
14
|
precision = _ref$precision === void 0 ? 2 : _ref$precision,
|
|
14
15
|
valueType = _ref.valueType;
|
|
15
16
|
if (type === 'ProNumberRange' && ['permillage', 'percentage'].includes(valueType)) {
|
|
16
|
-
|
|
17
|
-
return {
|
|
17
|
+
var ref = null;
|
|
18
|
+
return {
|
|
19
|
+
normalize: function normalize(value) {
|
|
20
|
+
if (!value || !value.some(function (item) {
|
|
21
|
+
return item;
|
|
22
|
+
})) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
return [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? Big(value[0] - 0).div(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? Big(value[1] - 0).div(Math.pow(10, precision)).toNumber() : null];
|
|
26
|
+
},
|
|
27
|
+
getValueProps: function getValueProps(value) {
|
|
28
|
+
if (!value || !value.some(function (item) {
|
|
29
|
+
return item;
|
|
30
|
+
})) {
|
|
31
|
+
return {
|
|
32
|
+
value: []
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (isEqual(ref, value)) {
|
|
36
|
+
return {
|
|
37
|
+
value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? Big(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? Big(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
ref = value;
|
|
41
|
+
return {
|
|
42
|
+
value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? Big(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? Big(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
18
46
|
}
|
|
19
47
|
return {
|
|
20
48
|
normalize: function normalize(value) {
|
|
@@ -18,8 +18,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
18
18
|
dataSource = props.dataSource,
|
|
19
19
|
style = props.style,
|
|
20
20
|
_props$theme = props.theme,
|
|
21
|
-
theme = _props$theme === void 0 ? 'dark' : _props$theme
|
|
22
|
-
otherProps = props.otherProps;
|
|
21
|
+
theme = _props$theme === void 0 ? 'dark' : _props$theme;
|
|
23
22
|
var _ref = dataSource || {},
|
|
24
23
|
menus = _ref.menus,
|
|
25
24
|
sideMenu = _ref.sideMenu;
|
package/es/ProLayout/index.js
CHANGED
|
@@ -25,7 +25,8 @@ var ProLayout = function ProLayout(props) {
|
|
|
25
25
|
headerNotice = props.headerNotice,
|
|
26
26
|
noticeIn = props.notice,
|
|
27
27
|
dataSource = props.dataSource,
|
|
28
|
-
theme = props.theme
|
|
28
|
+
theme = props.theme,
|
|
29
|
+
onCollapsedChange = props.onCollapsedChange;
|
|
29
30
|
var _useSetState = useSetState({
|
|
30
31
|
notice: headerNotice || noticeIn,
|
|
31
32
|
menus: [],
|
|
@@ -86,7 +87,10 @@ var ProLayout = function ProLayout(props) {
|
|
|
86
87
|
dataSource: menus,
|
|
87
88
|
notice: notice,
|
|
88
89
|
collapsed: collapsed,
|
|
89
|
-
onToggle:
|
|
90
|
+
onToggle: function onToggle() {
|
|
91
|
+
toggle();
|
|
92
|
+
onCollapsedChange && onCollapsedChange(!collapsed);
|
|
93
|
+
}
|
|
90
94
|
})), _jsx("div", {
|
|
91
95
|
className: "pro-layout-content",
|
|
92
96
|
style: _objectSpread(_objectSpread({}, contentStyle), {}, {
|
|
@@ -51,6 +51,10 @@ export interface ProLayoutProps {
|
|
|
51
51
|
contentStyle?: CSSProperties;
|
|
52
52
|
waterMarkProps?: ProWaterMarkProps;
|
|
53
53
|
theme?: themeEnum;
|
|
54
|
+
/**
|
|
55
|
+
* 折叠回调事件
|
|
56
|
+
*/
|
|
57
|
+
onCollapsedChange?: (collapsed: any) => void;
|
|
54
58
|
[key: string]: any;
|
|
55
59
|
}
|
|
56
60
|
export interface ProLayoutStates {
|
package/es/ProSelect/index.js
CHANGED
|
@@ -27,7 +27,8 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
27
27
|
var _ref = useProConfig('ProSelect') || {},
|
|
28
28
|
_ref$fieldNames = _ref.fieldNames,
|
|
29
29
|
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
|
|
30
|
-
showCodeName = _ref.showCodeName
|
|
30
|
+
showCodeName = _ref.showCodeName,
|
|
31
|
+
gViewportReady = _ref.viewportReady;
|
|
31
32
|
var label = 'label';
|
|
32
33
|
var code = 'value';
|
|
33
34
|
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
@@ -54,16 +55,16 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
54
55
|
updateDataSource = props.updateDataSource,
|
|
55
56
|
transformResponse = props.transformResponse,
|
|
56
57
|
isViewPro = props.isView,
|
|
57
|
-
|
|
58
|
-
viewportReady = _props$viewportReady === void 0 ? false : _props$viewportReady,
|
|
58
|
+
__viewportReady = props.viewportReady,
|
|
59
59
|
selectProps = _objectWithoutProperties(props, _excluded);
|
|
60
|
+
var viewportReady = __viewportReady || gViewportReady;
|
|
60
61
|
/** 是否在可视区域出现过 */
|
|
61
62
|
var _useState = useState(false),
|
|
62
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
64
|
viewFlag = _useState2[0],
|
|
64
65
|
setViewFlag = _useState2[1];
|
|
65
|
-
var
|
|
66
|
-
var _useInViewport = useInViewport(
|
|
66
|
+
var refSelect1 = useRef();
|
|
67
|
+
var _useInViewport = useInViewport(refSelect1),
|
|
67
68
|
_useInViewport2 = _slicedToArray(_useInViewport, 1),
|
|
68
69
|
inViewport = _useInViewport2[0];
|
|
69
70
|
selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
|
|
@@ -299,45 +300,51 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
299
300
|
fieldNames: fieldNames
|
|
300
301
|
});
|
|
301
302
|
}
|
|
302
|
-
return _jsx(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
title: "".concat(item[code], "-").concat(item[label]),
|
|
336
|
-
children:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
303
|
+
return _jsx("div", {
|
|
304
|
+
ref: refSelect1,
|
|
305
|
+
style: props.style,
|
|
306
|
+
className: "ant-select-compact-item-div",
|
|
307
|
+
children: _jsx(_Select, _objectSpread(_objectSpread({
|
|
308
|
+
// id={refSelect1.current}
|
|
309
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProSelect = locale.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
|
|
310
|
+
allowClear: true,
|
|
311
|
+
showArrow: true,
|
|
312
|
+
loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
|
|
313
|
+
onChange: handleChange,
|
|
314
|
+
optionLabelProp: "children" // 解决warning报错,添加默认值
|
|
315
|
+
,
|
|
316
|
+
showSearch: true,
|
|
317
|
+
filterOption: isFunction(_onSearch) ? false : function (input, option) {
|
|
318
|
+
var _option$children, _option$children$prop;
|
|
319
|
+
var value = isString(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
|
|
320
|
+
return value.toLowerCase().includes(input.toLowerCase());
|
|
321
|
+
},
|
|
322
|
+
onSearch: function onSearch(value) {
|
|
323
|
+
_onSearch && _onSearch(value, _objectSpread({}, fetchFunction));
|
|
324
|
+
},
|
|
325
|
+
getPopupContainer: function getPopupContainer(trigger) {
|
|
326
|
+
return scrollFollowParent ? trigger.parentElement : document.body;
|
|
327
|
+
}
|
|
328
|
+
}, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style'])), {}, {
|
|
329
|
+
value: transformValue(),
|
|
330
|
+
children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
|
|
331
|
+
return _jsx(Option, {
|
|
332
|
+
value: item[code],
|
|
333
|
+
record: item,
|
|
334
|
+
disabled: !!item.disabled,
|
|
335
|
+
children: _jsx(TooltipOption, {
|
|
336
|
+
title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
|
|
337
|
+
children: OptionRender ? _jsx("span", {
|
|
338
|
+
title: OptionRender(item),
|
|
339
|
+
children: OptionRender(item)
|
|
340
|
+
}) : _jsx("span", {
|
|
341
|
+
title: "".concat(item[code], "-").concat(item[label]),
|
|
342
|
+
children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
|
|
343
|
+
})
|
|
344
|
+
}, item[code])
|
|
345
|
+
}, item[code]);
|
|
346
|
+
})
|
|
347
|
+
}))
|
|
348
|
+
});
|
|
342
349
|
};
|
|
343
350
|
export default /*#__PURE__*/forwardRef(ProSelect);
|
package/es/ProSelect/index.less
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
3
|
+
'data-row-key': string;
|
|
4
|
+
'data-hide'?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Row: FC<RowProps>;
|
|
8
|
+
declare const DndWrapper: ({ draggable, value, onChange, disabled, children }: {
|
|
9
|
+
draggable: any;
|
|
10
|
+
value: any;
|
|
11
|
+
onChange: any;
|
|
12
|
+
disabled: any;
|
|
13
|
+
children: any;
|
|
14
|
+
}) => any;
|
|
15
|
+
export default DndWrapper;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["disabled", "children"];
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { DndContext } from '@dnd-kit/core';
|
|
7
|
+
import { arrayMove, useSortable, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
8
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
9
|
+
import ProIcon from '../../../ProIcon';
|
|
10
|
+
export var Row = function Row(props) {
|
|
11
|
+
var disabled = props.disabled,
|
|
12
|
+
children = props.children,
|
|
13
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
14
|
+
var data = useSortable({
|
|
15
|
+
id: props['data-row-key'],
|
|
16
|
+
disabled: disabled
|
|
17
|
+
});
|
|
18
|
+
var attributes = data.attributes,
|
|
19
|
+
listeners = data.listeners,
|
|
20
|
+
setNodeRef = data.setNodeRef,
|
|
21
|
+
transform = data.transform,
|
|
22
|
+
transition = data.transition,
|
|
23
|
+
isDragging = data.isDragging;
|
|
24
|
+
var style = _objectSpread(_objectSpread({}, props.style), {}, {
|
|
25
|
+
transform: CSS.Transform.toString(transform && _objectSpread(_objectSpread({}, transform), {}, {
|
|
26
|
+
scaleY: 1
|
|
27
|
+
})),
|
|
28
|
+
transition: transition
|
|
29
|
+
}, isDragging ? {
|
|
30
|
+
position: 'relative',
|
|
31
|
+
zIndex: 2
|
|
32
|
+
} : {});
|
|
33
|
+
return _jsx("tr", _objectSpread(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
34
|
+
ref: setNodeRef,
|
|
35
|
+
style: style
|
|
36
|
+
}, attributes), {}, {
|
|
37
|
+
children: React.Children.map(children, function (child) {
|
|
38
|
+
if (child.key === 'RC_TABLE_KEY') {
|
|
39
|
+
var _ref = (child === null || child === void 0 ? void 0 : child.props) || {},
|
|
40
|
+
render = _ref.render,
|
|
41
|
+
record = _ref.record,
|
|
42
|
+
renderIndex = _ref.renderIndex;
|
|
43
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
44
|
+
children: _jsxs("span", {
|
|
45
|
+
className: "drag-wrapper".concat(props['data-hide'] ? ' no-check' : ''),
|
|
46
|
+
children: [_jsx(ProIcon, _objectSpread({
|
|
47
|
+
className: "drag-icon",
|
|
48
|
+
style: {
|
|
49
|
+
touchAction: 'none',
|
|
50
|
+
cursor: disabled ? 'no-drop' : 'move'
|
|
51
|
+
},
|
|
52
|
+
type: "drag",
|
|
53
|
+
size: 20
|
|
54
|
+
}, listeners)), props['data-hide'] ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return child;
|
|
59
|
+
})
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
var DndWrapper = function DndWrapper(_ref2) {
|
|
63
|
+
var _value$;
|
|
64
|
+
var draggable = _ref2.draggable,
|
|
65
|
+
value = _ref2.value,
|
|
66
|
+
onChange = _ref2.onChange,
|
|
67
|
+
disabled = _ref2.disabled,
|
|
68
|
+
children = _ref2.children;
|
|
69
|
+
var onDragEnd = function onDragEnd(_ref3) {
|
|
70
|
+
var active = _ref3.active,
|
|
71
|
+
over = _ref3.over;
|
|
72
|
+
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
73
|
+
var activeIndex = value.findIndex(function (i) {
|
|
74
|
+
return i.rowKey === active.id;
|
|
75
|
+
});
|
|
76
|
+
var overIndex = value.findIndex(function (i) {
|
|
77
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
78
|
+
});
|
|
79
|
+
var nextValue = arrayMove(value, activeIndex, overIndex);
|
|
80
|
+
onChange(nextValue);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return draggable && !disabled ? _jsx(DndContext, {
|
|
84
|
+
onDragEnd: onDragEnd,
|
|
85
|
+
children: _jsx(SortableContext, {
|
|
86
|
+
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value.map(function (i) {
|
|
87
|
+
return i.rowKey;
|
|
88
|
+
}) : [],
|
|
89
|
+
strategy: verticalListSortingStrategy,
|
|
90
|
+
children: children
|
|
91
|
+
})
|
|
92
|
+
}) : children;
|
|
93
|
+
};
|
|
94
|
+
export default DndWrapper;
|
package/es/ProTable/index.d.ts
CHANGED