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) 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) 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
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 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
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 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
createNewGroup(items) → {Object}
Creates a new group object with items.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array | The items to add to the new group. |
- Source:
Returns:
The new group object.
- Type
- Object
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 |
filterProperties()
Filters properties by label
generateGroupId() → {string}
Generates a unique group id.
- Source:
Returns:
The unique id.
- Type
- string
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
getDefaultValue(property) → {string}
Returns a default value for a property provided.
Parameters:
Name | Type | Description |
---|---|---|
property |
Object |
Returns:
- Type
- string
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
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
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
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
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
Type Definitions
Contributor
Produces a list of Contributors
from a list of initialContributors
and a list of propertyGroups
Type:
- Object
- Source: