DataTable Vue Components with a Bulma implementation over a renderless core
Can be used outside of the Enso ecosystem.
For live examples and demos, you may visit laravel-enso.com
Should be used with its backend sibling
# InstallationInstall the package:
(within Enso, remember to cd
into the client
folder before installing front-end assets)
Note that this package has a couple of external dependencies. Read here for more info.
# Exports@enso-ui/tables/bulma
:
EnsoTable
,VueTable
,@enso-ui/tables/renderless
:
CoreTable
,Import the following in a main js file:
Then in any given page import the component:
And then use it within your page:
# Within EnsoEnso comes with a series of defaults and conventions, and there are Enso specific versions of some components that make use of these conventions so you add as little as possible configuration.
Import the Enso version of the component:
Use the component in your page:
If you're following conventions, the table component will try to determine the endpoint's path by using the current page's path as well as assuming the path's suffix will be initTable
.
Of course, you can still manually specify and thus overwrite this determined path:
There's also the route()
helper available, so instead of the above you can also use it in combination with named routes:
This is the renderless version of the component that can be built upon to create your own custom version.
# PropserrorHandler
- function
- used to handle axios errors
filters
- object
- a filters object that is sent to the back-end to filter the results
id
- string
, required, an identifier for the table component, required for caching this table's preferences/settings
intervals
- object
, optional - an interval filters object that is sent to the back-end to filter the results. Note that if the interval is a date, in addition to the min
and max
values for a given interval, you must also give the dateFormat
parameter, with the date format to be used for example intervals
can look like this:
If using within Enso, you may forgo specifying a format, and can set the dateFormat
attribute as null
, in which case, the back-end component will use the global Enso format, from the configuration file (config('enso.config.dateTimeFormat')
).
Note that even if null, you're still required to specify the dateFormat
attribute for date intervals.
i18n
, function
, optional - the function that handles localisation
params
- object
, optional - a params object that may be used on the back-end to perform additional, custom, operations
initParams
- object
, optional - a params object that may be used on the back-end during the init phase
path
- string
, required - the URI path used to fetch the table template.
ready
- when the component is initialized after fetching its template, BEFORE fetching the actual table datafetching
- just before making the request to fetch the table datafetched
- when the table data has been fetchedclicked
- when clicking on a clickable
columnreset
- when clicking the reset buttonVarious other user events may be emitted depending on the configured template.
# VueTableThis is the main bulma styled component and it is built upon the renderless component renderless/VueTable.vue
.
All the props from CoreTable
can be provided here
slot
attribute in their meta, in the template, then a scoped slot is rendered for each of these columns. The name of the slot is the column's name. The slot exposes the row
& column
objects'preview'
Is designed to be used within the Enso ecosystem, requiring minimal configuration from the dev.
Example:
# PropsAll the props from VueTable
can be provided here
The custom slots from VueTable
are available here
In order for a column to be sortable, it needs to be marked in the template as such ('sortable'
);
Once the columns are configured as searchable, when you want to sort using a certain column, it is enough to click the column's header.
Once a sorting has been applied, there will be a small 'x' button visible which you can use to cancel the sorting.
You may also use the reset button to clear all the table customizations including sorting and reload the template.
# FilteringIn order to filter using a string of text, you may start typing in the search input.
All columns marked in the template as 'searchable'
(even those marked as 'notVisible'
or 'rogue'
) will be used for filtering. The search type is WHERE ... OR ...
.
For a brief example the following string abc will be used as search value. By default, there are five search modes available:
'startsWith'
- starting with the searched text (represented with ab*)'endsWith'
- ending with the searched text (represented with *ab)'exactMatch'
(represented with abc)'full'
- containing the searched text (represented with *a*)'doesntContain'
(represented with abc).
'doesntContain'
search mode. So if there is a row that contains string "abc" and all the other fields are empty, then it will be considered that all row data cells (in this case just one) contain the string and thus the row will be excluded.Also, the default search mode is to look for attributes starting with the searched text as it's faster than 'full'
and more useful than 'exactMatch'
.
In the interface, if you want to switch between the search modes, you can use the button that appears to the right side of the search input, once you've typed something.
The button can show a maximum of three characters. To indicate the mode you're in, it will display either 3 letters of whatever you've typed or 1-2 letters, replacing the remaining space with asterisk wildcard (*
). Ex: if the search word is "abc", the button will be illustrated like: "ab*", "*ab", "abc" "*a*", "abc".
The search filter is case-insensitive.
The available modes as well as the default mode can be customized in the tables
config.
Once the mode has been changed in the interface, the preferences are saved in the browser's local storage.
If you want to remove the search filtering, clear the search input.
You may also use the reset button to clear all the table customizations including searching and reload the template.
# Advanced FilteringBeyond the automatic filtering available out of the box, the VueJS component takes a set parameters which you can use on the back-end to customize the query:
Intervals are meant for applying date/dateTime restrictions on your results, are applied automatically and should respect table and column names:
Please take a look at the CoreTable parameters section above for more information on the value of dateFormat
.
Filters are meant for applying generic restrictions on your results, are applied automatically and should also respect table and column names:
Params are meant for building custom logic restrictions on your results and are NOT applied automatically. As such the parameter structure and attribute names depend on your choices.
The parameters object will be made available in your table builder specific methods. Please be sure to read the advanced usage section of the documentation for more information.
# Table Init Sample ResponseBelow is the response from the back-end when the table is initialized. The sample is taken from the https://www.laravel-enso.com/system/menus/ index page.
# Table Data Sample ResponseBelow is the response given by the backend when searching for something via the search input.
# Questions & IssuesFor questions and support please use the issues functionality for this package's github repository.
Please make sure to search for existing issues before creating a new issue, and when opening a new issue, fill the required information in the issue template.
Issues not conforming to the guidelines may be closed immediately.
# Contributionsare welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!
# LicenseRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4