@teamix/pro 1.5.36 → 1.5.37
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 +407 -438
- 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 +5 -1
- package/es/table/components/Layout/index.js +1 -1
- package/es/table/index.js +3 -3
- package/es/table/utils/genAutoWidthColumns.js +2 -2
- package/es/table/utils/useTableSelection.d.ts +25 -2
- package/es/table/utils/useTableSelection.js +11 -7
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Cell/index.js +4 -0
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/index.js +3 -3
- package/lib/table/utils/genAutoWidthColumns.js +2 -2
- package/lib/table/utils/useTableSelection.d.ts +25 -2
- package/lib/table/utils/useTableSelection.js +11 -7
- 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
|
+
declare const version = "1.5.37";
|
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
@@ -15,7 +15,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
15
15
|
* 渲染列的逻辑函数
|
16
16
|
*/
|
17
17
|
import React from 'react';
|
18
|
-
import { getTargetValue } from '@teamix/utils';
|
18
|
+
import { getTargetValue, _ } from '@teamix/utils';
|
19
19
|
import { ProActionGroup } from '../../../actions';
|
20
20
|
import ProField from '../../../field';
|
21
21
|
/**
|
@@ -200,6 +200,10 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
200
200
|
if (preValue === false && nextValue === false || nextValue === undefined) {
|
201
201
|
return false;
|
202
202
|
}
|
203
|
+
// 如果不是 string 类型,全部刷新
|
204
|
+
if (!_.isString(nextValue)) {
|
205
|
+
return false;
|
206
|
+
}
|
203
207
|
if (preValue === nextValue) {
|
204
208
|
return true;
|
205
209
|
}
|
@@ -130,7 +130,7 @@ var Layout = function Layout(props) {
|
|
130
130
|
}
|
131
131
|
}, [
|
132
132
|
//todo: 重复render 问题都在这里
|
133
|
-
dataFilter, mainAction, dataFilterFormRef, afterDataFilter]);
|
133
|
+
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
|
134
134
|
// 区域组合渲染
|
135
135
|
var renderLayout = function renderLayout() {
|
136
136
|
if (header && mainAction) {
|
package/es/table/index.js
CHANGED
@@ -422,9 +422,9 @@ var ProTable = function ProTable(props) {
|
|
422
422
|
if (showSkeleton && result) {
|
423
423
|
result.disabled = true;
|
424
424
|
}
|
425
|
-
return _objectSpread(
|
425
|
+
return _objectSpread({
|
426
426
|
_primaryKey: props.primaryKey
|
427
|
-
},
|
427
|
+
}, result);
|
428
428
|
},
|
429
429
|
titleProps: function titleProps() {
|
430
430
|
var result = {};
|
@@ -437,7 +437,7 @@ var ProTable = function ProTable(props) {
|
|
437
437
|
return result;
|
438
438
|
},
|
439
439
|
onChange: onChangeRowSelection
|
440
|
-
}), primaryKey);
|
440
|
+
}), data !== null && data !== void 0 ? data : propsDataSource, primaryKey);
|
441
441
|
var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
|
442
442
|
var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
|
443
443
|
useEffect(function () {
|
@@ -61,7 +61,6 @@ export function genAutoWidthColumns(columns, ref, data, size, useRowSelection, a
|
|
61
61
|
finalColumns.push(column);
|
62
62
|
return;
|
63
63
|
}
|
64
|
-
;
|
65
64
|
if ((column === null || column === void 0 ? void 0 : column.columnFilters) === false) {
|
66
65
|
finalColumns.push(column);
|
67
66
|
return;
|
@@ -100,7 +99,8 @@ export function genAutoWidthColumns(columns, ref, data, size, useRowSelection, a
|
|
100
99
|
return;
|
101
100
|
}
|
102
101
|
// @ts-ignore
|
103
|
-
var titleWidth = _.get(childNodes
|
102
|
+
var titleWidth = _.get(childNodes[index], "children[0].scrollWidth", 0);
|
103
|
+
// const titleWidth = childNodes[index]?.children[0].scrollWidth
|
104
104
|
// @ts-ignore
|
105
105
|
if (fixedWidthTypeList[finalType]) {
|
106
106
|
// console.log(
|
@@ -1,3 +1,26 @@
|
|
1
|
-
import {
|
2
|
-
declare function useTableSelection(config
|
1
|
+
import { innerRowSelectionType } from '../typing';
|
2
|
+
declare function useTableSelection(config: ({
|
3
|
+
getProps?: ((record: any, index: number) => any) | undefined;
|
4
|
+
onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
|
5
|
+
onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
|
6
|
+
onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
|
7
|
+
selectedRowKeys?: any[] | undefined;
|
8
|
+
selectedRecords?: any[] | undefined;
|
9
|
+
mode?: "multiple" | "single" | undefined;
|
10
|
+
titleProps?: (() => any) | undefined;
|
11
|
+
columnProps?: (() => any) | undefined;
|
12
|
+
titleAddons?: (() => any) | undefined;
|
13
|
+
defaultSelectedRowKeys?: any[] | undefined;
|
14
|
+
defaultSelectedRecords?: any[] | undefined;
|
15
|
+
} & {
|
16
|
+
getProps?: ((record: any, index: number) => void) | undefined;
|
17
|
+
onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
|
18
|
+
onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
|
19
|
+
onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
|
20
|
+
selectedRowKeys?: any[] | undefined;
|
21
|
+
mode?: "multiple" | "single" | undefined;
|
22
|
+
titleProps?: (() => any) | undefined;
|
23
|
+
columnProps?: (() => any) | undefined;
|
24
|
+
titleAddons?: (() => any) | undefined;
|
25
|
+
}) | undefined, records: any, primaryKey?: string): innerRowSelectionType;
|
3
26
|
export default useTableSelection;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["primaryKey"];
|
1
|
+
var _excluded = ["primaryKey", "_primaryKey"];
|
2
2
|
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; }
|
3
3
|
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; }
|
4
4
|
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; }
|
@@ -24,7 +24,8 @@ import { Balloon, Checkbox } from '@alicloudfe/components';
|
|
24
24
|
var Tooltip = Balloon.Tooltip;
|
25
25
|
function useTableSelection() {
|
26
26
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
27
|
-
var
|
27
|
+
var records = arguments.length > 1 ? arguments[1] : undefined;
|
28
|
+
var primaryKey = arguments.length > 2 ? arguments[2] : undefined;
|
28
29
|
var _config$defaultSelect = config.defaultSelectedRecords,
|
29
30
|
defaultSelectedRecords = _config$defaultSelect === void 0 ? [] : _config$defaultSelect,
|
30
31
|
_config$defaultSelect2 = config.defaultSelectedRowKeys,
|
@@ -72,18 +73,21 @@ function useTableSelection() {
|
|
72
73
|
config.onChange(value, records);
|
73
74
|
}
|
74
75
|
}
|
75
|
-
var renderCheckBox = function renderCheckBox(props) {
|
76
|
+
var renderCheckBox = function renderCheckBox(props, record) {
|
76
77
|
var primaryKey = props.primaryKey,
|
78
|
+
_primaryKey = props._primaryKey,
|
77
79
|
others = _objectWithoutProperties(props, _excluded);
|
78
80
|
return /*#__PURE__*/React.createElement(Checkbox, _objectSpread({
|
79
81
|
checked: selectedRowKeys.includes(primaryKey),
|
80
82
|
onChange: function onChange(checked) {
|
83
|
+
var _config$onSelect;
|
84
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, records);
|
81
85
|
if (checked) {
|
82
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [
|
86
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record]);
|
83
87
|
} else {
|
84
88
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
|
85
89
|
return item !== primaryKey;
|
86
|
-
}), [
|
90
|
+
}), [record]);
|
87
91
|
}
|
88
92
|
}
|
89
93
|
}, others));
|
@@ -104,13 +108,13 @@ function useTableSelection() {
|
|
104
108
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
105
109
|
trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
106
110
|
primaryKey: primaryKey
|
107
|
-
})),
|
111
|
+
}), record),
|
108
112
|
align: "t"
|
109
113
|
}, propResult.disabledTooltip);
|
110
114
|
}
|
111
115
|
return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
112
116
|
primaryKey: primaryKey
|
113
|
-
}));
|
117
|
+
}), record);
|
114
118
|
}
|
115
119
|
});
|
116
120
|
};
|
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.37";
|
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.37';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|
@@ -204,6 +204,10 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
204
204
|
if (preValue === false && nextValue === false || nextValue === undefined) {
|
205
205
|
return false;
|
206
206
|
}
|
207
|
+
// 如果不是 string 类型,全部刷新
|
208
|
+
if (!_utils._.isString(nextValue)) {
|
209
|
+
return false;
|
210
|
+
}
|
207
211
|
if (preValue === nextValue) {
|
208
212
|
return true;
|
209
213
|
}
|
@@ -139,7 +139,7 @@ var Layout = function Layout(props) {
|
|
139
139
|
}
|
140
140
|
}, [
|
141
141
|
//todo: 重复render 问题都在这里
|
142
|
-
dataFilter, mainAction, dataFilterFormRef, afterDataFilter]);
|
142
|
+
dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
|
143
143
|
// 区域组合渲染
|
144
144
|
var renderLayout = function renderLayout() {
|
145
145
|
if (header && mainAction) {
|
package/lib/table/index.js
CHANGED
@@ -443,9 +443,9 @@ var ProTable = function ProTable(props) {
|
|
443
443
|
if (showSkeleton && result) {
|
444
444
|
result.disabled = true;
|
445
445
|
}
|
446
|
-
return _objectSpread(
|
446
|
+
return _objectSpread({
|
447
447
|
_primaryKey: props.primaryKey
|
448
|
-
},
|
448
|
+
}, result);
|
449
449
|
},
|
450
450
|
titleProps: function titleProps() {
|
451
451
|
var result = {};
|
@@ -458,7 +458,7 @@ var ProTable = function ProTable(props) {
|
|
458
458
|
return result;
|
459
459
|
},
|
460
460
|
onChange: onChangeRowSelection
|
461
|
-
}), primaryKey);
|
461
|
+
}), data !== null && data !== void 0 ? data : propsDataSource, primaryKey);
|
462
462
|
var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
|
463
463
|
var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
|
464
464
|
(0, _react.useEffect)(function () {
|
@@ -71,7 +71,6 @@ function genAutoWidthColumns(columns, ref, data, size, useRowSelection, actionCo
|
|
71
71
|
finalColumns.push(column);
|
72
72
|
return;
|
73
73
|
}
|
74
|
-
;
|
75
74
|
if ((column === null || column === void 0 ? void 0 : column.columnFilters) === false) {
|
76
75
|
finalColumns.push(column);
|
77
76
|
return;
|
@@ -110,7 +109,8 @@ function genAutoWidthColumns(columns, ref, data, size, useRowSelection, actionCo
|
|
110
109
|
return;
|
111
110
|
}
|
112
111
|
// @ts-ignore
|
113
|
-
var titleWidth = _utils._.get(childNodes
|
112
|
+
var titleWidth = _utils._.get(childNodes[index], "children[0].scrollWidth", 0);
|
113
|
+
// const titleWidth = childNodes[index]?.children[0].scrollWidth
|
114
114
|
// @ts-ignore
|
115
115
|
if (fixedWidthTypeList[finalType]) {
|
116
116
|
// console.log(
|
@@ -1,3 +1,26 @@
|
|
1
|
-
import {
|
2
|
-
declare function useTableSelection(config
|
1
|
+
import { innerRowSelectionType } from '../typing';
|
2
|
+
declare function useTableSelection(config: ({
|
3
|
+
getProps?: ((record: any, index: number) => any) | undefined;
|
4
|
+
onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
|
5
|
+
onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
|
6
|
+
onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
|
7
|
+
selectedRowKeys?: any[] | undefined;
|
8
|
+
selectedRecords?: any[] | undefined;
|
9
|
+
mode?: "multiple" | "single" | undefined;
|
10
|
+
titleProps?: (() => any) | undefined;
|
11
|
+
columnProps?: (() => any) | undefined;
|
12
|
+
titleAddons?: (() => any) | undefined;
|
13
|
+
defaultSelectedRowKeys?: any[] | undefined;
|
14
|
+
defaultSelectedRecords?: any[] | undefined;
|
15
|
+
} & {
|
16
|
+
getProps?: ((record: any, index: number) => void) | undefined;
|
17
|
+
onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
|
18
|
+
onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
|
19
|
+
onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
|
20
|
+
selectedRowKeys?: any[] | undefined;
|
21
|
+
mode?: "multiple" | "single" | undefined;
|
22
|
+
titleProps?: (() => any) | undefined;
|
23
|
+
columnProps?: (() => any) | undefined;
|
24
|
+
titleAddons?: (() => any) | undefined;
|
25
|
+
}) | undefined, records: any, primaryKey?: string): innerRowSelectionType;
|
3
26
|
export default useTableSelection;
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
var _utils = require("@teamix/utils");
|
10
10
|
var _components = require("@alicloudfe/components");
|
11
|
-
var _excluded = ["primaryKey"];
|
11
|
+
var _excluded = ["primaryKey", "_primaryKey"];
|
12
12
|
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); }
|
13
13
|
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; }
|
14
14
|
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; }
|
@@ -29,7 +29,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
29
|
var Tooltip = _components.Balloon.Tooltip;
|
30
30
|
function useTableSelection() {
|
31
31
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
32
|
-
var
|
32
|
+
var records = arguments.length > 1 ? arguments[1] : undefined;
|
33
|
+
var primaryKey = arguments.length > 2 ? arguments[2] : undefined;
|
33
34
|
var _config$defaultSelect = config.defaultSelectedRecords,
|
34
35
|
defaultSelectedRecords = _config$defaultSelect === void 0 ? [] : _config$defaultSelect,
|
35
36
|
_config$defaultSelect2 = config.defaultSelectedRowKeys,
|
@@ -77,18 +78,21 @@ function useTableSelection() {
|
|
77
78
|
config.onChange(value, records);
|
78
79
|
}
|
79
80
|
}
|
80
|
-
var renderCheckBox = function renderCheckBox(props) {
|
81
|
+
var renderCheckBox = function renderCheckBox(props, record) {
|
81
82
|
var primaryKey = props.primaryKey,
|
83
|
+
_primaryKey = props._primaryKey,
|
82
84
|
others = _objectWithoutProperties(props, _excluded);
|
83
85
|
return /*#__PURE__*/_react.default.createElement(_components.Checkbox, _objectSpread({
|
84
86
|
checked: selectedRowKeys.includes(primaryKey),
|
85
87
|
onChange: function onChange(checked) {
|
88
|
+
var _config$onSelect;
|
89
|
+
config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, records);
|
86
90
|
if (checked) {
|
87
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [
|
91
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record]);
|
88
92
|
} else {
|
89
93
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
|
90
94
|
return item !== primaryKey;
|
91
|
-
}), [
|
95
|
+
}), [record]);
|
92
96
|
}
|
93
97
|
}
|
94
98
|
}, others));
|
@@ -109,13 +113,13 @@ function useTableSelection() {
|
|
109
113
|
return /*#__PURE__*/_react.default.createElement(Tooltip, {
|
110
114
|
trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
111
115
|
primaryKey: primaryKey
|
112
|
-
})),
|
116
|
+
}), record),
|
113
117
|
align: "t"
|
114
118
|
}, propResult.disabledTooltip);
|
115
119
|
}
|
116
120
|
return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
|
117
121
|
primaryKey: primaryKey
|
118
|
-
}));
|
122
|
+
}), record);
|
119
123
|
}
|
120
124
|
});
|
121
125
|
};
|