Giter Site home page Giter Site logo

dcasia / expandable-table-row Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 2.0 1.08 MB

Provides an easy way to append extra data to each row of your resource tables.

License: MIT License

JavaScript 38.52% CSS 0.43% Vue 42.49% PHP 18.56%
expandable laravel nova4 table

expandable-table-row's Introduction

Expandable Table Row

Latest Version on Packagist Total Downloads License

Expandable Table Row in Action

Provides an easy way to append extra data to each row of your resource tables.

Installation

You can install the package via composer:

composer require digital-creative/expandable-table-row

Basic Usage

To use the new functionality, all you need to do is add the ->expandableRowData() method to your field definition and return any class that extends Nova Field or an array of fields.

class UserResource extends Resource
{
    public function fields(NovaRequest $request): array
    {
        return [
            //...
            Text::make('First Name')->expandableRowData(function () {
                return [
                    Line::make(null)->displayUsing(fn () => 'Name')->asSubTitle(),
                    Text::make('Full Name', fn (User $user) => sprintf('%s %s',$user->first_name, $user->last_name))->copyable(),
                    Text::make('Email')->copyable(),
                ];
            }),
    
            Text::make('Last Name')->expandableRowData(function () {
                return [
                    Line::make(null)->displayUsing(fn () => 'Address')->asSubTitle(),
                    Text::make('Country'),
                    Text::make('Address', fn (User $user) => sprintf(
                        '%s, %s, %s - %s', $user->city, $user->state, $user->address, $user->zipcode
                    ))->copyable(),
                ];
            }),
            //...          
        ];
    }
}

Settings

You can configure several options by using ->expandableRowOptions(). Below, you'll find an explanation of each.

public function fields(NovaRequest $request): array
{
    return [
        Text::make('...')->expandableRowOptions([
            'span' => 2, // This makes the metadata take X much more columns.
            'expanded_by_default' => true, // This makes the table row start expanded by default.
            'preallocate_column_width' => true, // This will avoid the table column shifting when expanding / collapsing.
        ]),
    ];
}

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

Other Packages You Might Like

License

The MIT License (MIT). Please see License File for more information.

expandable-table-row's People

Contributors

milewski avatar scramatte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

expandable-table-row's Issues

Compatiblity between expandable-table-row and nova-sortable

Hi,

Please find my patch here
https://github.com/operativeit/nova-sortable

And for expandable-table-row I've send you a PR

What I would like to comment with you as I follow your way to minimize component overriding is if you know how can we add
draggable component programmatically.

Basically what I've done is move draggable on table tag itself, wrap each tr into tbody and append index property as it's necessary to sort list correctly. Without this property the reorder is incorrect as draggable reporta incorrect index ( it lookup to all html children including thead or any other markup).

Please take a look to the code and if you know a way to remove the last override.

Regards

Unable to rebuild locally

Hello,

To debug my problem, I've forked your repository, but I'm unable to "npm run watch" , command returns me an error


ERROR in ./resources/js/components/Toggler.vue?vue&type=style&index=0&id=9bfe4bfa&lang=scss (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/Toggler.vue?vue&type=style&index=0&id=9bfe4bfa&lang=scss)
Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module 'tailwindcss/defaultTheme'
Require stack:

Any idea?

Feature request: colspan

Hello,

Can you add a feature to colspan to whole row or between fields with expandableData ?
Regards

Span problem and Stack field problem.

Trying to use span option and what I see: If span is set up as 1, all works fine, but starts from 2 there is a problem on the right side of the table.

Screen Shot 2023-10-19 at 08 10 34

Also I have a Stack fields and looks like for this type of field package does not work.

Nova 4 compatibility?

Hello,

I've installed this package on my Nova 4 but I don't see any change on the index page.
Can you give me an hand?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.