hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

Ability to move/modify cells for array values.

Open MartinDawson opened this issue 3 years ago • 4 comments

Here's the unit test that specifies this isn't allowed:

  it('should not be possible to move cells to area with matrix', () => {
    const [engine] = HyperFormula.buildFromArray({ cells: [
      [{ cellValue: '1' }, { cellValue: '2' }],
      [{ cellValue: '=TRANSPOSE(A1:B1)' }],
    ]})

    expect(() => {
      engine.moveCells(AbsoluteCellRange.spanFrom(adr('A1'), 2, 1), adr('A2'))
    }).toThrowError('Cannot perform this operation, target location has an array inside.')
  })

Google sheets allows this and there's no real reason to not allow it imo so it would be a good feature.

For example when you do a cut/paste it doesn't work on array cells.

MartinDawson avatar Jan 21 '22 15:01 MartinDawson

I think this is actually a bug and not a feature. @warpech Could this issue label be changed please to 'bug'?

Because it's correct that users cannot copy/cut paste child array cells but the topLeft most cell should be allowed to be moved.

I think we might pick this bug up soon cause it's quit annoying for users to not be able to do this on arrays.

MartinDawson avatar Feb 06 '22 11:02 MartinDawson

This error was explicitly added in a commit very early on https://github.com/handsontable/hyperformula/commit/6648a23566a1a807efe972e802db62c3b469ae78. My best guess is that the reason was that it requires some additional deoptimization, but I am not sure. We will check.

warpech avatar Feb 07 '22 21:02 warpech

@MartinDawson I can confirm it's a bug. moveCells should allow overriding the array formulas by moving content into the top-left corner of an array.

sequba avatar Feb 18 '22 12:02 sequba

Related: #131

sequba avatar Sep 29 '22 13:09 sequba