@@ -174,6 +174,7 @@ export function updateSelectPosition(
174174 state . select . ranges = [ ] ;
175175 scenegraph . deleteAllSelectBorder ( ) ;
176176 }
177+
177178 if ( state . select . headerSelectMode !== 'cell' && table . isColumnHeader ( col , row ) ) {
178179 // 选中行表头
179180 const cellRange = table . getCellRange ( col , row ) ;
@@ -210,7 +211,8 @@ export function updateSelectPosition(
210211 // 选中表头行号单元格
211212 extendSelectRange = false ;
212213
213- if ( state . select . headerSelectMode === 'body' ) {
214+ const { cornerHeaderSelectMode } = state . select ;
215+ if ( cornerHeaderSelectMode === 'body' ) {
214216 state . select . ranges . push ( {
215217 start : {
216218 col : table . leftRowSeriesNumberCount ,
@@ -219,13 +221,46 @@ export function updateSelectPosition(
219221 end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
220222 skipBodyMerge : true
221223 } ) ;
224+ } else if ( cornerHeaderSelectMode === 'inline' ) {
225+ // inline 选中行号所在单元格下所有列
226+ const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
227+ state . select . ranges . push ( {
228+ start : { col : cellRange . start . col , row : cellRange . start . row } ,
229+ end : { col : cellRange . end . col , row : table . rowCount - 1 } ,
230+ skipBodyMerge : true
231+ } ) ;
232+ } else if ( cornerHeaderSelectMode === 'cell' ) {
233+ // 选中行号单元格
234+ const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
235+ state . select . ranges . push ( {
236+ start : { col : cellRange . start . col , row : cellRange . start . row } ,
237+ end : { col : cellRange . end . col , row : cellRange . end . row } ,
238+ skipBodyMerge : skipBodyMerge || undefined
239+ } ) ;
222240 } else {
223241 state . select . ranges . push ( {
224242 start : { col : 0 , row : 0 } ,
225243 end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
226244 skipBodyMerge : true
227245 } ) ;
228246 }
247+ // 旧逻辑
248+ // if (state.select.headerSelectMode === 'body') {
249+ // state.select.ranges.push({
250+ // start: {
251+ // col: table.leftRowSeriesNumberCount,
252+ // row: table.columnHeaderLevelCount
253+ // },
254+ // end: { col: table.colCount - 1, row: table.rowCount - 1 },
255+ // skipBodyMerge: true
256+ // });
257+ // } else {
258+ // state.select.ranges.push({
259+ // start: { col: 0, row: 0 },
260+ // end: { col: table.colCount - 1, row: table.rowCount - 1 },
261+ // skipBodyMerge: true
262+ // });
263+ // }
229264 } else if ( ( table . internalProps . layoutMap as SimpleHeaderLayoutMap ) . isSeriesNumberInBody ( col , row ) ) {
230265 // 选中内容行号单元格
231266 extendSelectRange = false ;
@@ -249,7 +284,8 @@ export function updateSelectPosition(
249284 // 选中表头行号单元格
250285 extendSelectRange = false ;
251286 const { cornerHeaderSelectMode } = state . select ;
252- if ( state . select . headerSelectMode === 'body' || cornerHeaderSelectMode === 'body' ) {
287+
288+ if ( cornerHeaderSelectMode === 'body' ) {
253289 state . select . ranges . push ( {
254290 start : {
255291 col : table . rowHeaderLevelCount + table . leftRowSeriesNumberCount ,
@@ -258,40 +294,41 @@ export function updateSelectPosition(
258294 end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
259295 skipBodyMerge : true
260296 } ) ;
297+ } else if ( cornerHeaderSelectMode === 'cell' ) {
298+ // 选中普通单元格
299+ const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
300+ state . select . ranges . push ( {
301+ start : { col : cellRange . start . col , row : cellRange . start . row } ,
302+ end : { col : cellRange . end . col , row : cellRange . end . row } ,
303+ skipBodyMerge : skipBodyMerge || undefined
304+ } ) ;
305+ } else if ( cornerHeaderSelectMode === 'inline' ) {
306+ // inline
307+ const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
308+ state . select . ranges . push ( {
309+ start : { col : cellRange . start . col , row : cellRange . start . row } ,
310+ end : { col : cellRange . end . col , row : table . rowCount - 1 } ,
311+ skipBodyMerge : true
312+ } ) ;
313+ } else if ( cornerHeaderSelectMode === 'all' ) {
314+ // all 或者用户传的其他的什么值 :'' | 'test',虽然类型会提示用户不能为其他的值,
315+ state . select . ranges . push ( {
316+ start : {
317+ col : table . leftRowSeriesNumberCount ,
318+ row : 0
319+ } ,
320+ end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
321+ skipBodyMerge : true
322+ } ) ;
261323 } else {
262- if ( cornerHeaderSelectMode === 'cell' ) {
263- // 选中普通单元格
264- const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
265- state . select . ranges . push ( {
266- start : { col : cellRange . start . col , row : cellRange . start . row } ,
267- end : { col : cellRange . end . col , row : cellRange . end . row } ,
268- skipBodyMerge : skipBodyMerge || undefined
269- } ) ;
270- } else if ( cornerHeaderSelectMode === 'inline' ) {
271- // inline
272- const cellRange = skipBodyMerge ? { start : { col, row } , end : { col, row } } : table . getCellRange ( col , row ) ;
273- state . select . ranges . push ( {
274- start : { col : cellRange . start . col , row : cellRange . start . row } ,
275- end : { col : cellRange . end . col , row : table . rowCount - 1 } ,
276- skipBodyMerge : true
277- } ) ;
278- } else {
279- // all 或者用户传的其他的什么值 :'' | 'test',虽然类型会提示用户不能为其他的值,
280- state . select . ranges . push ( {
281- start : {
282- col : table . leftRowSeriesNumberCount ,
283- row : 0
284- } ,
285- end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
286- skipBodyMerge : true
287- } ) ;
288- }
289- // 选中全部
290- // state.select.ranges.push({
291- // start: { col: table.leftRowSeriesNumberCount, row: 0 },
292- // end: { col: table.colCount - 1, row: table.rowCount - 1 },
293- // skipBodyMerge: true
294- // });
324+ state . select . ranges . push ( {
325+ start : {
326+ col : table . leftRowSeriesNumberCount ,
327+ row : 0
328+ } ,
329+ end : { col : table . colCount - 1 , row : table . rowCount - 1 } ,
330+ skipBodyMerge : true
331+ } ) ;
295332 }
296333 } else if ( col >= 0 && row >= 0 ) {
297334 // 选中普通单元格
0 commit comments