@teamix/pro 1.2.34 → 1.3.2
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/pro.css +1 -1
- package/dist/pro.js +1542 -1149
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +9 -4
- package/es/actions/dialog-form.js +16 -9
- package/es/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/es/form/Components/ProField/mapDateFormat.js +113 -0
- package/es/form/Filter/AdvancedFilter.js +4 -4
- package/es/form/Filter/LightFilter.js +22 -15
- package/es/form/Filter/index.js +171 -133
- package/es/form/Filter/useSpecialProps.d.ts +1 -1
- package/es/form/Filter/useSpecialProps.js +9 -9
- package/es/form/ProForm/customComponent.js +2 -1
- package/es/form/ProForm/index.scss +8 -8
- package/es/form/SchemaForm/index.js +2 -2
- package/es/form/SchemaForm/initializeRequest.js +1 -2
- package/es/form/SchemaForm/reactions.d.ts +2 -2
- package/es/form/SchemaForm/reactions.js +32 -21
- package/es/form/fieldTypeMap.d.ts +3 -0
- package/es/form/fieldTypeMap.js +3 -0
- package/es/form/typing.d.ts +8 -1
- package/es/index.d.ts +4 -4
- package/es/index.js +4 -4
- package/es/nocode/configurators/PageHeader.js +2 -2
- package/es/page-header/index.js +7 -3
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/Pagination/index.js +11 -1
- package/es/table/components/ToolBar/DensityIcon.js +5 -3
- package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
- package/es/table/components/ToolBar/Fullscreen.js +6 -6
- package/es/table/components/ToolBar/index.scss +2 -2
- package/es/table/index.js +40 -21
- package/es/table/index.scss +6 -0
- package/es/table/typing.d.ts +13 -6
- package/es/table/utils/columnRender.js +6 -0
- package/es/timeline/ProTimeLineItem/index.d.ts +5 -0
- package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +59 -72
- package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
- package/es/timeline/index.d.ts +10 -0
- package/es/{step → timeline}/index.js +33 -57
- package/es/timeline/index.scss +7 -0
- package/es/timeline/typing.d.ts +101 -0
- package/es/{step → timeline}/typing.js +0 -0
- package/lib/actions/dialog-form.d.ts +9 -4
- package/lib/actions/dialog-form.js +16 -9
- package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/lib/form/Components/ProField/mapDateFormat.js +125 -0
- package/lib/form/Filter/AdvancedFilter.js +4 -4
- package/lib/form/Filter/LightFilter.js +21 -15
- package/lib/form/Filter/index.js +170 -132
- package/lib/form/Filter/useSpecialProps.d.ts +1 -1
- package/lib/form/Filter/useSpecialProps.js +8 -8
- package/lib/form/ProForm/customComponent.js +3 -1
- package/lib/form/ProForm/index.scss +8 -8
- package/lib/form/SchemaForm/index.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -2
- package/lib/form/SchemaForm/reactions.d.ts +2 -2
- package/lib/form/SchemaForm/reactions.js +31 -20
- package/lib/form/fieldTypeMap.d.ts +3 -0
- package/lib/form/fieldTypeMap.js +5 -1
- package/lib/form/typing.d.ts +8 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +10 -10
- package/lib/nocode/configurators/PageHeader.js +2 -2
- package/lib/page-header/index.js +6 -2
- package/lib/table/components/Layout/index.js +2 -2
- package/lib/table/components/Pagination/index.js +10 -0
- package/lib/table/components/ToolBar/DensityIcon.js +5 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
- package/lib/table/components/ToolBar/Fullscreen.js +6 -6
- package/lib/table/components/ToolBar/index.scss +2 -2
- package/lib/table/index.js +40 -21
- package/lib/table/index.scss +6 -0
- package/lib/table/typing.d.ts +13 -6
- package/lib/table/utils/columnRender.js +6 -0
- package/lib/timeline/ProTimeLineItem/index.d.ts +5 -0
- package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +58 -72
- package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
- package/lib/timeline/index.d.ts +10 -0
- package/lib/{step → timeline}/index.js +38 -58
- package/lib/timeline/index.scss +7 -0
- package/lib/timeline/typing.d.ts +101 -0
- package/lib/{step → timeline}/typing.js +0 -0
- package/package.json +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
- package/es/step/ProStepItem/components/HozStepItem/index.js +0 -235
- package/es/step/ProStepItem/components/HozStepItem/index.scss +0 -279
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
- package/es/step/ProStepItem/index.d.ts +0 -4
- package/es/step/ProStepItem/index.js +0 -57
- package/es/step/index.d.ts +0 -9
- package/es/step/typing.d.ts +0 -96
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
- package/lib/step/ProStepItem/components/HozStepItem/index.js +0 -258
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +0 -279
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
- package/lib/step/ProStepItem/index.d.ts +0 -4
- package/lib/step/ProStepItem/index.js +0 -69
- package/lib/step/index.d.ts +0 -9
- package/lib/step/typing.d.ts +0 -96
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { ProFormProps, ProFormSchema } from '../form';
|
2
|
+
import { ProFormProps, ProFormSchema, ProFormType } from '../form';
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
@@ -12,9 +12,14 @@ export interface DialogFormAction extends DialogAction {
|
|
12
12
|
/**
|
13
13
|
* @deprecated 建议使用 schema 配置 ProFormProps 代替
|
14
14
|
*/
|
15
|
-
formProps?: Omit<ProFormProps, 'schema'>;
|
16
|
-
/**
|
17
|
-
|
15
|
+
formProps?: Omit<ProFormProps, 'schema' | 'form'>;
|
16
|
+
/** 同时支持两种配置方式:
|
17
|
+
* 如果想完整定制表单,可使用完整的表单配置项 ProFormProps,但不可以传 form 字段,可以通过 formRef 获取内部 form 实例。
|
18
|
+
* 否则可以只配置 ProFormSchema
|
19
|
+
*/
|
20
|
+
schema: ProFormSchema | Omit<ProFormProps, 'form'>;
|
21
|
+
/** 外部传来的 formRef,用于获取内置 form 实例 */
|
22
|
+
formRef?: React.MutableRefObject<ProFormType | undefined>;
|
18
23
|
}
|
19
24
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
20
25
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["schema"],
|
2
|
-
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest"];
|
2
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest", "formRef"];
|
3
3
|
|
4
4
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
5
5
|
|
@@ -89,7 +89,8 @@ var DialogForm = function DialogForm(props) {
|
|
89
89
|
schema = props.schema,
|
90
90
|
formProps = props.formProps,
|
91
91
|
context = props.context,
|
92
|
-
formRef = props.formRef
|
92
|
+
formRef = props.formRef,
|
93
|
+
innerFormRef = props.innerFormRef;
|
93
94
|
|
94
95
|
var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
|
95
96
|
formSchema = _getSchemaAndFormProp.schema,
|
@@ -106,7 +107,11 @@ var DialogForm = function DialogForm(props) {
|
|
106
107
|
|
107
108
|
var history = useHistory();
|
108
109
|
useEffect(function () {
|
109
|
-
formRef
|
110
|
+
if (formRef) {
|
111
|
+
formRef.current = form;
|
112
|
+
}
|
113
|
+
|
114
|
+
innerFormRef.current = form;
|
110
115
|
|
111
116
|
if (initialRequest) {
|
112
117
|
setLoading(true);
|
@@ -141,9 +146,10 @@ export function useDialogFormAction(action, context) {
|
|
141
146
|
size = _action$size === void 0 ? 'small' : _action$size,
|
142
147
|
_onFinish = action.onFinish,
|
143
148
|
propsBeforeRequest = action.beforeRequest,
|
149
|
+
propsFormRef = action.formRef,
|
144
150
|
others = _objectWithoutProperties(action, _excluded2);
|
145
151
|
|
146
|
-
var
|
152
|
+
var innerFormRef = /*#__PURE__*/createRef();
|
147
153
|
return useDialogAction(Object.assign({
|
148
154
|
size: size,
|
149
155
|
closeable: true,
|
@@ -157,13 +163,14 @@ export function useDialogFormAction(action, context) {
|
|
157
163
|
context: contentContext
|
158
164
|
};
|
159
165
|
return /*#__PURE__*/React.createElement(DialogForm, _objectSpread({
|
160
|
-
|
166
|
+
innerFormRef: innerFormRef,
|
167
|
+
formRef: propsFormRef
|
161
168
|
}, dialogFormProps));
|
162
169
|
},
|
163
170
|
extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
|
164
171
|
beforeRequest: function beforeRequest(context) {
|
165
172
|
return new Promise(function (resolve, reject) {
|
166
|
-
|
173
|
+
innerFormRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
167
174
|
var beforeRequestContext, requestContext;
|
168
175
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
169
176
|
while (1) {
|
@@ -199,7 +206,7 @@ export function useDialogFormAction(action, context) {
|
|
199
206
|
|
200
207
|
case 13:
|
201
208
|
requestContext = Object.assign({
|
202
|
-
fields:
|
209
|
+
fields: innerFormRef.current.values
|
203
210
|
}, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
|
204
211
|
resolve(requestContext);
|
205
212
|
|
@@ -215,9 +222,9 @@ export function useDialogFormAction(action, context) {
|
|
215
222
|
});
|
216
223
|
},
|
217
224
|
onFinish: function onFinish() {
|
218
|
-
var
|
225
|
+
var _innerFormRef$current;
|
219
226
|
|
220
|
-
_onFinish && _onFinish((
|
227
|
+
_onFinish && _onFinish((_innerFormRef$current = innerFormRef.current) === null || _innerFormRef$current === void 0 ? void 0 : _innerFormRef$current.values);
|
221
228
|
}
|
222
229
|
}, others), context);
|
223
230
|
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
6
|
+
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8
|
+
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
10
|
+
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
+
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
|
+
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
16
|
+
|
17
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
18
|
+
|
19
|
+
import { isEmpty } from '@formily/shared';
|
20
|
+
import { isArr, isFn } from '@teamix/utils';
|
21
|
+
import Moment from 'moment';
|
22
|
+
|
23
|
+
var moment = function moment(date, format) {
|
24
|
+
return Moment((date === null || date === void 0 ? void 0 : date.toDate) ? date.toDate() : date, format);
|
25
|
+
};
|
26
|
+
|
27
|
+
var momentable = function momentable(value, format) {
|
28
|
+
return Array.isArray(value) ? value.map(function (val) {
|
29
|
+
return moment(val, format);
|
30
|
+
}) : value ? moment(value, format) : value;
|
31
|
+
};
|
32
|
+
|
33
|
+
var formatMomentValue = function formatMomentValue(value, format, placeholder) {
|
34
|
+
var formatDate = function formatDate(date, format) {
|
35
|
+
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
36
|
+
if (!date) return placeholder;
|
37
|
+
|
38
|
+
if (isArr(format)) {
|
39
|
+
var _format = format[i];
|
40
|
+
|
41
|
+
if (isFn(_format)) {
|
42
|
+
return _format(date);
|
43
|
+
}
|
44
|
+
|
45
|
+
if (isEmpty(_format)) {
|
46
|
+
return date;
|
47
|
+
}
|
48
|
+
|
49
|
+
return moment(date).format(_format);
|
50
|
+
} else {
|
51
|
+
if (isFn(format)) {
|
52
|
+
return format(date);
|
53
|
+
}
|
54
|
+
|
55
|
+
if (isEmpty(format)) {
|
56
|
+
return date;
|
57
|
+
}
|
58
|
+
|
59
|
+
return moment(date).format(format);
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
if (isArr(value)) {
|
64
|
+
return value.map(function (val, index) {
|
65
|
+
return formatDate(val, format, index);
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
return value ? formatDate(value, format) : value || placeholder;
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
var mapDateFormatDatePicker2 = function mapDateFormatDatePicker2(type) {
|
73
|
+
var getDefaultFormat = function getDefaultFormat(props) {
|
74
|
+
var _type = props['type'] || type;
|
75
|
+
|
76
|
+
if (_type === 'month') {
|
77
|
+
return 'YYYY-MM';
|
78
|
+
} else if (_type === 'quarter') {
|
79
|
+
return 'YYYY-\\QQ';
|
80
|
+
} else if (_type === 'year') {
|
81
|
+
return 'YYYY';
|
82
|
+
} else if (_type === 'week') {
|
83
|
+
return 'YYYY-wo';
|
84
|
+
}
|
85
|
+
|
86
|
+
return props['showTime'] ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
87
|
+
};
|
88
|
+
|
89
|
+
return function (props) {
|
90
|
+
var format = props['format'] || getDefaultFormat(props);
|
91
|
+
var _onChange = props.onChange;
|
92
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
93
|
+
format: format === 'YYYY-MM-DD HH:mm:ss' ? 'YYYY-MM-DD' : format,
|
94
|
+
value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
|
95
|
+
onChange: function onChange(value) {
|
96
|
+
if (_onChange) {
|
97
|
+
_onChange(formatMomentValue(value, format));
|
98
|
+
}
|
99
|
+
}
|
100
|
+
});
|
101
|
+
};
|
102
|
+
};
|
103
|
+
|
104
|
+
var mapDateFormat = function mapDateFormat(props, field) {
|
105
|
+
var _ref = field.component || [],
|
106
|
+
_ref2 = _slicedToArray(_ref, 1),
|
107
|
+
component = _ref2[0];
|
108
|
+
|
109
|
+
console.log(component);
|
110
|
+
return {};
|
111
|
+
};
|
112
|
+
|
113
|
+
export default mapDateFormat;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["schema", "onSubmit", "onReset", "
|
1
|
+
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "forceClear"];
|
2
2
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
@@ -35,12 +35,12 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
35
35
|
var schema = props.schema,
|
36
36
|
onSubmit = props.onSubmit,
|
37
37
|
onReset = props.onReset,
|
38
|
-
onResetClick = props.onResetClick,
|
39
38
|
layout = props.layout,
|
40
39
|
labelAlign = props.labelAlign,
|
41
40
|
wrapperAlign = props.wrapperAlign,
|
42
41
|
labelCol = props.labelCol,
|
43
42
|
wrapperCol = props.wrapperCol,
|
43
|
+
forceClear = props.forceClear,
|
44
44
|
otherProps = _objectWithoutProperties(props, _excluded);
|
45
45
|
|
46
46
|
var prefixCls = usePrefixCls('', {
|
@@ -71,7 +71,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
71
71
|
component: 'Reset',
|
72
72
|
props: {
|
73
73
|
onResetValidateSuccess: onReset,
|
74
|
-
|
74
|
+
forceClear: !!forceClear,
|
75
75
|
children: getMessage('reset')
|
76
76
|
}
|
77
77
|
}, {
|
@@ -86,7 +86,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
86
86
|
}]
|
87
87
|
}])
|
88
88
|
}];
|
89
|
-
}, [schema, onReset
|
89
|
+
}, [schema, onReset]);
|
90
90
|
var getTeamixLayout = useMemo(function () {
|
91
91
|
return {
|
92
92
|
breakpoints: [990],
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue"];
|
1
|
+
var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue", "activeFilterValueRef"];
|
2
2
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
@@ -10,9 +10,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
10
10
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
12
|
|
13
|
-
import React, { memo, useMemo, useCallback, useRef } from 'react';
|
13
|
+
import React, { memo, useMemo, useCallback, useRef, useEffect } from 'react';
|
14
14
|
import cls from 'classnames';
|
15
|
-
import { toJS } from '@formily/reactive';
|
16
15
|
import { usePrefixCls } from '@teamix/utils';
|
17
16
|
import ProForm from '../ProForm';
|
18
17
|
/**
|
@@ -27,24 +26,32 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
27
26
|
onSubmit = props.onSubmit,
|
28
27
|
onChange = props.onChange,
|
29
28
|
defaultFilterValue = props.defaultFilterValue,
|
29
|
+
activeFilterValueRef = props.activeFilterValueRef,
|
30
30
|
otherProps = _objectWithoutProperties(props, _excluded);
|
31
31
|
|
32
32
|
var filterValue = useRef(defaultFilterValue || ((_schema$ = schema[0]) === null || _schema$ === void 0 ? void 0 : _schema$.name));
|
33
33
|
var prefixCls = usePrefixCls('', {
|
34
34
|
prefix: 'teamix-pro-form-query-filter-light'
|
35
|
-
});
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
});
|
36
|
+
useEffect(function () {
|
37
|
+
if (activeFilterValueRef) {
|
38
|
+
activeFilterValueRef.current = filterValue.current;
|
39
|
+
}
|
40
|
+
}, []); // 筛选提交切换
|
40
41
|
|
41
42
|
var onFilterChange = useCallback(function (value) {
|
42
43
|
filterValue.current = value;
|
43
|
-
}, [form]); // onChange
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
if (activeFilterValueRef) {
|
46
|
+
activeFilterValueRef.current = value;
|
47
|
+
}
|
48
|
+
}, [form]); // 实际输出onFilter
|
49
|
+
|
50
|
+
var onFilter = useCallback(function () {
|
51
|
+
var key = filterValue.current;
|
52
|
+
var value = form.values[key];
|
53
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_defineProperty({}, key, value));
|
54
|
+
}, [onChange]);
|
48
55
|
var LightSchema = useMemo(function () {
|
49
56
|
return [{
|
50
57
|
component: 'LightFilter',
|
@@ -52,7 +59,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
52
59
|
defaultFilterValue: defaultFilterValue,
|
53
60
|
onFilterChange: onFilterChange,
|
54
61
|
buttonProps: {
|
55
|
-
onClick:
|
62
|
+
onClick: onFilter
|
56
63
|
}
|
57
64
|
},
|
58
65
|
children: schema
|
@@ -64,7 +71,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
64
71
|
}
|
65
72
|
}
|
66
73
|
}];
|
67
|
-
}, [schema,
|
74
|
+
}, [schema, onFilter, onFilterChange, defaultFilterValue]);
|
68
75
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
69
76
|
form: form,
|
70
77
|
className: cls(prefixCls, props.className),
|
@@ -73,7 +80,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
73
80
|
breakpoints: [],
|
74
81
|
bordered: false,
|
75
82
|
onSubmit: onSubmit,
|
76
|
-
onChange:
|
83
|
+
onChange: onFilter
|
77
84
|
}));
|
78
85
|
});
|
79
86
|
export default LightFilter;
|