@teamix/pro 1.5.43 → 1.5.45
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 +22053 -23605
- package/dist/pro.min.js +1 -1
- package/dist/pro.xconsole.min.css +1 -1
- package/es/form/Filter/useBindUrl.d.ts +14 -2
- package/es/form/Filter/useBindUrl.js +41 -11
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/Cell/index.js +23 -3
- package/es/table/components/ToolBar/FilterColumnIcon.js +3 -3
- package/es/table/index.js +2 -2
- package/es/table/utils/useTableSelection.js +38 -20
- package/es/table/xconsole.scss +6 -3
- package/es/xconsole.scss +9 -0
- package/lib/form/Filter/useBindUrl.d.ts +14 -2
- package/lib/form/Filter/useBindUrl.js +42 -13
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Cell/index.js +23 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +3 -3
- package/lib/table/index.js +2 -2
- package/lib/table/utils/useTableSelection.js +37 -19
- package/lib/table/xconsole.scss +6 -3
- package/lib/xconsole.scss +9 -0
- package/package.json +1 -1
@@ -1,2 +1,14 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { UrlStateOptions } from '@teamix/hooks';
|
3
|
+
import type { Form } from '@formily/core';
|
4
|
+
export interface BindUrlInitFunctions {
|
5
|
+
onInit?: (values: Record<string, any>) => void;
|
6
|
+
onFilter?: (values: Record<string, any>) => void;
|
7
|
+
onReset?: (values: Record<string, any>) => void;
|
8
|
+
}
|
9
|
+
export default function useBindUrl(bindUrl: boolean | UrlStateOptions | undefined, functions: BindUrlInitFunctions, formRef: React.MutableRefObject<Form<any> | undefined>): {
|
10
|
+
onInit?: ((values: Record<string, any>) => void) | undefined;
|
11
|
+
onFilter?: ((values: Record<string, any>) => void) | undefined;
|
12
|
+
onReset?: ((values: Record<string, any>) => void) | undefined;
|
13
|
+
setValuesByUrlState: (form: any) => void;
|
14
|
+
};
|
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
9
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10
10
|
import { useUrlState } from '@teamix/hooks';
|
11
11
|
import { isUsable, isPlainObj } from '@teamix/utils';
|
12
|
-
export default
|
12
|
+
export default function useBindUrl(bindUrl, functions, formRef) {
|
13
13
|
// 预处理 bindUrl 参数(主要兼容 SelectGroup 组件)
|
14
14
|
var initializeBindUrl = function initializeBindUrl(options) {
|
15
15
|
return options ? _objectSpread(_objectSpread({}, options), {}, {
|
@@ -23,8 +23,9 @@ export default (function (bindUrl, functions, formRef) {
|
|
23
23
|
key = _ref2[0],
|
24
24
|
value = _ref2[1];
|
25
25
|
var form = formRef.current;
|
26
|
-
var field = (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
27
|
-
|
26
|
+
var field = form === null || form === void 0 ? void 0 : (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
27
|
+
var component = field === null || field === void 0 ? void 0 : field.component;
|
28
|
+
if (component instanceof Array && component[0] === 'SelectGroup') {
|
28
29
|
newValues[key] = value.map(function (_ref3) {
|
29
30
|
var key = _ref3.key,
|
30
31
|
value = _ref3.value;
|
@@ -38,17 +39,46 @@ export default (function (bindUrl, functions, formRef) {
|
|
38
39
|
};
|
39
40
|
// 通过 useUrlState 获取 url 上的参数和 url 配置方法
|
40
41
|
var _ref4 = bindUrl ? useUrlState(undefined, initializeBindUrl(isPlainObj(bindUrl) ? bindUrl : {})) : [],
|
41
|
-
_ref5 = _slicedToArray(_ref4,
|
42
|
+
_ref5 = _slicedToArray(_ref4, 3),
|
42
43
|
urlState = _ref5[0],
|
43
|
-
setUrlState = _ref5[1]
|
44
|
+
setUrlState = _ref5[1],
|
45
|
+
queryFromUrl = _ref5[2];
|
44
46
|
// 输出配置url参数的函数
|
45
47
|
var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref6) {
|
46
48
|
var _ref7 = _slicedToArray(_ref6, 2),
|
47
|
-
|
48
|
-
|
49
|
-
prev[
|
50
|
-
|
51
|
-
|
49
|
+
listenerKey = _ref7[0],
|
50
|
+
originalFunction = _ref7[1];
|
51
|
+
prev[listenerKey] = function (values) {
|
52
|
+
originalFunction === null || originalFunction === void 0 ? void 0 : originalFunction(values);
|
53
|
+
if (bindUrl) {
|
54
|
+
// guard: onInit 会在 mount 时被自动调用,需要避免其在任何情况下都调用 setUrlState。故增加幂等判断
|
55
|
+
var hasDifference = false;
|
56
|
+
for (var paramName in values) {
|
57
|
+
if (Object.hasOwn(values, paramName)) {
|
58
|
+
var simpleTransform = function simpleTransform(value) {
|
59
|
+
if (value instanceof Array) {
|
60
|
+
return value.join(',');
|
61
|
+
}
|
62
|
+
if (value === undefined || value === null) {
|
63
|
+
return '';
|
64
|
+
}
|
65
|
+
if (value instanceof Object) {
|
66
|
+
console.warn('useBindUrl: 无法处理对象类型的 url 参数');
|
67
|
+
}
|
68
|
+
return value;
|
69
|
+
};
|
70
|
+
var oldValue = queryFromUrl === null || queryFromUrl === void 0 ? void 0 : queryFromUrl[paramName];
|
71
|
+
var newValue = values[paramName];
|
72
|
+
if (simpleTransform(newValue) !== simpleTransform(oldValue)) {
|
73
|
+
hasDifference = true;
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
if (hasDifference) {
|
79
|
+
setUrlState(values);
|
80
|
+
}
|
81
|
+
}
|
52
82
|
};
|
53
83
|
return prev;
|
54
84
|
}, {});
|
@@ -87,4 +117,4 @@ export default (function (bindUrl, functions, formRef) {
|
|
87
117
|
return _objectSpread({
|
88
118
|
setValuesByUrlState: setValuesByUrlState
|
89
119
|
}, initializedFunctions);
|
90
|
-
}
|
120
|
+
}
|
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
|
+
declare const version = "1.5.45";
|
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
@@ -189,11 +189,31 @@ var processBuriedPoint = function processBuriedPoint() {
|
|
189
189
|
}))));
|
190
190
|
};
|
191
191
|
var equalColumns = function equalColumns(prevProps, nextProps) {
|
192
|
-
var preValue = prevProps.value
|
192
|
+
var preValue = prevProps.value,
|
193
|
+
preItem = prevProps.item,
|
194
|
+
preRecord = prevProps.record,
|
195
|
+
preContext = prevProps.context;
|
193
196
|
var nextValue = nextProps.value,
|
194
|
-
|
197
|
+
nextItem = nextProps.item,
|
198
|
+
nextRecord = nextProps.record,
|
199
|
+
nextContext = nextProps.context;
|
200
|
+
// if (nextItem?.render) {
|
201
|
+
// let renderCache = true;
|
202
|
+
// Object.keys(nextItem?.render).forEach((key) => {
|
203
|
+
// // 如果 preItem 不包含 render 的属性,则强制刷新
|
204
|
+
// if (!preItem?.render[key]) {
|
205
|
+
// renderCache = false;
|
206
|
+
// return false
|
207
|
+
// }
|
208
|
+
// let preRenderValue = getTargetValue(preItem?.render[key], {...preRecord, ...preContext});
|
209
|
+
// let nextRenderValue = getTargetValue(nextItem?.render[key], {...nextRecord, ...nextContext})
|
210
|
+
// if (preRenderValue !== nextRenderValue) {
|
211
|
+
// renderCache = false;
|
212
|
+
// }
|
213
|
+
// })
|
214
|
+
// }
|
195
215
|
// columns 强制更新参数
|
196
|
-
if (
|
216
|
+
if (nextItem === null || nextItem === void 0 ? void 0 : nextItem.forcedUpdate) {
|
197
217
|
return false;
|
198
218
|
}
|
199
219
|
// 操作列的时候强制刷新 || 当 value 值拿不到的时候
|
@@ -37,9 +37,9 @@ var processColumns = function processColumns(columns) {
|
|
37
37
|
return (item === null || item === void 0 ? void 0 : item.hidden) !== true && (!globalFilterColumns || globalFilterColumns(item));
|
38
38
|
});
|
39
39
|
return columns.map(function (item) {
|
40
|
-
if (item.columnFilters === false) {
|
41
|
-
|
42
|
-
}
|
40
|
+
// if (item.columnFilters === false) {
|
41
|
+
// return item;
|
42
|
+
// }
|
43
43
|
return _objectSpread(_objectSpread({}, item), {}, {
|
44
44
|
columnFilters: filterColumnsKey.findIndex(function (key) {
|
45
45
|
return item.dataIndex === key;
|
package/es/table/index.js
CHANGED
@@ -337,9 +337,9 @@ var ProTable = function ProTable(props) {
|
|
337
337
|
setFooterSuctionState(false);
|
338
338
|
}
|
339
339
|
// 如果有切换区tab,那么重新计算
|
340
|
-
if (headerFixedTopSectionDom.clientHeight) {
|
340
|
+
if (headerFixedTopSectionDom === null || headerFixedTopSectionDom === void 0 ? void 0 : headerFixedTopSectionDom.clientHeight) {
|
341
341
|
var _headerFixedTopSectio;
|
342
|
-
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
|
342
|
+
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom === null || headerFixedTopSectionDom === void 0 ? void 0 : headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
|
343
343
|
// const clientTableBodyHeight =
|
344
344
|
// document.body.clientHeight - offsetHeaderHeight;
|
345
345
|
setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
|
@@ -18,7 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
* 处理表格 rowSelection hooks
|
19
19
|
* 除了基本 rowSelection 之外返回平铺后的 selectedRowKeys、selectedRecords
|
20
20
|
*/
|
21
|
-
import React, { useEffect, useState } from 'react';
|
21
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
22
22
|
import { getDeepValue } from '@teamix/utils';
|
23
23
|
import { Balloon, Checkbox } from '@alicloudfe/components';
|
24
24
|
var Tooltip = Balloon.Tooltip;
|
@@ -38,13 +38,20 @@ function useTableSelection() {
|
|
38
38
|
_useState4 = _slicedToArray(_useState3, 2),
|
39
39
|
selectedRecords = _useState4[0],
|
40
40
|
setSelectedRecords = _useState4[1];
|
41
|
+
var dataRef = useRef({
|
42
|
+
selectedRowKeys: config.selectedRowKeys || defaultSelectedRowKeys
|
43
|
+
});
|
44
|
+
var onSetSelectedRowKeys = function onSetSelectedRowKeys(keys) {
|
45
|
+
setSelectedRowKeys(keys);
|
46
|
+
dataRef.current.selectedRowKeys = keys;
|
47
|
+
};
|
41
48
|
useEffect(function () {
|
42
|
-
var _config$selectedRowKe;
|
49
|
+
var _config$selectedRowKe, _config$selectedRowKe2;
|
43
50
|
setSelectedRowKeys((_config$selectedRowKe = config === null || config === void 0 ? void 0 : config.selectedRowKeys) !== null && _config$selectedRowKe !== void 0 ? _config$selectedRowKe : []);
|
51
|
+
dataRef.current.selectedRowKeys = (_config$selectedRowKe2 = config === null || config === void 0 ? void 0 : config.selectedRowKeys) !== null && _config$selectedRowKe2 !== void 0 ? _config$selectedRowKe2 : [];
|
44
52
|
}, [config.selectedRowKeys]);
|
45
53
|
function _onChange(value, records, checked, record) {
|
46
54
|
if (primaryKey) {
|
47
|
-
var _config$onSelect;
|
48
55
|
var newValue = value.filter(function (v) {
|
49
56
|
return !selectedRowKeys.includes(v);
|
50
57
|
});
|
@@ -70,28 +77,36 @@ function useTableSelection() {
|
|
70
77
|
});
|
71
78
|
}
|
72
79
|
setSelectedRecords(nextSelectedRecords);
|
73
|
-
|
80
|
+
// 暂时只有在多选模式下才会触发
|
81
|
+
if (config.mode !== 'single') {
|
82
|
+
var _config$onSelect;
|
83
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, nextSelectedRecords);
|
84
|
+
}
|
74
85
|
} else {
|
75
|
-
var _config$onSelect2;
|
76
86
|
setSelectedRecords(records);
|
77
|
-
|
87
|
+
// 暂时只有在多选模式下才会触发
|
88
|
+
if (config.mode !== 'single') {
|
89
|
+
var _config$onSelect2;
|
90
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect2 = config.onSelect) === null || _config$onSelect2 === void 0 ? void 0 : _config$onSelect2.call(config, checked, record, records);
|
91
|
+
}
|
78
92
|
}
|
79
93
|
setSelectedRowKeys(value);
|
94
|
+
dataRef.current.selectedRowKeys = value;
|
80
95
|
if (config.onChange) {
|
81
96
|
config.onChange(value, records);
|
82
97
|
}
|
83
98
|
}
|
84
|
-
var renderCheckBox = function renderCheckBox(props, record) {
|
99
|
+
var renderCheckBox = function renderCheckBox(props, record, keys) {
|
85
100
|
var primaryKey = props.primaryKey,
|
86
101
|
_primaryKey = props._primaryKey,
|
87
102
|
others = _objectWithoutProperties(props, _excluded);
|
88
103
|
return /*#__PURE__*/React.createElement(Checkbox, _objectSpread({
|
89
|
-
checked:
|
104
|
+
checked: keys.includes(primaryKey),
|
90
105
|
onChange: function onChange(checked) {
|
91
106
|
if (checked) {
|
92
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record], checked, record);
|
107
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(dataRef.current.selectedRowKeys), [primaryKey]), [record], checked, record);
|
93
108
|
} else {
|
94
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
|
109
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(dataRef.current.selectedRowKeys.filter(function (item) {
|
95
110
|
return item !== primaryKey;
|
96
111
|
}), [record], checked, record);
|
97
112
|
}
|
@@ -114,27 +129,30 @@ function useTableSelection() {
|
|
114
129
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
115
130
|
trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
116
131
|
primaryKey: primaryKey
|
117
|
-
}), record),
|
132
|
+
}), record, dataRef.current.selectedRowKeys),
|
118
133
|
align: "t"
|
119
134
|
}, propResult.disabledTooltip);
|
120
135
|
}
|
121
136
|
return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
122
137
|
primaryKey: primaryKey
|
123
|
-
}), record);
|
138
|
+
}), record, dataRef.current.selectedRowKeys);
|
124
139
|
}
|
125
140
|
});
|
126
141
|
};
|
127
|
-
var rowSelection =
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
142
|
+
var rowSelection = useMemo(function () {
|
143
|
+
return _objectSpread(_objectSpread({
|
144
|
+
selectedRowKeys: selectedRowKeys,
|
145
|
+
selectedRecords: selectedRecords
|
146
|
+
}, config), {}, {
|
147
|
+
onChange: _onChange,
|
148
|
+
getProps: getProps
|
149
|
+
// onSelect: undefined,
|
150
|
+
});
|
151
|
+
}, [selectedRowKeys, config, selectedRecords]);
|
134
152
|
return {
|
135
153
|
rowSelection: rowSelection,
|
136
154
|
selectedRowKeys: selectedRowKeys,
|
137
|
-
setSelectedRowKeys:
|
155
|
+
setSelectedRowKeys: onSetSelectedRowKeys,
|
138
156
|
selectedRecords: selectedRecords,
|
139
157
|
setSelectedRecords: setSelectedRecords
|
140
158
|
};
|
package/es/table/xconsole.scss
CHANGED
package/es/xconsole.scss
CHANGED
@@ -506,6 +506,15 @@
|
|
506
506
|
display: flex;
|
507
507
|
}
|
508
508
|
}
|
509
|
+
.teamix-pro-table-toolbar-content {
|
510
|
+
.teamix-pro-table-toolbar-custom {
|
511
|
+
.next-btn:not(.isOnlyIcon):not(.next-btn-text) {
|
512
|
+
min-width: 32px;
|
513
|
+
color: #5a5a5a;
|
514
|
+
padding: 0;
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
509
518
|
.next-dialog-centered {
|
510
519
|
text-align: center;
|
511
520
|
}
|
@@ -1,2 +1,14 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { UrlStateOptions } from '@teamix/hooks';
|
3
|
+
import type { Form } from '@formily/core';
|
4
|
+
export interface BindUrlInitFunctions {
|
5
|
+
onInit?: (values: Record<string, any>) => void;
|
6
|
+
onFilter?: (values: Record<string, any>) => void;
|
7
|
+
onReset?: (values: Record<string, any>) => void;
|
8
|
+
}
|
9
|
+
export default function useBindUrl(bindUrl: boolean | UrlStateOptions | undefined, functions: BindUrlInitFunctions, formRef: React.MutableRefObject<Form<any> | undefined>): {
|
10
|
+
onInit?: ((values: Record<string, any>) => void) | undefined;
|
11
|
+
onFilter?: ((values: Record<string, any>) => void) | undefined;
|
12
|
+
onReset?: ((values: Record<string, any>) => void) | undefined;
|
13
|
+
setValuesByUrlState: (form: any) => void;
|
14
|
+
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = useBindUrl;
|
7
7
|
var _hooks = require("@teamix/hooks");
|
8
8
|
var _utils = require("@teamix/utils");
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
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; }
|
16
16
|
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; }
|
17
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
18
|
-
|
18
|
+
function useBindUrl(bindUrl, functions, formRef) {
|
19
19
|
// 预处理 bindUrl 参数(主要兼容 SelectGroup 组件)
|
20
20
|
var initializeBindUrl = function initializeBindUrl(options) {
|
21
21
|
return options ? _objectSpread(_objectSpread({}, options), {}, {
|
@@ -29,8 +29,9 @@ var _default = function _default(bindUrl, functions, formRef) {
|
|
29
29
|
key = _ref2[0],
|
30
30
|
value = _ref2[1];
|
31
31
|
var form = formRef.current;
|
32
|
-
var field = (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
33
|
-
|
32
|
+
var field = form === null || form === void 0 ? void 0 : (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
33
|
+
var component = field === null || field === void 0 ? void 0 : field.component;
|
34
|
+
if (component instanceof Array && component[0] === 'SelectGroup') {
|
34
35
|
newValues[key] = value.map(function (_ref3) {
|
35
36
|
var key = _ref3.key,
|
36
37
|
value = _ref3.value;
|
@@ -44,17 +45,46 @@ var _default = function _default(bindUrl, functions, formRef) {
|
|
44
45
|
};
|
45
46
|
// 通过 useUrlState 获取 url 上的参数和 url 配置方法
|
46
47
|
var _ref4 = bindUrl ? (0, _hooks.useUrlState)(undefined, initializeBindUrl((0, _utils.isPlainObj)(bindUrl) ? bindUrl : {})) : [],
|
47
|
-
_ref5 = _slicedToArray(_ref4,
|
48
|
+
_ref5 = _slicedToArray(_ref4, 3),
|
48
49
|
urlState = _ref5[0],
|
49
|
-
setUrlState = _ref5[1]
|
50
|
+
setUrlState = _ref5[1],
|
51
|
+
queryFromUrl = _ref5[2];
|
50
52
|
// 输出配置url参数的函数
|
51
53
|
var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref6) {
|
52
54
|
var _ref7 = _slicedToArray(_ref6, 2),
|
53
|
-
|
54
|
-
|
55
|
-
prev[
|
56
|
-
|
57
|
-
|
55
|
+
listenerKey = _ref7[0],
|
56
|
+
originalFunction = _ref7[1];
|
57
|
+
prev[listenerKey] = function (values) {
|
58
|
+
originalFunction === null || originalFunction === void 0 ? void 0 : originalFunction(values);
|
59
|
+
if (bindUrl) {
|
60
|
+
// guard: onInit 会在 mount 时被自动调用,需要避免其在任何情况下都调用 setUrlState。故增加幂等判断
|
61
|
+
var hasDifference = false;
|
62
|
+
for (var paramName in values) {
|
63
|
+
if (Object.hasOwn(values, paramName)) {
|
64
|
+
var simpleTransform = function simpleTransform(value) {
|
65
|
+
if (value instanceof Array) {
|
66
|
+
return value.join(',');
|
67
|
+
}
|
68
|
+
if (value === undefined || value === null) {
|
69
|
+
return '';
|
70
|
+
}
|
71
|
+
if (value instanceof Object) {
|
72
|
+
console.warn('useBindUrl: 无法处理对象类型的 url 参数');
|
73
|
+
}
|
74
|
+
return value;
|
75
|
+
};
|
76
|
+
var oldValue = queryFromUrl === null || queryFromUrl === void 0 ? void 0 : queryFromUrl[paramName];
|
77
|
+
var newValue = values[paramName];
|
78
|
+
if (simpleTransform(newValue) !== simpleTransform(oldValue)) {
|
79
|
+
hasDifference = true;
|
80
|
+
break;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
if (hasDifference) {
|
85
|
+
setUrlState(values);
|
86
|
+
}
|
87
|
+
}
|
58
88
|
};
|
59
89
|
return prev;
|
60
90
|
}, {});
|
@@ -93,5 +123,4 @@ var _default = function _default(bindUrl, functions, formRef) {
|
|
93
123
|
return _objectSpread({
|
94
124
|
setValuesByUrlState: setValuesByUrlState
|
95
125
|
}, initializedFunctions);
|
96
|
-
}
|
97
|
-
exports.default = _default;
|
126
|
+
}
|
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
|
+
declare const version = "1.5.45";
|
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.
|
302
|
+
var version = '1.5.45';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|
@@ -193,11 +193,31 @@ var processBuriedPoint = function processBuriedPoint() {
|
|
193
193
|
}))));
|
194
194
|
};
|
195
195
|
var equalColumns = function equalColumns(prevProps, nextProps) {
|
196
|
-
var preValue = prevProps.value
|
196
|
+
var preValue = prevProps.value,
|
197
|
+
preItem = prevProps.item,
|
198
|
+
preRecord = prevProps.record,
|
199
|
+
preContext = prevProps.context;
|
197
200
|
var nextValue = nextProps.value,
|
198
|
-
|
201
|
+
nextItem = nextProps.item,
|
202
|
+
nextRecord = nextProps.record,
|
203
|
+
nextContext = nextProps.context;
|
204
|
+
// if (nextItem?.render) {
|
205
|
+
// let renderCache = true;
|
206
|
+
// Object.keys(nextItem?.render).forEach((key) => {
|
207
|
+
// // 如果 preItem 不包含 render 的属性,则强制刷新
|
208
|
+
// if (!preItem?.render[key]) {
|
209
|
+
// renderCache = false;
|
210
|
+
// return false
|
211
|
+
// }
|
212
|
+
// let preRenderValue = getTargetValue(preItem?.render[key], {...preRecord, ...preContext});
|
213
|
+
// let nextRenderValue = getTargetValue(nextItem?.render[key], {...nextRecord, ...nextContext})
|
214
|
+
// if (preRenderValue !== nextRenderValue) {
|
215
|
+
// renderCache = false;
|
216
|
+
// }
|
217
|
+
// })
|
218
|
+
// }
|
199
219
|
// columns 强制更新参数
|
200
|
-
if (
|
220
|
+
if (nextItem === null || nextItem === void 0 ? void 0 : nextItem.forcedUpdate) {
|
201
221
|
return false;
|
202
222
|
}
|
203
223
|
// 操作列的时候强制刷新 || 当 value 值拿不到的时候
|
@@ -44,9 +44,9 @@ var processColumns = function processColumns(columns) {
|
|
44
44
|
return (item === null || item === void 0 ? void 0 : item.hidden) !== true && (!globalFilterColumns || globalFilterColumns(item));
|
45
45
|
});
|
46
46
|
return columns.map(function (item) {
|
47
|
-
if (item.columnFilters === false) {
|
48
|
-
|
49
|
-
}
|
47
|
+
// if (item.columnFilters === false) {
|
48
|
+
// return item;
|
49
|
+
// }
|
50
50
|
return _objectSpread(_objectSpread({}, item), {}, {
|
51
51
|
columnFilters: filterColumnsKey.findIndex(function (key) {
|
52
52
|
return item.dataIndex === key;
|
package/lib/table/index.js
CHANGED
@@ -358,9 +358,9 @@ var ProTable = function ProTable(props) {
|
|
358
358
|
setFooterSuctionState(false);
|
359
359
|
}
|
360
360
|
// 如果有切换区tab,那么重新计算
|
361
|
-
if (headerFixedTopSectionDom.clientHeight) {
|
361
|
+
if (headerFixedTopSectionDom === null || headerFixedTopSectionDom === void 0 ? void 0 : headerFixedTopSectionDom.clientHeight) {
|
362
362
|
var _headerFixedTopSectio;
|
363
|
-
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
|
363
|
+
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom === null || headerFixedTopSectionDom === void 0 ? void 0 : headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
|
364
364
|
// const clientTableBodyHeight =
|
365
365
|
// document.body.clientHeight - offsetHeaderHeight;
|
366
366
|
setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
|
@@ -43,13 +43,20 @@ function useTableSelection() {
|
|
43
43
|
_useState4 = _slicedToArray(_useState3, 2),
|
44
44
|
selectedRecords = _useState4[0],
|
45
45
|
setSelectedRecords = _useState4[1];
|
46
|
+
var dataRef = (0, _react.useRef)({
|
47
|
+
selectedRowKeys: config.selectedRowKeys || defaultSelectedRowKeys
|
48
|
+
});
|
49
|
+
var onSetSelectedRowKeys = function onSetSelectedRowKeys(keys) {
|
50
|
+
setSelectedRowKeys(keys);
|
51
|
+
dataRef.current.selectedRowKeys = keys;
|
52
|
+
};
|
46
53
|
(0, _react.useEffect)(function () {
|
47
|
-
var _config$selectedRowKe;
|
54
|
+
var _config$selectedRowKe, _config$selectedRowKe2;
|
48
55
|
setSelectedRowKeys((_config$selectedRowKe = config === null || config === void 0 ? void 0 : config.selectedRowKeys) !== null && _config$selectedRowKe !== void 0 ? _config$selectedRowKe : []);
|
56
|
+
dataRef.current.selectedRowKeys = (_config$selectedRowKe2 = config === null || config === void 0 ? void 0 : config.selectedRowKeys) !== null && _config$selectedRowKe2 !== void 0 ? _config$selectedRowKe2 : [];
|
49
57
|
}, [config.selectedRowKeys]);
|
50
58
|
function _onChange(value, records, checked, record) {
|
51
59
|
if (primaryKey) {
|
52
|
-
var _config$onSelect;
|
53
60
|
var newValue = value.filter(function (v) {
|
54
61
|
return !selectedRowKeys.includes(v);
|
55
62
|
});
|
@@ -75,28 +82,36 @@ function useTableSelection() {
|
|
75
82
|
});
|
76
83
|
}
|
77
84
|
setSelectedRecords(nextSelectedRecords);
|
78
|
-
|
85
|
+
// 暂时只有在多选模式下才会触发
|
86
|
+
if (config.mode !== 'single') {
|
87
|
+
var _config$onSelect;
|
88
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, nextSelectedRecords);
|
89
|
+
}
|
79
90
|
} else {
|
80
|
-
var _config$onSelect2;
|
81
91
|
setSelectedRecords(records);
|
82
|
-
|
92
|
+
// 暂时只有在多选模式下才会触发
|
93
|
+
if (config.mode !== 'single') {
|
94
|
+
var _config$onSelect2;
|
95
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect2 = config.onSelect) === null || _config$onSelect2 === void 0 ? void 0 : _config$onSelect2.call(config, checked, record, records);
|
96
|
+
}
|
83
97
|
}
|
84
98
|
setSelectedRowKeys(value);
|
99
|
+
dataRef.current.selectedRowKeys = value;
|
85
100
|
if (config.onChange) {
|
86
101
|
config.onChange(value, records);
|
87
102
|
}
|
88
103
|
}
|
89
|
-
var renderCheckBox = function renderCheckBox(props, record) {
|
104
|
+
var renderCheckBox = function renderCheckBox(props, record, keys) {
|
90
105
|
var primaryKey = props.primaryKey,
|
91
106
|
_primaryKey = props._primaryKey,
|
92
107
|
others = _objectWithoutProperties(props, _excluded);
|
93
108
|
return /*#__PURE__*/_react.default.createElement(_components.Checkbox, _objectSpread({
|
94
|
-
checked:
|
109
|
+
checked: keys.includes(primaryKey),
|
95
110
|
onChange: function onChange(checked) {
|
96
111
|
if (checked) {
|
97
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record], checked, record);
|
112
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(dataRef.current.selectedRowKeys), [primaryKey]), [record], checked, record);
|
98
113
|
} else {
|
99
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
|
114
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(dataRef.current.selectedRowKeys.filter(function (item) {
|
100
115
|
return item !== primaryKey;
|
101
116
|
}), [record], checked, record);
|
102
117
|
}
|
@@ -119,27 +134,30 @@ function useTableSelection() {
|
|
119
134
|
return /*#__PURE__*/_react.default.createElement(Tooltip, {
|
120
135
|
trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
121
136
|
primaryKey: primaryKey
|
122
|
-
}), record),
|
137
|
+
}), record, dataRef.current.selectedRowKeys),
|
123
138
|
align: "t"
|
124
139
|
}, propResult.disabledTooltip);
|
125
140
|
}
|
126
141
|
return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
127
142
|
primaryKey: primaryKey
|
128
|
-
}), record);
|
143
|
+
}), record, dataRef.current.selectedRowKeys);
|
129
144
|
}
|
130
145
|
});
|
131
146
|
};
|
132
|
-
var rowSelection =
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
147
|
+
var rowSelection = (0, _react.useMemo)(function () {
|
148
|
+
return _objectSpread(_objectSpread({
|
149
|
+
selectedRowKeys: selectedRowKeys,
|
150
|
+
selectedRecords: selectedRecords
|
151
|
+
}, config), {}, {
|
152
|
+
onChange: _onChange,
|
153
|
+
getProps: getProps
|
154
|
+
// onSelect: undefined,
|
155
|
+
});
|
156
|
+
}, [selectedRowKeys, config, selectedRecords]);
|
139
157
|
return {
|
140
158
|
rowSelection: rowSelection,
|
141
159
|
selectedRowKeys: selectedRowKeys,
|
142
|
-
setSelectedRowKeys:
|
160
|
+
setSelectedRowKeys: onSetSelectedRowKeys,
|
143
161
|
selectedRecords: selectedRecords,
|
144
162
|
setSelectedRecords: setSelectedRecords
|
145
163
|
};
|
package/lib/table/xconsole.scss
CHANGED