@teamix/pro 1.4.8 → 1.4.11
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 +174 -97
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.d.ts +5 -1
- package/es/actions/dialog.js +18 -11
- package/es/form/Components/ProField/mapDateFormat.js +0 -1
- package/es/form/Filter/AdvancedFilter.js +22 -12
- package/es/form/ProForm/index.js +13 -12
- package/es/form/typing.d.ts +3 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.scss +4 -0
- package/es/table/components/Filter/index.js +9 -15
- package/es/table/components/Layout/index.js +19 -17
- package/es/table/index.js +59 -22
- package/es/table/typing.d.ts +3 -1
- package/lib/actions/dialog.d.ts +5 -1
- package/lib/actions/dialog.js +17 -10
- package/lib/form/Components/ProField/mapDateFormat.js +0 -1
- package/lib/form/Filter/AdvancedFilter.js +21 -11
- package/lib/form/ProForm/index.js +12 -11
- package/lib/form/typing.d.ts +3 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.scss +4 -0
- package/lib/table/components/Filter/index.js +9 -15
- package/lib/table/components/Layout/index.js +19 -17
- package/lib/table/index.js +59 -22
- package/lib/table/typing.d.ts +3 -1
- package/package.json +1 -1
package/es/actions/dialog.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
|
|
4
4
|
import { ProFormSchema, ProFormSchemaItem } from '../form';
|
5
5
|
import { ProMessageProps } from '../utils/message';
|
6
6
|
import { RequestAction } from './request';
|
7
|
-
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | '
|
7
|
+
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onError'> {
|
8
8
|
/** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
|
9
9
|
url?: string;
|
10
10
|
/** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
|
@@ -25,6 +25,10 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
25
25
|
schema?: any;
|
26
26
|
/** 弹窗内容区的组件 */
|
27
27
|
component?: any;
|
28
|
+
/** 点击确定自定义回调函数 */
|
29
|
+
onOk?: any;
|
30
|
+
/** 点击取消自定义回调函数 */
|
31
|
+
onCancel?: any;
|
28
32
|
}
|
29
33
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
30
34
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
package/es/actions/dialog.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
1
|
+
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel"],
|
2
2
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
3
3
|
|
4
4
|
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; }
|
@@ -27,7 +27,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
27
27
|
|
28
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
29
29
|
|
30
|
-
import React, { useState, useEffect, useRef } from 'react';
|
30
|
+
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
31
31
|
import classnames from 'classnames';
|
32
32
|
import { useHistory } from 'react-router-dom';
|
33
33
|
import { Dialog, Drawer } from '@alicloudfe/components';
|
@@ -51,7 +51,9 @@ var FooterForm = function FooterForm(props) {
|
|
51
51
|
var schema = props.schema,
|
52
52
|
context = props.context,
|
53
53
|
formRef = props.formRef;
|
54
|
-
var form =
|
54
|
+
var form = useMemo(function () {
|
55
|
+
return createForm();
|
56
|
+
}, []);
|
55
57
|
useEffect(function () {
|
56
58
|
formRef.current = form;
|
57
59
|
}, []);
|
@@ -95,6 +97,8 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
95
97
|
formatResult = action.formatResult,
|
96
98
|
onSuccess = action.onSuccess,
|
97
99
|
onError = action.onError,
|
100
|
+
propsOnOk = action.onOk,
|
101
|
+
propsOnCancel = action.onCancel,
|
98
102
|
others = _objectWithoutProperties(action, _excluded);
|
99
103
|
|
100
104
|
var _getTargetValue = getTargetValue(others, context),
|
@@ -175,33 +179,34 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
175
179
|
|
176
180
|
case 6:
|
177
181
|
onFinish && onFinish();
|
182
|
+
propsOnOk && propsOnOk(context);
|
178
183
|
resolve(true);
|
179
|
-
_context.next =
|
184
|
+
_context.next = 19;
|
180
185
|
break;
|
181
186
|
|
182
|
-
case
|
183
|
-
_context.prev =
|
187
|
+
case 11:
|
188
|
+
_context.prev = 11;
|
184
189
|
_context.t0 = _context["catch"](2);
|
185
190
|
setLoading(false); // 如果 beforeRequest 中返回了 false 并且不是 dialog-form,则直接关闭弹窗
|
186
191
|
|
187
192
|
if (!(beforeRequest && !hasForm)) {
|
188
|
-
_context.next =
|
193
|
+
_context.next = 17;
|
189
194
|
break;
|
190
195
|
}
|
191
196
|
|
192
197
|
resolve(true);
|
193
198
|
return _context.abrupt("return");
|
194
199
|
|
195
|
-
case
|
200
|
+
case 17:
|
196
201
|
resolve(false);
|
197
202
|
return _context.abrupt("return");
|
198
203
|
|
199
|
-
case
|
204
|
+
case 19:
|
200
205
|
case "end":
|
201
206
|
return _context.stop();
|
202
207
|
}
|
203
208
|
}
|
204
|
-
}, _callee, null, [[2,
|
209
|
+
}, _callee, null, [[2, 11]]);
|
205
210
|
}));
|
206
211
|
|
207
212
|
return function (_x) {
|
@@ -224,7 +229,9 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
224
229
|
});
|
225
230
|
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({}, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
226
231
|
|
227
|
-
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "
|
232
|
+
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "onCancel", function onCancel() {
|
233
|
+
propsOnCancel && propsOnCancel(context);
|
234
|
+
}), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
228
235
|
className: "teamix-pro-dialog-before-content"
|
229
236
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
230
237
|
className: "teamix-pro-dialog-message"
|
@@ -1,10 +1,4 @@
|
|
1
|
-
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "forceClear"];
|
2
|
-
|
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
|
-
|
5
|
-
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; }
|
6
|
-
|
7
|
-
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; }
|
1
|
+
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "gridProps", "forceClear"];
|
8
2
|
|
9
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
4
|
|
@@ -18,12 +12,18 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
18
12
|
|
19
13
|
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; }
|
20
14
|
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
21
21
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
22
22
|
|
23
23
|
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; }
|
24
24
|
|
25
25
|
import React, { memo, useMemo } from 'react';
|
26
|
-
import { usePrefixCls, getMessage, cls } from '@teamix/utils';
|
26
|
+
import { usePrefixCls, getMessage, cls, isBool } from '@teamix/utils';
|
27
27
|
import ProForm from '../ProForm';
|
28
28
|
import { mergeArrayValue } from '../utils';
|
29
29
|
/**
|
@@ -39,6 +39,8 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
39
39
|
wrapperAlign = props.wrapperAlign,
|
40
40
|
labelCol = props.labelCol,
|
41
41
|
wrapperCol = props.wrapperCol,
|
42
|
+
breakpoints = props.breakpoints,
|
43
|
+
gridProps = props.gridProps,
|
42
44
|
forceClear = props.forceClear,
|
43
45
|
otherProps = _objectWithoutProperties(props, _excluded);
|
44
46
|
|
@@ -47,13 +49,13 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
47
49
|
return [{
|
48
50
|
name: 'FormGrid',
|
49
51
|
component: 'FormGrid',
|
50
|
-
props: {
|
52
|
+
props: _objectSpread({
|
51
53
|
breakpoints: [480, 720, 990, 1200, Infinity],
|
52
54
|
maxColumns: [1, 2, 3, 3, 4],
|
53
55
|
maxWidth: [480, 360, 330, 400],
|
54
56
|
columnGap: 16,
|
55
57
|
rowGap: 12
|
56
|
-
},
|
58
|
+
}, gridProps),
|
57
59
|
children: [].concat(_toConsumableArray(schema), [{
|
58
60
|
component: 'FormGrid.GridColumn',
|
59
61
|
props: {
|
@@ -85,15 +87,22 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
85
87
|
}];
|
86
88
|
}, [schema, onReset]);
|
87
89
|
var getTeamixLayout = useMemo(function () {
|
88
|
-
return {
|
90
|
+
return breakpoints === true ? {
|
89
91
|
breakpoints: [990],
|
90
92
|
layout: mergeArrayValue(['vertical'], layout),
|
91
93
|
labelAlign: mergeArrayValue(['left'], labelAlign),
|
92
94
|
wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
|
93
95
|
labelCol: mergeArrayValue([24], labelCol),
|
94
96
|
wrapperCol: mergeArrayValue([24], wrapperCol)
|
97
|
+
} : {
|
98
|
+
breakpoints: isBool(breakpoints) ? undefined : breakpoints,
|
99
|
+
layout: layout,
|
100
|
+
labelAlign: labelAlign,
|
101
|
+
wrapperAlign: wrapperAlign,
|
102
|
+
labelCol: labelCol,
|
103
|
+
wrapperCol: wrapperCol
|
95
104
|
};
|
96
|
-
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
105
|
+
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
97
106
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
98
107
|
className: cls(prefixCls(), props.className),
|
99
108
|
schema: gridSchema,
|
@@ -103,6 +112,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
103
112
|
}));
|
104
113
|
});
|
105
114
|
AdvancedFilter.defaultProps = {
|
115
|
+
breakpoints: true,
|
106
116
|
layout: 'horizontal',
|
107
117
|
labelAlign: 'right',
|
108
118
|
labelCol: 6,
|
package/es/form/ProForm/index.js
CHANGED
@@ -11,7 +11,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
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
13
|
import React, { memo, useEffect, useMemo } from 'react';
|
14
|
-
import { usePrefixCls, cls, getLanguage, getGlobalConfig } from '@teamix/utils';
|
14
|
+
import { usePrefixCls, cls, getLanguage, getGlobalConfig, isBool } from '@teamix/utils';
|
15
15
|
import { createForm, onFieldValueChange, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
16
|
import { toJS } from '@formily/reactive';
|
17
17
|
import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
@@ -101,20 +101,20 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
101
101
|
var onAutoSubmit = useAutoSubmit(onSubmit, context); // todo 需要formily支持断点下的属性更新
|
102
102
|
|
103
103
|
var getTeamixLayout = useMemo(function () {
|
104
|
-
return breakpoints ? {
|
105
|
-
breakpoints: breakpoints,
|
106
|
-
layout: layout,
|
107
|
-
labelAlign: labelAlign,
|
108
|
-
wrapperAlign: wrapperAlign,
|
109
|
-
labelCol: labelCol,
|
110
|
-
wrapperCol: wrapperCol
|
111
|
-
} : {
|
104
|
+
return breakpoints === true ? {
|
112
105
|
breakpoints: [480],
|
113
106
|
layout: mergeArrayValue(['vertical'], layout),
|
114
107
|
labelAlign: mergeArrayValue(['left'], labelAlign),
|
115
108
|
wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
|
116
109
|
labelCol: mergeArrayValue([24], labelCol),
|
117
110
|
wrapperCol: mergeArrayValue([24], wrapperCol)
|
111
|
+
} : {
|
112
|
+
breakpoints: isBool(breakpoints) ? undefined : breakpoints,
|
113
|
+
layout: layout,
|
114
|
+
labelAlign: labelAlign,
|
115
|
+
wrapperAlign: wrapperAlign,
|
116
|
+
labelCol: labelCol,
|
117
|
+
wrapperCol: wrapperCol
|
118
118
|
};
|
119
119
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
120
120
|
useMemo(function () {
|
@@ -150,7 +150,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
150
150
|
});
|
151
151
|
});
|
152
152
|
}
|
153
|
-
}, [onChange]);
|
153
|
+
}, [onChange, form]);
|
154
154
|
useEffect(function () {
|
155
155
|
// 配置国际化
|
156
156
|
setValidateLanguage(getLanguage() || 'zh-cn');
|
@@ -169,7 +169,8 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
169
169
|
});
|
170
170
|
ProForm.defaultProps = {
|
171
171
|
colon: false,
|
172
|
-
|
173
|
-
|
172
|
+
validateFirst: true,
|
173
|
+
breakpoints: true,
|
174
|
+
labelAlign: 'left'
|
174
175
|
};
|
175
176
|
export default ProForm;
|
package/es/form/typing.d.ts
CHANGED
@@ -59,7 +59,7 @@ export interface ProFormSchemaItem {
|
|
59
59
|
data?: AnyObject;
|
60
60
|
}
|
61
61
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
62
|
-
export interface ProFormProps extends IFormLayoutProps {
|
62
|
+
export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
|
63
63
|
form?: FormType | false;
|
64
64
|
schema?: ProFormSchema;
|
65
65
|
scope?: any;
|
@@ -77,6 +77,7 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
77
77
|
onSubmit?: ((values: any) => any) | CommonRequestConfig;
|
78
78
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
79
79
|
onInitialComplete?: (form: FormType) => void;
|
80
|
+
breakpoints?: number[] | boolean;
|
80
81
|
}
|
81
82
|
export interface FilterProps extends ProFormProps {
|
82
83
|
form: FormType;
|
@@ -108,6 +109,7 @@ export interface QueryFilterProps extends ProFormProps {
|
|
108
109
|
purePanel?: boolean;
|
109
110
|
/** 面板是否默认展开,仅在 mode='panel' 时生效 */
|
110
111
|
expand?: boolean;
|
112
|
+
gridProps?: any;
|
111
113
|
/** 是否强制清除 */
|
112
114
|
forceClear?: boolean;
|
113
115
|
/** 顶部筛选区前缀 */
|
package/es/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.4.
|
31
|
+
declare const version = "1.4.11";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -36,6 +36,6 @@ export * from './table';
|
|
36
36
|
export * from './sidebar';
|
37
37
|
export * from './utils';
|
38
38
|
export * from './timeline';
|
39
|
-
var version = '1.4.
|
39
|
+
var version = '1.4.11';
|
40
40
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
41
41
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
@@ -172,7 +172,7 @@ var Filter = function Filter(props) {
|
|
172
172
|
btn: true
|
173
173
|
}),
|
174
174
|
onClick: function onClick() {
|
175
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
175
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
|
176
176
|
|
177
177
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
178
178
|
|
@@ -193,24 +193,18 @@ var Filter = function Filter(props) {
|
|
193
193
|
rules: selected,
|
194
194
|
params: param
|
195
195
|
})));
|
196
|
+
var targetPageKey = 'currentPage';
|
197
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
196
198
|
|
197
|
-
if (
|
198
|
-
|
199
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
200
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
201
|
+
} // 发送请求
|
199
202
|
|
200
|
-
var targetPageKey = 'currentPage';
|
201
|
-
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
202
203
|
|
203
|
-
|
204
|
-
|
205
|
-
} // 发送请求
|
206
|
-
|
207
|
-
|
208
|
-
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _defineProperty({}, targetPageKey, 1));
|
209
|
-
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
210
|
-
|
211
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
212
|
-
}
|
204
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _defineProperty({}, targetPageKey, 1));
|
205
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
213
206
|
|
207
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
214
208
|
setVisible(false);
|
215
209
|
}
|
216
210
|
}, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection"];
|
1
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar"];
|
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
|
|
@@ -31,6 +31,7 @@ var Layout = function Layout(props) {
|
|
31
31
|
dataFilterFormRef = props.dataFilterFormRef,
|
32
32
|
afterDataFilter = props.afterDataFilter,
|
33
33
|
rowSelection = props.rowSelection,
|
34
|
+
toolBar = props.toolBar,
|
34
35
|
otherProps = _objectWithoutProperties(props, _excluded); // 渲染主操作区
|
35
36
|
|
36
37
|
|
@@ -69,7 +70,8 @@ var Layout = function Layout(props) {
|
|
69
70
|
quickAction: extra,
|
70
71
|
rowSelection: rowSelection
|
71
72
|
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
72
|
-
actionRef: actionRef
|
73
|
+
actionRef: actionRef,
|
74
|
+
toolBar: toolBar
|
73
75
|
}, otherProps)));
|
74
76
|
}; // 渲染新版 QueryFilter
|
75
77
|
|
@@ -86,13 +88,11 @@ var Layout = function Layout(props) {
|
|
86
88
|
onExpand: function onExpand(expand) {
|
87
89
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
88
90
|
setTimeout(function () {
|
89
|
-
var _actionRef$current, _actionRef$current$
|
90
|
-
|
91
|
-
if ((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge = _actionRef$current.getState) === null || _actionRef$current$ge === void 0 ? void 0 : _actionRef$current$ge.call(_actionRef$current).fullScreenState) {
|
92
|
-
var _actionRef$current2, _actionRef$current2$r;
|
91
|
+
var _actionRef$current, _actionRef$current$re;
|
93
92
|
|
94
|
-
|
95
|
-
|
93
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
94
|
+
// 偏移量8像素为面板展开后的下margin
|
95
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.resetTableMaxBodyHeight) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current, expand ? 8 : 0); // }
|
96
96
|
});
|
97
97
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
98
98
|
},
|
@@ -106,13 +106,11 @@ var Layout = function Layout(props) {
|
|
106
106
|
onExpand: function onExpand(expand) {
|
107
107
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
108
108
|
setTimeout(function () {
|
109
|
-
var _actionRef$
|
110
|
-
|
111
|
-
if ((_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : _actionRef$current3$g.call(_actionRef$current3).fullScreenState) {
|
112
|
-
var _actionRef$current4, _actionRef$current4$r;
|
109
|
+
var _actionRef$current2, _actionRef$current2$r;
|
113
110
|
|
114
|
-
|
115
|
-
|
111
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
112
|
+
// 偏移量8像素为面板展开后的下margin
|
113
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2, expand ? 8 : 0); // }
|
116
114
|
});
|
117
115
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
118
116
|
},
|
@@ -174,9 +172,13 @@ var Layout = function Layout(props) {
|
|
174
172
|
}
|
175
173
|
};
|
176
174
|
|
177
|
-
|
178
|
-
|
179
|
-
|
175
|
+
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
|
176
|
+
return /*#__PURE__*/React.createElement("div", {
|
177
|
+
className: cls()
|
178
|
+
}, renderLayout());
|
179
|
+
}
|
180
|
+
|
181
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
180
182
|
};
|
181
183
|
|
182
184
|
export default /*#__PURE__*/React.memo(Layout);
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody"];
|
2
2
|
|
3
3
|
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); }
|
4
4
|
|
@@ -172,6 +172,8 @@ var ProTable = function ProTable(props) {
|
|
172
172
|
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
173
173
|
disableSelectAll = props.disableSelectAll,
|
174
174
|
context = props.context,
|
175
|
+
_props$fixedTableBody = props.fixedTableBody,
|
176
|
+
fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
|
175
177
|
otherProps = _objectWithoutProperties(props, _excluded);
|
176
178
|
|
177
179
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -253,9 +255,36 @@ var ProTable = function ProTable(props) {
|
|
253
255
|
actionRefCallback = _useState24[0]; // 存储定时器 id
|
254
256
|
|
255
257
|
|
256
|
-
var autoRefreshTimerRef = useRef();
|
258
|
+
var autoRefreshTimerRef = useRef();
|
259
|
+
var onResize = null;
|
260
|
+
useEffect(function () {
|
261
|
+
getHeaderHeight(fullscreenState);
|
262
|
+
|
263
|
+
if (window.onresize) {
|
264
|
+
onResize = window.onresize;
|
265
|
+
|
266
|
+
window.onresize = function () {
|
267
|
+
var _onResize;
|
268
|
+
|
269
|
+
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
270
|
+
getHeaderHeight(fullscreenState);
|
271
|
+
};
|
272
|
+
} else {
|
273
|
+
window.onresize = function () {
|
274
|
+
getHeaderHeight(fullscreenState);
|
275
|
+
};
|
276
|
+
}
|
257
277
|
|
258
|
-
|
278
|
+
return function () {
|
279
|
+
if (onResize) {
|
280
|
+
window.onresize = onResize;
|
281
|
+
} else {
|
282
|
+
window.onresize = null;
|
283
|
+
}
|
284
|
+
};
|
285
|
+
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
286
|
+
|
287
|
+
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
259
288
|
var _tableDom$getElements, _tableDom$getElements2;
|
260
289
|
|
261
290
|
var tableDom = tableRef.current;
|
@@ -264,16 +293,29 @@ var ProTable = function ProTable(props) {
|
|
264
293
|
base: true
|
265
294
|
});
|
266
295
|
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
267
|
-
|
268
|
-
|
269
|
-
|
296
|
+
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
297
|
+
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
298
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
299
|
+
setTimeout(function () {
|
300
|
+
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
270
301
|
|
271
|
-
|
302
|
+
var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
|
272
303
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
304
|
+
var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
|
305
|
+
var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50; // 固定表格主体高度
|
306
|
+
|
307
|
+
if (fixedTableBody && !isFullscreen) {
|
308
|
+
var _pageContainerDom$off, _teamixNavDom$offsetH;
|
309
|
+
|
310
|
+
// 16px 为 padding
|
311
|
+
var pageHeaderHeight = ((_pageContainerDom$off = pageContainerDom === null || pageContainerDom === void 0 ? void 0 : pageContainerDom.offsetHeight) !== null && _pageContainerDom$off !== void 0 ? _pageContainerDom$off : 0) + 16;
|
312
|
+
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
|
313
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0));
|
314
|
+
} else {
|
315
|
+
// 24px 为 padding
|
316
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0));
|
317
|
+
}
|
318
|
+
}, 50);
|
277
319
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
278
320
|
|
279
321
|
|
@@ -471,10 +513,8 @@ var ProTable = function ProTable(props) {
|
|
471
513
|
|
472
514
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
473
515
|
|
474
|
-
getHeaderHeight().then(function (height) {
|
475
|
-
setHeaderHeight(height);
|
476
|
-
});
|
477
516
|
setFullscreenState(state);
|
517
|
+
getHeaderHeight(state);
|
478
518
|
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
|
479
519
|
return state;
|
480
520
|
},
|
@@ -542,10 +582,8 @@ var ProTable = function ProTable(props) {
|
|
542
582
|
normalDataFilterForm: normalDataFilterForm,
|
543
583
|
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
544
584
|
filterEnableRef: filterEnableRef,
|
545
|
-
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
546
|
-
getHeaderHeight(
|
547
|
-
setHeaderHeight(height);
|
548
|
-
});
|
585
|
+
resetTableMaxBodyHeight: function resetTableMaxBodyHeight(offset) {
|
586
|
+
getHeaderHeight(fullscreenState, offset);
|
549
587
|
}
|
550
588
|
}); // 将 Actions 绑定到传入的 propsActionRef 中
|
551
589
|
|
@@ -826,9 +864,8 @@ var ProTable = function ProTable(props) {
|
|
826
864
|
rowSelection: rowSelection,
|
827
865
|
emptyContent: /*#__PURE__*/React.createElement(EmptyContent, null),
|
828
866
|
sortIcons: getTableSortIcons(),
|
829
|
-
fixedHeader: fullscreenState,
|
830
|
-
|
831
|
-
maxBodyHeight: "calc(100vh - 84px - ".concat(headerHeight, "px)")
|
867
|
+
fixedHeader: fullscreenState || fixedTableBody,
|
868
|
+
maxBodyHeight: "calc(100vh - ".concat(headerHeight, "px)")
|
832
869
|
}, pickProps(getTableProps(), otherProps))));
|
833
870
|
} else {
|
834
871
|
// 不传 columns 直接返回原始 Table
|
@@ -970,7 +1007,7 @@ var ProTable = function ProTable(props) {
|
|
970
1007
|
|
971
1008
|
}),
|
972
1009
|
ref: tableRef
|
973
|
-
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
1010
|
+
}, renderTable(isFullScreen), (footerSuctionState && footerSuction && !fullscreenState || fixedTableBody) && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && !fixedTableBody && renderFooter(), fullscreenState && renderFooter());
|
974
1011
|
});
|
975
1012
|
};
|
976
1013
|
|
package/es/table/typing.d.ts
CHANGED
@@ -141,6 +141,8 @@ export declare type ProTableProps = {
|
|
141
141
|
disableSelectAll?: boolean;
|
142
142
|
/** 接收外部传来的 context,eg: dialog-table */
|
143
143
|
context?: any;
|
144
|
+
/** 是否固定表格主体(开启后横向滚动条会固定在底部) */
|
145
|
+
fixedTableBody?: boolean;
|
144
146
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
145
147
|
export declare type rowSelectionType = {
|
146
148
|
getProps?: (record: any, index: number) => any;
|
@@ -224,7 +226,7 @@ export declare type ProTableActionTypeMutations = {
|
|
224
226
|
/** 获取 列 过滤规则 */
|
225
227
|
getFilterRules?: () => object;
|
226
228
|
/** 重新计算表格maxHeight高度 */
|
227
|
-
resetTableMaxBodyHeight?: () => void;
|
229
|
+
resetTableMaxBodyHeight?: (offset: number) => void;
|
228
230
|
/** 列筛选规则 */
|
229
231
|
filterColumns?: any[];
|
230
232
|
/** 获取所有 on 监听事件 */
|
package/lib/actions/dialog.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
|
|
4
4
|
import { ProFormSchema, ProFormSchemaItem } from '../form';
|
5
5
|
import { ProMessageProps } from '../utils/message';
|
6
6
|
import { RequestAction } from './request';
|
7
|
-
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | '
|
7
|
+
export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onError'> {
|
8
8
|
/** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
|
9
9
|
url?: string;
|
10
10
|
/** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
|
@@ -25,6 +25,10 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
25
25
|
schema?: any;
|
26
26
|
/** 弹窗内容区的组件 */
|
27
27
|
component?: any;
|
28
|
+
/** 点击确定自定义回调函数 */
|
29
|
+
onOk?: any;
|
30
|
+
/** 点击取消自定义回调函数 */
|
31
|
+
onCancel?: any;
|
28
32
|
}
|
29
33
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
30
34
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|