-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
178 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
weight: 2 | ||
title: 'Number field' | ||
--- | ||
|
||
# Number field | ||
|
||
{{< br >}} | ||
|
||
In the table page, a number field will look like this | ||
|
||
![field image](/adomin/images/models/table_number.png) | ||
|
||
In the create / edit page | ||
|
||
![edit field image](/adomin/images/models/number.png) | ||
|
||
## Config | ||
|
||
### min | ||
|
||
Optionnal, minimum value for the number | ||
|
||
### max | ||
|
||
Optionnal, maximum value for the number | ||
|
||
### step | ||
|
||
Optionnal, step to use in the HTML number input type field | ||
|
||
e.g. `0.01` if you want to allow 2 decimals | ||
|
||
By default only allows integers: `step = 1` | ||
|
||
### defaultValue | ||
|
||
Optionnal, a static number default value to show on the creation form | ||
|
||
### valueDisplayTemplate | ||
|
||
Optionnal, a string that work as a template to customize the value displayed in the table | ||
|
||
You can put whatever you want in the string as long as you put `{{value}}` somewhere | ||
|
||
e.g. `"{{value}} €"` | ||
|
||
### variant | ||
|
||
Optionnal, use a number component variant: | ||
|
||
- for now only [bitset](/adomin/docs/backend/views/models/number/bitset/) exists |
72 changes: 72 additions & 0 deletions
72
docs/content/docs/backend/views/models/number/bitset/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
weight: 1 | ||
title: 'Bitset field' | ||
--- | ||
|
||
# Bitset field | ||
|
||
{{< br >}} | ||
|
||
In the table page, a bitset number field will look like this | ||
|
||
![field image](/adomin/images/models/table_bitset.png) | ||
|
||
In the create / edit page | ||
|
||
![edit field image](/adomin/images/models/bitset.png) | ||
|
||
## Config | ||
|
||
Inside the number field config, you must pass the bitset config like this | ||
|
||
```ts | ||
{ | ||
type: 'number', | ||
// ... | ||
variant: { | ||
type: 'bitset', | ||
bitsetValues: {}, | ||
bitsetLabels: {}, | ||
} | ||
} | ||
``` | ||
|
||
### bitsetValues | ||
|
||
Values for the bitset | ||
|
||
```ts | ||
{ [K in string]: number } | ||
``` | ||
|
||
e.g. | ||
|
||
```ts | ||
{ 'DEFAULT': 0b0, 'ROLE1': 0b1, 'ROLE2': 0b10, 'ROLE3': 0b100 } | ||
``` | ||
|
||
With each number value representing a specific bit. | ||
|
||
With the example config: | ||
|
||
- ROLE1 represents the first bit of the number (the least significant bit 0b1) | ||
- ROLE2 the 2nd bit (the 2nd least significant bit 0b01) | ||
- ROLE3 the 3rd bit (the 3rd least significant bit 0b001) | ||
|
||
So if the model column value is the integer 3 (0b011) | ||
|
||
the model instance will have ROLE1 and ROLE2, but not ROLE3 | ||
|
||
### bitsetLabels | ||
|
||
Optionnal, labels for the bitset | ||
|
||
```ts | ||
{ [K in string]: string } | ||
``` | ||
|
||
e.g. | ||
|
||
```ts | ||
{ 'DEFAULT': 'Utilisateur', 'ROLE1': 'Role 1', 'ROLE2': 'Role 2', 'ROLE3': 'Role 3' } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
weight: 1 | ||
title: 'String field' | ||
--- | ||
|
||
# String field | ||
|
||
{{< br >}} | ||
|
||
In the table page, a string field will look like this | ||
|
||
![field image](/adomin/images/models/table_email.png) | ||
|
||
In the create / edit page | ||
|
||
![edit field image](/adomin/images/models/email.png) | ||
|
||
## Config | ||
|
||
### isPassword | ||
|
||
Optionnal, if true, in order to not leak the password hash, returns '\*\*\*' to the frontend. | ||
On create/update, will work as expected (run beforeSave hooks) | ||
e.g. will hash the password if your model uses the `withAuthFinder` mixin | ||
|
||
### isEmail | ||
|
||
Optionnal, if true, add basic email validation on the backend | ||
|
||
### defaultValue | ||
|
||
Optionnal, a static string default value to show on the creation form | ||
|
||
### valueDisplayTemplate | ||
|
||
Optionnal, a string that work as a template to customize the value displayed in the table | ||
|
||
You can put whatever you want in the string as long as you put `{{value}}` somewhere | ||
|
||
e.g. `"{{value}} €"` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.