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

feat: adding renderer #3

Merged
merged 10 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .gitlab-ci.yml

This file was deleted.

19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can provide Datatable native configuration in the main object. It works prop

If you want more info about the base configuration, please refer to the official documentation.

If you want to add the specific Lyxea custom object, you need to add the key `lxConfig`.
If you want to add the specific Lyxea custom object, you need to add the key `lxConfig`. Then you can add your own custom configuration depend on your needs.

The following sections are dedicated to this configuration.

Expand Down Expand Up @@ -146,6 +146,23 @@ If you want to add an action on each row of the datatable, we need to implement

To do it, simply add the key `actions` on the LyxaDatatable specific config object.

### Renderer

| name | description | example |
| ------------------ | ------------------------------------------------------------------------------------------ | ---------------------------------------------------- | --- | --- |
| DATE*TO_FORMAT* | parse date to defined format | {render: 'DATE_TO_FORMAT_YYYY'} => '2024' |
| DATE | parse date to predefined date format | '23/04/2024 12:23' |
| DATE_DAY | parse date with year, month and day only | '23/04/2024' |
| DATE_WITH_SECOND | parse date to predefined date format | '23/04/2024 12:23:34' |
| LOCAL_NUMBER | parse number to string with correct format | 1300 => '1 300' |
| BOOLEAN_YESNO | return a string 'Yes' / 'No' depend on the bool value | true => "Yes" or false => "No" |
| NUMBER_FIXED_2 | fix the number value to two digit | 1.3443 => 1.34, 1 => 1.00 |
| NUMBER_2_DIGIT_MAX | fix the number value to two digit max | 1.3443 => 1.34, 1 => 1 |
| CUT_LONG_TEXT | In case of a long text, prevent the overflow by cutting the text and replace it with '...' | "a very long text" => "a very ..." |
| PARSE_INT | parse a string to integer | "3" => 3 |
| CHECKBOX | add a checkbox at the first columns of the table | |
| UPPERCASE | convert a string to uppercase | "this must be uppercase" => "THIS MUST BE UPPERCASE" | | |

## Architecture

### Project structure
Expand Down
5 changes: 5 additions & 0 deletions dist/dto/Renderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ export type RendederConfig = {};
declare class LxRenderer {
renderers: Array<RendederConfig>;
constructor(config: LxConfigObject);
number2DigitMax(data: any | null): any;
booleanString: (data: boolean) => "Oui" | "Non";
cutLongText: (data: any) => any;
uppercase: (data: any) => any;
numberToFixed: (data: any) => string | undefined;
}
export default LxRenderer;
Loading
Loading