You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,20 @@ npm i directus-extension-computed-interface
20
20
1. Go to **Settings**, create a new field with type string or number.
21
21
2. In the **Interface** panel, choose **Computed** interface. There are 2 options:
22
22
1.**Template**: Similar to M2M interface, determine how the field is calculated. Learn more about syntax in the next section.
23
-
2.**Display Only**: If the field is an alias and you don't want to save to the database, enable this.
23
+
2.**Field Mode**: Choose how the value is displayed.
24
+
-**null**: Default option. Show an input with the computed value but still allow manual editing.
25
+
-**Display Only**: Show the computed value but will not save it to the database. Usually used for alias fields.
26
+
-**Read Only**: Show an input with the computed value and disallow manual editing.
27
+
3.**Prefix**: a string to prefix the computed value.
28
+
4.**Suffix**: a string to suffix the computed value.
29
+
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.
24
30
25
31
# Syntax
32
+
33
+
The template consists of 2 elements: plain strings & expressions.
34
+
- Plain strings are string literal, often used for text interpolation.
35
+
- Expressions can contains operators, other fields & numbers. They must be enclosed by `{{` and `}}`.
36
+
26
37
## Examples
27
38
Sum 2 numbers:
28
39
```
@@ -143,4 +154,3 @@ Operator | Description
143
154
144
155
# Limitation
145
156
- Cannot parse literal strings (`{{ 's' }}`).
146
-
- Cannot use relational fields (`{{ user.name }}`).
0 commit comments