Members
(constant) BOOLEAN_OPTIONS
Values for criteria row inputs.
- Source:
(constant) CONJUNCTIONS
Constants for OData query.
- Source:
(constant) contributorShape
A Contributor contains a set Criterias, Properties and identifiers.
- conjunctionId: the value of the congunction
- conjunctionInputId: an identifier for the back-fornt relationship
- criteriaMap: a Criteria frontend consumable
- entityName: an identifier for the back-front relationship
- inputId: an identifier for the back-fornt relationship
- modelLabel: a human friendly name of the type of Contributor
- properties: a list of properties that can conform the Criteria of this Contributor
- propertyKey: an indentifier to help get information about the properties in its Property Group
- query: the Criteria in oData query format
- Source:
(constant) createNewGroup
Creates a new group object with items.
- Source:
(constant) criteriaShape
A Criteria is contains and defines the relationship of a set of Criterion.
Those Criterion can be contained as well in a Criteria.
- Source:
(constant) criterionShape
A Criterion is the unit that forms a rule.
{propertyName} works as an identifier to related to a property
- Source:
(constant) DragTypes
Copyright (c) 2000-present Liferay, Inc. All rights reserved.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
- Source:
(constant) ENTER
Copyright (c) 2000-present Liferay, Inc. All rights reserved.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
- Source:
(nullable) entityName :string|undefined
Name of the entity that a set of properties belongs to, for example,
"User". This value it not displayed anywhere. Only used in
CriteriaRow for requesting a field value's name.
Type:
- string | undefined
- Default Value:
- undefined
- Source:
(constant) initialContributorShape
The Initial Contributor is a way to define the Contributor
that the server provides at the app initialization
to the app. The front has to parse it.
- conjunctionId: the value of the congunction
- conjunctionInputId: an identifier for the back-fornt relationship
- initialQuery: the Criteria in a oData query format
- inputId: an identifier for the back-fornt relationship
- propertyKey: an indentifier to help get information about the properties in its Property Group
- Source:
(nullable) modelLabel :string|undefined
Name displayed to label a contributor and its' properties.
Type:
- string | undefined
- Default Value:
- undefined
- Source:
(constant) oDataV4ParserNameMap
Maps Odata-v4-parser generated AST expression names to internally used
constants.
- Source:
(constant) operatorShape
An Operator defines the relationship between a property and a value in a Criterion
- label: human friendly value
- name: computer frinedly value
- Source:
(constant) PROPERTY_TYPES
Constants to match property types in the passed in supportedProperties array.
- Source:
(constant) propertyGroupShape
A Property Group contains a set of Properties that can be used
to create a Criteria in a Contributor
- Source:
(constant) propertyShape
A Property is a reference to define behaviour of each
criterion in the Criteria Editor.
- Source:
(constant) propertyTypesShape
The Property Types contains a relationship of the types of properties
and their compatible operators
- Source:
(constant) withDragSource
A function that decorates the passed in component with the drag source HOC.
This was separated out since this function needed to be called again for the
nested groups.
Methods
addNewGroup(oDataASTNode, prevConjunction)
Wraps a node in a grouping node.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object | |
prevConjunction |
string |
- Source:
Returns:
Object representing the grouping
applyConjunctionChangeToContributor(contributors) → {Array.<Contributor>}
Applies a conjunction change to the whole array of contributors
Parameters:
Name | Type | Description |
---|---|---|
contributors |
Array.<Contributor> |
- Source:
Returns:
contributors
- Type
- Array.<Contributor>
applyCriteriaChangeToContributors(contributors, change) → {Array.<Contributor>}
Applies a criteria change to a contributor from a list
in both the criteriaMap and query properties
Parameters:
Name | Type | Description |
---|---|---|
contributors |
Array.<Contributor> | |
change |
Object | Contains the criteria change and an identifier to locate the right contributor |
- Source:
Returns:
contributors
- Type
- Array.<Contributor>
beginDrag(props) → {Object}
Passes the required values to the drop target.
This method must be called `beginDrag`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props |
Returns:
The props to be passed to the drop target.
- Type
- Object
beginDrag(props) → {Object}
Passes the required values to the drop target.
This method must be called `beginDrag`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props |
Returns:
The props to be passed to the drop target.
- Type
- Object
beginDrag(props) → {Object}
Passes the required values to the drop target.
This method must be called `beginDrag`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props |
Returns:
The props to be passed to the drop target.
- Type
- Object
buildQueryString(criteria, queryConjunction, properties)
Recursively traverses the criteria object to build an oData filter query
string. Properties is required to parse the correctly with or without quotes
and formatting the query differently for certain types like collection.
Parameters:
Name | Type | Description |
---|---|---|
criteria |
object | The criteria object. |
queryConjunction |
string | The conjunction name value to be used in the query. |
properties |
array | The list of property objects. See ContributorBuilder for valid property object shape. |
- Source:
Returns:
An OData query string built from the criteria object.
canDrop(props, monitor) → {boolean}
Prevents items from being dropped from other contributors.
This method must be called `canDrop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
Returns:
True if the target should accept the item.
- Type
- boolean
canDrop(props, monitor) → {boolean}
Prevents groups from dropping within itself and all items from dropping into
a position that would not change its' current position.
This method must be called `canDrop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
Returns:
True if the target should accept the item.
- Type
- boolean
canDrop(props, monitor) → {boolean}
Prevents rows from dropping onto itself and adding properties to not matching
contributors.
This method must be called `canDrop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
Returns:
True if the target should accept the item.
- Type
- boolean
drop(props, monitor)
Implements the behavior of what will occur when an item is dropped.
Items dropped on top of rows will create a new grouping.
This method must be called `drop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
drop(props, monitor)
Implements the behavior of what will occur when an item is dropped.
For properties dropped from the sidebar, a new criterion will be added.
For rows and groups being dropped, they will be moved to the dropped
position.
This method must be called `drop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
drop(props, monitor)
Implements the behavior of what will occur when an item is dropped.
Adds the criterion dropped.
This method must be called `drop`.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Component's current props. |
monitor |
DropTargetMonitor |
encodeQueryString(queryString) → {string}
Prepares odata query by encoding special characters in string values.
Parameters:
Name | Type | Description |
---|---|---|
queryString |
string | The odata query. |
- Source:
Returns:
The encoded odata query.
- Type
- string
filterProperties()
Filters properties by label
formatCriterionValue(criterionValue) → {string}
Removes both single `'` and double `"` quotes from a string as well as decode
special characters.
Parameters:
Name | Type | Description |
---|---|---|
criterionValue |
string | The string to remove quotes and decode. |
- Source:
Returns:
The decoded string without quotes.
- Type
- string
generateGroupId() → {string}
Generates a unique group id.
- Source:
Returns:
The unique id.
- Type
- string
getChildExpressionName(oDataASTNode)
Gets the internal name of a child expression from the oDataV4Parser name.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
String value of the internal name.
getChildGroupIds(criteria) → {Array}
Gets a list of group ids from a criteria object.
Used for disallowing groups to be moved into its own deeper nested groups.
Example of returned value: ['group_02', 'group_03']
Parameters:
Name | Type | Description |
---|---|---|
criteria |
Object | The criteria object to search through. |
- Source:
Returns:
- Type
- Array
getConjunctionForGroup(oDataASTNode)
Gets the conjunction of the group or returns AND as a default.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
The conjunction name for a group or, if not available, AND.
getDefaultValue(property) → {string}
Returns a default value for a property provided.
Parameters:
Name | Type | Description |
---|---|---|
property |
Object |
Returns:
- Type
- string
getExpressionName(oDataASTNode)
Gets the internal name of an expression from the oDataV4Parser name.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
String value of the internal name
getNextNonGroupExpression(oDataASTNode)
Returns the next expression in the syntax tree that is not a grouping.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
String value of the internal name of the next expression.
getNextOperatorExpression(oDataASTNode)
Returns the next expression in the syntax tree that is not a grouping.
Also ignoring Common, Paren, Member, and FirstMember expressions for property
path expression types like `cookies/any(c:c eq 'key=value')` since the
expressions' value are the same for a collection query.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
String value of the internal name of the next expression.
getPluralMessage(singular, plural, count, toString) → {string|Array}
Uses the singular language key if the count is 1. Otherwise uses the plural
language key.
Parameters:
Name | Type | Description |
---|---|---|
singular |
string | The language key in singular form. |
plural |
string | The language key in plural form. |
count |
number | The amount to display in the message. |
toString |
boolean | If the message should be converted to a string. |
- Source:
Returns:
The translated message.
- Type
- string | Array
getSupportedOperatorsFromType(operators, propertyTypes, type)
Gets the list of operators for a supported type.
Used for displaying the operators available for each criteria row.
Parameters:
Name | Type | Description |
---|---|---|
operators |
Array | The full list of supported operators. |
propertyTypes |
Object | A map of property types and the operators supported for each type. |
type |
string | The type to get the supported operators for. |
- Source:
getTypeByPropertyName(propertyName, properties) → {string}
Gets the type of the property from the property name.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
string | The property name to find. |
properties |
array | The list of defined properties to search in. |
- Source:
Returns:
The property type.
- Type
- string
hasDifferentConjunctions(lastNodeWasGroup, oDataASTNode, prevConjunction)
Checks if a grouping has different conjunctions (e.g. (x AND y OR z)).
Parameters:
Name | Type | Description |
---|---|---|
lastNodeWasGroup |
boolean | |
oDataASTNode |
object | |
prevConjunction |
string |
- Source:
Returns:
boolean of whether a grouping has different conjunctions.
insertAtIndex(item, list, index) → {Array}
Inserts an item into a list at the specified index.
Parameters:
Name | Type | Description |
---|---|---|
item |
* | The item that will be inserted. |
list |
Array | The list where the item will be inserted into. |
index |
number | The position where the item will be inserted. |
- Source:
Returns:
- Type
- Array
isCriteriaGroup(criteria)
Checks if the criteria is a group by checking if it has an `items` property.
Parameters:
Name | Type | Description |
---|---|---|
criteria |
object |
- Source:
isRedundantGroup(lastNodeWasGroup, oDataASTNode, prevConjunction)
Checks if the group is needed; It is unnecessary when there are multiple
groupings in a row, when the conjunction directly outside the group is the
same as the one inside or there is no conjunction within a grouping.
Parameters:
Name | Type | Description |
---|---|---|
lastNodeWasGroup |
boolean | |
oDataASTNode |
object | |
prevConjunction |
string |
- Source:
Returns:
a boolean of whether a group is necessary.
isValueType(types, value) → {boolean}
Checks if the value is a certain type.
Parameters:
Name | Type | Description |
---|---|---|
types |
object | A map of supported types. |
value |
* | The value to validate. |
- Source:
Returns:
- Type
- boolean
jsDatetoYYYYMMDD(dateJsObject) → {string}
Returns a YYYY-MM-DD date
based on a JS Date object
Parameters:
Name | Type | Description |
---|---|---|
dateJsObject |
Date |
- Source:
Returns:
- Type
- string
keyLangToLanguageTag(keyLangopt, lowercaseopt) → {string}
Helper to deal with the differnce in language keys for
human reading, svg consumption and keys
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
keyLang |
string |
<optional> |
'' | |
lowercase |
boolean |
<optional> |
true |
Returns:
- Type
- string
objectToFormData(dataObject)
Converts an object of key value pairs to a form data object for passing
into a fetch body.
Parameters:
Name | Type | Description |
---|---|---|
dataObject |
Object | The data to be converted. |
- Source:
removeAtIndex(list, index) → {Array}
Removes an item at the specified index.
Parameters:
Name | Type | Description |
---|---|---|
list |
Array | The list the where an item will be removed. |
index |
number | The position where the item will be removed. |
- Source:
Returns:
- Type
- Array
replaceAtIndex(item, list, index) → {Array}
Replaces an item in a list at the specified index.
Parameters:
Name | Type | Description |
---|---|---|
item |
* | The item that will be added. |
list |
Array | The list where an item will be replaced. |
index |
number | The position where the item will be replaced. |
- Source:
Returns:
- Type
- Array
skipGroup(oDataASTNode, prevConjunction)
Removes a grouping node and returns the child node
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object | |
prevConjunction |
string |
- Source:
Returns:
Object representing the operation inside the grouping
sub(langKey, args, join) → {string|Array}
Utility function for substituting variables into language keys.
Examples:
sub(Liferay.Language.get('search-x'), ['all'])
=> 'search all'
sub(Liferay.Language.get('search-x'), [all], false)
=> 'search all'
Parameters:
Name | Type | Description |
---|---|---|
langKey |
string | This is the language key used from our properties file |
args |
string | Arguments to pass into language key |
join |
string | Boolean used to indicate whether to call `.join()` on the array before it is returned. Use `false` if subbing in JSX. |
- Source:
Returns:
- Type
- string | Array
toCriteria(context)
Recursively transforms the AST generated by the odata-v4-parser library into
a shape the criteria builder expects. Returns an array so that left and right
arguments can be concatenated together.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
context |
object |
Properties
|
- Source:
Returns:
Criterion representation of an AST expression node in an array
transformCommonNode(oDataASTNode)
Transform an operator expression node into a criterion for the criteria
builder.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
An array containing the object representation of a collection
criterion.
transformConjunctionNode(context)
Transforms conjunction expression node into a criterion for the criteria
builder. If it comes across a grouping sharing an AND and OR conjunction, it
will add a new grouping so the criteria builder doesn't require a user to
know operator precedence.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
context |
object |
Properties
|
- Source:
Returns:
an array containing the concatenated left and right values of a
conjunction expression or a new grouping.
transformFunctionalNode(oDataASTNode)
Transform a function expression node into a criterion for the criteria
builder.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
an array containing the object representation of an operator
criterion
transformGroupNode(context)
Transforms a group expression node into a criterion for the criteria
builder. If it comes across a grouping that is redundant (doesn't provide
readability improvements, superfluous to order of operations), it will remove
it.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
context |
object |
Properties
|
- Source:
Returns:
Criterion representation of an AST expression node in an array
transformNotNode(oDataASTNode)
Transform an operator expression node into a criterion for the criteria
builder.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
an array containing the object representation of an operator
criterion
transformOperatorNode(oDataASTNode)
Transform an operator expression node into a criterion for the criteria
builder.
Parameters:
Name | Type | Description |
---|---|---|
oDataASTNode |
object |
- Source:
Returns:
an array containing the object representation of an operator
criterion
translateQueryToCriteria(queryString) → {object}
Converts an OData filter query string to an object that can be used by the
criteria builder
Parameters:
Name | Type | Description |
---|---|---|
queryString |
string |
- Source:
Returns:
Criteria representation of the query string
- Type
- object
valueParser(value, type) → {string}
Decides whether to add quotes to value.
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean | string | |
type |
boolean | date | number | string |
- Source:
Returns:
- Type
- string
wrapInCriteriaGroup(criteriaArray)
Wraps the criteria items in a criteria group.
Parameters:
Name | Type | Description |
---|---|---|
criteriaArray |
array | The list of criterion. |
- Source:
Type Definitions
Contributor
Produces a list of Contributors
from a list of initialContributors
and a list of propertyGroups
Type:
- Object
- Source: