@genesislcap/expression-builder 14.260.1 → 14.260.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +145 -139
- package/dist/dts/config/combinators.d.ts +14 -3
- package/dist/dts/config/combinators.d.ts.map +1 -1
- package/dist/dts/main/expression-builder.d.ts +111 -2
- package/dist/dts/main/expression-builder.d.ts.map +1 -1
- package/dist/dts/types/public.types.d.ts +206 -43
- package/dist/dts/types/public.types.d.ts.map +1 -1
- package/dist/dts/utils/formatting.d.ts +8 -4
- package/dist/dts/utils/formatting.d.ts.map +1 -1
- package/dist/esm/config/combinators.js +14 -3
- package/dist/esm/main/expression-builder.js +40 -2
- package/dist/esm/utils/formatting.js +8 -4
- package/dist/expression-builder.api.json +1156 -2
- package/dist/expression-builder.d.ts +339 -52
- package/docs/api/expression-builder.config.base_logical_combinators.md +16 -0
- package/docs/api/expression-builder.config.logical_combinators.md +16 -0
- package/docs/api/expression-builder.config.md +8 -0
- package/docs/api/expression-builder.config.null_combinator.md +18 -0
- package/docs/api/expression-builder.expressionbuilder.config.md +61 -0
- package/docs/api/expression-builder.expressionbuilder.dispatchchangeevent.md +31 -0
- package/docs/api/expression-builder.expressionbuilder.md +40 -0
- package/docs/api/expression-builder.expressionbuilder.model.md +35 -0
- package/docs/api/expression-builder.expressionbuilder.styles.md +39 -0
- package/docs/api/expression-builder.formatdatestring.md +18 -0
- package/docs/api/expression-builder.formatdatetimestring.md +18 -0
- package/docs/api/expression-builder.md +13 -0
- package/docs/api/expression-builder.types._operator.md +23 -0
- package/docs/api/expression-builder.types.binaryoperator.md +20 -0
- package/docs/api/expression-builder.types.checkboxinput.md +19 -0
- package/docs/api/expression-builder.types.combinator.md +29 -0
- package/docs/api/expression-builder.types.config.md +25 -0
- package/docs/api/expression-builder.types.customelements.md +47 -0
- package/docs/api/expression-builder.types.customstyles.md +32 -0
- package/docs/api/expression-builder.types.dateinput.md +20 -0
- package/docs/api/expression-builder.types.datetimeinput.md +20 -0
- package/docs/api/expression-builder.types.field.md +24 -0
- package/docs/api/expression-builder.types.fieldtypes.md +18 -0
- package/docs/api/expression-builder.types.group.md +49 -0
- package/docs/api/expression-builder.types.md +26 -0
- package/docs/api/expression-builder.types.numberinput.md +20 -0
- package/docs/api/expression-builder.types.operator.md +18 -0
- package/docs/api/expression-builder.types.rule.md +45 -0
- package/docs/api/expression-builder.types.selectinput.md +20 -0
- package/docs/api/expression-builder.types.styles.md +25 -0
- package/docs/api/expression-builder.types.ternararyoperator.md +20 -0
- package/docs/api/expression-builder.types.textinput.md +20 -0
- package/docs/api/expression-builder.types.uniraryoperator.md +22 -0
- package/docs/api/expression-builder.types.variadicoperator.md +20 -0
- package/docs/api-report.md +29 -34
- package/package.json +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [ExpressionBuilder](./expression-builder.expressionbuilder.md) > [config](./expression-builder.expressionbuilder.config.md)
|
|
4
|
+
|
|
5
|
+
## ExpressionBuilder.config property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
config - `Types.Config` the configuration which is required to be set for the expression builder. All properties are defined under this single object to enforce that they're kept in sync with one another.
|
|
11
|
+
|
|
12
|
+
If you want to set the expression of the expression builder you should do it via the `model` property on this object.
|
|
13
|
+
|
|
14
|
+
If you're using a child class of this component with a specific model implementation you likely \*don't\* want to set this property directly. See example 3.
|
|
15
|
+
|
|
16
|
+
**Signature:**
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
config: Config;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example 1
|
|
23
|
+
|
|
24
|
+
Configuring the basic elements required by an expression builder instance
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const config: Types.Config = {
|
|
28
|
+
fields: ...,
|
|
29
|
+
combinators: ...,
|
|
30
|
+
operators: ...,
|
|
31
|
+
};
|
|
32
|
+
document.querySelector('expression-builder').config = config;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Example 2
|
|
36
|
+
|
|
37
|
+
Configuring the basic elements required by an expression builder instance, as well as inputting a model to hydrate
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const config: Types.Config = {
|
|
41
|
+
fields: ...,
|
|
42
|
+
combinators: ...,
|
|
43
|
+
operators: ...,
|
|
44
|
+
model: ...,
|
|
45
|
+
};
|
|
46
|
+
document.querySelector('expression-builder').config = config;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Example 3
|
|
50
|
+
|
|
51
|
+
You may create your own child of the expression builder which automatically defines some of the properties, such as creating a rule builder which defines boolean operators and combinators. In this case you should use your own property name, and on change apply the user and your configurations back to the config property.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const config: MyTypes.RuleConfig = {
|
|
55
|
+
operators: ...,
|
|
56
|
+
};
|
|
57
|
+
// In the implementation of RuleExpressionBuilder it should listen to ruleConfigChanged and
|
|
58
|
+
apply the missing combinators and opreators back to the config along with the user's configuration
|
|
59
|
+
document.querySelector('rule-expression-builder').ruleConfig = config;
|
|
60
|
+
```
|
|
61
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [ExpressionBuilder](./expression-builder.expressionbuilder.md) > [dispatchChangeEvent](./expression-builder.expressionbuilder.dispatchchangeevent.md)
|
|
4
|
+
|
|
5
|
+
## ExpressionBuilder.dispatchChangeEvent() method
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Dispatches the provided model to the DOM.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
protected dispatchChangeEvent(group: Group): void;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type | Description |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| group | [Group](./expression-builder.types.group.md) | |
|
|
23
|
+
|
|
24
|
+
**Returns:**
|
|
25
|
+
|
|
26
|
+
void
|
|
27
|
+
|
|
28
|
+
## Remarks
|
|
29
|
+
|
|
30
|
+
Override this to change the shape of model the component returns
|
|
31
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [ExpressionBuilder](./expression-builder.expressionbuilder.md)
|
|
4
|
+
|
|
5
|
+
## ExpressionBuilder class
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Top level component to allow the user to build expressions. It produces a generic payload which doesn't have any system by itself to evaluate or execute the built expression.
|
|
11
|
+
|
|
12
|
+
The basics required to work with this component:
|
|
13
|
+
|
|
14
|
+
[ExpressionBuilder.config](./expression-builder.expressionbuilder.config.md) property to configure and input data and models into the component.
|
|
15
|
+
|
|
16
|
+
\_Event\_ change - `Types.Group` emits the model configuration on change. If you create a child component of the expression builder where you want to use a different (e.g. domain specific) model then it will likely override then emit event and instead emit it's own model. To check the underlying `Types.Group` model check the [ExpressionBuilder.model](./expression-builder.expressionbuilder.model.md) property.
|
|
17
|
+
|
|
18
|
+
**Signature:**
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
export declare class ExpressionBuilder extends GenesisElement implements MetadataProvider
|
|
22
|
+
```
|
|
23
|
+
**Extends:** GenesisElement
|
|
24
|
+
|
|
25
|
+
**Implements:** MetadataProvider
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
| Property | Modifiers | Type | Description |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| [config](./expression-builder.expressionbuilder.config.md) | | Config | <p>**_(BETA)_** config - <code>Types.Config</code> the configuration which is required to be set for the expression builder. All properties are defined under this single object to enforce that they're kept in sync with one another.</p><p>If you want to set the expression of the expression builder you should do it via the <code>model</code> property on this object.</p><p>If you're using a child class of this component with a specific model implementation you likely \*don't\* want to set this property directly. See example 3.</p> |
|
|
32
|
+
| [model](./expression-builder.expressionbuilder.model.md) | | ModelGroup \| null | <p>**_(BETA)_** model - <code>Types.Group</code> the current model which completely describes the state of the component.</p><p>\*IMPORTANT\* you should not set this yourself via this property directly, you should always set it via the model property on the [ExpressionBuilder.config](./expression-builder.expressionbuilder.config.md) block.</p><p>You may want to read from this variable to get the most up to date state, for example if you create a child component which has a model which isn't valid for every single state (e.g. requires a complete rule) you can check this underlying model to verify what field or operator is selected.</p> |
|
|
33
|
+
| [styles?](./expression-builder.expressionbuilder.styles.md) | | [Styles](./expression-builder.types.styles.md) | **_(BETA)_** _(Optional)_ styles - <code>Types.Styles</code> optional configuration which allows you to set custom element tag names to be used, as well as custom css to be inserted into the shadow DOM. |
|
|
34
|
+
|
|
35
|
+
## Methods
|
|
36
|
+
|
|
37
|
+
| Method | Modifiers | Description |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| [dispatchChangeEvent(group)](./expression-builder.expressionbuilder.dispatchchangeevent.md) | <code>protected</code> | **_(BETA)_** Dispatches the provided model to the DOM. |
|
|
40
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [ExpressionBuilder](./expression-builder.expressionbuilder.md) > [model](./expression-builder.expressionbuilder.model.md)
|
|
4
|
+
|
|
5
|
+
## ExpressionBuilder.model property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
model - `Types.Group` the current model which completely describes the state of the component.
|
|
11
|
+
|
|
12
|
+
\*IMPORTANT\* you should not set this yourself via this property directly, you should always set it via the model property on the [ExpressionBuilder.config](./expression-builder.expressionbuilder.config.md) block.
|
|
13
|
+
|
|
14
|
+
You may want to read from this variable to get the most up to date state, for example if you create a child component which has a model which isn't valid for every single state (e.g. requires a complete rule) you can check this underlying model to verify what field or operator is selected.
|
|
15
|
+
|
|
16
|
+
**Signature:**
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
model: ModelGroup | null;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const model = document.querySelector('expression-builder');
|
|
27
|
+
// Once you have the model you can read it to check the applied config. While the primary use should be checking the updated model via
|
|
28
|
+
the emited change event, you can use this to check more specific changes that a domain specific model might not.
|
|
29
|
+
|
|
30
|
+
For example, imagine a RulExpressionBuilder which is an implementation specifically for a boolean logic expression. That component may not
|
|
31
|
+
model a non-complete rule (a rule without a field, and operator, and value). In that case when it emits the event the payload will only change
|
|
32
|
+
when the user has completely configured a new rule. But if you need to catch cases earlier when they've changed the field but before they've
|
|
33
|
+
changed the value you can check the model here.
|
|
34
|
+
```
|
|
35
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [ExpressionBuilder](./expression-builder.expressionbuilder.md) > [styles](./expression-builder.expressionbuilder.styles.md)
|
|
4
|
+
|
|
5
|
+
## ExpressionBuilder.styles property
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
styles - `Types.Styles` optional configuration which allows you to set custom element tag names to be used, as well as custom css to be inserted into the shadow DOM.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
styles?: Styles;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
Bare bones example of using a custom select component
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
const styles: Types.Styles = {
|
|
24
|
+
customElements: {
|
|
25
|
+
select: 'rapid-select',
|
|
26
|
+
},
|
|
27
|
+
styles: {
|
|
28
|
+
// If you want to customise your `rapid-select` then you can do it here. The select input
|
|
29
|
+
// is used in the value, field, and operator component, so you should set the styles for all of them for real
|
|
30
|
+
value: `
|
|
31
|
+
rapid-select {
|
|
32
|
+
max-width: 180px;
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
document.querySelector('expression-builder').styles = styles;
|
|
38
|
+
```
|
|
39
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [formatDateString](./expression-builder.formatdatestring.md)
|
|
4
|
+
|
|
5
|
+
## formatDateString variable
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Gets the string representation from a `Date` which is the format a `date` input uses. `yyyy-mm-dd`<!-- -->. Uses UTC methods to ensure consistent output regardless of timezone.
|
|
11
|
+
|
|
12
|
+
Used to convert a javascript date object into the required string format expected by the expression builder.
|
|
13
|
+
|
|
14
|
+
**Signature:**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
formatDateString: (date: Date) => string
|
|
18
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [formatDateTimeString](./expression-builder.formatdatetimestring.md)
|
|
4
|
+
|
|
5
|
+
## formatDateTimeString variable
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Gets the string representation from a `Date` which is the format a `datetime-local` input uses. `yyyy-mm-ddThh:mm:ss`<!-- -->. Uses UTC methods to ensure consistent output regardless of timezone.
|
|
11
|
+
|
|
12
|
+
Used to convert a javascript date object into the required string format expected by the expression builder.
|
|
13
|
+
|
|
14
|
+
**Signature:**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
formatDateTimeString: (date: Date) => string
|
|
18
|
+
```
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## expression-builder package
|
|
6
6
|
|
|
7
|
+
## Classes
|
|
8
|
+
|
|
9
|
+
| Class | Description |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| [ExpressionBuilder](./expression-builder.expressionbuilder.md) | <p>**_(BETA)_** Top level component to allow the user to build expressions. It produces a generic payload which doesn't have any system by itself to evaluate or execute the built expression.</p><p>The basics required to work with this component:</p><p>[ExpressionBuilder.config](./expression-builder.expressionbuilder.config.md) property to configure and input data and models into the component.</p><p>\_Event\_ change - <code>Types.Group</code> emits the model configuration on change. If you create a child component of the expression builder where you want to use a different (e.g. domain specific) model then it will likely override then emit event and instead emit it's own model. To check the underlying <code>Types.Group</code> model check the [ExpressionBuilder.model](./expression-builder.expressionbuilder.model.md) property.</p> |
|
|
12
|
+
|
|
7
13
|
## Namespaces
|
|
8
14
|
|
|
9
15
|
| Namespace | Description |
|
|
@@ -11,3 +17,10 @@
|
|
|
11
17
|
| [Config](./expression-builder.config.md) | |
|
|
12
18
|
| [Types](./expression-builder.types.md) | |
|
|
13
19
|
|
|
20
|
+
## Variables
|
|
21
|
+
|
|
22
|
+
| Variable | Description |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| [formatDateString](./expression-builder.formatdatestring.md) | <p>**_(BETA)_** Gets the string representation from a <code>Date</code> which is the format a <code>date</code> input uses. <code>yyyy-mm-dd</code>. Uses UTC methods to ensure consistent output regardless of timezone.</p><p>Used to convert a javascript date object into the required string format expected by the expression builder.</p> |
|
|
25
|
+
| [formatDateTimeString](./expression-builder.formatdatetimestring.md) | <p>**_(BETA)_** Gets the string representation from a <code>Date</code> which is the format a <code>datetime-local</code> input uses. <code>yyyy-mm-ddThh:mm:ss</code>. Uses UTC methods to ensure consistent output regardless of timezone.</p><p>Used to convert a javascript date object into the required string format expected by the expression builder.</p> |
|
|
26
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [\_Operator](./expression-builder.types._operator.md)
|
|
4
|
+
|
|
5
|
+
## Types.\_Operator type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
\*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type _Operator = {
|
|
16
|
+
applyTo: FieldTypes['type'][];
|
|
17
|
+
optgroup?: string | null;
|
|
18
|
+
type: string;
|
|
19
|
+
tooltip?: string;
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
**References:** [FieldTypes](./expression-builder.types.fieldtypes.md)
|
|
23
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [BinaryOperator](./expression-builder.types.binaryoperator.md)
|
|
4
|
+
|
|
5
|
+
## Types.BinaryOperator type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
An operator which has one value. Example `greater_than` \*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type BinaryOperator = {
|
|
16
|
+
nbInputs: 1;
|
|
17
|
+
} & _Operator;
|
|
18
|
+
```
|
|
19
|
+
**References:** [\_Operator](./expression-builder.types._operator.md)
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [CheckboxInput](./expression-builder.types.checkboxinput.md)
|
|
4
|
+
|
|
5
|
+
## Types.CheckboxInput type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Configuration for a boolean-type input, which has a boolean value and a checkbox. \*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type CheckboxInput = {
|
|
16
|
+
input: 'checkbox';
|
|
17
|
+
type: 'boolean';
|
|
18
|
+
};
|
|
19
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [Combinator](./expression-builder.types.combinator.md)
|
|
4
|
+
|
|
5
|
+
## Types.Combinator type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
\*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type Combinator = {
|
|
16
|
+
type: string;
|
|
17
|
+
maxRules: 1 | 2 | 'many';
|
|
18
|
+
invisible?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
allowedFields?: Field['fieldId'][];
|
|
22
|
+
allowedOperators?: Operator['type'][];
|
|
23
|
+
validator?: (group: Group) => string | null;
|
|
24
|
+
allowLiterals?: boolean;
|
|
25
|
+
forceFieldOnly?: boolean;
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
**References:** [Field](./expression-builder.types.field.md)<!-- -->, [Operator](./expression-builder.types.operator.md)<!-- -->, [Group](./expression-builder.types.group.md)
|
|
29
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [Config](./expression-builder.types.config.md)
|
|
4
|
+
|
|
5
|
+
## Types.Config type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
\*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type Config = {
|
|
16
|
+
operators: Operator[];
|
|
17
|
+
fields: Field[];
|
|
18
|
+
combinators: Combinator[];
|
|
19
|
+
model?: Group;
|
|
20
|
+
maxNesting?: number;
|
|
21
|
+
partialRuleValidationWarning?: boolean;
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
**References:** [Operator](./expression-builder.types.operator.md)<!-- -->, [Field](./expression-builder.types.field.md)<!-- -->, [Combinator](./expression-builder.types.combinator.md)<!-- -->, [Group](./expression-builder.types.group.md)
|
|
25
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [CustomElements](./expression-builder.types.customelements.md)
|
|
4
|
+
|
|
5
|
+
## Types.CustomElements type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
By default the expression builder uses the basic html components such as buttons and inputs. If you want to integrate your own components from a design system or otherwise you can add the tag names for your elements here. For your custom components to work they must expose the same API as the underlying HTML element they're overriding.
|
|
11
|
+
|
|
12
|
+
`checkbox`<!-- -->: Custom element tag for checkbox inputs
|
|
13
|
+
|
|
14
|
+
`text`<!-- -->: Custom element tag for text inputs
|
|
15
|
+
|
|
16
|
+
`number`<!-- -->: Custom element tag for number inputs
|
|
17
|
+
|
|
18
|
+
`date`<!-- -->: Custom element tag for date inputs
|
|
19
|
+
|
|
20
|
+
`datetimeLocal`<!-- -->: Custom element tag for datetime-local inputs
|
|
21
|
+
|
|
22
|
+
`select`<!-- -->: Custom element tag for select inputs
|
|
23
|
+
|
|
24
|
+
`option`<!-- -->: Custom element tag for option elements
|
|
25
|
+
|
|
26
|
+
`button`<!-- -->: Custom element tag for button elements
|
|
27
|
+
|
|
28
|
+
`radio`<!-- -->: Custom element tag for radio and radio group elements. When using a custom element for a radio you require a parent radio group component to semantically link the radios into a group. The parent radio group must expose the `change` event and `value` attribute.
|
|
29
|
+
|
|
30
|
+
**Signature:**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
export type CustomElements = {
|
|
34
|
+
checkbox?: string;
|
|
35
|
+
text?: string;
|
|
36
|
+
number?: string;
|
|
37
|
+
date?: string;
|
|
38
|
+
datetimeLocal?: string;
|
|
39
|
+
select?: string;
|
|
40
|
+
option?: string;
|
|
41
|
+
button?: string;
|
|
42
|
+
radio?: {
|
|
43
|
+
input: string;
|
|
44
|
+
group: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [CustomStyles](./expression-builder.types.customstyles.md)
|
|
4
|
+
|
|
5
|
+
## Types.CustomStyles type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Optional strings for configuring css to be applied inside of each constituent element's shadow DOM. To apply styles to components which are used inside of multiple different components (such as buttons which are used in groups, rules, and values) you must ensure the styling is set in each block. If your styling isn't showing the ensure that you're using more specific css rules to override the precedence of your rule.
|
|
11
|
+
|
|
12
|
+
`rule`<!-- -->: Additional CSS for expression rule component
|
|
13
|
+
|
|
14
|
+
`value`<!-- -->: Additional CSS for rule value component
|
|
15
|
+
|
|
16
|
+
`field`<!-- -->: Additional CSS for rule field component
|
|
17
|
+
|
|
18
|
+
`operator`<!-- -->: Additional CSS for rule operator component
|
|
19
|
+
|
|
20
|
+
`group`<!-- -->: Additional CSS for expression group component
|
|
21
|
+
|
|
22
|
+
**Signature:**
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
export type CustomStyles = {
|
|
26
|
+
rule?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
field?: string;
|
|
29
|
+
operator?: string;
|
|
30
|
+
group?: string;
|
|
31
|
+
};
|
|
32
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [DateInput](./expression-builder.types.dateinput.md)
|
|
4
|
+
|
|
5
|
+
## Types.DateInput type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Configuration for a date input, which has s string value and a date field input \*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type DateInput = {
|
|
16
|
+
input: 'date';
|
|
17
|
+
type: 'date';
|
|
18
|
+
validation?: (x: unknown) => string | null;
|
|
19
|
+
};
|
|
20
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [DateTimeInput](./expression-builder.types.datetimeinput.md)
|
|
4
|
+
|
|
5
|
+
## Types.DateTimeInput type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Configuration for a datetime input, which has s string value and a datetime field input \*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type DateTimeInput = {
|
|
16
|
+
input: 'datetime-local';
|
|
17
|
+
type: 'date-time';
|
|
18
|
+
validation?: (x: unknown) => string | null;
|
|
19
|
+
};
|
|
20
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [Field](./expression-builder.types.field.md)
|
|
4
|
+
|
|
5
|
+
## Types.Field type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
\*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type Field = {
|
|
16
|
+
optgroup?: string | null;
|
|
17
|
+
defaultValue?: any;
|
|
18
|
+
fieldId: string;
|
|
19
|
+
label: string;
|
|
20
|
+
operators?: string[];
|
|
21
|
+
} & FieldTypes;
|
|
22
|
+
```
|
|
23
|
+
**References:** [FieldTypes](./expression-builder.types.fieldtypes.md)
|
|
24
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [FieldTypes](./expression-builder.types.fieldtypes.md)
|
|
4
|
+
|
|
5
|
+
## Types.FieldTypes type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Union of all input types \*
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type FieldTypes = TextInput | NumberInput | CheckboxInput | SelectInput | DateInput | DateTimeInput;
|
|
16
|
+
```
|
|
17
|
+
**References:** [TextInput](./expression-builder.types.textinput.md)<!-- -->, [NumberInput](./expression-builder.types.numberinput.md)<!-- -->, [CheckboxInput](./expression-builder.types.checkboxinput.md)<!-- -->, [SelectInput](./expression-builder.types.selectinput.md)<!-- -->, [DateInput](./expression-builder.types.dateinput.md)<!-- -->, [DateTimeInput](./expression-builder.types.datetimeinput.md)
|
|
18
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/expression-builder](./expression-builder.md) > [Types](./expression-builder.types.md) > [Group](./expression-builder.types.group.md)
|
|
4
|
+
|
|
5
|
+
## Types.Group type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
A group forms the overall model of the expression builder, and is recursive to itself allowing for a nested tree.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type Group = {
|
|
16
|
+
combinator: Combinator;
|
|
17
|
+
children: (Rule | Group)[];
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
**References:** [Combinator](./expression-builder.types.combinator.md)<!-- -->, [Rule](./expression-builder.types.rule.md)<!-- -->, [Group](./expression-builder.types.group.md)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
RULE 1
|
|
27
|
+
FIELD : PROFILE_AGE
|
|
28
|
+
OPERATOR : GREATER_THAN
|
|
29
|
+
VALUE : 18
|
|
30
|
+
|
|
31
|
+
COMBINATOR : OR
|
|
32
|
+
|
|
33
|
+
GROUP 2
|
|
34
|
+
RULE 2
|
|
35
|
+
FIELD : PARENT_ROLE
|
|
36
|
+
OPERATOR : ONE_OF
|
|
37
|
+
VALUE : GIVES_PERMISSION
|
|
38
|
+
|
|
39
|
+
COMBINATOR : AND
|
|
40
|
+
|
|
41
|
+
RULE 3
|
|
42
|
+
FIELD : GRANTS_CHILD_ACCESS
|
|
43
|
+
OPERATOR : EQUALS
|
|
44
|
+
VALUE : true
|
|
45
|
+
|
|
46
|
+
If you're constructing a boolean expression then this rule could be used to restrict users who are 17 or younger, but
|
|
47
|
+
allowing parents who have specific rights to be able to grant access too.
|
|
48
|
+
```
|
|
49
|
+
|
|
@@ -4,3 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
## Types namespace
|
|
6
6
|
|
|
7
|
+
## Type Aliases
|
|
8
|
+
|
|
9
|
+
| Type Alias | Description |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| [\_Operator](./expression-builder.types._operator.md) | **_(BETA)_** \* |
|
|
12
|
+
| [BinaryOperator](./expression-builder.types.binaryoperator.md) | **_(BETA)_** An operator which has one value. Example <code>greater_than</code> \* |
|
|
13
|
+
| [CheckboxInput](./expression-builder.types.checkboxinput.md) | **_(BETA)_** Configuration for a boolean-type input, which has a boolean value and a checkbox. \* |
|
|
14
|
+
| [Combinator](./expression-builder.types.combinator.md) | **_(BETA)_** \* |
|
|
15
|
+
| [Config](./expression-builder.types.config.md) | **_(BETA)_** \* |
|
|
16
|
+
| [CustomElements](./expression-builder.types.customelements.md) | <p>**_(BETA)_** By default the expression builder uses the basic html components such as buttons and inputs. If you want to integrate your own components from a design system or otherwise you can add the tag names for your elements here. For your custom components to work they must expose the same API as the underlying HTML element they're overriding.</p><p><code>checkbox</code>: Custom element tag for checkbox inputs</p><p><code>text</code>: Custom element tag for text inputs</p><p><code>number</code>: Custom element tag for number inputs</p><p><code>date</code>: Custom element tag for date inputs</p><p><code>datetimeLocal</code>: Custom element tag for datetime-local inputs</p><p><code>select</code>: Custom element tag for select inputs</p><p><code>option</code>: Custom element tag for option elements</p><p><code>button</code>: Custom element tag for button elements</p><p><code>radio</code>: Custom element tag for radio and radio group elements. When using a custom element for a radio you require a parent radio group component to semantically link the radios into a group. The parent radio group must expose the <code>change</code> event and <code>value</code> attribute.</p> |
|
|
17
|
+
| [CustomStyles](./expression-builder.types.customstyles.md) | <p>**_(BETA)_** Optional strings for configuring css to be applied inside of each constituent element's shadow DOM. To apply styles to components which are used inside of multiple different components (such as buttons which are used in groups, rules, and values) you must ensure the styling is set in each block. If your styling isn't showing the ensure that you're using more specific css rules to override the precedence of your rule.</p><p><code>rule</code>: Additional CSS for expression rule component</p><p><code>value</code>: Additional CSS for rule value component</p><p><code>field</code>: Additional CSS for rule field component</p><p><code>operator</code>: Additional CSS for rule operator component</p><p><code>group</code>: Additional CSS for expression group component</p> |
|
|
18
|
+
| [DateInput](./expression-builder.types.dateinput.md) | **_(BETA)_** Configuration for a date input, which has s string value and a date field input \* |
|
|
19
|
+
| [DateTimeInput](./expression-builder.types.datetimeinput.md) | **_(BETA)_** Configuration for a datetime input, which has s string value and a datetime field input \* |
|
|
20
|
+
| [Field](./expression-builder.types.field.md) | **_(BETA)_** \* |
|
|
21
|
+
| [FieldTypes](./expression-builder.types.fieldtypes.md) | **_(BETA)_** Union of all input types \* |
|
|
22
|
+
| [Group](./expression-builder.types.group.md) | **_(BETA)_** A group forms the overall model of the expression builder, and is recursive to itself allowing for a nested tree. |
|
|
23
|
+
| [NumberInput](./expression-builder.types.numberinput.md) | **_(BETA)_** Configuration for a number-type input, which has a number value and a number input. \* |
|
|
24
|
+
| [Operator](./expression-builder.types.operator.md) | **_(BETA)_** \* |
|
|
25
|
+
| [Rule](./expression-builder.types.rule.md) | **_(BETA)_** A rule is a single constituent element of a larger expression, and is the smallest whole part of an expression. |
|
|
26
|
+
| [SelectInput](./expression-builder.types.selectinput.md) | **_(BETA)_** Configuration for an enum-type input, which as a string or number value, and uses a select input. \* |
|
|
27
|
+
| [Styles](./expression-builder.types.styles.md) | <p>**_(BETA)_** Configuration items for the expression builder styles.</p><p><code>customElements</code>: optional <code>Types.CustomElements</code> block for overriding the html tags used in the expression builder</p><p><code>customStyles</code>: optional <code>Types.CustomStyles</code> block to configure custom css for components.</p> |
|
|
28
|
+
| [TernararyOperator](./expression-builder.types.ternararyoperator.md) | **_(BETA)_** An operator which has two values. Example <code>between_inclusive</code> \* |
|
|
29
|
+
| [TextInput](./expression-builder.types.textinput.md) | **_(BETA)_** Configuration for a text-type input, which has a string value and a text input. \* |
|
|
30
|
+
| [UniraryOperator](./expression-builder.types.uniraryoperator.md) | <p>**_(BETA)_** An operator which doesn't have any value. Example <code>is_null</code></p><p>\*</p> |
|
|
31
|
+
| [VariadicOperator](./expression-builder.types.variadicoperator.md) | **_(BETA)_** An operator which can have any number of values where <code>NumVals >= 1</code>, defaulting to 1. Example <code>one_of</code>. \* |
|
|
32
|
+
|