aspire icon indicating copy to clipboard operation
aspire copied to clipboard

Replace data grid column headers with custom template

Open adamint opened this issue 1 year ago • 1 comments

Description

@vnbaaij graciously added the ability to resize columns via a UI to fluentui-blazor. However, this is done by adding a button to the column header cell, space which adds up when there are many columns in a grid. For example, image

We are still required to have some way to toggle this UI, so I created two wrapper classes FluentTemplateColumn and FluentPropertyColumn which set the header cell template to a button that, when clicked, opens a menu allowing the user to select between Sort and Resize - this UI concept is taken directly from the accessible data grid example provided here. The button is not a MenuButton because we do not want to show the chevron (again, for space reasons).

The resize ui (column options ui) is toggled if a cell is clicked that is not sortable, as can be seen in the recording below. Most changes are Property/TemplateColumn -> AspireProperty/TemplateColumn

https://github.com/user-attachments/assets/3a4bda73-c20d-4789-88ff-f6728dcf75cf

Fixes #3364, fixes #3365

Checklist

  • Is this feature complete?
    • [X] Yes. Ready to ship.
    • [ ] No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • [ ] Yes
    • [X] No
  • Did you add public API?
    • [ ] Yes
      • If yes, did you have an API Review for it?
        • [ ] Yes
        • [ ] No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • [ ] Yes
        • [ ] No
    • [X] No
  • Does the change make any security assumptions or guarantees?
    • [ ] Yes
      • If yes, have you done a threat model and had a security review?
        • [ ] Yes
        • [ ] No
    • [X] No
  • Does the change require an update in our Aspire docs?
    • [ ] Yes
      • Link to aspire-docs issue:
    • [X] No

adamint avatar Aug 12 '24 15:08 adamint

@dvoituron should we perhaps consider this to be our default behavior as well?

vnbaaij avatar Aug 12 '24 16:08 vnbaaij

The context menu sometimes appears on the right of the column instead of the left:

context-menu-position

JamesNK avatar Aug 13 '24 06:08 JamesNK

The curved arrow button feels confusing. It seems to be a reset button, yes?

image

Should it only be enabled when there is a value to reset? Otherwise, people will click on it and not see any change. Also, clicking the tick button closes the popup. I think that clicking the reset button should close the dialog as well.


Edit: I think this feedback can be ignored if we go with +/- buttons. See below.

JamesNK avatar Aug 13 '24 07:08 JamesNK

I'm curious if there was a reason why you chose a text box compared to + and - buttons like FluentUI?

image

https://www.fluentui-blazor.net/DataGrid

It is easier to find the size you want by tapping those buttons compared to guessing with a pixel number.

JamesNK avatar Aug 13 '24 07:08 JamesNK

Discussion here indicates +/- are ok.

JamesNK avatar Aug 13 '24 07:08 JamesNK

The curved arrow button feels confusing. It seems to be a reset button, yes?

image

Should it only be enabled when there is a value to reset? Otherwise, people will click on it and not see any change. Also, clicking the tick button closes the popup. I think that clicking the reset button should close the dialog as well.


Edit: I think this feedback can be ignored if we go with +/- buttons. See below.

Yes, it is a reset button (same as Shift+r key). I don't think we have a mechanism yet to determine if any changes have been made. Agree on reset closing the dialog.

vnbaaij avatar Aug 13 '24 08:08 vnbaaij

I'm curious if there was a reason why you chose a text box compared to + and - buttons like FluentUI?

image

https://www.fluentui-blazor.net/DataGrid

It is easier to find the size you want by tapping those buttons compared to guessing with a pixel number.

We offer both as options for resizing. It is controlled by the ResizeType parameter

vnbaaij avatar Aug 13 '24 08:08 vnbaaij

@dvoituron should we perhaps consider this to be our default behavior as well?

Yes, I find it preferable to have a minimum of visual information on the grid headers. And it will look more like FluentUI React.

dvoituron avatar Aug 13 '24 08:08 dvoituron

I'm curious if there was a reason why you chose a text box compared to + and - buttons like FluentUI?

https://www.fluentui-blazor.net/DataGrid

It is easier to find the size you want by tapping those buttons compared to guessing with a pixel number.

Should it only be enabled when there is a value to reset? Otherwise, people will click on it and not see any change. Also, clicking the tick button closes the popup. I think that clicking the reset button should close the dialog as well.

We don't own that resize UI. That's provided from fluentui-blazor. I changed it to Discrete, but @vnbaaij should we just open issues for the display of that UI?

adamint avatar Aug 14 '24 20:08 adamint

The context menu sometimes appears on the right of the column instead of the left:

context-menu-position context-menu-position

I couldn't see how that behavior is anything but a bug in fluentui. I've been trying to figure it out, even setting the horizontal position explicitly to left or start doesn't change it. @vnbaaij for confirmation

However, if there's no easy resolution, since this isn't a blocking bug - whereas we are on strict timelines for accessibility sev2s - we could still merge.

adamint avatar Aug 14 '24 20:08 adamint

Agree that it's not a blocking bug. But please create an issue in the fluentui repo.

JamesNK avatar Aug 15 '24 00:08 JamesNK

/azp run

adamint avatar Aug 15 '24 18:08 adamint

/azp run

adamint avatar Aug 15 '24 22:08 adamint

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 15 '24 22:08 azure-pipelines[bot]

/azp run

adamint avatar Aug 16 '24 02:08 adamint

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 16 '24 02:08 azure-pipelines[bot]

Build failed with a timeout of 100 seconds on downloading a file:

##[error].packages/microsoft.net.runtime.workloadtesting.internal/9.0.0-preview.5.24272.3/Sdk/WorkloadTesting.Core.targets(82,5): error MSB3923: (NETCORE_ENGINEERING_TELEMETRY=Build) Failed to download file "https://dot.net/v1/dotnet-install.sh". The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing. ---> A task was canceled. ---> A task was canceled.

/azp run

drewnoakes avatar Aug 16 '24 03:08 drewnoakes

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 16 '24 03:08 azure-pipelines[bot]