openalloc / SwiftTabler

A multi-platform SwiftUI component for tabular data
Apache License 2.0
133 stars 13 forks source link

Support row-scoped context/swipe menu for Grid-based tables #23

Open reedes opened 2 years ago

reedes commented 2 years ago

Like Apple's own Table component for macOS, it's necessary to attach modifiers to each column, which can be inconvenient.

One way to do this is to support an 'item' modifier parameter, which will be applied to all items in a row.

reedes commented 2 years ago

Attempted to apply a .contextMenu modifier in GridItemMod without success.

func body(content: Content) -> some View {
        content
            .padding(config.itemPadding)
            .contextMenu {
                Button("aaa") {}
                Button("bbb") {}
            }
    ...
}

The resulting items do not layout as expected.

Works as expected in StackItemMod (in TablerDemo).