Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app-headless-cms): set list entries fields using ACO config #4388

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

leopuleo
Copy link
Contributor

@leopuleo leopuleo commented Nov 14, 2024

Changes

With this PR, we are refactoring the way we set the fields while listing entries to present in the list table.

Before:

We include all simple fields: "text", "number", "boolean", "file", "long-text", "ref", "datetime".

Now:

We also include fields coming from ACO columns configs, including complex fields such as object and dynamicZone -> Documentation.

The current table column configurations can stay the same, utilizing the name property as the field identifier. Additionally, we are introducing a new fieldIds property that accepts an array of explicitly defined field IDs. This feature will enable developers to create custom cell renderers based on data from other fields.

In the future:

We can remove the default simple fields. However, this change could disrupt existing customizations, as developers might have created or wish to create custom column renderers using these fields without necessarily displaying them in a visible column. (Documentation).

Example

<ContentEntryListConfig>
    {/* Object field with nested fields */}
    <Browser.Table.Column
        name={"address"}
        header={"Street"}
        cell={<AddressCell />}
        modelIds={["article"]}
    />
    {/* Number field */}
    <Browser.Table.Column 
        name={"order"} 
        header={"Order"} 
        modelIds={["article"]} 
    />
    {/* Multiple fieldIds defined using `fieldIds` property */}
    <Browser.Table.Column
        name={"scheduledDate"}
        header={"Scheduled"}
        modelIds={["article"]}
        fieldIds={["scheduledDate", "published"]}
        cell={<ScheduledCell />}
    />
    {/* Dynamic zone field */}
    <Browser.Table.Column
        name={"hero"}
        header={"Hero"}
        modelIds={["article"]}
        cell={<HeroColumn />}
    />
    {/* Column defined with `name` property as a not existing field */}
    <Browser.Table.Column
        name={"notExistingField"}
        header={"Not Existing Field"}
        modelIds={["article"]}
    />
</ContentEntryListConfig>

CleanShot 2024-11-15 at 16 14 24@2x

How Has This Been Tested?

Manually

@leopuleo leopuleo force-pushed the leo/fix/list-entries-using-columns-configs branch from 8c2704e to 5c0f585 Compare November 14, 2024 19:18
@leopuleo leopuleo self-assigned this Nov 15, 2024
@webiny-bot webiny-bot added this to the 5.41.2 milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants