@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/lib/actions/dialog.js
CHANGED
@@ -30,7 +30,7 @@ var _request = require("./request");
|
|
30
30
|
|
31
31
|
var _utils2 = require("./utils");
|
32
32
|
|
33
|
-
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
33
|
+
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel"],
|
34
34
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
35
35
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -77,7 +77,9 @@ var FooterForm = function FooterForm(props) {
|
|
77
77
|
var schema = props.schema,
|
78
78
|
context = props.context,
|
79
79
|
formRef = props.formRef;
|
80
|
-
var form = (0,
|
80
|
+
var form = (0, _react.useMemo)(function () {
|
81
|
+
return (0, _form.createForm)();
|
82
|
+
}, []);
|
81
83
|
(0, _react.useEffect)(function () {
|
82
84
|
formRef.current = form;
|
83
85
|
}, []);
|
@@ -121,6 +123,8 @@ function useDialogAction(action, actionContext, hasForm) {
|
|
121
123
|
formatResult = action.formatResult,
|
122
124
|
onSuccess = action.onSuccess,
|
123
125
|
onError = action.onError,
|
126
|
+
propsOnOk = action.onOk,
|
127
|
+
propsOnCancel = action.onCancel,
|
124
128
|
others = _objectWithoutProperties(action, _excluded);
|
125
129
|
|
126
130
|
var _getTargetValue = (0, _utils.getTargetValue)(others, context),
|
@@ -201,33 +205,34 @@ function useDialogAction(action, actionContext, hasForm) {
|
|
201
205
|
|
202
206
|
case 6:
|
203
207
|
onFinish && onFinish();
|
208
|
+
propsOnOk && propsOnOk(context);
|
204
209
|
resolve(true);
|
205
|
-
_context.next =
|
210
|
+
_context.next = 19;
|
206
211
|
break;
|
207
212
|
|
208
|
-
case
|
209
|
-
_context.prev =
|
213
|
+
case 11:
|
214
|
+
_context.prev = 11;
|
210
215
|
_context.t0 = _context["catch"](2);
|
211
216
|
setLoading(false); // 如果 beforeRequest 中返回了 false 并且不是 dialog-form,则直接关闭弹窗
|
212
217
|
|
213
218
|
if (!(beforeRequest && !hasForm)) {
|
214
|
-
_context.next =
|
219
|
+
_context.next = 17;
|
215
220
|
break;
|
216
221
|
}
|
217
222
|
|
218
223
|
resolve(true);
|
219
224
|
return _context.abrupt("return");
|
220
225
|
|
221
|
-
case
|
226
|
+
case 17:
|
222
227
|
resolve(false);
|
223
228
|
return _context.abrupt("return");
|
224
229
|
|
225
|
-
case
|
230
|
+
case 19:
|
226
231
|
case "end":
|
227
232
|
return _context.stop();
|
228
233
|
}
|
229
234
|
}
|
230
|
-
}, _callee, null, [[2,
|
235
|
+
}, _callee, null, [[2, 11]]);
|
231
236
|
}));
|
232
237
|
|
233
238
|
return function (_x) {
|
@@ -250,7 +255,9 @@ function useDialogAction(action, actionContext, hasForm) {
|
|
250
255
|
});
|
251
256
|
var dialogContent = Component ? /*#__PURE__*/_react.default.createElement(Component, _objectSpread({}, (0, _utils2.addContext)(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
252
257
|
|
253
|
-
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "
|
258
|
+
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "onCancel", function onCancel() {
|
259
|
+
propsOnCancel && propsOnCancel(context);
|
260
|
+
}), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, beforeContent && /*#__PURE__*/_react.default.createElement("div", {
|
254
261
|
className: "teamix-pro-dialog-before-content"
|
255
262
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
|
256
263
|
className: "teamix-pro-dialog-message"
|
@@ -15,7 +15,7 @@ var _ProForm = _interopRequireDefault(require("../ProForm"));
|
|
15
15
|
|
16
16
|
var _utils2 = require("../utils");
|
17
17
|
|
18
|
-
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "forceClear"];
|
18
|
+
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "gridProps", "forceClear"];
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
@@ -23,12 +23,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
23
23
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
25
|
|
26
|
-
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
|
-
|
28
|
-
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; }
|
29
|
-
|
30
|
-
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; }
|
31
|
-
|
32
26
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
33
27
|
|
34
28
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -41,6 +35,12 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
41
35
|
|
42
36
|
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; }
|
43
37
|
|
38
|
+
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; }
|
39
|
+
|
40
|
+
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; }
|
41
|
+
|
42
|
+
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; }
|
43
|
+
|
44
44
|
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; }
|
45
45
|
|
46
46
|
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; }
|
@@ -57,6 +57,8 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
57
57
|
wrapperAlign = props.wrapperAlign,
|
58
58
|
labelCol = props.labelCol,
|
59
59
|
wrapperCol = props.wrapperCol,
|
60
|
+
breakpoints = props.breakpoints,
|
61
|
+
gridProps = props.gridProps,
|
60
62
|
forceClear = props.forceClear,
|
61
63
|
otherProps = _objectWithoutProperties(props, _excluded);
|
62
64
|
|
@@ -65,13 +67,13 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
65
67
|
return [{
|
66
68
|
name: 'FormGrid',
|
67
69
|
component: 'FormGrid',
|
68
|
-
props: {
|
70
|
+
props: _objectSpread({
|
69
71
|
breakpoints: [480, 720, 990, 1200, Infinity],
|
70
72
|
maxColumns: [1, 2, 3, 3, 4],
|
71
73
|
maxWidth: [480, 360, 330, 400],
|
72
74
|
columnGap: 16,
|
73
75
|
rowGap: 12
|
74
|
-
},
|
76
|
+
}, gridProps),
|
75
77
|
children: [].concat(_toConsumableArray(schema), [{
|
76
78
|
component: 'FormGrid.GridColumn',
|
77
79
|
props: {
|
@@ -103,15 +105,22 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
103
105
|
}];
|
104
106
|
}, [schema, onReset]);
|
105
107
|
var getTeamixLayout = (0, _react.useMemo)(function () {
|
106
|
-
return {
|
108
|
+
return breakpoints === true ? {
|
107
109
|
breakpoints: [990],
|
108
110
|
layout: (0, _utils2.mergeArrayValue)(['vertical'], layout),
|
109
111
|
labelAlign: (0, _utils2.mergeArrayValue)(['left'], labelAlign),
|
110
112
|
wrapperAlign: (0, _utils2.mergeArrayValue)(['left'], wrapperAlign),
|
111
113
|
labelCol: (0, _utils2.mergeArrayValue)([24], labelCol),
|
112
114
|
wrapperCol: (0, _utils2.mergeArrayValue)([24], wrapperCol)
|
115
|
+
} : {
|
116
|
+
breakpoints: (0, _utils.isBool)(breakpoints) ? undefined : breakpoints,
|
117
|
+
layout: layout,
|
118
|
+
labelAlign: labelAlign,
|
119
|
+
wrapperAlign: wrapperAlign,
|
120
|
+
labelCol: labelCol,
|
121
|
+
wrapperCol: wrapperCol
|
113
122
|
};
|
114
|
-
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
123
|
+
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
115
124
|
return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread(_objectSpread({
|
116
125
|
className: (0, _utils.cls)(prefixCls(), props.className),
|
117
126
|
schema: gridSchema,
|
@@ -121,6 +130,7 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
121
130
|
}));
|
122
131
|
});
|
123
132
|
AdvancedFilter.defaultProps = {
|
133
|
+
breakpoints: true,
|
124
134
|
layout: 'horizontal',
|
125
135
|
labelAlign: 'right',
|
126
136
|
labelCol: 6,
|
@@ -133,20 +133,20 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
133
133
|
var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit, context); // todo 需要formily支持断点下的属性更新
|
134
134
|
|
135
135
|
var getTeamixLayout = (0, _react.useMemo)(function () {
|
136
|
-
return breakpoints ? {
|
137
|
-
breakpoints: breakpoints,
|
138
|
-
layout: layout,
|
139
|
-
labelAlign: labelAlign,
|
140
|
-
wrapperAlign: wrapperAlign,
|
141
|
-
labelCol: labelCol,
|
142
|
-
wrapperCol: wrapperCol
|
143
|
-
} : {
|
136
|
+
return breakpoints === true ? {
|
144
137
|
breakpoints: [480],
|
145
138
|
layout: (0, _utils2.mergeArrayValue)(['vertical'], layout),
|
146
139
|
labelAlign: (0, _utils2.mergeArrayValue)(['left'], labelAlign),
|
147
140
|
wrapperAlign: (0, _utils2.mergeArrayValue)(['left'], wrapperAlign),
|
148
141
|
labelCol: (0, _utils2.mergeArrayValue)([24], labelCol),
|
149
142
|
wrapperCol: (0, _utils2.mergeArrayValue)([24], wrapperCol)
|
143
|
+
} : {
|
144
|
+
breakpoints: (0, _utils.isBool)(breakpoints) ? undefined : breakpoints,
|
145
|
+
layout: layout,
|
146
|
+
labelAlign: labelAlign,
|
147
|
+
wrapperAlign: wrapperAlign,
|
148
|
+
labelCol: labelCol,
|
149
|
+
wrapperCol: wrapperCol
|
150
150
|
};
|
151
151
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
152
152
|
(0, _react.useMemo)(function () {
|
@@ -182,7 +182,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
182
182
|
});
|
183
183
|
});
|
184
184
|
}
|
185
|
-
}, [onChange]);
|
185
|
+
}, [onChange, form]);
|
186
186
|
(0, _react.useEffect)(function () {
|
187
187
|
// 配置国际化
|
188
188
|
(0, _core.setValidateLanguage)((0, _utils.getLanguage)() || 'zh-cn');
|
@@ -201,8 +201,9 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
201
201
|
});
|
202
202
|
ProForm.defaultProps = {
|
203
203
|
colon: false,
|
204
|
-
|
205
|
-
|
204
|
+
validateFirst: true,
|
205
|
+
breakpoints: true,
|
206
|
+
labelAlign: 'left'
|
206
207
|
};
|
207
208
|
var _default = ProForm;
|
208
209
|
exports.default = _default;
|
package/lib/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/lib/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/lib/index.js
CHANGED
@@ -191,7 +191,7 @@ var Filter = function Filter(props) {
|
|
191
191
|
btn: true
|
192
192
|
}),
|
193
193
|
onClick: function onClick() {
|
194
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
194
|
+
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;
|
195
195
|
|
196
196
|
(_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
|
197
197
|
|
@@ -212,24 +212,18 @@ var Filter = function Filter(props) {
|
|
212
212
|
rules: selected,
|
213
213
|
params: param
|
214
214
|
})));
|
215
|
+
var targetPageKey = 'currentPage';
|
216
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
215
217
|
|
216
|
-
if (
|
217
|
-
|
218
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
219
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
220
|
+
} // 发送请求
|
218
221
|
|
219
|
-
var targetPageKey = 'currentPage';
|
220
|
-
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
221
222
|
|
222
|
-
|
223
|
-
|
224
|
-
} // 发送请求
|
225
|
-
|
226
|
-
|
227
|
-
(_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));
|
228
|
-
(_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); // 清空表格选择
|
229
|
-
|
230
|
-
(_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);
|
231
|
-
}
|
223
|
+
(_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));
|
224
|
+
(_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); // 清空表格选择
|
232
225
|
|
226
|
+
(_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);
|
233
227
|
setVisible(false);
|
234
228
|
}
|
235
229
|
}, (0, _utils.getMessage)('ok')), /*#__PURE__*/_react.default.createElement(_components.Button, {
|
@@ -21,7 +21,7 @@ var _QuickAction = _interopRequireDefault(require("../QuickAction"));
|
|
21
21
|
|
22
22
|
require("./index.scss");
|
23
23
|
|
24
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection"];
|
24
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar"];
|
25
25
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
27
|
|
@@ -52,6 +52,7 @@ var Layout = function Layout(props) {
|
|
52
52
|
dataFilterFormRef = props.dataFilterFormRef,
|
53
53
|
afterDataFilter = props.afterDataFilter,
|
54
54
|
rowSelection = props.rowSelection,
|
55
|
+
toolBar = props.toolBar,
|
55
56
|
otherProps = _objectWithoutProperties(props, _excluded); // 渲染主操作区
|
56
57
|
|
57
58
|
|
@@ -90,7 +91,8 @@ var Layout = function Layout(props) {
|
|
90
91
|
quickAction: extra,
|
91
92
|
rowSelection: rowSelection
|
92
93
|
}), /*#__PURE__*/_react.default.createElement(_ToolBar.default, _objectSpread({
|
93
|
-
actionRef: actionRef
|
94
|
+
actionRef: actionRef,
|
95
|
+
toolBar: toolBar
|
94
96
|
}, otherProps)));
|
95
97
|
}; // 渲染新版 QueryFilter
|
96
98
|
|
@@ -107,13 +109,11 @@ var Layout = function Layout(props) {
|
|
107
109
|
onExpand: function onExpand(expand) {
|
108
110
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
109
111
|
setTimeout(function () {
|
110
|
-
var _actionRef$current, _actionRef$current$
|
111
|
-
|
112
|
-
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) {
|
113
|
-
var _actionRef$current2, _actionRef$current2$r;
|
112
|
+
var _actionRef$current, _actionRef$current$re;
|
114
113
|
|
115
|
-
|
116
|
-
|
114
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
115
|
+
// 偏移量8像素为面板展开后的下margin
|
116
|
+
(_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); // }
|
117
117
|
});
|
118
118
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
119
119
|
},
|
@@ -127,13 +127,11 @@ var Layout = function Layout(props) {
|
|
127
127
|
onExpand: function onExpand(expand) {
|
128
128
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
129
129
|
setTimeout(function () {
|
130
|
-
var _actionRef$
|
131
|
-
|
132
|
-
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) {
|
133
|
-
var _actionRef$current4, _actionRef$current4$r;
|
130
|
+
var _actionRef$current2, _actionRef$current2$r;
|
134
131
|
|
135
|
-
|
136
|
-
|
132
|
+
// if (actionRef.current?.getState?.().fullScreenState) {
|
133
|
+
// 偏移量8像素为面板展开后的下margin
|
134
|
+
(_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); // }
|
137
135
|
});
|
138
136
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
139
137
|
},
|
@@ -195,9 +193,13 @@ var Layout = function Layout(props) {
|
|
195
193
|
}
|
196
194
|
};
|
197
195
|
|
198
|
-
|
199
|
-
|
200
|
-
|
196
|
+
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
|
197
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
198
|
+
className: cls()
|
199
|
+
}, renderLayout());
|
200
|
+
}
|
201
|
+
|
202
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
201
203
|
};
|
202
204
|
|
203
205
|
var _default = /*#__PURE__*/_react.default.memo(Layout);
|
package/lib/table/index.js
CHANGED
@@ -53,7 +53,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
53
53
|
}
|
54
54
|
});
|
55
55
|
});
|
56
|
-
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"];
|
56
|
+
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"];
|
57
57
|
|
58
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
59
59
|
|
@@ -215,6 +215,8 @@ var ProTable = function ProTable(props) {
|
|
215
215
|
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
216
216
|
disableSelectAll = props.disableSelectAll,
|
217
217
|
context = props.context,
|
218
|
+
_props$fixedTableBody = props.fixedTableBody,
|
219
|
+
fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
|
218
220
|
otherProps = _objectWithoutProperties(props, _excluded);
|
219
221
|
|
220
222
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -296,9 +298,36 @@ var ProTable = function ProTable(props) {
|
|
296
298
|
actionRefCallback = _useState24[0]; // 存储定时器 id
|
297
299
|
|
298
300
|
|
299
|
-
var autoRefreshTimerRef = (0, _react.useRef)();
|
301
|
+
var autoRefreshTimerRef = (0, _react.useRef)();
|
302
|
+
var onResize = null;
|
303
|
+
(0, _react.useEffect)(function () {
|
304
|
+
getHeaderHeight(fullscreenState);
|
305
|
+
|
306
|
+
if (window.onresize) {
|
307
|
+
onResize = window.onresize;
|
308
|
+
|
309
|
+
window.onresize = function () {
|
310
|
+
var _onResize;
|
311
|
+
|
312
|
+
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
313
|
+
getHeaderHeight(fullscreenState);
|
314
|
+
};
|
315
|
+
} else {
|
316
|
+
window.onresize = function () {
|
317
|
+
getHeaderHeight(fullscreenState);
|
318
|
+
};
|
319
|
+
}
|
300
320
|
|
301
|
-
|
321
|
+
return function () {
|
322
|
+
if (onResize) {
|
323
|
+
window.onresize = onResize;
|
324
|
+
} else {
|
325
|
+
window.onresize = null;
|
326
|
+
}
|
327
|
+
};
|
328
|
+
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
329
|
+
|
330
|
+
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
302
331
|
var _tableDom$getElements, _tableDom$getElements2;
|
303
332
|
|
304
333
|
var tableDom = tableRef.current;
|
@@ -307,16 +336,29 @@ var ProTable = function ProTable(props) {
|
|
307
336
|
base: true
|
308
337
|
});
|
309
338
|
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];
|
310
|
-
|
311
|
-
|
312
|
-
|
339
|
+
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
340
|
+
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
341
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
342
|
+
setTimeout(function () {
|
343
|
+
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
313
344
|
|
314
|
-
|
345
|
+
var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
|
315
346
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
347
|
+
var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
|
348
|
+
var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50; // 固定表格主体高度
|
349
|
+
|
350
|
+
if (fixedTableBody && !isFullscreen) {
|
351
|
+
var _pageContainerDom$off, _teamixNavDom$offsetH;
|
352
|
+
|
353
|
+
// 16px 为 padding
|
354
|
+
var pageHeaderHeight = ((_pageContainerDom$off = pageContainerDom === null || pageContainerDom === void 0 ? void 0 : pageContainerDom.offsetHeight) !== null && _pageContainerDom$off !== void 0 ? _pageContainerDom$off : 0) + 16;
|
355
|
+
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
|
356
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0));
|
357
|
+
} else {
|
358
|
+
// 24px 为 padding
|
359
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0));
|
360
|
+
}
|
361
|
+
}, 50);
|
320
362
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
321
363
|
|
322
364
|
|
@@ -514,10 +556,8 @@ var ProTable = function ProTable(props) {
|
|
514
556
|
|
515
557
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
516
558
|
|
517
|
-
getHeaderHeight().then(function (height) {
|
518
|
-
setHeaderHeight(height);
|
519
|
-
});
|
520
559
|
setFullscreenState(state);
|
560
|
+
getHeaderHeight(state);
|
521
561
|
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);
|
522
562
|
return state;
|
523
563
|
},
|
@@ -585,10 +625,8 @@ var ProTable = function ProTable(props) {
|
|
585
625
|
normalDataFilterForm: normalDataFilterForm,
|
586
626
|
fullscreenDataFilterForm: fullscreenDataFilterForm,
|
587
627
|
filterEnableRef: filterEnableRef,
|
588
|
-
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
589
|
-
getHeaderHeight(
|
590
|
-
setHeaderHeight(height);
|
591
|
-
});
|
628
|
+
resetTableMaxBodyHeight: function resetTableMaxBodyHeight(offset) {
|
629
|
+
getHeaderHeight(fullscreenState, offset);
|
592
630
|
}
|
593
631
|
}); // 将 Actions 绑定到传入的 propsActionRef 中
|
594
632
|
|
@@ -869,9 +907,8 @@ var ProTable = function ProTable(props) {
|
|
869
907
|
rowSelection: rowSelection,
|
870
908
|
emptyContent: /*#__PURE__*/_react.default.createElement(_EmptyContent.default, null),
|
871
909
|
sortIcons: (0, _getTableSortIcons.default)(),
|
872
|
-
fixedHeader: fullscreenState,
|
873
|
-
|
874
|
-
maxBodyHeight: "calc(100vh - 84px - ".concat(headerHeight, "px)")
|
910
|
+
fixedHeader: fullscreenState || fixedTableBody,
|
911
|
+
maxBodyHeight: "calc(100vh - ".concat(headerHeight, "px)")
|
875
912
|
}, (0, _utils.pickProps)((0, _getTableProps.default)(), otherProps))));
|
876
913
|
} else {
|
877
914
|
// 不传 columns 直接返回原始 Table
|
@@ -1013,7 +1050,7 @@ var ProTable = function ProTable(props) {
|
|
1013
1050
|
|
1014
1051
|
}),
|
1015
1052
|
ref: tableRef
|
1016
|
-
}, renderTable(isFullScreen), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter());
|
1053
|
+
}, renderTable(isFullScreen), (footerSuctionState && footerSuction && !fullscreenState || fixedTableBody) && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && !fixedTableBody && renderFooter(), fullscreenState && renderFooter());
|
1017
1054
|
});
|
1018
1055
|
};
|
1019
1056
|
|
package/lib/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 监听事件 */
|