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

Table Component #959

Merged
merged 18 commits into from
Feb 9, 2025
Merged

Table Component #959

merged 18 commits into from
Feb 9, 2025

Conversation

SmokeyStack
Copy link
Member

This PR aims to resolve #955.

The current JSON configuration is as follow:

{
    "content": [
        {
            "column2": "Hello , World",
            "extra": "Yuip",
            "test": [
                "Stuff in the test column",
                "ylol"
            ]
        },
        {
            "column2": "Hello , World",
            "extra": "Yuip",
            "optional?": "Opt",
            "test": [
                "Stuff in the test row 2 column",
                "ylol",
                "8b83a891-7b20-4faf-931f-6976b4b8a9b28b83a891-7b20-4faf-931f-6976b4b8a9b28b83a891-7b20-4faf-931f-6976b4b8a9b28b83a891-7b20-4faf-931f-6976b4b8a9b2",
                1
            ]
        }
    ],
    "header": [
        "test",
        "column2",
        "extra",
        "optional?"
    ]
}

@QuazChick
Copy link
Collaborator

QuazChick commented Dec 16, 2024

How it looks now:

docs/assets/tables/test/my-table.json

{
  "columns": {
    "number_column": {
      "name": "Number Column",
      "text_align": "right"
    },
    "boolean_column": {
      "name": "Boolean",
      "text_align": "center",
      "default": false
    },
    "my_other_column": {
      "name": "Another Column"
    }
  },
  "rows": [
    {
      "number_column": 1,
      "my_other_column": "Aute incididunt proident incididunt ullamco [...]",
      "boolean_column": true
    },
    {
      "boolean_column": false,
      "number_column": 2,
      "my_other_column": "Proident amet id ut exercitation. Do esse [...]"
    },
    {
      "number_column": 3,
      "boolean_column": false,
      "my_other_column": [
        "Proident amet id ut exercitation.",
        "Do esse exercitation eiusmod Lorem incididunt exercitation esse fugiat Lorem et.",
        "Magna eu ex excepteur qui est consectetur nostrud dolor ea est."
      ]
    }
  ]
}

docs/test.md

## Tables

<Table data="my-table.json" />

@Xterionix
Copy link
Contributor

What's stopping thing from not being a draft?

@SmokeyStack
Copy link
Member Author

What's stopping thing from not being a draft?

That would be me. I haven't been around to really take a poke at this and have it in a state where it can be merged at any time. I really want to nail the JSON schema first and try to port some existing tables(such as the Block Tags) to this new component.

let path = "docs/public";

if (props.data[0] !== "/") {
path += "/assets/tables/" + page.value.relativePath.replace(/\.md$/, "/");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can somehow make the tables use an identifier? that way if we move things around, existing pages that reference the table just use the identifier.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like identifiers would end up being similar to the file path so it could get a bit repetitive. With the folder structure being enforced how it currently is, it makes finding tables included in a page easier since you can just go to assets/<page>/*.json

@SmokeyStack SmokeyStack marked this pull request as ready for review February 2, 2025 16:12
@QuazChick
Copy link
Collaborator

The sortable parameter can now be added to columns, allowing rows to be sorted by the value of that column. Toggles between ascending/descending/initial order.

Sortable columns may not include arrays (bullet-point lists).

image

@QuazChick QuazChick merged commit 0166396 into wiki Feb 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Component for Tables
3 participants