@teamix/pro 1.5.33-beta-2 → 1.5.33-beta-3
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 +2 -1
- package/dist/pro.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/Cell/index.js +7 -1
- package/es/table/index.js +23 -3
- package/es/table/utils/genAutoWidthColumns.d.ts +1 -1
- package/es/table/utils/genAutoWidthColumns.js +10 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Cell/index.js +7 -1
- package/lib/table/index.js +23 -3
- package/lib/table/utils/genAutoWidthColumns.d.ts +1 -1
- package/lib/table/utils/genAutoWidthColumns.js +10 -1
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.33-beta";
|
33
|
+
declare const version = "1.5.33-beta-3";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -124,7 +124,9 @@ var Cell = function Cell(props) {
|
|
124
124
|
value: value,
|
125
125
|
render: newRender,
|
126
126
|
dataSource: newDataSource,
|
127
|
-
format: format
|
127
|
+
format: format,
|
128
|
+
// 预留 context 位置
|
129
|
+
context: context
|
128
130
|
}, itemProps));
|
129
131
|
};
|
130
132
|
/**
|
@@ -189,6 +191,10 @@ var processBuriedPoint = function processBuriedPoint() {
|
|
189
191
|
var equalColumns = function equalColumns(prevProps, nextProps) {
|
190
192
|
var preValue = prevProps.value;
|
191
193
|
var nextValue = nextProps.value;
|
194
|
+
// 操作列的时候强制刷新
|
195
|
+
if (preValue === false && nextValue === false) {
|
196
|
+
return false;
|
197
|
+
}
|
192
198
|
if (preValue === nextValue) {
|
193
199
|
return true;
|
194
200
|
}
|
package/es/table/index.js
CHANGED
@@ -490,11 +490,22 @@ var ProTable = function ProTable(props) {
|
|
490
490
|
var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
|
491
491
|
setFilteredColumns(columns);
|
492
492
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
|
493
|
+
if (autoWidth) {
|
494
|
+
reGenFilteredColumnsByAutoWidth(columns);
|
495
|
+
}
|
493
496
|
}, [propsColumns]);
|
494
497
|
// dataSource 受控
|
495
498
|
useEffect(function () {
|
496
499
|
if (propsDataSource) {
|
497
500
|
_setData(propsDataSource);
|
501
|
+
if (autoWidth) {
|
502
|
+
shadowContainer({
|
503
|
+
columns: filteredColumns,
|
504
|
+
data: propsDataSource,
|
505
|
+
shadowContainerRef: shadowContainerRef
|
506
|
+
});
|
507
|
+
reGenFilteredColumnsByAutoWidth();
|
508
|
+
}
|
498
509
|
}
|
499
510
|
}, [propsDataSource]);
|
500
511
|
// 初始化 ActionRef。
|
@@ -914,7 +925,7 @@ var ProTable = function ProTable(props) {
|
|
914
925
|
getData.run(requestData);
|
915
926
|
}
|
916
927
|
}
|
917
|
-
}, [bindUrl, bindUrlProps, dataRef, url, customRequest]);
|
928
|
+
}, [bindUrl, bindUrlProps, dataRef, url, customRequest, currentPage, pageSize, propsParams]);
|
918
929
|
var onSort = useCallback(function (dataIndex, order) {
|
919
930
|
var nextSort = _defineProperty({}, dataIndex, order);
|
920
931
|
setSort(nextSort);
|
@@ -967,6 +978,11 @@ var ProTable = function ProTable(props) {
|
|
967
978
|
return showLoading && !showSkeleton && (customTableLoading || props.loading);
|
968
979
|
}
|
969
980
|
}, [customRequest, showLoading, showSkeleton, customTableLoading, props.loading, getData]);
|
981
|
+
useEffect(function () {
|
982
|
+
if (autoWidth) {
|
983
|
+
reGenFilteredColumnsByAutoWidth();
|
984
|
+
}
|
985
|
+
}, [shadowContainerRef === null || shadowContainerRef === void 0 ? void 0 : shadowContainerRef.current]);
|
970
986
|
var memorizedGenProColumnToColumn = useMemo(function () {
|
971
987
|
var result = genProColumnToColumn(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps);
|
972
988
|
return result;
|
@@ -997,7 +1013,11 @@ var ProTable = function ProTable(props) {
|
|
997
1013
|
autoRefreshProps: autoRefreshProps,
|
998
1014
|
bindUrlProps: bindUrlProps,
|
999
1015
|
bindUrl: bindUrl
|
1000
|
-
}),
|
1016
|
+
}), autoWidth && shadowContainer({
|
1017
|
+
columns: filteredColumns,
|
1018
|
+
data: data,
|
1019
|
+
shadowContainerRef: shadowContainerRef
|
1020
|
+
}), hasActionColumn && shadowActionColumnContainer(filteredColumns, shadowActionColumnContainerRef), switchViewState === 'table' && /*#__PURE__*/React.createElement(TableContent, _objectSpread({
|
1001
1021
|
hasBorder: false,
|
1002
1022
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
1003
1023
|
columns: memorizedGenProColumnToColumn,
|
@@ -1175,7 +1195,7 @@ var ProTable = function ProTable(props) {
|
|
1175
1195
|
// 'footer-suction': footerSuctionState && footerSuction,
|
1176
1196
|
}),
|
1177
1197
|
ref: tableRef
|
1178
|
-
},
|
1198
|
+
}, autoWidth && shadowContainer({
|
1179
1199
|
columns: filteredColumns,
|
1180
1200
|
data: data,
|
1181
1201
|
shadowContainerRef: shadowContainerRef
|
@@ -12,7 +12,7 @@ interface IShadowContainerProps {
|
|
12
12
|
data: any[];
|
13
13
|
shadowContainerRef: MutableRefObject<null>;
|
14
14
|
}
|
15
|
-
export declare const shadowContainer: (props: IShadowContainerProps) => JSX.Element;
|
15
|
+
export declare const shadowContainer: (props: IShadowContainerProps) => JSX.Element | null;
|
16
16
|
export declare const shadowActionColumnContainer: (columns: ProTableColumnProps[], shadowActionColumnContainerRef: MutableRefObject<null>) => JSX.Element | undefined;
|
17
17
|
export declare const computeableWidthTypeList: {
|
18
18
|
dateTime: (data: any[], render: ITableCellRender) => any;
|
@@ -27,13 +27,16 @@ var columnShrinkMaxWidth = 100;
|
|
27
27
|
* @returns
|
28
28
|
*/
|
29
29
|
export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSelection, actionColumnRef) {
|
30
|
-
if (!ref.current) {
|
30
|
+
if (!(ref === null || ref === void 0 ? void 0 : ref.current)) {
|
31
31
|
return fileteredColumns;
|
32
32
|
}
|
33
33
|
var hasLockFlag = false;
|
34
34
|
var dom = ref.current;
|
35
35
|
var actionColumnDom = actionColumnRef === null || actionColumnRef === void 0 ? void 0 : actionColumnRef.current;
|
36
36
|
var childNodes = dom.children;
|
37
|
+
if (dom.children.length === 0) {
|
38
|
+
return fileteredColumns;
|
39
|
+
}
|
37
40
|
var finalColumns = [];
|
38
41
|
fileteredColumns.forEach(function (column, index) {
|
39
42
|
var _childNodes$index;
|
@@ -119,6 +122,7 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
119
122
|
// @ts-ignore
|
120
123
|
Math.max(titleWidth, computeableWidthTypeList[finalType](data, render)), size, index === 0 && useRowSelection);
|
121
124
|
} else {
|
125
|
+
var _column$render;
|
122
126
|
// 直接根据 dom 计算
|
123
127
|
// console.log(column.title, '可计算 dom')
|
124
128
|
column.isAutoWidth = false;
|
@@ -131,6 +135,10 @@ export function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSel
|
|
131
135
|
} else if (column === null || column === void 0 ? void 0 : column.sortable) {
|
132
136
|
column.width = column.width + 24;
|
133
137
|
}
|
138
|
+
// @ts-ignore
|
139
|
+
if (column === null || column === void 0 ? void 0 : (_column$render = column.render) === null || _column$render === void 0 ? void 0 : _column$render.copy) {
|
140
|
+
column.width = column.width + 16;
|
141
|
+
}
|
134
142
|
}
|
135
143
|
if (index === 0) {
|
136
144
|
// 首列不会被挤占
|
@@ -151,6 +159,7 @@ export var shadowContainer = function shadowContainer(props) {
|
|
151
159
|
var columns = props.columns,
|
152
160
|
data = props.data,
|
153
161
|
shadowContainerRef = props.shadowContainerRef;
|
162
|
+
if (data.length === 0) return null;
|
154
163
|
return /*#__PURE__*/React.createElement("div", {
|
155
164
|
ref: shadowContainerRef,
|
156
165
|
className: "teamix-pro-table-shadow-container"
|
package/lib/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.33-beta";
|
33
|
+
declare const version = "1.5.33-beta-3";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -299,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
299
299
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
300
300
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
301
301
|
}
|
302
|
-
var version = '1.5.33-beta';
|
302
|
+
var version = '1.5.33-beta-3';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|
@@ -128,7 +128,9 @@ var Cell = function Cell(props) {
|
|
128
128
|
value: value,
|
129
129
|
render: newRender,
|
130
130
|
dataSource: newDataSource,
|
131
|
-
format: format
|
131
|
+
format: format,
|
132
|
+
// 预留 context 位置
|
133
|
+
context: context
|
132
134
|
}, itemProps));
|
133
135
|
};
|
134
136
|
/**
|
@@ -193,6 +195,10 @@ var processBuriedPoint = function processBuriedPoint() {
|
|
193
195
|
var equalColumns = function equalColumns(prevProps, nextProps) {
|
194
196
|
var preValue = prevProps.value;
|
195
197
|
var nextValue = nextProps.value;
|
198
|
+
// 操作列的时候强制刷新
|
199
|
+
if (preValue === false && nextValue === false) {
|
200
|
+
return false;
|
201
|
+
}
|
196
202
|
if (preValue === nextValue) {
|
197
203
|
return true;
|
198
204
|
}
|
package/lib/table/index.js
CHANGED
@@ -511,11 +511,22 @@ var ProTable = function ProTable(props) {
|
|
511
511
|
var columns = (0, _processColumns.default)(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
|
512
512
|
setFilteredColumns(columns);
|
513
513
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
|
514
|
+
if (autoWidth) {
|
515
|
+
reGenFilteredColumnsByAutoWidth(columns);
|
516
|
+
}
|
514
517
|
}, [propsColumns]);
|
515
518
|
// dataSource 受控
|
516
519
|
(0, _react.useEffect)(function () {
|
517
520
|
if (propsDataSource) {
|
518
521
|
_setData(propsDataSource);
|
522
|
+
if (autoWidth) {
|
523
|
+
(0, _genAutoWidthColumns.shadowContainer)({
|
524
|
+
columns: filteredColumns,
|
525
|
+
data: propsDataSource,
|
526
|
+
shadowContainerRef: shadowContainerRef
|
527
|
+
});
|
528
|
+
reGenFilteredColumnsByAutoWidth();
|
529
|
+
}
|
519
530
|
}
|
520
531
|
}, [propsDataSource]);
|
521
532
|
// 初始化 ActionRef。
|
@@ -935,7 +946,7 @@ var ProTable = function ProTable(props) {
|
|
935
946
|
getData.run(requestData);
|
936
947
|
}
|
937
948
|
}
|
938
|
-
}, [bindUrl, bindUrlProps, dataRef, url, customRequest]);
|
949
|
+
}, [bindUrl, bindUrlProps, dataRef, url, customRequest, currentPage, pageSize, propsParams]);
|
939
950
|
var onSort = (0, _react.useCallback)(function (dataIndex, order) {
|
940
951
|
var nextSort = _defineProperty({}, dataIndex, order);
|
941
952
|
setSort(nextSort);
|
@@ -988,6 +999,11 @@ var ProTable = function ProTable(props) {
|
|
988
999
|
return showLoading && !showSkeleton && (customTableLoading || props.loading);
|
989
1000
|
}
|
990
1001
|
}, [customRequest, showLoading, showSkeleton, customTableLoading, props.loading, getData]);
|
1002
|
+
(0, _react.useEffect)(function () {
|
1003
|
+
if (autoWidth) {
|
1004
|
+
reGenFilteredColumnsByAutoWidth();
|
1005
|
+
}
|
1006
|
+
}, [shadowContainerRef === null || shadowContainerRef === void 0 ? void 0 : shadowContainerRef.current]);
|
991
1007
|
var memorizedGenProColumnToColumn = (0, _react.useMemo)(function () {
|
992
1008
|
var result = (0, _genProColumnToColumn.default)(filteredColumns, showSkeleton, actionRef, context, dataTeamixSpm, bindUrl, bindUrlProps);
|
993
1009
|
return result;
|
@@ -1018,7 +1034,11 @@ var ProTable = function ProTable(props) {
|
|
1018
1034
|
autoRefreshProps: autoRefreshProps,
|
1019
1035
|
bindUrlProps: bindUrlProps,
|
1020
1036
|
bindUrl: bindUrl
|
1021
|
-
}),
|
1037
|
+
}), autoWidth && (0, _genAutoWidthColumns.shadowContainer)({
|
1038
|
+
columns: filteredColumns,
|
1039
|
+
data: data,
|
1040
|
+
shadowContainerRef: shadowContainerRef
|
1041
|
+
}), hasActionColumn && (0, _genAutoWidthColumns.shadowActionColumnContainer)(filteredColumns, shadowActionColumnContainerRef), switchViewState === 'table' && /*#__PURE__*/_react.default.createElement(_TableContent.default, _objectSpread({
|
1022
1042
|
hasBorder: false,
|
1023
1043
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
1024
1044
|
columns: memorizedGenProColumnToColumn,
|
@@ -1196,7 +1216,7 @@ var ProTable = function ProTable(props) {
|
|
1196
1216
|
// 'footer-suction': footerSuctionState && footerSuction,
|
1197
1217
|
}),
|
1198
1218
|
ref: tableRef
|
1199
|
-
},
|
1219
|
+
}, autoWidth && (0, _genAutoWidthColumns.shadowContainer)({
|
1200
1220
|
columns: filteredColumns,
|
1201
1221
|
data: data,
|
1202
1222
|
shadowContainerRef: shadowContainerRef
|
@@ -12,7 +12,7 @@ interface IShadowContainerProps {
|
|
12
12
|
data: any[];
|
13
13
|
shadowContainerRef: MutableRefObject<null>;
|
14
14
|
}
|
15
|
-
export declare const shadowContainer: (props: IShadowContainerProps) => JSX.Element;
|
15
|
+
export declare const shadowContainer: (props: IShadowContainerProps) => JSX.Element | null;
|
16
16
|
export declare const shadowActionColumnContainer: (columns: ProTableColumnProps[], shadowActionColumnContainerRef: MutableRefObject<null>) => JSX.Element | undefined;
|
17
17
|
export declare const computeableWidthTypeList: {
|
18
18
|
dateTime: (data: any[], render: ITableCellRender) => any;
|
@@ -37,13 +37,16 @@ var columnShrinkMaxWidth = 100;
|
|
37
37
|
* @returns
|
38
38
|
*/
|
39
39
|
function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSelection, actionColumnRef) {
|
40
|
-
if (!ref.current) {
|
40
|
+
if (!(ref === null || ref === void 0 ? void 0 : ref.current)) {
|
41
41
|
return fileteredColumns;
|
42
42
|
}
|
43
43
|
var hasLockFlag = false;
|
44
44
|
var dom = ref.current;
|
45
45
|
var actionColumnDom = actionColumnRef === null || actionColumnRef === void 0 ? void 0 : actionColumnRef.current;
|
46
46
|
var childNodes = dom.children;
|
47
|
+
if (dom.children.length === 0) {
|
48
|
+
return fileteredColumns;
|
49
|
+
}
|
47
50
|
var finalColumns = [];
|
48
51
|
fileteredColumns.forEach(function (column, index) {
|
49
52
|
var _childNodes$index;
|
@@ -129,6 +132,7 @@ function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSelection,
|
|
129
132
|
// @ts-ignore
|
130
133
|
Math.max(titleWidth, computeableWidthTypeList[finalType](data, render)), size, index === 0 && useRowSelection);
|
131
134
|
} else {
|
135
|
+
var _column$render;
|
132
136
|
// 直接根据 dom 计算
|
133
137
|
// console.log(column.title, '可计算 dom')
|
134
138
|
column.isAutoWidth = false;
|
@@ -141,6 +145,10 @@ function genAutoWidthColumns(fileteredColumns, ref, data, size, useRowSelection,
|
|
141
145
|
} else if (column === null || column === void 0 ? void 0 : column.sortable) {
|
142
146
|
column.width = column.width + 24;
|
143
147
|
}
|
148
|
+
// @ts-ignore
|
149
|
+
if (column === null || column === void 0 ? void 0 : (_column$render = column.render) === null || _column$render === void 0 ? void 0 : _column$render.copy) {
|
150
|
+
column.width = column.width + 16;
|
151
|
+
}
|
144
152
|
}
|
145
153
|
if (index === 0) {
|
146
154
|
// 首列不会被挤占
|
@@ -161,6 +169,7 @@ var shadowContainer = function shadowContainer(props) {
|
|
161
169
|
var columns = props.columns,
|
162
170
|
data = props.data,
|
163
171
|
shadowContainerRef = props.shadowContainerRef;
|
172
|
+
if (data.length === 0) return null;
|
164
173
|
return /*#__PURE__*/_react.default.createElement("div", {
|
165
174
|
ref: shadowContainerRef,
|
166
175
|
className: "teamix-pro-table-shadow-container"
|