@teamix/pro 1.5.22 → 1.5.24
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.all.min.css +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +13294 -8545
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +9 -0
- package/dist/pro.xconsole.min.css +1 -1
- package/es/actions/index.js +5 -3
- package/es/actions/index.scss +4 -0
- package/es/form/Components/FormItem2/animation.scss +72 -0
- package/es/form/Components/FormItem2/grid.scss +173 -0
- package/es/form/Components/FormItem2/index.d.ts +41 -0
- package/es/form/Components/FormItem2/index.js +286 -0
- package/es/form/Components/FormItem2/main.scss +413 -0
- package/es/form/Components/FormItem2/scss/variable.scss +118 -0
- package/es/form/Components/FormItem2/style.d.ts +1 -0
- package/es/form/Components/FormItem2/style.js +1 -0
- package/es/form/Components/LightFilter/index.scss +4 -0
- package/es/form/Components/__builtins__/empty.d.ts +1 -0
- package/es/form/Components/__builtins__/empty.js +51 -0
- package/es/form/Components/__builtins__/hooks/index.d.ts +2 -0
- package/es/form/Components/__builtins__/hooks/index.js +2 -0
- package/es/form/Components/__builtins__/hooks/useClickAway.d.ts +5 -0
- package/es/form/Components/__builtins__/hooks/useClickAway.js +37 -0
- package/es/form/Components/__builtins__/hooks/usePrefixCls.d.ts +3 -0
- package/es/form/Components/__builtins__/hooks/usePrefixCls.js +8 -0
- package/es/form/Components/__builtins__/icons.d.ts +20 -0
- package/es/form/Components/__builtins__/icons.js +153 -0
- package/es/form/Components/__builtins__/index.d.ts +8 -0
- package/es/form/Components/__builtins__/index.js +8 -0
- package/es/form/Components/__builtins__/loading.d.ts +1 -0
- package/es/form/Components/__builtins__/loading.js +41 -0
- package/es/form/Components/__builtins__/mapSize.d.ts +1 -0
- package/es/form/Components/__builtins__/mapSize.js +13 -0
- package/es/form/Components/__builtins__/mapStatus.d.ts +2 -0
- package/es/form/Components/__builtins__/mapStatus.js +20 -0
- package/es/form/Components/__builtins__/moment.d.ts +2 -0
- package/es/form/Components/__builtins__/moment.js +47 -0
- package/es/form/Components/__builtins__/pickDataProps.d.ts +1 -0
- package/es/form/Components/__builtins__/pickDataProps.js +9 -0
- package/es/form/Components/form-layout/index.d.ts +74 -0
- package/es/form/Components/form-layout/index.js +71 -0
- package/es/form/Components/form-layout/main.scss +0 -0
- package/es/form/Components/form-layout/style.d.ts +1 -0
- package/es/form/Components/form-layout/style.js +3 -0
- package/es/form/Components/form-layout/useResponsiveFormLayout.d.ts +18 -0
- package/es/form/Components/form-layout/useResponsiveFormLayout.js +87 -0
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/index2.js +1 -1
- package/es/form/ProForm/index.js +3 -1
- package/es/form/SchemaForm/initializeDataSource.js +0 -7
- package/es/image/index.d.ts +2 -1
- package/es/image/index.js +3 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/index.js +2 -5
- package/es/sidebar/components/tree/index.js +20 -6
- package/es/sidebar/index.js +6 -2
- package/es/sidebar/typing.d.ts +4 -0
- package/es/table/components/Filter/index.js +15 -2
- package/es/table/components/Pagination/index.d.ts +1 -0
- package/es/table/components/Pagination/index.js +38 -19
- package/es/table/index.js +42 -20
- package/es/table/typing.d.ts +4 -0
- package/es/xconsole.scss +1 -0
- package/lib/actions/index.js +5 -3
- package/lib/actions/index.scss +4 -0
- package/lib/form/Components/FormItem2/animation.scss +72 -0
- package/lib/form/Components/FormItem2/grid.scss +173 -0
- package/lib/form/Components/FormItem2/index.d.ts +41 -0
- package/lib/form/Components/FormItem2/index.js +299 -0
- package/lib/form/Components/FormItem2/main.scss +413 -0
- package/lib/form/Components/FormItem2/scss/variable.scss +118 -0
- package/lib/form/Components/FormItem2/style.d.ts +1 -0
- package/lib/form/Components/FormItem2/style.js +3 -0
- package/lib/form/Components/LightFilter/index.scss +4 -0
- package/lib/form/Components/__builtins__/empty.d.ts +1 -0
- package/lib/form/Components/__builtins__/empty.js +59 -0
- package/lib/form/Components/__builtins__/hooks/index.d.ts +2 -0
- package/lib/form/Components/__builtins__/hooks/index.js +27 -0
- package/lib/form/Components/__builtins__/hooks/useClickAway.d.ts +5 -0
- package/lib/form/Components/__builtins__/hooks/useClickAway.js +44 -0
- package/lib/form/Components/__builtins__/hooks/usePrefixCls.d.ts +3 -0
- package/lib/form/Components/__builtins__/hooks/usePrefixCls.js +15 -0
- package/lib/form/Components/__builtins__/icons.d.ts +20 -0
- package/lib/form/Components/__builtins__/icons.js +174 -0
- package/lib/form/Components/__builtins__/index.d.ts +8 -0
- package/lib/form/Components/__builtins__/index.js +93 -0
- package/lib/form/Components/__builtins__/loading.d.ts +1 -0
- package/lib/form/Components/__builtins__/loading.js +48 -0
- package/lib/form/Components/__builtins__/mapSize.d.ts +1 -0
- package/lib/form/Components/__builtins__/mapSize.js +20 -0
- package/lib/form/Components/__builtins__/mapStatus.d.ts +2 -0
- package/lib/form/Components/__builtins__/mapStatus.js +27 -0
- package/lib/form/Components/__builtins__/moment.d.ts +2 -0
- package/lib/form/Components/__builtins__/moment.js +56 -0
- package/lib/form/Components/__builtins__/pickDataProps.d.ts +1 -0
- package/lib/form/Components/__builtins__/pickDataProps.js +16 -0
- package/lib/form/Components/form-layout/index.d.ts +74 -0
- package/lib/form/Components/form-layout/index.js +88 -0
- package/lib/form/Components/form-layout/main.scss +0 -0
- package/lib/form/Components/form-layout/style.d.ts +1 -0
- package/lib/form/Components/form-layout/style.js +3 -0
- package/lib/form/Components/form-layout/useResponsiveFormLayout.d.ts +18 -0
- package/lib/form/Components/form-layout/useResponsiveFormLayout.js +94 -0
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/index2.js +1 -1
- package/lib/form/ProForm/index.js +3 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -9
- package/lib/image/index.d.ts +2 -1
- package/lib/image/index.js +3 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/index.js +1 -4
- package/lib/sidebar/components/tree/index.js +20 -6
- package/lib/sidebar/index.js +6 -2
- package/lib/sidebar/typing.d.ts +4 -0
- package/lib/table/components/Filter/index.js +15 -2
- package/lib/table/components/Pagination/index.d.ts +1 -0
- package/lib/table/components/Pagination/index.js +37 -18
- package/lib/table/index.js +41 -19
- package/lib/table/typing.d.ts +4 -0
- package/lib/xconsole.scss +1 -0
- package/package.json +1 -1
package/lib/table/index.js
CHANGED
@@ -38,7 +38,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
38
38
|
}
|
39
39
|
});
|
40
40
|
});
|
41
|
-
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", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps", "bindUrlProps", "bindUrl"],
|
41
|
+
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", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps", "bindUrlProps", "bindUrl", "autoRedirect", "useMaxData"],
|
42
42
|
_excluded2 = ["onChange"];
|
43
43
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
44
44
|
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); }
|
@@ -181,6 +181,9 @@ var ProTable = function ProTable(props) {
|
|
181
181
|
emptyProps = props.emptyProps,
|
182
182
|
bindUrlProps = props.bindUrlProps,
|
183
183
|
bindUrl = props.bindUrl,
|
184
|
+
_props$autoRedirect = props.autoRedirect,
|
185
|
+
autoRedirect = _props$autoRedirect === void 0 ? true : _props$autoRedirect,
|
186
|
+
useMaxData = props.useMaxData,
|
184
187
|
otherProps = _objectWithoutProperties(props, _excluded);
|
185
188
|
var targetPageKey = pageKey || globalPageKey;
|
186
189
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
@@ -209,7 +212,7 @@ var ProTable = function ProTable(props) {
|
|
209
212
|
_useState10 = _slicedToArray(_useState9, 2),
|
210
213
|
sort = _useState10[0],
|
211
214
|
setSort = _useState10[1];
|
212
|
-
var _useState11 = (0, _react.useState)(!propsDataSource && requestWhenMount && propsShowSkeleton
|
215
|
+
var _useState11 = (0, _react.useState)(!propsDataSource && requestWhenMount && propsShowSkeleton),
|
213
216
|
_useState12 = _slicedToArray(_useState11, 2),
|
214
217
|
showSkeleton = _useState12[0],
|
215
218
|
setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
|
@@ -398,6 +401,11 @@ var ProTable = function ProTable(props) {
|
|
398
401
|
fullscreen: false,
|
399
402
|
normal: true
|
400
403
|
});
|
404
|
+
// 全局状态 : 大数据截断
|
405
|
+
var globalUseMaxData = (0, _react.useMemo)(function () {
|
406
|
+
var _getGlobalConfig2;
|
407
|
+
return (_getGlobalConfig2 = (0, _utils.getGlobalConfig)('ProTable')) === null || _getGlobalConfig2 === void 0 ? void 0 : _getGlobalConfig2.useMaxData;
|
408
|
+
}, []);
|
401
409
|
// 非全屏状态下的
|
402
410
|
var normalDataFilterFormRef = (0, _react.useRef)();
|
403
411
|
var fullscreenDataFilterFormRef = (0, _react.useRef)();
|
@@ -687,6 +695,17 @@ var ProTable = function ProTable(props) {
|
|
687
695
|
}
|
688
696
|
function onFormatResult(next) {
|
689
697
|
props.onFormatResult && props.onFormatResult(next);
|
698
|
+
// 如果开启了 autoRedirect 当当前页数不为1,并且data为空的时候,重定向到第一页
|
699
|
+
if (autoRedirect) {
|
700
|
+
var _next$data;
|
701
|
+
if (!(next === null || next === void 0 ? void 0 : (_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length) && currentPage > 1) {
|
702
|
+
setCurrentPage(1);
|
703
|
+
setShowLoading(true);
|
704
|
+
setTimeout(function () {
|
705
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
706
|
+
});
|
707
|
+
}
|
708
|
+
}
|
690
709
|
var time = 0;
|
691
710
|
if (autoRefresh) {
|
692
711
|
time = 60 * 1000;
|
@@ -703,14 +722,14 @@ var ProTable = function ProTable(props) {
|
|
703
722
|
}
|
704
723
|
// 设置 dataSource、total
|
705
724
|
if (switchViewState === 'table' || currentPage === 1 || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
706
|
-
var _next$
|
725
|
+
var _next$data2;
|
707
726
|
_setData(next.data || []);
|
708
|
-
setTotal(next.total || ((_next$
|
727
|
+
setTotal(next.total || ((_next$data2 = next.data) === null || _next$data2 === void 0 ? void 0 : _next$data2.length));
|
709
728
|
}
|
710
729
|
if (switchViewState === 'card' && currentPage !== 1 && !(cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
711
|
-
var _next$
|
730
|
+
var _next$data3;
|
712
731
|
_setData([].concat(_toConsumableArray(data), _toConsumableArray(next.data || [])));
|
713
|
-
setTotal(total + (next.total || ((_next$
|
732
|
+
setTotal(total + (next.total || ((_next$data3 = next.data) === null || _next$data3 === void 0 ? void 0 : _next$data3.length)));
|
714
733
|
}
|
715
734
|
setShowSkeleton(false);
|
716
735
|
}
|
@@ -840,6 +859,16 @@ var ProTable = function ProTable(props) {
|
|
840
859
|
totalRes = res.total,
|
841
860
|
success = res.success;
|
842
861
|
if (success === true) {
|
862
|
+
// 如果开启了 autoRedirect 当当前页数不为1,并且data为空的时候,重定向到第一页
|
863
|
+
if (autoRedirect) {
|
864
|
+
if (!(dataRes === null || dataRes === void 0 ? void 0 : dataRes.length) && currentPage > 1) {
|
865
|
+
setCurrentPage(1);
|
866
|
+
setShowLoading(true);
|
867
|
+
setTimeout(function () {
|
868
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
869
|
+
});
|
870
|
+
}
|
871
|
+
}
|
843
872
|
// 设置 dataSource、total
|
844
873
|
if (switchViewState === 'table' || params[targetPageKey] === 1 || isReset || (cardViewProps === null || cardViewProps === void 0 ? void 0 : cardViewProps.useTablePagination)) {
|
845
874
|
_setData(dataRes || []);
|
@@ -865,7 +894,7 @@ var ProTable = function ProTable(props) {
|
|
865
894
|
time = 60 * 1000;
|
866
895
|
}
|
867
896
|
if (autoRefresh && typeof autoRefresh !== 'boolean') {
|
868
|
-
time = autoRefresh ? autoRefresh(
|
897
|
+
time = autoRefresh ? autoRefresh(dataRes) : 0;
|
869
898
|
}
|
870
899
|
if (Number.isInteger(time) && time >= 1000) {
|
871
900
|
autoRefreshTimerRef.current = setTimeout(function () {
|
@@ -935,10 +964,7 @@ var ProTable = function ProTable(props) {
|
|
935
964
|
var renderTable = function renderTable(isFullScreen) {
|
936
965
|
if (propsColumns) {
|
937
966
|
return /*#__PURE__*/_react.default.createElement("div", {
|
938
|
-
className: (0, _classnames.default)('teamix-pro-table-container', className
|
939
|
-
"data-teamix-test-request": "url=".concat(url, "&formatResult=").concat(!!formatResult),
|
940
|
-
"data-teamix-test-params": (0, _utils.getTestRequestParams)(propsParams),
|
941
|
-
"data-teamix-test-data": (0, _utils.getTestRequestData)(propsColumns),
|
967
|
+
className: (0, _classnames.default)('teamix-pro-table-container', className),
|
942
968
|
"data-teamix-spm": dataTeamixSpm
|
943
969
|
}, /*#__PURE__*/_react.default.createElement(_Layout.default, {
|
944
970
|
header: header,
|
@@ -1037,7 +1063,7 @@ var ProTable = function ProTable(props) {
|
|
1037
1063
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
1038
1064
|
}
|
1039
1065
|
function onChangePaginationSize(currentPageSize) {
|
1040
|
-
var
|
1066
|
+
var _request10;
|
1041
1067
|
// 翻页默认清空选择
|
1042
1068
|
if (!reserveSelectedRecords) {
|
1043
1069
|
var _actionRef$current9, _actionRef$current9$c;
|
@@ -1045,7 +1071,7 @@ var ProTable = function ProTable(props) {
|
|
1045
1071
|
}
|
1046
1072
|
setPageSize(currentPageSize);
|
1047
1073
|
setCurrentPage(1);
|
1048
|
-
_request((
|
1074
|
+
_request((_request10 = {}, _defineProperty(_request10, targetPageSizeKey, currentPageSize), _defineProperty(_request10, targetPageKey, 1), _request10));
|
1049
1075
|
}
|
1050
1076
|
function renderRowSelection() {
|
1051
1077
|
if (rowSelection) {
|
@@ -1098,11 +1124,6 @@ var ProTable = function ProTable(props) {
|
|
1098
1124
|
responsivePaginationType: responsivePaginationType,
|
1099
1125
|
// shape="arrow-only"
|
1100
1126
|
// pageSizePosition="end"
|
1101
|
-
totalRender: function totalRender(total) {
|
1102
|
-
return (0, _utils.getMessage)('total', {
|
1103
|
-
total: new Intl.NumberFormat().format(total)
|
1104
|
-
});
|
1105
|
-
},
|
1106
1127
|
pageSize: pageSize,
|
1107
1128
|
current: currentPage,
|
1108
1129
|
pageSizeList: pageSizeList,
|
@@ -1110,7 +1131,8 @@ var ProTable = function ProTable(props) {
|
|
1110
1131
|
type: total / pageSize <= 2 ? 'simple' : 'normal',
|
1111
1132
|
onPageSizeChange: function onPageSizeChange(number) {
|
1112
1133
|
return onChangePaginationSize(number);
|
1113
|
-
}
|
1134
|
+
},
|
1135
|
+
useMaxData: globalUseMaxData !== null && globalUseMaxData !== void 0 ? globalUseMaxData : useMaxData
|
1114
1136
|
}, othersPaginationProps)))));
|
1115
1137
|
} else if (!showPagination && (footerAction || rowSelection || useRowSelection)) {
|
1116
1138
|
return /*#__PURE__*/_react.default.createElement("div", {
|
package/lib/table/typing.d.ts
CHANGED
@@ -172,6 +172,10 @@ export declare type ProTableProps = {
|
|
172
172
|
bindUrl?: boolean;
|
173
173
|
/** 绑定 url 配置 **/
|
174
174
|
bindUrlProps?: ProTableBindUrlProps;
|
175
|
+
/** 当前页数据被删除完后,是否跳转回第一页 **/
|
176
|
+
autoRedirect?: boolean;
|
177
|
+
/** 使用超大数据模式 **/
|
178
|
+
useMaxData?: boolean;
|
175
179
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
176
180
|
export declare type rowSelectionType = {
|
177
181
|
getProps?: (record: any, index: number) => any;
|
package/lib/xconsole.scss
CHANGED