@teamix/pro 1.5.7-beta.0 → 1.5.7
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.js +123 -41
- package/dist/pro.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/index.js +8 -4
- package/es/info/typing.d.ts +2 -0
- package/es/table/components/CardView/index.js +45 -16
- package/es/table/index.js +37 -13
- package/es/table/typing.d.ts +13 -0
- package/es/utils/useRealHistory.js +8 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/index.js +8 -4
- package/lib/info/typing.d.ts +2 -0
- package/lib/table/components/CardView/index.js +43 -14
- package/lib/table/index.js +37 -13
- package/lib/table/typing.d.ts +13 -0
- package/lib/utils/useRealHistory.js +8 -2
- package/package.json +1 -1
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.5.7
|
31
|
+
declare const version = "1.5.7";
|
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
@@ -35,7 +35,7 @@ export * from './table';
|
|
35
35
|
export * from './sidebar';
|
36
36
|
export * from './utils';
|
37
37
|
export * from './timeline';
|
38
|
-
var version = '1.5.7
|
38
|
+
var version = '1.5.7';
|
39
39
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo,
|
40
40
|
// ProLayout,
|
41
41
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
@@ -17,7 +17,9 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
17
17
|
actionRef = props.actionRef,
|
18
18
|
layout = props.layout,
|
19
19
|
size = props.size,
|
20
|
-
context = props.context
|
20
|
+
context = props.context,
|
21
|
+
_props$disabledAutoSi = props.disabledAutoSize,
|
22
|
+
disabledAutoSize = _props$disabledAutoSi === void 0 ? false : _props$disabledAutoSi;
|
21
23
|
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
22
24
|
// 获取列内的布局参数
|
23
25
|
var getFormItemLayout = function getFormItemLayout(colspan) {
|
@@ -84,7 +86,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
84
86
|
}));
|
85
87
|
});
|
86
88
|
};
|
87
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
|
89
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, ((size === null || size === void 0 ? void 0 : size.width) || disabledAutoSize) && /*#__PURE__*/React.createElement(Row, {
|
88
90
|
wrap: true,
|
89
91
|
className: "teamix-pro-info-content-row",
|
90
92
|
gutter: 20
|
package/es/info/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra", "context"],
|
1
|
+
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra", "context", "disabledAutoSize"],
|
2
2
|
_excluded2 = ["context"];
|
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
|
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; }
|
@@ -47,6 +47,7 @@ var ProInfo = function ProInfo(props) {
|
|
47
47
|
userLoading = props.loading,
|
48
48
|
extra = props.extra,
|
49
49
|
infoContext = props.context,
|
50
|
+
disabledAutoSize = props.disabledAutoSize,
|
50
51
|
others = _objectWithoutProperties(props, _excluded);
|
51
52
|
var _useContext = useContext(ProInfoGroupContext),
|
52
53
|
contextUrl = _useContext.url,
|
@@ -153,7 +154,8 @@ var ProInfo = function ProInfo(props) {
|
|
153
154
|
result: data,
|
154
155
|
actionRef: actionRef,
|
155
156
|
layout: layout,
|
156
|
-
context: context
|
157
|
+
context: context,
|
158
|
+
disabledAutoSize: disabledAutoSize
|
157
159
|
}), type === 'header' && /*#__PURE__*/React.createElement(ProHeaderInfo, {
|
158
160
|
dataSource: dataSource,
|
159
161
|
columns: columns,
|
@@ -163,7 +165,8 @@ var ProInfo = function ProInfo(props) {
|
|
163
165
|
actionRef: actionRef,
|
164
166
|
layout: layout,
|
165
167
|
size: size,
|
166
|
-
context: context
|
168
|
+
context: context,
|
169
|
+
disabledAutoSize: disabledAutoSize
|
167
170
|
}), type === 'base' && /*#__PURE__*/React.createElement(ProBaseInfo, {
|
168
171
|
dataSource: dataSource,
|
169
172
|
columns: columns,
|
@@ -172,7 +175,8 @@ var ProInfo = function ProInfo(props) {
|
|
172
175
|
actionRef: actionRef,
|
173
176
|
layout: layout,
|
174
177
|
size: size,
|
175
|
-
context: context
|
178
|
+
context: context,
|
179
|
+
disabledAutoSize: disabledAutoSize
|
176
180
|
})));
|
177
181
|
};
|
178
182
|
ProInfo.Group = ProInfoGroup;
|
package/es/info/typing.d.ts
CHANGED
@@ -51,6 +51,8 @@ export declare type ProInfoBaseProps = {
|
|
51
51
|
loading?: boolean;
|
52
52
|
/** 上下文传递 */
|
53
53
|
context?: object;
|
54
|
+
/** 是否在获取宽度之后才渲染Info 是否忽略首次响应式计算 **/
|
55
|
+
disabledAutoSize?: boolean;
|
54
56
|
} & ProInfoHeaderProps & ProInfoRequestProps;
|
55
57
|
/** ProInfoColumnsProps info 单元格 定义 */
|
56
58
|
export declare type ProInfoItemProps = ProInfoColumnsProps;
|
@@ -9,19 +9,21 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
11
|
import React, { isValidElement, useEffect, useMemo, useState } from 'react';
|
12
|
-
import { Grid } from '@alicloudfe/components';
|
13
|
-
import { getDeepValue, ProCard, ProInfo } from '../../../';
|
12
|
+
import { Grid, Loading } from '@alicloudfe/components';
|
13
|
+
import { getDeepValue, getMessage, ProCard, ProInfo } from '../../../';
|
14
14
|
import { ProSkeletonRaw } from '../../../skeleton';
|
15
15
|
import { usePrefixCls } from '@teamix/utils';
|
16
16
|
import './index.scss';
|
17
17
|
import { renderCell } from '../../utils/columnRender';
|
18
18
|
import LoadMore from '../LoadMore';
|
19
|
+
import Result from '@teamix/result';
|
19
20
|
var Row = Grid.Row,
|
20
21
|
Col = Grid.Col;
|
21
22
|
var cls = usePrefixCls('teamix-pro-table-card-view');
|
22
23
|
var CardView = function CardView(props) {
|
23
24
|
var _cardViewProps$scroll;
|
24
|
-
var dataSource = props.dataSource,
|
25
|
+
var _props$dataSource = props.dataSource,
|
26
|
+
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
25
27
|
_props$columns = props.columns,
|
26
28
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
27
29
|
_props$loading = props.loading,
|
@@ -51,7 +53,16 @@ var CardView = function CardView(props) {
|
|
51
53
|
if (showSkeleton) {
|
52
54
|
setLoadState('none');
|
53
55
|
}
|
56
|
+
if (dataSource.length === 0) {
|
57
|
+
setLoadState('none');
|
58
|
+
}
|
54
59
|
}, [loading, skeletonVisible, showSkeleton]);
|
60
|
+
// 数据源变化毁掉
|
61
|
+
useEffect(function () {
|
62
|
+
if (dataSource.length === 0) {
|
63
|
+
setLoadState('none');
|
64
|
+
}
|
65
|
+
}, [dataSource]);
|
55
66
|
var getDataIndexValue = function getDataIndexValue(dataIndex, dataSource) {
|
56
67
|
if (Array.isArray(dataIndex)) {
|
57
68
|
return dataIndex.map(function (item) {
|
@@ -316,16 +327,17 @@ var CardView = function CardView(props) {
|
|
316
327
|
};
|
317
328
|
// 渲染单个卡片
|
318
329
|
var renderCard = function renderCard(record, index) {
|
319
|
-
|
330
|
+
var _cardViewProps$cardRe;
|
331
|
+
return /*#__PURE__*/React.createElement(Col, _objectSpread({
|
320
332
|
xxs: 24,
|
321
333
|
xs: 12,
|
322
|
-
s:
|
334
|
+
s: 12,
|
323
335
|
m: 8,
|
324
336
|
l: 6,
|
325
337
|
xl: 6,
|
326
338
|
key: index,
|
327
339
|
className: cls('card-item')
|
328
|
-
}, /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
340
|
+
}, (_cardViewProps$cardRe = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.cardResponsiveProps) !== null && _cardViewProps$cardRe !== void 0 ? _cardViewProps$cardRe : {}), /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
329
341
|
title: renderCardTitle(record, index),
|
330
342
|
subTitle: renderCardSubTitle(record, index),
|
331
343
|
extra: getProCardExtra(record, index),
|
@@ -336,24 +348,41 @@ var CardView = function CardView(props) {
|
|
336
348
|
context: {
|
337
349
|
record: record,
|
338
350
|
index: index
|
351
|
+
},
|
352
|
+
disabledAutoSize: true
|
353
|
+
})));
|
354
|
+
};
|
355
|
+
// 渲染卡片主体
|
356
|
+
var renderCardBox = function renderCardBox() {
|
357
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, skeletonVisible && /*#__PURE__*/React.createElement(ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && /*#__PURE__*/React.createElement(Result, {
|
358
|
+
theme: "hybridcloud-container",
|
359
|
+
img: "noData",
|
360
|
+
title: getMessage('noData'),
|
361
|
+
style: {
|
362
|
+
padding: '50px 0 60px'
|
363
|
+
}
|
364
|
+
}), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/React.createElement(Row, {
|
365
|
+
gutter: 16,
|
366
|
+
wrap: true,
|
367
|
+
style: {
|
368
|
+
marginTop: '-16px'
|
339
369
|
}
|
370
|
+
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item, index) {
|
371
|
+
return renderCard(item, index);
|
340
372
|
})));
|
341
373
|
};
|
342
374
|
return /*#__PURE__*/React.createElement("div", {
|
343
375
|
className: cls()
|
344
|
-
}, /*#__PURE__*/React.createElement(
|
376
|
+
}, (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && /*#__PURE__*/React.createElement(Loading, {
|
377
|
+
visible: loading,
|
378
|
+
style: {
|
379
|
+
width: '100%'
|
380
|
+
}
|
381
|
+
}, renderCardBox()), !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && /*#__PURE__*/React.createElement(LoadMore, {
|
345
382
|
onScrollBottom: onScrollBottom,
|
346
383
|
onLoadMore: onLoadMore,
|
347
384
|
loadState: loadState,
|
348
385
|
scrollHeight: (_cardViewProps$scroll = cardViewProps.scrollHeight) !== null && _cardViewProps$scroll !== void 0 ? _cardViewProps$scroll : scrollHeight
|
349
|
-
},
|
350
|
-
gutter: 16,
|
351
|
-
wrap: true,
|
352
|
-
style: {
|
353
|
-
marginTop: '-16px'
|
354
|
-
}
|
355
|
-
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item, index) {
|
356
|
-
return renderCard(item, index);
|
357
|
-
}))));
|
386
|
+
}, renderCardBox()));
|
358
387
|
};
|
359
388
|
export default CardView;
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
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", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView"]
|
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", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView"],
|
2
|
+
_excluded2 = ["onChange"];
|
2
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); }
|
3
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
4
5
|
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."); }
|
@@ -121,7 +122,7 @@ var ProTable = function ProTable(props) {
|
|
121
122
|
pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
|
122
123
|
responsivePaginationType = props.responsivePaginationType,
|
123
124
|
_props$showSkeleton = props.showSkeleton,
|
124
|
-
propsShowSkeleton = _props$showSkeleton === void 0 ?
|
125
|
+
propsShowSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton,
|
125
126
|
_props$skeletonSize = props.skeletonSize,
|
126
127
|
skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
|
127
128
|
propsActionRef = props.actionRef,
|
@@ -223,6 +224,13 @@ var ProTable = function ProTable(props) {
|
|
223
224
|
// 存储定时器 id
|
224
225
|
var autoRefreshTimerRef = useRef();
|
225
226
|
var onResize = null;
|
227
|
+
useEffect(function () {
|
228
|
+
setShowSkeleton(propsShowSkeleton);
|
229
|
+
}, [propsShowSkeleton]);
|
230
|
+
// useEffect(() => {
|
231
|
+
// console.log('传入的props变化', propsLoading);
|
232
|
+
// setShowLoading(propsLoading ?? false);
|
233
|
+
// }, [propsLoading]);
|
226
234
|
useEffect(function () {
|
227
235
|
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
228
236
|
getHeaderHeight(fullscreenState);
|
@@ -555,9 +563,13 @@ var ProTable = function ProTable(props) {
|
|
555
563
|
setCurrentPage(1);
|
556
564
|
},
|
557
565
|
nextPage: function nextPage() {
|
566
|
+
var _props$paginationProp, _props$paginationProp2;
|
558
567
|
var newCurrentPage = currentPage + 1;
|
559
568
|
setCurrentPage(newCurrentPage);
|
560
|
-
|
569
|
+
props === null || props === void 0 ? void 0 : (_props$paginationProp = props.paginationProps) === null || _props$paginationProp === void 0 ? void 0 : (_props$paginationProp2 = _props$paginationProp.onChange) === null || _props$paginationProp2 === void 0 ? void 0 : _props$paginationProp2.call(_props$paginationProp, newCurrentPage, {});
|
570
|
+
if (!propsDataSource) {
|
571
|
+
_request(_defineProperty({}, targetPageKey, newCurrentPage));
|
572
|
+
}
|
561
573
|
},
|
562
574
|
rowSelection: rowSelection,
|
563
575
|
clearRowSelection: function clearRowSelection() {
|
@@ -586,17 +598,24 @@ var ProTable = function ProTable(props) {
|
|
586
598
|
},
|
587
599
|
switchView: function switchView(view) {
|
588
600
|
setSwitchViewState(view);
|
589
|
-
|
590
|
-
|
601
|
+
if (!propsDataSource) {
|
602
|
+
setCurrentPage(1);
|
603
|
+
}
|
591
604
|
if (view === 'table') {
|
592
|
-
var _request4;
|
593
605
|
setPageSize(pageSize !== null && pageSize !== void 0 ? pageSize : 20);
|
594
|
-
|
606
|
+
if (!propsDataSource) {
|
607
|
+
var _request4;
|
608
|
+
setShowSkeleton(true);
|
609
|
+
_request((_request4 = {}, _defineProperty(_request4, targetPageSizeKey, pageSize !== null && pageSize !== void 0 ? pageSize : 20), _defineProperty(_request4, targetPageKey, 1), _request4));
|
610
|
+
}
|
595
611
|
}
|
596
612
|
if (view === 'card') {
|
597
|
-
var _cardViewProps$pageSi
|
613
|
+
var _cardViewProps$pageSi;
|
598
614
|
setPageSize((_cardViewProps$pageSi = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.pageSize) !== null && _cardViewProps$pageSi !== void 0 ? _cardViewProps$pageSi : 12);
|
599
|
-
|
615
|
+
if (!propsDataSource) {
|
616
|
+
var _cardViewProps$pageSi2, _request5;
|
617
|
+
_request((_request5 = {}, _defineProperty(_request5, targetPageSizeKey, (_cardViewProps$pageSi2 = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.pageSize) !== null && _cardViewProps$pageSi2 !== void 0 ? _cardViewProps$pageSi2 : 12), _defineProperty(_request5, targetPageKey, 1), _request5));
|
618
|
+
}
|
600
619
|
}
|
601
620
|
getHeaderHeight(fullscreenState);
|
602
621
|
}
|
@@ -953,7 +972,11 @@ var ProTable = function ProTable(props) {
|
|
953
972
|
}
|
954
973
|
}
|
955
974
|
}
|
956
|
-
if (showPagination && switchViewState === 'table') {
|
975
|
+
if (showPagination && switchViewState === 'table' || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && switchViewState === 'card') {
|
976
|
+
var _props$paginationProp3;
|
977
|
+
var _ref6 = (_props$paginationProp3 = props === null || props === void 0 ? void 0 : props.paginationProps) !== null && _props$paginationProp3 !== void 0 ? _props$paginationProp3 : {},
|
978
|
+
onPaginationPropsChange = _ref6.onChange,
|
979
|
+
othersPaginationProps = _objectWithoutProperties(_ref6, _excluded2);
|
957
980
|
return /*#__PURE__*/React.createElement("div", {
|
958
981
|
className: cls('footer', {
|
959
982
|
'footer-has-rowSelection': rowSelection,
|
@@ -963,8 +986,9 @@ var ProTable = function ProTable(props) {
|
|
963
986
|
className: cls('footer-right-wrapper')
|
964
987
|
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : /*#__PURE__*/React.createElement(React.Fragment, null, data.length > 0 && /*#__PURE__*/React.createElement(Pagination, _objectSpread({
|
965
988
|
className: cls('pagination'),
|
966
|
-
onChange: function onChange(number) {
|
967
|
-
|
989
|
+
onChange: function onChange(number, e) {
|
990
|
+
onChangePagination(number);
|
991
|
+
onPaginationPropsChange === null || onPaginationPropsChange === void 0 ? void 0 : onPaginationPropsChange(number, e);
|
968
992
|
},
|
969
993
|
total: total,
|
970
994
|
responsivePaginationType: responsivePaginationType,
|
@@ -983,7 +1007,7 @@ var ProTable = function ProTable(props) {
|
|
983
1007
|
onPageSizeChange: function onPageSizeChange(number) {
|
984
1008
|
return onChangePaginationSize(number);
|
985
1009
|
}
|
986
|
-
},
|
1010
|
+
}, othersPaginationProps)))));
|
987
1011
|
} else if (!showPagination && (footerAction || rowSelection || useRowSelection)) {
|
988
1012
|
return /*#__PURE__*/React.createElement("div", {
|
989
1013
|
className: cls('footer', {
|
package/es/table/typing.d.ts
CHANGED
@@ -341,6 +341,17 @@ export declare type ProTableCardProps = {
|
|
341
341
|
scrollDom?: HTMLElement;
|
342
342
|
/** 触底事件 **/
|
343
343
|
onScrollBottom?: () => void;
|
344
|
+
/** 使用表格分页 **/
|
345
|
+
useTablePagination?: boolean;
|
346
|
+
/** 使用响应式 **/
|
347
|
+
cardResponsiveProps?: {
|
348
|
+
xxs?: number;
|
349
|
+
xs?: number;
|
350
|
+
s?: number;
|
351
|
+
m?: number;
|
352
|
+
l?: number;
|
353
|
+
xl?: number;
|
354
|
+
};
|
344
355
|
/** 卡片配置 **/
|
345
356
|
cardProps?: {
|
346
357
|
[key in keyof ProCardProps]?: ProCardProps[key] | ((index: number, record: any) => ProCardProps[key]);
|
@@ -367,5 +378,7 @@ export declare type ProTableCardViewProps = {
|
|
367
378
|
showSkeleton?: boolean;
|
368
379
|
/** ProCard 卡片配置 **/
|
369
380
|
cardProps?: ProTableCardProps['cardProps'];
|
381
|
+
/** 表格分页器参数 **/
|
382
|
+
tablePaginationProps?: PaginationProps;
|
370
383
|
};
|
371
384
|
export {};
|
@@ -23,8 +23,14 @@ var useRealHistory = function useRealHistory() {
|
|
23
23
|
history = window.HistoryLibrary.createBrowserHistory();
|
24
24
|
var oldPush = history.push;
|
25
25
|
history.push = function (p) {
|
26
|
-
|
27
|
-
|
26
|
+
if (typeof p === 'string') {
|
27
|
+
var _window$ICESTARK;
|
28
|
+
oldPush(path.join(((_window$ICESTARK = window.ICESTARK) === null || _window$ICESTARK === void 0 ? void 0 : _window$ICESTARK.basename) || '/', p));
|
29
|
+
} else {
|
30
|
+
var _window$ICESTARK2;
|
31
|
+
p.pathname = path.join(((_window$ICESTARK2 = window.ICESTARK) === null || _window$ICESTARK2 === void 0 ? void 0 : _window$ICESTARK2.basename) || '/', p.pathname);
|
32
|
+
oldPush(p);
|
33
|
+
}
|
28
34
|
};
|
29
35
|
setRealHistory(history);
|
30
36
|
}
|
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.5.7
|
31
|
+
declare const version = "1.5.7";
|
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
@@ -280,5 +280,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
280
280
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
281
281
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
282
282
|
}
|
283
|
-
var version = '1.5.7
|
283
|
+
var version = '1.5.7';
|
284
284
|
exports.version = version;
|
@@ -24,7 +24,9 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
24
24
|
actionRef = props.actionRef,
|
25
25
|
layout = props.layout,
|
26
26
|
size = props.size,
|
27
|
-
context = props.context
|
27
|
+
context = props.context,
|
28
|
+
_props$disabledAutoSi = props.disabledAutoSize,
|
29
|
+
disabledAutoSize = _props$disabledAutoSi === void 0 ? false : _props$disabledAutoSi;
|
28
30
|
var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
29
31
|
// 获取列内的布局参数
|
30
32
|
var getFormItemLayout = function getFormItemLayout(colspan) {
|
@@ -91,7 +93,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
91
93
|
}));
|
92
94
|
});
|
93
95
|
};
|
94
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/_react.default.createElement(Row, {
|
96
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ((size === null || size === void 0 ? void 0 : size.width) || disabledAutoSize) && /*#__PURE__*/_react.default.createElement(Row, {
|
95
97
|
wrap: true,
|
96
98
|
className: "teamix-pro-info-content-row",
|
97
99
|
gutter: 20
|
package/lib/info/index.js
CHANGED
@@ -28,7 +28,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
28
28
|
}
|
29
29
|
});
|
30
30
|
});
|
31
|
-
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra", "context"],
|
31
|
+
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra", "context", "disabledAutoSize"],
|
32
32
|
_excluded2 = ["context"];
|
33
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
34
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -69,6 +69,7 @@ var ProInfo = function ProInfo(props) {
|
|
69
69
|
userLoading = props.loading,
|
70
70
|
extra = props.extra,
|
71
71
|
infoContext = props.context,
|
72
|
+
disabledAutoSize = props.disabledAutoSize,
|
72
73
|
others = _objectWithoutProperties(props, _excluded);
|
73
74
|
var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
|
74
75
|
contextUrl = _useContext.url,
|
@@ -175,7 +176,8 @@ var ProInfo = function ProInfo(props) {
|
|
175
176
|
result: data,
|
176
177
|
actionRef: actionRef,
|
177
178
|
layout: layout,
|
178
|
-
context: context
|
179
|
+
context: context,
|
180
|
+
disabledAutoSize: disabledAutoSize
|
179
181
|
}), type === 'header' && /*#__PURE__*/_react.default.createElement(_headerInfo.default, {
|
180
182
|
dataSource: dataSource,
|
181
183
|
columns: columns,
|
@@ -185,7 +187,8 @@ var ProInfo = function ProInfo(props) {
|
|
185
187
|
actionRef: actionRef,
|
186
188
|
layout: layout,
|
187
189
|
size: size,
|
188
|
-
context: context
|
190
|
+
context: context,
|
191
|
+
disabledAutoSize: disabledAutoSize
|
189
192
|
}), type === 'base' && /*#__PURE__*/_react.default.createElement(_baseInfo.default, {
|
190
193
|
dataSource: dataSource,
|
191
194
|
columns: columns,
|
@@ -194,7 +197,8 @@ var ProInfo = function ProInfo(props) {
|
|
194
197
|
actionRef: actionRef,
|
195
198
|
layout: layout,
|
196
199
|
size: size,
|
197
|
-
context: context
|
200
|
+
context: context,
|
201
|
+
disabledAutoSize: disabledAutoSize
|
198
202
|
})));
|
199
203
|
};
|
200
204
|
ProInfo.Group = _InfoGroup.default;
|
package/lib/info/typing.d.ts
CHANGED
@@ -51,6 +51,8 @@ export declare type ProInfoBaseProps = {
|
|
51
51
|
loading?: boolean;
|
52
52
|
/** 上下文传递 */
|
53
53
|
context?: object;
|
54
|
+
/** 是否在获取宽度之后才渲染Info 是否忽略首次响应式计算 **/
|
55
|
+
disabledAutoSize?: boolean;
|
54
56
|
} & ProInfoHeaderProps & ProInfoRequestProps;
|
55
57
|
/** ProInfoColumnsProps info 单元格 定义 */
|
56
58
|
export declare type ProInfoItemProps = ProInfoColumnsProps;
|
@@ -12,6 +12,7 @@ var _utils = require("@teamix/utils");
|
|
12
12
|
require("./index.scss");
|
13
13
|
var _columnRender = require("../../utils/columnRender");
|
14
14
|
var _LoadMore = _interopRequireDefault(require("../LoadMore"));
|
15
|
+
var _result = _interopRequireDefault(require("@teamix/result"));
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
18
|
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; }
|
@@ -30,7 +31,8 @@ var Row = _components.Grid.Row,
|
|
30
31
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-table-card-view');
|
31
32
|
var CardView = function CardView(props) {
|
32
33
|
var _cardViewProps$scroll;
|
33
|
-
var dataSource = props.dataSource,
|
34
|
+
var _props$dataSource = props.dataSource,
|
35
|
+
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
34
36
|
_props$columns = props.columns,
|
35
37
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
36
38
|
_props$loading = props.loading,
|
@@ -60,7 +62,16 @@ var CardView = function CardView(props) {
|
|
60
62
|
if (showSkeleton) {
|
61
63
|
setLoadState('none');
|
62
64
|
}
|
65
|
+
if (dataSource.length === 0) {
|
66
|
+
setLoadState('none');
|
67
|
+
}
|
63
68
|
}, [loading, skeletonVisible, showSkeleton]);
|
69
|
+
// 数据源变化毁掉
|
70
|
+
(0, _react.useEffect)(function () {
|
71
|
+
if (dataSource.length === 0) {
|
72
|
+
setLoadState('none');
|
73
|
+
}
|
74
|
+
}, [dataSource]);
|
64
75
|
var getDataIndexValue = function getDataIndexValue(dataIndex, dataSource) {
|
65
76
|
if (Array.isArray(dataIndex)) {
|
66
77
|
return dataIndex.map(function (item) {
|
@@ -325,16 +336,17 @@ var CardView = function CardView(props) {
|
|
325
336
|
};
|
326
337
|
// 渲染单个卡片
|
327
338
|
var renderCard = function renderCard(record, index) {
|
328
|
-
|
339
|
+
var _cardViewProps$cardRe;
|
340
|
+
return /*#__PURE__*/_react.default.createElement(Col, _objectSpread({
|
329
341
|
xxs: 24,
|
330
342
|
xs: 12,
|
331
|
-
s:
|
343
|
+
s: 12,
|
332
344
|
m: 8,
|
333
345
|
l: 6,
|
334
346
|
xl: 6,
|
335
347
|
key: index,
|
336
348
|
className: cls('card-item')
|
337
|
-
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread({
|
349
|
+
}, (_cardViewProps$cardRe = cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.cardResponsiveProps) !== null && _cardViewProps$cardRe !== void 0 ? _cardViewProps$cardRe : {}), /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread({
|
338
350
|
title: renderCardTitle(record, index),
|
339
351
|
subTitle: renderCardSubTitle(record, index),
|
340
352
|
extra: getProCardExtra(record, index),
|
@@ -345,25 +357,42 @@ var CardView = function CardView(props) {
|
|
345
357
|
context: {
|
346
358
|
record: record,
|
347
359
|
index: index
|
360
|
+
},
|
361
|
+
disabledAutoSize: true
|
362
|
+
})));
|
363
|
+
};
|
364
|
+
// 渲染卡片主体
|
365
|
+
var renderCardBox = function renderCardBox() {
|
366
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, skeletonVisible && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Content, null), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) === 0 && /*#__PURE__*/_react.default.createElement(_result.default, {
|
367
|
+
theme: "hybridcloud-container",
|
368
|
+
img: "noData",
|
369
|
+
title: (0, _.getMessage)('noData'),
|
370
|
+
style: {
|
371
|
+
padding: '50px 0 60px'
|
372
|
+
}
|
373
|
+
}), !skeletonVisible && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 && /*#__PURE__*/_react.default.createElement(Row, {
|
374
|
+
gutter: 16,
|
375
|
+
wrap: true,
|
376
|
+
style: {
|
377
|
+
marginTop: '-16px'
|
348
378
|
}
|
379
|
+
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item, index) {
|
380
|
+
return renderCard(item, index);
|
349
381
|
})));
|
350
382
|
};
|
351
383
|
return /*#__PURE__*/_react.default.createElement("div", {
|
352
384
|
className: cls()
|
353
|
-
}, /*#__PURE__*/_react.default.createElement(
|
385
|
+
}, (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && /*#__PURE__*/_react.default.createElement(_components.Loading, {
|
386
|
+
visible: loading,
|
387
|
+
style: {
|
388
|
+
width: '100%'
|
389
|
+
}
|
390
|
+
}, renderCardBox()), !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination) && /*#__PURE__*/_react.default.createElement(_LoadMore.default, {
|
354
391
|
onScrollBottom: onScrollBottom,
|
355
392
|
onLoadMore: onLoadMore,
|
356
393
|
loadState: loadState,
|
357
394
|
scrollHeight: (_cardViewProps$scroll = cardViewProps.scrollHeight) !== null && _cardViewProps$scroll !== void 0 ? _cardViewProps$scroll : scrollHeight
|
358
|
-
},
|
359
|
-
gutter: 16,
|
360
|
-
wrap: true,
|
361
|
-
style: {
|
362
|
-
marginTop: '-16px'
|
363
|
-
}
|
364
|
-
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item, index) {
|
365
|
-
return renderCard(item, index);
|
366
|
-
}))));
|
395
|
+
}, renderCardBox()));
|
367
396
|
};
|
368
397
|
var _default = CardView;
|
369
398
|
exports.default = _default;
|