@kdcloudjs/table 1.2.0-canary.10 → 1.2.0-canary.12
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/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +72 -22
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +6 -6
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/table.d.ts +1 -1
- package/es/table/base/table.js +4 -7
- package/es/table/pipeline/features/autoFill.js +3 -1
- package/es/table/pipeline/features/columnDrag.js +11 -7
- package/es/table/pipeline/features/multiSelect.js +6 -4
- package/es/table/pipeline/features/rowDrag.d.ts +2 -0
- package/es/table/pipeline/features/rowDrag.js +2 -0
- package/es/table/pipeline/features/singleSelect.js +6 -4
- package/es/table/utils/index.d.ts +1 -0
- package/es/table/utils/index.js +2 -1
- package/es/table/utils/selectColumn.d.ts +4 -0
- package/es/table/utils/selectColumn.js +6 -0
- package/lib/table/base/table.d.ts +1 -1
- package/lib/table/base/table.js +4 -7
- package/lib/table/pipeline/features/autoFill.js +3 -1
- package/lib/table/pipeline/features/columnDrag.js +10 -6
- package/lib/table/pipeline/features/multiSelect.js +8 -5
- package/lib/table/pipeline/features/rowDrag.d.ts +2 -0
- package/lib/table/pipeline/features/rowDrag.js +2 -0
- package/lib/table/pipeline/features/singleSelect.js +8 -5
- package/lib/table/utils/index.d.ts +1 -0
- package/lib/table/utils/index.js +21 -1
- package/lib/table/utils/selectColumn.d.ts +4 -0
- package/lib/table/utils/selectColumn.js +16 -0
- package/package.json +1 -1
package/es/table/base/table.d.ts
CHANGED
|
@@ -130,11 +130,11 @@ export declare class BaseTable extends React.Component<BaseTableProps, BaseTable
|
|
|
130
130
|
private artTableWrapperRef;
|
|
131
131
|
private domHelper;
|
|
132
132
|
private rootSubscription;
|
|
133
|
+
private resizeSubject;
|
|
133
134
|
private lastInfo;
|
|
134
135
|
private props$;
|
|
135
136
|
private hasScrollY;
|
|
136
137
|
private resizeObserver?;
|
|
137
|
-
private resizeSubject;
|
|
138
138
|
private offsetY;
|
|
139
139
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
140
140
|
getDoms(): TableDOMHelper;
|
package/es/table/base/table.js
CHANGED
|
@@ -63,9 +63,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
63
63
|
_this = _super.call(this, props);
|
|
64
64
|
_this.rowHeightManager = makeRowHeightManager(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
65
65
|
_this.artTableWrapperRef = /*#__PURE__*/React.createRef();
|
|
66
|
-
_this.rootSubscription = new Subscription();
|
|
67
66
|
_this.hasScrollY = false;
|
|
68
|
-
_this.resizeSubject = new Subject();
|
|
69
67
|
_this.offsetY = 0;
|
|
70
68
|
|
|
71
69
|
_this.handleRowMouseEnter = function (e) {
|
|
@@ -512,12 +510,11 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
512
510
|
}, {
|
|
513
511
|
key: "componentDidMount",
|
|
514
512
|
value: function componentDidMount() {
|
|
515
|
-
var _a, _b, _c, _d, _e, _f;
|
|
516
|
-
// console.log('update dom helper start')
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
this.updateDOMHelper(); // console.log('update dom helper end')
|
|
513
|
+
var _a, _b, _c, _d, _e, _f;
|
|
520
514
|
|
|
515
|
+
this.rootSubscription = new Subscription();
|
|
516
|
+
this.resizeSubject = new Subject();
|
|
517
|
+
this.updateDOMHelper();
|
|
521
518
|
this.props$ = new BehaviorSubject(this.props);
|
|
522
519
|
this.initSubscriptions();
|
|
523
520
|
this.didMountOrUpdate(); // console.log('did mount end')
|
|
@@ -133,7 +133,9 @@ function getColumnWidthSum(pipeline) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
function getTableRemainingWidth(pipeline) {
|
|
136
|
-
var
|
|
136
|
+
var _a, _b;
|
|
137
|
+
|
|
138
|
+
var tableWidth = ((_b = (_a = pipeline.ref.current.domHelper) === null || _a === void 0 ? void 0 : _a.tableBody) === null || _b === void 0 ? void 0 : _b.clientWidth) || pipeline.getStateAtKey(tableWidthKey);
|
|
137
139
|
if (!tableWidth) return;
|
|
138
140
|
var remainingWidth = Math.floor(tableWidth - getColumnWidthSum(pipeline));
|
|
139
141
|
return remainingWidth > 0 ? remainingWidth : 0;
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
4
4
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
-
import { makeRecursiveMapper, mergeCellProps, collectNodes, isLeafNode } from '../../utils';
|
|
5
|
+
import { makeRecursiveMapper, mergeCellProps, collectNodes, isLeafNode, isSelectColumn } from '../../utils';
|
|
6
6
|
import { FILL_COLUMN_CODE } from './autoFill';
|
|
7
7
|
var stateKey = 'columnDrag';
|
|
8
8
|
var SCROLL_SIZE = 30;
|
|
@@ -315,9 +315,13 @@ export function columnDrag() {
|
|
|
315
315
|
if (onColumnDragStopped) {
|
|
316
316
|
var _context;
|
|
317
317
|
|
|
318
|
-
var
|
|
319
|
-
var
|
|
320
|
-
return code
|
|
318
|
+
var isRowDragColumn = function isRowDragColumn(code) {
|
|
319
|
+
var rowDragColumnKey = pipeline.getFeatureOptions('rowDragColumnKey');
|
|
320
|
+
return code === rowDragColumnKey;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
var newColumns = _filterInstanceProperty(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (column) {
|
|
324
|
+
return column.code !== FILL_COLUMN_CODE && !isRowDragColumn(column.code) && !isSelectColumn(column);
|
|
321
325
|
}); // TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
322
326
|
|
|
323
327
|
|
|
@@ -343,9 +347,9 @@ export function columnDrag() {
|
|
|
343
347
|
};
|
|
344
348
|
}
|
|
345
349
|
|
|
346
|
-
function enableMove(
|
|
347
|
-
var lock =
|
|
348
|
-
code =
|
|
350
|
+
function enableMove(_ref) {
|
|
351
|
+
var lock = _ref.lock,
|
|
352
|
+
code = _ref.code;
|
|
349
353
|
return code && code !== FILL_COLUMN_CODE && !lock;
|
|
350
354
|
}
|
|
351
355
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
3
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
4
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
4
5
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { internals } from '../../internals';
|
|
7
8
|
import { always, arrayUtils } from '../../utils/others';
|
|
8
|
-
import { collectNodes, mergeCellProps } from '../../utils';
|
|
9
|
+
import { collectNodes, mergeCellProps, MULTI_SELECT_MARK_PROPNAME } from '../../utils';
|
|
9
10
|
var fullRowsSetKey = 'fullRowsSetKey';
|
|
10
11
|
var allEnableKeys = 'allEnableKeys';
|
|
11
12
|
var selectValueSetKey = 'selectValueSetKey';
|
|
12
13
|
export function multiSelect() {
|
|
13
14
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
15
|
return function multiSelectStep(pipeline) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
16
17
|
|
|
17
18
|
var stateKey = 'multiSelect';
|
|
18
19
|
var Checkbox = pipeline.ctx.components.Checkbox;
|
|
@@ -150,12 +151,13 @@ export function multiSelect() {
|
|
|
150
151
|
}
|
|
151
152
|
} : undefined
|
|
152
153
|
});
|
|
153
|
-
}
|
|
154
|
+
},
|
|
155
|
+
features: _extends(_extends({}, (_l = opts.checkboxColumn) === null || _l === void 0 ? void 0 : _l.features), _defineProperty({}, MULTI_SELECT_MARK_PROPNAME, true))
|
|
154
156
|
});
|
|
155
157
|
|
|
156
158
|
var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
|
|
157
159
|
|
|
158
|
-
var checkboxPlacement = (
|
|
160
|
+
var checkboxPlacement = (_m = opts.checkboxPlacement) !== null && _m !== void 0 ? _m : 'start';
|
|
159
161
|
|
|
160
162
|
if (checkboxPlacement === 'start') {
|
|
161
163
|
nextColumns.unshift(checkboxColumn);
|
|
@@ -21,6 +21,8 @@ export interface RowDragFeatureOptions {
|
|
|
21
21
|
rowDragColumn?: ArtColumn;
|
|
22
22
|
/** 行高 */
|
|
23
23
|
rowHeight?: number;
|
|
24
|
+
/** 拖拽过程中是否禁止滚动条滚动 */
|
|
25
|
+
suppressScrollMove?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare const ROW_DRAG_COLUMN_CODE = "$_row_drag_column_&";
|
|
26
28
|
export declare const rowDragKey = "rowDragKey";
|
|
@@ -86,6 +86,7 @@ export function rowDrag(opt) {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
var updateScrollPosition = function updateScrollPosition(mouseMoveEvent) {
|
|
89
|
+
if (opt === null || opt === void 0 ? void 0 : opt.suppressScrollMove) return;
|
|
89
90
|
var clientY = mouseMoveEvent.clientY;
|
|
90
91
|
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
91
92
|
var top = tableBodyClientRect.top,
|
|
@@ -182,6 +183,7 @@ export function rowDrag(opt) {
|
|
|
182
183
|
};
|
|
183
184
|
|
|
184
185
|
var rowDragColumn = (opt === null || opt === void 0 ? void 0 : opt.rowDragColumn) || defaultRowDragColumn;
|
|
186
|
+
pipeline.setFeatureOptions('rowDragColumnKey', rowDragColumn.code);
|
|
185
187
|
|
|
186
188
|
var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
|
|
187
189
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
3
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { internals } from '../../internals';
|
|
5
6
|
import { always } from '../../utils/others';
|
|
6
|
-
import { mergeCellProps } from '../../utils';
|
|
7
|
+
import { mergeCellProps, SINGLE_SELECT_MARK_PROPNAME } from '../../utils';
|
|
7
8
|
export function singleSelect() {
|
|
8
9
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
10
|
return function singleSelectStep(pipeline) {
|
|
10
11
|
var _context;
|
|
11
12
|
|
|
12
|
-
var _a, _b, _c, _d, _e;
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
14
|
|
|
14
15
|
var Radio = pipeline.ctx.components.Radio;
|
|
15
16
|
|
|
@@ -80,12 +81,13 @@ export function singleSelect() {
|
|
|
80
81
|
onChange(rowKey);
|
|
81
82
|
} : undefined
|
|
82
83
|
});
|
|
83
|
-
}
|
|
84
|
+
},
|
|
85
|
+
features: _extends(_extends({}, (_e = opts.radioColumn) === null || _e === void 0 ? void 0 : _e.features), _defineProperty({}, SINGLE_SELECT_MARK_PROPNAME, true))
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
|
|
87
89
|
|
|
88
|
-
var radioPlacement = (
|
|
90
|
+
var radioPlacement = (_f = opts.radioPlacement) !== null && _f !== void 0 ? _f : 'start';
|
|
89
91
|
|
|
90
92
|
if (radioPlacement === 'start') {
|
|
91
93
|
nextColumns.unshift(radioColumn);
|
|
@@ -17,3 +17,4 @@ export { default as layeredFilter } from './layeredFilter';
|
|
|
17
17
|
export { getEventPath, isElementInEventPath, getTargetEleInEventPath, calculatePointerRelative, calculatePopupRelative, keepWithinBounds } from './element';
|
|
18
18
|
export { default as console } from './console';
|
|
19
19
|
export { browserType } from './browserType';
|
|
20
|
+
export { MULTI_SELECT_MARK_PROPNAME, SINGLE_SELECT_MARK_PROPNAME, isSelectColumn } from './selectColumn';
|
package/es/table/utils/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export { copyDataToClipboard, executeOnTempElement } from './copyToClipboard';
|
|
|
16
16
|
export { default as layeredFilter } from './layeredFilter';
|
|
17
17
|
export { getEventPath, isElementInEventPath, getTargetEleInEventPath, calculatePointerRelative, calculatePopupRelative, keepWithinBounds } from './element';
|
|
18
18
|
export { default as console } from './console';
|
|
19
|
-
export { browserType } from './browserType';
|
|
19
|
+
export { browserType } from './browserType';
|
|
20
|
+
export { MULTI_SELECT_MARK_PROPNAME, SINGLE_SELECT_MARK_PROPNAME, isSelectColumn } from './selectColumn';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var MULTI_SELECT_MARK_PROPNAME = 'checkboxSelection';
|
|
2
|
+
export var SINGLE_SELECT_MARK_PROPNAME = 'radioSelection';
|
|
3
|
+
export function isSelectColumn(column) {
|
|
4
|
+
var features = column.features || {};
|
|
5
|
+
return features[MULTI_SELECT_MARK_PROPNAME] === true || features[SINGLE_SELECT_MARK_PROPNAME] === true;
|
|
6
|
+
}
|
|
@@ -130,11 +130,11 @@ export declare class BaseTable extends React.Component<BaseTableProps, BaseTable
|
|
|
130
130
|
private artTableWrapperRef;
|
|
131
131
|
private domHelper;
|
|
132
132
|
private rootSubscription;
|
|
133
|
+
private resizeSubject;
|
|
133
134
|
private lastInfo;
|
|
134
135
|
private props$;
|
|
135
136
|
private hasScrollY;
|
|
136
137
|
private resizeObserver?;
|
|
137
|
-
private resizeSubject;
|
|
138
138
|
private offsetY;
|
|
139
139
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
140
140
|
getDoms(): TableDOMHelper;
|
package/lib/table/base/table.js
CHANGED
|
@@ -113,9 +113,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
113
113
|
_this = _super.call(this, props);
|
|
114
114
|
_this.rowHeightManager = (0, _rowHeightManager.makeRowHeightManager)(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
115
115
|
_this.artTableWrapperRef = /*#__PURE__*/_react.default.createRef();
|
|
116
|
-
_this.rootSubscription = new _rxjs.Subscription();
|
|
117
116
|
_this.hasScrollY = false;
|
|
118
|
-
_this.resizeSubject = new _rxjs.Subject();
|
|
119
117
|
_this.offsetY = 0;
|
|
120
118
|
|
|
121
119
|
_this.handleRowMouseEnter = function (e) {
|
|
@@ -559,12 +557,11 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
559
557
|
}, {
|
|
560
558
|
key: "componentDidMount",
|
|
561
559
|
value: function componentDidMount() {
|
|
562
|
-
var _a, _b, _c, _d, _e, _f;
|
|
563
|
-
// console.log('update dom helper start')
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
this.updateDOMHelper(); // console.log('update dom helper end')
|
|
560
|
+
var _a, _b, _c, _d, _e, _f;
|
|
567
561
|
|
|
562
|
+
this.rootSubscription = new _rxjs.Subscription();
|
|
563
|
+
this.resizeSubject = new _rxjs.Subject();
|
|
564
|
+
this.updateDOMHelper();
|
|
568
565
|
this.props$ = new _rxjs.BehaviorSubject(this.props);
|
|
569
566
|
this.initSubscriptions();
|
|
570
567
|
this.didMountOrUpdate(); // console.log('did mount end')
|
|
@@ -153,7 +153,9 @@ function getColumnWidthSum(pipeline) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
function getTableRemainingWidth(pipeline) {
|
|
156
|
-
var
|
|
156
|
+
var _a, _b;
|
|
157
|
+
|
|
158
|
+
var tableWidth = ((_b = (_a = pipeline.ref.current.domHelper) === null || _a === void 0 ? void 0 : _a.tableBody) === null || _b === void 0 ? void 0 : _b.clientWidth) || pipeline.getStateAtKey(tableWidthKey);
|
|
157
159
|
if (!tableWidth) return;
|
|
158
160
|
var remainingWidth = Math.floor(tableWidth - getColumnWidthSum(pipeline));
|
|
159
161
|
return remainingWidth > 0 ? remainingWidth : 0;
|
|
@@ -329,9 +329,13 @@ function columnDrag() {
|
|
|
329
329
|
if (onColumnDragStopped) {
|
|
330
330
|
var _context;
|
|
331
331
|
|
|
332
|
-
var
|
|
333
|
-
var
|
|
334
|
-
return code
|
|
332
|
+
var isRowDragColumn = function isRowDragColumn(code) {
|
|
333
|
+
var rowDragColumnKey = pipeline.getFeatureOptions('rowDragColumnKey');
|
|
334
|
+
return code === rowDragColumnKey;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
var newColumns = (0, _filter.default)(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (column) {
|
|
338
|
+
return column.code !== _autoFill.FILL_COLUMN_CODE && !isRowDragColumn(column.code) && !(0, _utils.isSelectColumn)(column);
|
|
335
339
|
}); // TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
336
340
|
|
|
337
341
|
onColumnDragStopped(columnMoved, newColumns);
|
|
@@ -356,9 +360,9 @@ function columnDrag() {
|
|
|
356
360
|
};
|
|
357
361
|
}
|
|
358
362
|
|
|
359
|
-
function enableMove(
|
|
360
|
-
var lock =
|
|
361
|
-
code =
|
|
363
|
+
function enableMove(_ref) {
|
|
364
|
+
var lock = _ref.lock,
|
|
365
|
+
code = _ref.code;
|
|
362
366
|
return code && code !== _autoFill.FILL_COLUMN_CODE && !lock;
|
|
363
367
|
}
|
|
364
368
|
|
|
@@ -9,7 +9,9 @@ exports.multiSelect = multiSelect;
|
|
|
9
9
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
13
15
|
|
|
14
16
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
15
17
|
|
|
@@ -30,7 +32,7 @@ var selectValueSetKey = 'selectValueSetKey';
|
|
|
30
32
|
function multiSelect() {
|
|
31
33
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
34
|
return function multiSelectStep(pipeline) {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
34
36
|
|
|
35
37
|
var stateKey = 'multiSelect';
|
|
36
38
|
var Checkbox = pipeline.ctx.components.Checkbox;
|
|
@@ -107,7 +109,7 @@ function multiSelect() {
|
|
|
107
109
|
}
|
|
108
110
|
});
|
|
109
111
|
|
|
110
|
-
var checkboxColumn = (0,
|
|
112
|
+
var checkboxColumn = (0, _extends3.default)((0, _extends3.default)({
|
|
111
113
|
name: '是否选中',
|
|
112
114
|
title: defaultCheckboxColumnTitle,
|
|
113
115
|
width: 50,
|
|
@@ -171,10 +173,11 @@ function multiSelect() {
|
|
|
171
173
|
}
|
|
172
174
|
} : undefined
|
|
173
175
|
});
|
|
174
|
-
}
|
|
176
|
+
},
|
|
177
|
+
features: (0, _extends3.default)((0, _extends3.default)({}, (_l = opts.checkboxColumn) === null || _l === void 0 ? void 0 : _l.features), (0, _defineProperty2.default)({}, _utils.MULTI_SELECT_MARK_PROPNAME, true))
|
|
175
178
|
});
|
|
176
179
|
var nextColumns = (0, _slice.default)(_context = pipeline.getColumns()).call(_context);
|
|
177
|
-
var checkboxPlacement = (
|
|
180
|
+
var checkboxPlacement = (_m = opts.checkboxPlacement) !== null && _m !== void 0 ? _m : 'start';
|
|
178
181
|
|
|
179
182
|
if (checkboxPlacement === 'start') {
|
|
180
183
|
nextColumns.unshift(checkboxColumn);
|
|
@@ -21,6 +21,8 @@ export interface RowDragFeatureOptions {
|
|
|
21
21
|
rowDragColumn?: ArtColumn;
|
|
22
22
|
/** 行高 */
|
|
23
23
|
rowHeight?: number;
|
|
24
|
+
/** 拖拽过程中是否禁止滚动条滚动 */
|
|
25
|
+
suppressScrollMove?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare const ROW_DRAG_COLUMN_CODE = "$_row_drag_column_&";
|
|
26
28
|
export declare const rowDragKey = "rowDragKey";
|
|
@@ -110,6 +110,7 @@ function rowDrag(opt) {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
var updateScrollPosition = function updateScrollPosition(mouseMoveEvent) {
|
|
113
|
+
if (opt === null || opt === void 0 ? void 0 : opt.suppressScrollMove) return;
|
|
113
114
|
var clientY = mouseMoveEvent.clientY;
|
|
114
115
|
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
115
116
|
var top = tableBodyClientRect.top,
|
|
@@ -206,6 +207,7 @@ function rowDrag(opt) {
|
|
|
206
207
|
};
|
|
207
208
|
|
|
208
209
|
var rowDragColumn = (opt === null || opt === void 0 ? void 0 : opt.rowDragColumn) || defaultRowDragColumn;
|
|
210
|
+
pipeline.setFeatureOptions('rowDragColumnKey', rowDragColumn.code);
|
|
209
211
|
var nextColumns = (0, _slice.default)(_context = pipeline.getColumns()).call(_context);
|
|
210
212
|
nextColumns.unshift(rowDragColumn);
|
|
211
213
|
pipeline.columns(nextColumns);
|
|
@@ -9,7 +9,9 @@ exports.singleSelect = singleSelect;
|
|
|
9
9
|
|
|
10
10
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
13
15
|
|
|
14
16
|
var _react = _interopRequireDefault(require("react"));
|
|
15
17
|
|
|
@@ -24,7 +26,7 @@ function singleSelect() {
|
|
|
24
26
|
return function singleSelectStep(pipeline) {
|
|
25
27
|
var _context;
|
|
26
28
|
|
|
27
|
-
var _a, _b, _c, _d, _e;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
30
|
|
|
29
31
|
var Radio = pipeline.ctx.components.Radio;
|
|
30
32
|
|
|
@@ -45,7 +47,7 @@ function singleSelect() {
|
|
|
45
47
|
pipeline.setStateAtKey(stateKey, rowKey);
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
var radioColumn = (0,
|
|
50
|
+
var radioColumn = (0, _extends3.default)((0, _extends3.default)({
|
|
49
51
|
name: '',
|
|
50
52
|
width: 50,
|
|
51
53
|
align: 'center'
|
|
@@ -97,10 +99,11 @@ function singleSelect() {
|
|
|
97
99
|
onChange(rowKey);
|
|
98
100
|
} : undefined
|
|
99
101
|
});
|
|
100
|
-
}
|
|
102
|
+
},
|
|
103
|
+
features: (0, _extends3.default)((0, _extends3.default)({}, (_e = opts.radioColumn) === null || _e === void 0 ? void 0 : _e.features), (0, _defineProperty2.default)({}, _utils.SINGLE_SELECT_MARK_PROPNAME, true))
|
|
101
104
|
});
|
|
102
105
|
var nextColumns = (0, _slice.default)(_context = pipeline.getColumns()).call(_context);
|
|
103
|
-
var radioPlacement = (
|
|
106
|
+
var radioPlacement = (_f = opts.radioPlacement) !== null && _f !== void 0 ? _f : 'start';
|
|
104
107
|
|
|
105
108
|
if (radioPlacement === 'start') {
|
|
106
109
|
nextColumns.unshift(radioColumn);
|
|
@@ -17,3 +17,4 @@ export { default as layeredFilter } from './layeredFilter';
|
|
|
17
17
|
export { getEventPath, isElementInEventPath, getTargetEleInEventPath, calculatePointerRelative, calculatePopupRelative, keepWithinBounds } from './element';
|
|
18
18
|
export { default as console } from './console';
|
|
19
19
|
export { browserType } from './browserType';
|
|
20
|
+
export { MULTI_SELECT_MARK_PROPNAME, SINGLE_SELECT_MARK_PROPNAME, isSelectColumn } from './selectColumn';
|
package/lib/table/utils/index.js
CHANGED
|
@@ -5,6 +5,18 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "MULTI_SELECT_MARK_PROPNAME", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _selectColumn.MULTI_SELECT_MARK_PROPNAME;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "SINGLE_SELECT_MARK_PROPNAME", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _selectColumn.SINGLE_SELECT_MARK_PROPNAME;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
8
20
|
Object.defineProperty(exports, "applyTransforms", {
|
|
9
21
|
enumerable: true,
|
|
10
22
|
get: function get() {
|
|
@@ -107,6 +119,12 @@ Object.defineProperty(exports, "isLeafNode", {
|
|
|
107
119
|
return _isLeafNode.default;
|
|
108
120
|
}
|
|
109
121
|
});
|
|
122
|
+
Object.defineProperty(exports, "isSelectColumn", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function get() {
|
|
125
|
+
return _selectColumn.isSelectColumn;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
110
128
|
Object.defineProperty(exports, "keepWithinBounds", {
|
|
111
129
|
enumerable: true,
|
|
112
130
|
get: function get() {
|
|
@@ -192,4 +210,6 @@ var _element = require("./element");
|
|
|
192
210
|
|
|
193
211
|
var _console = _interopRequireDefault(require("./console"));
|
|
194
212
|
|
|
195
|
-
var _browserType = require("./browserType");
|
|
213
|
+
var _browserType = require("./browserType");
|
|
214
|
+
|
|
215
|
+
var _selectColumn = require("./selectColumn");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SINGLE_SELECT_MARK_PROPNAME = exports.MULTI_SELECT_MARK_PROPNAME = void 0;
|
|
7
|
+
exports.isSelectColumn = isSelectColumn;
|
|
8
|
+
var MULTI_SELECT_MARK_PROPNAME = 'checkboxSelection';
|
|
9
|
+
exports.MULTI_SELECT_MARK_PROPNAME = MULTI_SELECT_MARK_PROPNAME;
|
|
10
|
+
var SINGLE_SELECT_MARK_PROPNAME = 'radioSelection';
|
|
11
|
+
exports.SINGLE_SELECT_MARK_PROPNAME = SINGLE_SELECT_MARK_PROPNAME;
|
|
12
|
+
|
|
13
|
+
function isSelectColumn(column) {
|
|
14
|
+
var features = column.features || {};
|
|
15
|
+
return features[MULTI_SELECT_MARK_PROPNAME] === true || features[SINGLE_SELECT_MARK_PROPNAME] === true;
|
|
16
|
+
}
|