Skip to content

Commit

Permalink
Publish v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
duydvu committed Dec 20, 2022
1 parent f367cf6 commit 03b088e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ npm i directus-extension-computed-interface
1. Go to **Settings**, create a new field with type string or number.
2. In the **Interface** panel, choose **Computed** interface. There are 2 options:
1. **Template**: Similar to M2M interface, determine how the field is calculated. Learn more about syntax in the next section.
2. **Display Only**: If the field is an alias and you don't want to save to the database, enable this.
2. **Field Mode**: Choose how the value is displayed.
- **null**: Default option. Show an input with the computed value but still allow manual editing.
- **Display Only**: Show the computed value but will not save it to the database. Usually used for alias fields.
- **Read Only**: Show an input with the computed value and disallow manual editing.
3. **Prefix**: a string to prefix the computed value.
4. **Suffix**: a string to suffix the computed value.
5. **Custom CSS**: an object for inline style binding. Only works with **Display Only** and **Read Only** mode. You can use this option to customize the appearance of the computed value such as font size, color, etc.

# Syntax

The template consists of 2 elements: plain strings & expressions.
- Plain strings are string literal, often used for text interpolation.
- Expressions can contains operators, other fields & numbers. They must be enclosed by `{{` and `}}`.

## Examples
Sum 2 numbers:
```
Expand Down Expand Up @@ -143,4 +154,3 @@ Operator | Description

# Limitation
- Cannot parse literal strings (`{{ 's' }}`).
- Cannot use relational fields (`{{ user.name }}`).
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "directus-extension-computed-interface",
"version": "1.2.0",
"version": "1.3.0",
"description": "Perform computed value based on other fields",
"author": {
"email": "duydvu98@gmail.com",
Expand Down

0 comments on commit 03b088e

Please sign in to comment.