Skip to content

Releases: Kreyu/data-table-bundle

v0.26.1

21 Jan 18:28
Compare
Choose a tag to compare
v0.26.1 Pre-release
Pre-release

What's Changed

This small release fixes the batch actions not working properly since 0.26.0 (#178). The URLs of the actions were not properly updated with the selected identifiers. The batch Stimulus controller was updated, therefore, remember to rebuild the assets if you're using build system.

Full Changelog: v0.26.0...v0.26.1

v0.26.0

18 Jan 14:27
Compare
Choose a tag to compare
v0.26.0 Pre-release
Pre-release

What's Changed

Caution

This release contains breaking changes and deprecations.

Breaking Changes

{# Before #}
{% block action_value %}{% endblock %}
{% block action_link_value %}{% endblock %}
{% block action_button_value %}{% endblock %} 
{% block action_form_value %}{% endblock %} 

{# After #}
{% block action_control %}{% endblock %}
{% block action_link_control %}{% endblock %}
{% block action_button_control %}{% endblock %} 
{% block action_form_control %}{% endblock %} 

This also includes custom action types with their own Twig blocks.

Deprecations

  • FormColumnType is now deprecated. No replacement available.

Features

$builder->addColumn('firstName', options: [
    'value_translation_parameters' => function (string $firstName, User $user) {
        return [...];
    },
]);
  • The column value view now contains two additional variables - itself as column and its name as name
  • Columns having TranslatableInterface as value is now automatically translated in export:
// Assume this data tables displays User entities

use Symfony\Contracts\Translation\TranslatableInterface;
use Symfony\Component\Translation\TranslatableMessage;

class User
{
    public function __construct(
        public TranslatableInterface $firstName,
    ) {
    }
}

// This column displays User's first name and is exportable
$builder->addColumn('firstName', options: ['export' => true]);

// The row displays a User of name "John"
$rowView = new ValueRowView(data: new User(firstName: new TranslatableMessage('John'));

// Then export's ColumnValueView will be like so:
$view = $column->createExportValueView($rowView);
$view->vars['data']; // object(TranslatableMessage)
$view->vars['value']; // string(4) "John"
  • The export value view now contains data variable, similar to regular value view, that represents value returned by property path or a getter option, not formatted by the formatter option:
// Assume this data tables displays User entities

use Kreyu\Bundle\DataTableBundle\ValueRowView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;

class User
{
    public function __construct(
        public string $firstName,
    ) {
    }
}

// This column displays User's first name and is exportable
$builder->addColumn('firstName', options: ['export' => true]);

// The row displays a User of name "John"
$rowView = new ValueRowView(data: new User(firstName: 'John'));

// Then export's ColumnValueView will be like so:
$view = $column->createExportValueView($rowView);
$view->vars['data']; // object(User)
$view->vars['value'] // string(4) "John"

Bug Fixes

  • The Doctrine ORM filter types now properly allows overwriting the supported operators via option - by @alexandre-castelain (#168):
$builder->addFilter('id', NumericFilterType::class, [
    'supported_operators' => [Operator::Equals, Operator::Contains],
    'operator_selectable' => true,
]);
  • The default property path inherited from column name is now properly set in column config (#148):
$builder->addColumn('firstName');

// Before:
$builder->getColumn('firstName')->getPropertyPath(); // null
$builder->getColumn('firstName')->getColumnConfig()->getPropertyPath(); // null

// After:
(string) $builder->getColumn('firstName')->getPropertyPath(); // string(9) "firstName"
(string) $dataTable->getColumn('firstName')->getConfig()->getPropertyPath(); // string(9) "firstName"
  • The default sort property path inherited from column name is now properly set in column config (#149):
$builder->addColumn('firstName', options: ['sort' => true]);

// Before:
$builder->getColumn('firstName')->getSortPropertyPath(); // null
$builder->getColumn('firstName')->getColumnConfig()->getSortPropertyPath(); // null

// After:
(string) $builder->getColumn('firstName')->getSortPropertyPath(); // string(9) "firstName"
(string) $dataTable->getColumn('firstName')->getConfig()->getSortPropertyPath(); // string(9) "firstName"
  • Setting the different column label for export is now properly respected (#147):
$builder->addColumn('name', TextColumnType::class, [
    'export' => [
        'label' => 'Full name',
    ],
]);
  • Columns now inherit the header_translation_domain and value_translation_domain options in export properly:
// Export will use column value translation domain and parameters:
$builder->addColumn('firstName', options: [
    'value_translation_domain' => 'user',
    'value_translation_parameters' => ['%first_name%' => 'John'];
]);

// This however, can be overwritten for export:
$builder->addColumn('firstName', options: [
    'value_translation_domain' => 'user',
    'value_translation_parameters' => ['%first_name%' => 'John'];
    'export' => [
        'value_translation_domain' => 'export_user',
        'value_translation_parameters' => ['%first_name%' => 'Jane'];
    ]
]);
  • Actions of the same name, but different context (global, row, batch) now use different ID of the confirmation modal:
// Assuming that the data table name is "user"
$builder
    ->addAction('foo', options: ['confirmation' => true]) 
    ->addRowAction('foo', options: ['confirmation' => true]) 
    ->addBatchAction('foo', options: ['confirmation' => true]);

Before, global and batch action confirmation modal would have the same ID: user-action-confirmation-foo, which will result in invalid HTML. Now, the IDs will be different, using the new patterns:

  • for global and batch action: [data table name]--[context]-action--[action name]--confirmation
  • for row action: [data table name]--[context]-action--[action name]--confirmation--[row index]

Therefore:

  • for global action, it will be user--global-action--foo--confirmation
  • for row action, it will be user--row-action--foo--confirmation-0, user--row-action--foo--confirmation-1... (depends on row index)
  • for batch action, it will be user--batch-action--foo--confirmation

New Contributors

Full Changelog: v0.25.7...v0.26.0

v0.25.8

14 Jan 12:01
Compare
Choose a tag to compare
v0.25.8 Pre-release
Pre-release

What's Changed

  • Fixed exception when rendering active filter with iterable value (partially fixes #151)
  • Added missing data-turbo-frame="_self" attribute to filter "clear" and "clear all" buttons

v0.25.7

29 Nov 20:16
7e78e53
Compare
Choose a tag to compare
v0.25.7 Pre-release
Pre-release

What's Changed

  • Fix missing theme variable in block calls for proper theme inheritance by @Kreyu in #154
  • Fix pagination per-page form not working properly with Turbo by @Kreyu in #155
  • Remove default ActionsColumnType priority option value for better flexibility

Full Changelog: v0.25.6...v0.25.7

v0.25.6

22 Nov 18:34
102a326
Compare
Choose a tag to compare
v0.25.6 Pre-release
Pre-release

What's Changed

  • [Docs] Fixed modal action docs by @easis in #146
  • [Bugfix] Browser back button not working properly with state Stimulus controller enabled #125

Full Changelog: v0.25.5...v0.25.6

v0.25.5

19 Nov 13:38
Compare
Choose a tag to compare
v0.25.5 Pre-release
Pre-release

What's Changed

Fixed incorrect behavior of date and date time related filters due to wrong url query parameters #145

Full Changelog: v0.25.4...v0.25.5

v0.25.4

19 Nov 12:58
a9e479c
Compare
Choose a tag to compare
v0.25.4 Pre-release
Pre-release

What's changed

Fixed DateTimeColumnType and DateColumnType throwing exceptions during export due to incorrect formatter option arguments

Full Changelog: v0.25.3...v0.25.4

v0.25.3

18 Nov 09:17
6801883
Compare
Choose a tag to compare
v0.25.3 Pre-release
Pre-release

What's Changed

Reverts 7c83d96 change that made initial data getters return null, which created unexpected issues with personalization.

Full Changelog: v0.25.2...v0.25.3

v0.25.2

14 Nov 15:13
Compare
Choose a tag to compare
v0.25.2 Pre-release
Pre-release

What's Changed

Fixes missing initial pagination data, displaying all records at once when page parameter is not given

Full Changelog: v0.25.1...v0.25.2

v0.25.1

14 Nov 10:23
Compare
Choose a tag to compare
v0.25.1 Pre-release
Pre-release

What's Changed

  • Fixed request handler to manually submit forms regardless of request method
  • Fixed "include all" export strategy not working
  • Fixed sort direction visible on non-sortable column in profiler tab
  • Fixed missing "total_count" array key in profiler tab
  • Changed data table url query parameters getter logic to accept nullable sorting data and use DataTableInterface getters instead of views
  • Changed initial pagination/sorting/filtration/personalization data getters to return null if initial nor persistence data is set

Full Changelog: v0.25.0...v0.25.1