Directus Extension Computed Interface screenshot

Directus Extension Computed Interface

Author Avatar Theme by Rezo labs
Updated: 10 Sep 2023
224 Stars

Perform computed value based on other fields

Categories

Overview

This product is a Directus extension that allows for the automatic calculation of field values based on other fields within the same item. It supports templating and arithmetic operations, such as concatenation, summation, subtraction, multiplication, modulo, and conversion to slug or currency. The extension can also be used as an alias field. The calculations are performed on the client side and the extension is lightweight, without the need for third-party libraries.

Features

  • Templating and arithmetic operations
  • Field value calculation based on other fields
  • Support for alias fields
  • Lightweight and no third-party libraries

Installation

To install the theme, follow these steps:

  1. Go to Settings in Directus.
  2. Create a new field with type string or number.
  3. In the Interface panel, choose Computed interface.
  4. Configure the following options:
    • Template: Determines how the field is calculated. Refer to the syntax section for more details.
    • Field Mode: Choose how the value is displayed (null, Display Only, Read Only).
    • Prefix: Specifies a string to prefix the computed value.
    • Suffix: Specifies a string to suffix the computed value.
    • Custom CSS: Allows for inline style binding to customize the appearance of the computed value.
    • Debug Mode: Used for debugging the template.
    • Compute If Empty: Computes the value if the field is empty.
    • Initial Compute: Computes the value when opening the form.
  5. Save the configuration.

Summary

This product is a Directus extension that enables the calculation of field values based on other fields within the same item. It supports a variety of arithmetic operations and templating options. The extension is lightweight and does not require the use of third-party libraries. Installation involves creating a new field with specific configurations in the Directus settings.