@kdcloudjs/table 1.2.0-canary.10 → 1.2.0-canary.11
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 +12 -3
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +2 -2
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/pipeline/features/autoFill.js +3 -1
- package/es/table/pipeline/features/columnDrag.js +6 -1
- package/es/table/pipeline/features/rowDrag.d.ts +2 -0
- package/es/table/pipeline/features/rowDrag.js +2 -0
- package/lib/table/pipeline/features/autoFill.js +3 -1
- package/lib/table/pipeline/features/columnDrag.js +6 -1
- package/lib/table/pipeline/features/rowDrag.d.ts +2 -0
- package/lib/table/pipeline/features/rowDrag.js +2 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -315,9 +315,14 @@ export function columnDrag() {
|
|
|
315
315
|
if (onColumnDragStopped) {
|
|
316
316
|
var _context;
|
|
317
317
|
|
|
318
|
+
var isRowDragColumn = function isRowDragColumn(code) {
|
|
319
|
+
var rowDragColumnKey = pipeline.getFeatureOptions('rowDragColumnKey');
|
|
320
|
+
return code === rowDragColumnKey;
|
|
321
|
+
};
|
|
322
|
+
|
|
318
323
|
var newColumns = _filterInstanceProperty(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (_ref) {
|
|
319
324
|
var code = _ref.code;
|
|
320
|
-
return code !== FILL_COLUMN_CODE;
|
|
325
|
+
return code !== FILL_COLUMN_CODE && !isRowDragColumn(code);
|
|
321
326
|
}); // TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
322
327
|
|
|
323
328
|
|
|
@@ -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
|
|
|
@@ -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,14 @@ function columnDrag() {
|
|
|
329
329
|
if (onColumnDragStopped) {
|
|
330
330
|
var _context;
|
|
331
331
|
|
|
332
|
+
var isRowDragColumn = function isRowDragColumn(code) {
|
|
333
|
+
var rowDragColumnKey = pipeline.getFeatureOptions('rowDragColumnKey');
|
|
334
|
+
return code === rowDragColumnKey;
|
|
335
|
+
};
|
|
336
|
+
|
|
332
337
|
var newColumns = (0, _filter.default)(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (_ref) {
|
|
333
338
|
var code = _ref.code;
|
|
334
|
-
return code !== _autoFill.FILL_COLUMN_CODE;
|
|
339
|
+
return code !== _autoFill.FILL_COLUMN_CODE && !isRowDragColumn(code);
|
|
335
340
|
}); // TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
336
341
|
|
|
337
342
|
onColumnDragStopped(columnMoved, newColumns);
|
|
@@ -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);
|