@teamix/pro 1.4.12 → 1.4.15
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 +532 -167
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.scss +1 -1
- package/es/form/ProForm/index.js +14 -32
- package/es/form/ProForm/index.scss +5 -0
- package/es/form/ProForm/useAutoLayout.d.ts +9 -0
- package/es/form/ProForm/useAutoLayout.js +114 -0
- package/es/form/SchemaForm/index.js +12 -4
- package/es/form/SchemaForm/initializeDataSource.d.ts +3 -0
- package/es/form/SchemaForm/initializeDataSource.js +7 -0
- package/es/form/SchemaForm/initializeFormButton.js +4 -5
- package/es/form/typing.d.ts +4 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/ProInfoItem/index.js +33 -4
- package/es/info/components/ProInfoItem/index.scss +18 -11
- package/es/info/components/baseInfo/index.js +4 -1
- package/es/info/components/baseInfo/index.scss +4 -1
- package/es/info/components/headerInfo/index.js +4 -1
- package/es/info/components/headerInfo/index.scss +3 -0
- package/es/info/components/tableInfo/index.js +2 -1
- package/es/info/index.js +6 -3
- package/es/info/typing.d.ts +3 -1
- package/es/nocode/index.scss +2 -2
- package/es/nocode/pages/playground.js +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/nocode/playground.js +1 -1
- package/es/table/components/Layout/index.js +8 -4
- package/es/table/components/QuickAction/index.js +1 -1
- package/es/table/index.js +121 -54
- package/es/table/index.scss +5 -0
- package/es/table/typing.d.ts +3 -1
- package/es/table/utils/columnRender.js +2 -1
- package/lib/actions/index.scss +1 -1
- package/lib/form/ProForm/index.js +13 -31
- package/lib/form/ProForm/index.scss +5 -0
- package/lib/form/ProForm/useAutoLayout.d.ts +9 -0
- package/lib/form/ProForm/useAutoLayout.js +124 -0
- package/lib/form/SchemaForm/index.js +11 -3
- package/lib/form/SchemaForm/initializeDataSource.d.ts +3 -0
- package/lib/form/SchemaForm/initializeDataSource.js +10 -2
- package/lib/form/SchemaForm/initializeFormButton.js +3 -4
- package/lib/form/typing.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/ProInfoItem/index.js +33 -4
- package/lib/info/components/ProInfoItem/index.scss +18 -11
- package/lib/info/components/baseInfo/index.js +4 -1
- package/lib/info/components/baseInfo/index.scss +4 -1
- package/lib/info/components/headerInfo/index.js +4 -1
- package/lib/info/components/headerInfo/index.scss +3 -0
- package/lib/info/components/tableInfo/index.js +3 -1
- package/lib/info/index.js +5 -2
- package/lib/info/typing.d.ts +3 -1
- package/lib/nocode/index.scss +2 -2
- package/lib/nocode/pages/playground.js +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/nocode/playground.js +1 -1
- package/lib/table/components/Layout/index.js +8 -4
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/index.js +120 -52
- package/lib/table/index.scss +5 -0
- package/lib/table/typing.d.ts +3 -1
- package/lib/table/utils/columnRender.js +2 -1
- package/package.json +1 -1
@@ -40,7 +40,7 @@ import PageHeader from '../../page-header';
|
|
40
40
|
import { ProSkeletonRaw } from '../../skeleton';
|
41
41
|
import { usePrefixCls } from '@teamix/utils';
|
42
42
|
import { PageMap } from '.';
|
43
|
-
var cls = usePrefixCls('teamix-nocode');
|
43
|
+
var cls = usePrefixCls('teamix-pro-nocode');
|
44
44
|
|
45
45
|
var Loading = function Loading(props) {
|
46
46
|
return /*#__PURE__*/React.createElement(PageContainer, _objectSpread({
|
package/es/nocode/playground.js
CHANGED
@@ -20,7 +20,7 @@ import React, { useMemo } from 'react';
|
|
20
20
|
import { usePrefixCls } from '@teamix/utils';
|
21
21
|
import { useDebounceFn } from '@teamix/hooks';
|
22
22
|
import { initConfigurator } from './configurators';
|
23
|
-
var cls = usePrefixCls('teamix-nocode-playground');
|
23
|
+
var cls = usePrefixCls('teamix-pro-nocode-playground');
|
24
24
|
export var PlayGroundLayout = function PlayGroundLayout(props) {
|
25
25
|
return /*#__PURE__*/React.createElement("div", {
|
26
26
|
className: cls()
|
@@ -122,14 +122,18 @@ var Layout = function Layout(props) {
|
|
122
122
|
}
|
123
123
|
} else if (mainAction) {
|
124
124
|
// 没传 dataFilter 但是传了 mainAction
|
125
|
-
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
125
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
126
126
|
addonBefore: renderMainAction(),
|
127
127
|
addonAfter: renderAddonAfter()
|
128
|
-
})
|
128
|
+
}), afterDataFilter && /*#__PURE__*/React.createElement("div", {
|
129
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
130
|
+
}, afterDataFilter));
|
129
131
|
} else {
|
130
|
-
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
132
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
131
133
|
addonAfter: renderAddonAfter()
|
132
|
-
})
|
134
|
+
}), ' ', afterDataFilter && /*#__PURE__*/React.createElement("div", {
|
135
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
136
|
+
}, afterDataFilter));
|
133
137
|
}
|
134
138
|
}; // 区域组合渲染
|
135
139
|
|
@@ -15,7 +15,7 @@ var QuickAction = function QuickAction(props) {
|
|
15
15
|
actionRef = props.actionRef,
|
16
16
|
rowSelection = props.rowSelection; // 如果传对象的话,默认为主要文字类型的 ProActionButton
|
17
17
|
|
18
|
-
if (_typeof(quickAction) === 'object') {
|
18
|
+
if (_typeof(quickAction) === 'object' && (quickAction === null || quickAction === void 0 ? void 0 : quickAction.config)) {
|
19
19
|
// 默认 context
|
20
20
|
var defaultContext = {
|
21
21
|
action: actionRef.current,
|
package/es/table/index.js
CHANGED
@@ -32,11 +32,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
32
32
|
|
33
33
|
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; }
|
34
34
|
|
35
|
-
import React, { useState, useEffect, useRef } from 'react';
|
35
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
36
36
|
import { Table, Checkbox } from '@alicloudfe/components';
|
37
37
|
import Pagination from './components/Pagination';
|
38
38
|
import genProColumnToColumn from './utils/genProColumnToColumn';
|
39
|
-
import { getGlobalConfig, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, usePrefixCls } from '@teamix/utils';
|
39
|
+
import { getGlobalConfig, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, usePrefixCls, getTestRequestData, getTestRequestParams } from '@teamix/utils';
|
40
40
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
41
41
|
import './index.scss';
|
42
42
|
import Layout from './components/Layout';
|
@@ -49,6 +49,7 @@ import EmptyContent from './components/EmptyContent';
|
|
49
49
|
import { ProActionGroup } from '../actions';
|
50
50
|
import classNames from 'classnames';
|
51
51
|
import ProPageContainer from '../page-container';
|
52
|
+
import debounce from 'lodash.debounce';
|
52
53
|
export * from './typing';
|
53
54
|
var cls = usePrefixCls('teamix-pro-table');
|
54
55
|
/**
|
@@ -214,7 +215,7 @@ var ProTable = function ProTable(props) {
|
|
214
215
|
var skeletonDataSource = new Array(skeletonSize).fill({});
|
215
216
|
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data'; // 如果使用 customRequest 的话,内置 loading
|
216
217
|
|
217
|
-
var _useState13 = useState(
|
218
|
+
var _useState13 = useState(requestWhenMount),
|
218
219
|
_useState14 = _slicedToArray(_useState13, 2),
|
219
220
|
customTableLoading = _useState14[0],
|
220
221
|
setCustomTableLoading = _useState14[1];
|
@@ -258,21 +259,45 @@ var ProTable = function ProTable(props) {
|
|
258
259
|
var autoRefreshTimerRef = useRef();
|
259
260
|
var onResize = null;
|
260
261
|
useEffect(function () {
|
262
|
+
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
263
|
+
|
261
264
|
getHeaderHeight(fullscreenState);
|
265
|
+
getFooterSuctionState();
|
262
266
|
|
263
267
|
if (window.onresize) {
|
264
268
|
onResize = window.onresize;
|
265
|
-
|
266
|
-
window.onresize = function () {
|
269
|
+
window.onresize = debounce(function () {
|
267
270
|
var _onResize;
|
268
271
|
|
269
272
|
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
270
|
-
|
271
|
-
|
273
|
+
|
274
|
+
if (footerSuction) {
|
275
|
+
getFooterSuctionState();
|
276
|
+
}
|
277
|
+
|
278
|
+
if (fixedTableBody) {
|
279
|
+
getHeaderHeight(fullscreenState);
|
280
|
+
}
|
281
|
+
}, 500);
|
272
282
|
} else {
|
273
|
-
window.onresize = function () {
|
274
|
-
|
275
|
-
|
283
|
+
window.onresize = debounce(function () {
|
284
|
+
if (footerSuction) {
|
285
|
+
getFooterSuctionState();
|
286
|
+
}
|
287
|
+
|
288
|
+
if (fixedTableBody) {
|
289
|
+
getHeaderHeight(fullscreenState);
|
290
|
+
}
|
291
|
+
}, 500);
|
292
|
+
} // 如果不传 dataFilter,则在这里初始化请求
|
293
|
+
|
294
|
+
|
295
|
+
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
296
|
+
|
297
|
+
if (requestWhenMount && !hasDataFilter) {
|
298
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
299
|
+
|
300
|
+
_request();
|
276
301
|
}
|
277
302
|
|
278
303
|
return function () {
|
@@ -281,11 +306,21 @@ var ProTable = function ProTable(props) {
|
|
281
306
|
} else {
|
282
307
|
window.onresize = null;
|
283
308
|
}
|
309
|
+
|
310
|
+
if (autoRefreshTimerRef.current) {
|
311
|
+
clearTimeout(autoRefreshTimerRef.current);
|
312
|
+
}
|
313
|
+
|
314
|
+
actionRef.current = undefined;
|
284
315
|
};
|
285
316
|
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
286
317
|
|
287
318
|
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
288
|
-
var _tableDom$getElements, _tableDom$getElements2;
|
319
|
+
var _tableDom$getElements, _tableDom$getElements2, _document$querySelect, _document$querySelect2, _document$querySelect3;
|
320
|
+
|
321
|
+
if (!fixedTableBody) {
|
322
|
+
return;
|
323
|
+
}
|
289
324
|
|
290
325
|
var tableDom = tableRef.current;
|
291
326
|
var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
|
@@ -295,7 +330,10 @@ var ProTable = function ProTable(props) {
|
|
295
330
|
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];
|
296
331
|
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
297
332
|
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
298
|
-
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
333
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer'); // 这边不能直接取 next-table-body
|
334
|
+
|
335
|
+
var tableBodyDom = (_document$querySelect = document.querySelector('.teamix-pro-table')) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.getElementsByTagName('table')) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2[1]) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.parentNode;
|
336
|
+
var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
|
299
337
|
setTimeout(function () {
|
300
338
|
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
301
339
|
|
@@ -309,11 +347,31 @@ var ProTable = function ProTable(props) {
|
|
309
347
|
|
310
348
|
// 16px 为 padding
|
311
349
|
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
|
-
|
350
|
+
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0; // 1 为预留值,js无法取出精确高度,会被四舍五入
|
351
|
+
|
352
|
+
var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
|
353
|
+
|
354
|
+
if (tableBodyDom.clientHeight < tableBodyDom.scrollHeight) {
|
355
|
+
setFooterSuctionState(true);
|
356
|
+
} else {
|
357
|
+
setFooterSuctionState(false);
|
358
|
+
} // 如果有切换区tab,那么重新计算
|
359
|
+
|
360
|
+
|
361
|
+
if (headerFixedTopSectionDom.clientHeight) {
|
362
|
+
var _headerFixedTopSectio;
|
363
|
+
|
364
|
+
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0; // const clientTableBodyHeight =
|
365
|
+
// document.body.clientHeight - offsetHeaderHeight;
|
366
|
+
|
367
|
+
setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
|
368
|
+
return;
|
369
|
+
}
|
370
|
+
|
371
|
+
setHeaderHeight(offsetHeaderHeight);
|
314
372
|
} else {
|
315
373
|
// 24px 为 padding
|
316
|
-
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0));
|
374
|
+
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0) + 1);
|
317
375
|
}
|
318
376
|
}, 50);
|
319
377
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
@@ -351,6 +409,10 @@ var ProTable = function ProTable(props) {
|
|
351
409
|
|
352
410
|
|
353
411
|
var getFooterSuctionState = function getFooterSuctionState() {
|
412
|
+
if (!footerSuction) {
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
|
354
416
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
355
417
|
|
356
418
|
if (containerDom) {
|
@@ -652,6 +714,10 @@ var ProTable = function ProTable(props) {
|
|
652
714
|
if (footerSuction) {
|
653
715
|
getFooterSuctionState();
|
654
716
|
}
|
717
|
+
|
718
|
+
if (fixedTableBody) {
|
719
|
+
getHeaderHeight(fullscreenState);
|
720
|
+
}
|
655
721
|
},
|
656
722
|
onError: function onError(error) {
|
657
723
|
setShowSkeleton(false);
|
@@ -665,6 +731,10 @@ var ProTable = function ProTable(props) {
|
|
665
731
|
if (footerSuction) {
|
666
732
|
getFooterSuctionState();
|
667
733
|
}
|
734
|
+
|
735
|
+
if (fixedTableBody) {
|
736
|
+
getHeaderHeight(fullscreenState);
|
737
|
+
}
|
668
738
|
}
|
669
739
|
}); // 请求函数
|
670
740
|
|
@@ -730,6 +800,20 @@ var ProTable = function ProTable(props) {
|
|
730
800
|
if (footerSuction) {
|
731
801
|
getFooterSuctionState();
|
732
802
|
}
|
803
|
+
|
804
|
+
if (fixedTableBody) {
|
805
|
+
getHeaderHeight(fullscreenState);
|
806
|
+
} // customRequest 中支持 autoRefresh
|
807
|
+
|
808
|
+
|
809
|
+
var time = autoRefresh ? autoRefresh(data) : false;
|
810
|
+
|
811
|
+
if (Number.isInteger(time) && time >= 1000) {
|
812
|
+
autoRefreshTimerRef.current = setTimeout(function () {
|
813
|
+
// 自动刷新不显示 loading
|
814
|
+
_request(requestData, true);
|
815
|
+
}, Number(time));
|
816
|
+
}
|
733
817
|
});
|
734
818
|
} else {
|
735
819
|
getData.run(requestData);
|
@@ -737,40 +821,6 @@ var ProTable = function ProTable(props) {
|
|
737
821
|
}
|
738
822
|
}
|
739
823
|
|
740
|
-
useEffect(function () {
|
741
|
-
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
742
|
-
|
743
|
-
// 监听 浏览器变化 更吸底状态
|
744
|
-
if (footerSuction) {
|
745
|
-
getFooterSuctionState();
|
746
|
-
|
747
|
-
window.onresize = function () {
|
748
|
-
getFooterSuctionState();
|
749
|
-
};
|
750
|
-
} // 如果不传 dataFilter,则在这里初始化请求
|
751
|
-
|
752
|
-
|
753
|
-
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
754
|
-
|
755
|
-
if (requestWhenMount && !hasDataFilter) {
|
756
|
-
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
757
|
-
|
758
|
-
_request();
|
759
|
-
}
|
760
|
-
|
761
|
-
return function () {
|
762
|
-
if (autoRefreshTimerRef.current) {
|
763
|
-
clearTimeout(autoRefreshTimerRef.current);
|
764
|
-
}
|
765
|
-
|
766
|
-
if (window.onresize) {
|
767
|
-
window.onresize = null;
|
768
|
-
}
|
769
|
-
|
770
|
-
actionRef.current = undefined;
|
771
|
-
};
|
772
|
-
}, []);
|
773
|
-
|
774
824
|
function onSort(dataIndex, order) {
|
775
825
|
var nextSort = _defineProperty({}, dataIndex, order);
|
776
826
|
|
@@ -836,7 +886,10 @@ var ProTable = function ProTable(props) {
|
|
836
886
|
var renderTable = function renderTable(isFullScreen) {
|
837
887
|
if (propsColumns) {
|
838
888
|
return /*#__PURE__*/React.createElement("div", {
|
839
|
-
className: classNames('teamix-pro-table-container', className)
|
889
|
+
className: classNames('teamix-pro-table-container', className, 'teamix-test-request'),
|
890
|
+
"data-teamix-test-request": "url=".concat(url, "&formatResult=").concat(!!formatResult),
|
891
|
+
"data-teamix-test-params": getTestRequestParams(propsParams),
|
892
|
+
"data-teamix-test-data": getTestRequestData(propsColumns)
|
840
893
|
}, /*#__PURE__*/React.createElement(Layout, {
|
841
894
|
header: header,
|
842
895
|
mainAction: mainAction,
|
@@ -962,7 +1015,7 @@ var ProTable = function ProTable(props) {
|
|
962
1015
|
})
|
963
1016
|
}, renderRowSelection(), /*#__PURE__*/React.createElement("div", {
|
964
1017
|
className: cls('footer-right-wrapper')
|
965
|
-
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : /*#__PURE__*/React.createElement(Pagination, _objectSpread({
|
1018
|
+
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : /*#__PURE__*/React.createElement(React.Fragment, null, data.length > 0 && /*#__PURE__*/React.createElement(Pagination, _objectSpread({
|
966
1019
|
className: cls('pagination'),
|
967
1020
|
onChange: function onChange(number) {
|
968
1021
|
return onChangePagination(number);
|
@@ -984,7 +1037,7 @@ var ProTable = function ProTable(props) {
|
|
984
1037
|
onPageSizeChange: function onPageSizeChange(number) {
|
985
1038
|
return onChangePaginationSize(number);
|
986
1039
|
}
|
987
|
-
}, props.paginationProps))));
|
1040
|
+
}, props.paginationProps)))));
|
988
1041
|
} else if (!showPagination) {
|
989
1042
|
return /*#__PURE__*/React.createElement("div", {
|
990
1043
|
className: cls('footer', {
|
@@ -994,8 +1047,22 @@ var ProTable = function ProTable(props) {
|
|
994
1047
|
className: cls('footer-right-wrapper')
|
995
1048
|
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : footer));
|
996
1049
|
}
|
997
|
-
};
|
1050
|
+
}; // 判断是否需要吸底
|
998
1051
|
|
1052
|
+
|
1053
|
+
var fixFooterState = useMemo(function () {
|
1054
|
+
if (fullscreenState) {
|
1055
|
+
return true;
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
if (fixedTableBody || footerSuction) {
|
1059
|
+
if (footerSuctionState) {
|
1060
|
+
return true;
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
return false;
|
1065
|
+
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
999
1066
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
1000
1067
|
visible: fullscreenState,
|
1001
1068
|
actionRef: actionRef
|
@@ -1007,7 +1074,7 @@ var ProTable = function ProTable(props) {
|
|
1007
1074
|
|
1008
1075
|
}),
|
1009
1076
|
ref: tableRef
|
1010
|
-
}, renderTable(isFullScreen),
|
1077
|
+
}, renderTable(isFullScreen), fixFooterState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !fixFooterState && renderFooter());
|
1011
1078
|
});
|
1012
1079
|
};
|
1013
1080
|
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -69,7 +69,9 @@ export declare type ProTableProps = {
|
|
69
69
|
/** 请求方法 */
|
70
70
|
method?: Method;
|
71
71
|
/** 请求参数 */
|
72
|
-
params?:
|
72
|
+
params?: {
|
73
|
+
[propName: string]: any;
|
74
|
+
};
|
73
75
|
/** sort 排序请求参数处理函数 */
|
74
76
|
formatSort?: (sort: object) => object;
|
75
77
|
/** 如需自定义调用参数格式,则可以设定此值在请求前对 params 进行自定义,如果返回false则可以阻止请求 */
|
@@ -39,8 +39,9 @@ import Filter from '../components/Filter';
|
|
39
39
|
export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
40
40
|
var filterMode = item.filterMode,
|
41
41
|
filters = item.filters,
|
42
|
+
dataSource = item.dataSource,
|
42
43
|
dataIndex = item.dataIndex,
|
43
|
-
|
44
|
+
valueType = item.valueType; // 为列过滤添加状态标题
|
44
45
|
|
45
46
|
var getItemLabel = function getItemLabel() {
|
46
47
|
if (filters && filterMode !== 'multiple') {
|
package/lib/actions/index.scss
CHANGED
@@ -31,17 +31,17 @@ var _index = _interopRequireDefault(require("../Components/Text/index"));
|
|
31
31
|
|
32
32
|
var _SchemaForm = _interopRequireDefault(require("../SchemaForm"));
|
33
33
|
|
34
|
-
var _utils2 = require("../utils");
|
35
|
-
|
36
34
|
var _useAutoSubmit = _interopRequireDefault(require("./useAutoSubmit"));
|
37
35
|
|
36
|
+
var _useAutoLayout = _interopRequireDefault(require("./useAutoLayout"));
|
37
|
+
|
38
38
|
var _useInitialRequest = _interopRequireDefault(require("./useInitialRequest"));
|
39
39
|
|
40
40
|
var _validate = _interopRequireDefault(require("../locales/validate"));
|
41
41
|
|
42
42
|
require("./index.scss");
|
43
43
|
|
44
|
-
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "
|
44
|
+
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
|
45
45
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
47
47
|
|
@@ -95,12 +95,6 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
95
95
|
scope = _ref.scope,
|
96
96
|
context = _ref.context,
|
97
97
|
components = _ref.components,
|
98
|
-
layout = _ref.layout,
|
99
|
-
labelAlign = _ref.labelAlign,
|
100
|
-
wrapperAlign = _ref.wrapperAlign,
|
101
|
-
labelCol = _ref.labelCol,
|
102
|
-
wrapperCol = _ref.wrapperCol,
|
103
|
-
breakpoints = _ref.breakpoints,
|
104
98
|
onChange = _ref.onChange,
|
105
99
|
onChangeType = _ref.onChangeType,
|
106
100
|
onSubmit = _ref.onSubmit,
|
@@ -112,7 +106,8 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
112
106
|
children = _ref.children,
|
113
107
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
114
108
|
|
115
|
-
// 获取全局配置
|
109
|
+
var formRef = (0, _react.useRef)(); // 获取全局配置
|
110
|
+
|
116
111
|
var _ref2 = (0, _utils.getGlobalConfig)('ProForm') || {},
|
117
112
|
globalComponents = _ref2.components,
|
118
113
|
globalScope = _ref2.scope;
|
@@ -130,25 +125,10 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
130
125
|
|
131
126
|
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), _ProField.default);
|
132
127
|
|
133
|
-
var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit, context);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
breakpoints: [480],
|
138
|
-
layout: (0, _utils2.mergeArrayValue)(['vertical'], layout),
|
139
|
-
labelAlign: (0, _utils2.mergeArrayValue)(['left'], labelAlign),
|
140
|
-
wrapperAlign: (0, _utils2.mergeArrayValue)(['left'], wrapperAlign),
|
141
|
-
labelCol: (0, _utils2.mergeArrayValue)([24], labelCol),
|
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
|
-
};
|
151
|
-
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
128
|
+
var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit, context);
|
129
|
+
var autoTeamixLayout = (0, _useAutoLayout.default)(_objectSpread(_objectSpread({}, otherProps), {}, {
|
130
|
+
schema: schema
|
131
|
+
}), formRef);
|
152
132
|
(0, _react.useMemo)(function () {
|
153
133
|
// 配置表单默认值
|
154
134
|
if (initialValues) {
|
@@ -189,7 +169,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
189
169
|
}, []);
|
190
170
|
return /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({
|
191
171
|
className: (0, _utils.cls)(prefixCls(), className)
|
192
|
-
}, otherProps),
|
172
|
+
}, otherProps), autoTeamixLayout), {}, {
|
193
173
|
form: form,
|
194
174
|
onAutoSubmit: onAutoSubmit,
|
195
175
|
onAutoSubmitFailed: onSubmitFailed
|
@@ -197,7 +177,9 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
197
177
|
schema: schema,
|
198
178
|
scope: mergedScope,
|
199
179
|
components: mergedComponents
|
200
|
-
}) : null,
|
180
|
+
}) : null, /*#__PURE__*/_react.default.createElement("div", {
|
181
|
+
ref: formRef
|
182
|
+
}), children);
|
201
183
|
});
|
202
184
|
ProForm.defaultProps = {
|
203
185
|
colon: false,
|
@@ -236,6 +236,11 @@
|
|
236
236
|
}
|
237
237
|
|
238
238
|
// 按钮样式
|
239
|
+
.teamix-button-group-item.#{$form-item-cls}-layout-vertical {
|
240
|
+
> .#{$css-prefix}formily-item-label {
|
241
|
+
display: none;
|
242
|
+
}
|
243
|
+
}
|
239
244
|
.#{$css-prefix}formily-button-group {
|
240
245
|
margin-top: var(--form-element-medium-height, 32px);
|
241
246
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
declare const useAutoLayout: ({ breakpoints: outBreakpoints, layout, labelAlign, wrapperAlign, labelCol: outLabelCol, wrapperCol: outWrapperCol, autoLayout, schema, }: any, formRef: any) => {
|
2
|
+
breakpoints: any;
|
3
|
+
layout: any;
|
4
|
+
labelAlign: any;
|
5
|
+
wrapperAlign: any;
|
6
|
+
labelCol: any;
|
7
|
+
wrapperCol: any;
|
8
|
+
};
|
9
|
+
export default useAutoLayout;
|
@@ -0,0 +1,124 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = require("react");
|
9
|
+
|
10
|
+
var _utils = require("@teamix/utils");
|
11
|
+
|
12
|
+
var _utils2 = require("../utils");
|
13
|
+
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
15
|
+
|
16
|
+
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."); }
|
17
|
+
|
18
|
+
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); }
|
19
|
+
|
20
|
+
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; }
|
21
|
+
|
22
|
+
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; }
|
23
|
+
|
24
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
25
|
+
|
26
|
+
var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
27
|
+
var outBreakpoints = _ref.breakpoints,
|
28
|
+
layout = _ref.layout,
|
29
|
+
labelAlign = _ref.labelAlign,
|
30
|
+
wrapperAlign = _ref.wrapperAlign,
|
31
|
+
outLabelCol = _ref.labelCol,
|
32
|
+
outWrapperCol = _ref.wrapperCol,
|
33
|
+
autoLayout = _ref.autoLayout,
|
34
|
+
schema = _ref.schema;
|
35
|
+
|
36
|
+
var _ref2 = (0, _utils.isPlainObj)(autoLayout) ? autoLayout : {
|
37
|
+
autoLabel: autoLayout
|
38
|
+
},
|
39
|
+
autoLabel = _ref2.autoLabel;
|
40
|
+
|
41
|
+
var breakpoints = (0, _react.useMemo)(function () {
|
42
|
+
return autoLabel ? false : breakpoints;
|
43
|
+
}, []); // 当前断点不支持Col更新
|
44
|
+
|
45
|
+
var _useState = (0, _react.useState)({
|
46
|
+
labelCol: outLabelCol,
|
47
|
+
wrapperCol: outWrapperCol
|
48
|
+
}),
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
50
|
+
autoCol = _useState2[0],
|
51
|
+
setAutoCol = _useState2[1];
|
52
|
+
|
53
|
+
var labelCol = autoCol.labelCol,
|
54
|
+
wrapperCol = autoCol.wrapperCol;
|
55
|
+
(0, _react.useEffect)(function () {
|
56
|
+
/**
|
57
|
+
* autolayout
|
58
|
+
*/
|
59
|
+
if (autoLabel) {
|
60
|
+
var formWidth = formRef.current.getBoundingClientRect().width; // 表单宽度
|
61
|
+
|
62
|
+
var labelArray = schema.map(function (item) {
|
63
|
+
var text = item.title;
|
64
|
+
|
65
|
+
if ((0, _utils.isStr)(text)) {
|
66
|
+
var _item$decoratorProps;
|
67
|
+
|
68
|
+
if (item.required) {
|
69
|
+
text += '一'; // 必填 + 12
|
70
|
+
}
|
71
|
+
|
72
|
+
if ((_item$decoratorProps = item.decoratorProps) === null || _item$decoratorProps === void 0 ? void 0 : _item$decoratorProps.tooltip) {
|
73
|
+
text += '一'; // 提示 + 18
|
74
|
+
}
|
75
|
+
|
76
|
+
return text;
|
77
|
+
}
|
78
|
+
|
79
|
+
return '';
|
80
|
+
}); // 标题内容集合
|
81
|
+
|
82
|
+
var labelWidthArray = (0, _utils.getWidthByCharacterMap)(labelArray); // 标题宽度集合
|
83
|
+
|
84
|
+
var _autoWidthBySpace = (0, _utils.autoWidthBySpace)(labelWidthArray),
|
85
|
+
expectedWidth = _autoWidthBySpace.expectedWidth,
|
86
|
+
consoleArray = _autoWidthBySpace.consoleArray; // 智能计算预期宽度
|
87
|
+
|
88
|
+
|
89
|
+
var expectedCol = Math.ceil(expectedWidth / formWidth * 24); // 预期宽度转换为 Col 值
|
90
|
+
|
91
|
+
setAutoCol({
|
92
|
+
labelCol: expectedCol,
|
93
|
+
wrapperCol: wrapperCol
|
94
|
+
});
|
95
|
+
} else {
|
96
|
+
setAutoCol({
|
97
|
+
labelCol: outLabelCol,
|
98
|
+
wrapperCol: outWrapperCol
|
99
|
+
});
|
100
|
+
}
|
101
|
+
}, [outLabelCol, outWrapperCol]); // Layout配置By断点(配置断点后,目前不支持 Col 更新)
|
102
|
+
|
103
|
+
var autoTeamixLayout = (0, _react.useMemo)(function () {
|
104
|
+
return breakpoints === true ? {
|
105
|
+
breakpoints: [480],
|
106
|
+
layout: (0, _utils2.mergeArrayValue)(['vertical'], layout),
|
107
|
+
labelAlign: (0, _utils2.mergeArrayValue)(['left'], labelAlign),
|
108
|
+
wrapperAlign: (0, _utils2.mergeArrayValue)(['left'], wrapperAlign),
|
109
|
+
labelCol: (0, _utils2.mergeArrayValue)([24], labelCol),
|
110
|
+
wrapperCol: (0, _utils2.mergeArrayValue)([24], wrapperCol)
|
111
|
+
} : {
|
112
|
+
breakpoints: (0, _utils.isBool)(breakpoints) ? undefined : breakpoints,
|
113
|
+
layout: layout,
|
114
|
+
labelAlign: labelAlign,
|
115
|
+
wrapperAlign: wrapperAlign,
|
116
|
+
labelCol: labelCol,
|
117
|
+
wrapperCol: wrapperCol
|
118
|
+
};
|
119
|
+
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
120
|
+
return autoTeamixLayout;
|
121
|
+
};
|
122
|
+
|
123
|
+
var _default = useAutoLayout;
|
124
|
+
exports.default = _default;
|