Members
(constant) ACTIONS_TYPES
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) ActionsProvider
ActionsContext is responsible for store which field is being hovered or active
- Source:
(constant) Component
Convenience function that returns a component that provides the passed
`value` as context.
- Source:
(constant) ConfigProvider
A provider to store any configuration or property that has no
side effect during the life cycle of the application.
Maintaining configuration properties with side effect properties
in the same `store` may be rendering unnecessary components
that use only configuration properties.
- Source:
(constant) context
Context stores all instances of schemas created by key to avoid recreating
a new instance of the same Schema in different components.
- Source:
(constant) createReducer
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) DEFAULT_CONFIG
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) DRAG_FIELD_TYPE_MOVE
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) FIELD_NAME_REGEX
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) FIELD_TYPES
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) FormFieldSettings
Render a new form to be used in the Sidebar so that can edit the
properties of a field, a new FormProvider is needed to control
the reducers of a Field's settingsContext structure.
- Source:
(constant) FormFieldSettingsAdapter
This component is temporary and for exclusive use for Sidebar
in Metal.js, this creates a form for editing the properties
of a field in Form Builder.
- Source:
(constant) FormNoopProvider
This is a no-op implementation for the store, a dispatch call will
not call any action on the FormProvider and the state will always
be the value passed through the value property.
This is a temporary implementation that works as an intermediate
provider and compatibility layer for the React and Metal.js frontier
in FormBuilder. The one who actually causes an action is the
LayoutProvider when that component is used.
-> Metal.js
-> Metal.js
-> React.js with Adapter
-> React.js
...
- Source:
(constant) FormProvider
Form Provider is a "store" that is compatible with the concept of
thunk but has no coupling to any specific reducer, the reducers
can be configured through the property, as well as configuring
the data init function and the initial state.
...
Reducers receive the extra config property in addition to state
and action, it is mandatory that ConfigProvider be declared
before FormProvider.
...
FormProvider is built to be composed and can be declared more
than once in the application to deal with the same structure in
some part of the application tree. The real example is Sidebar,
which has the same `pages` structure that needs to be manipulated
but is isolated from the application and the main store.
<- Main Store
<- Isolated state
- Source:
(constant) FormView
Exports the default application to render the form
for the user.
- Source:
(constant) getFormNode
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) getLocalizedValue
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) INITIAL_PAGES
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) LEGACY_EVENTS
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) LegacyFormBuilder
Render a form just for preview without actions/reducer just with FormNoopProvider,
this component is for compatibility with the FormBuilder in Metal.js.
- Source:
(constant) localDataStorage
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) MAPPED_EVENT_TYPES
Event mapping for compatibility with events for
the LayoutProvider component.
- Source:
(constant) OPERATOR_OPTIONS_TYPES
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) PAGINATION
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) PAGINATION_MODE_MAPPED
Maps the representation of pagination mode in the builder environment
in the form view.
- Source:
(constant) PluginContext
Context for shared data, intended as a mechanism for sharing between
a host application that uses `usePlugins()` and its hosted plugin modules.
- Source:
(constant) setValue
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) SIDEBAR_PANEL_IDS_TO_PLUGINS
In general, we expect the sidebarPanelId to correspond with the name
of a plugin. Here we deal with the exceptions by mapping IDs to
plugin names.
- Source:
(constant) swallow
Failure to preload is a non-critical failure, so we'll use this to swallow
rejected promises silently.
- Source:
(constant) SYMBOL_CONTEXT
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) TOKEN_TYPE_ACCEPTS_IMPLICIT_MULTIPLICATION
A Token can be have one of the following types:
Token.FUNCTION = 'Function';
Token.LEFT_PARENTHESIS = 'Left Parenthesis';
Token.LITERAL = 'Literal';
Token.OPERATOR = 'Operator';
Token.RIGHT_PARENTHESIS = 'Right Parenthesis';
Token.VARIABLE = 'Variable';
See https://github.com/liferay/liferay-portal/blob/e066954b019e5fcf42ca45b69fd4da595ad58029/modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-builder/src/main/resources/META-INF/resources/js/expressions/Token.es.js#L26
for more details.
Each key in the following dictionary represents the type of a token in which the
value is matched with the possible tokens that can add an implicit multiplication.
- Source:
(constant) useDataView
UseDataView creates a representation of the data based on the passed
schema otherwise nothing is done. It should not be used directly, it
is exposed through `useFormState`.
- Source:
(constant) useEvaluate
This hook is a partial function that removes the need to pass the same
properties every time they are called, this is only for thunks that use
the `evaluate` function.
- Source:
(constant) useStorage
Simple implementation to create a local storage that can be shared
independently of the React tree, Form Renderer is not an application
and can be reused more than once on the same page, so we need to share
requests and fields, they are loaded on demand, so as not to make
unnecessary requests. Use the `useStorage` hook as a way to cache data.
- Source:
Methods
findField()
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:
getColumn(Object)
This component will override the Column from Form Renderer and will
check if field to be rendered has a custom field.
If the field has a custom field, render it instead of children.
Parameters:
Name | Type | Description |
---|---|---|
Object |
customFields | You can override fields passing as parameter the customFields:
const customFields = {
required: (props) => |
- Source:
getConnectedReactComponentAdapter(ReactComponent)
The Adapter creates a communication bridge between the Metal and React components.
The Adapter when it is rendered for the first time uses `ReactDOM.render` to assemble
the component and subsequent renderings are done by React. We created a tunnel with
an Observer that updates the internal state of the component in React that makes a
wrapper over the main component to force React to render at the best time, we also
ignore the rendering of Metal.
Parameters:
Name | Type | Description |
---|---|---|
ReactComponent |
React.createElement |
- Source:
Examples
// import getConnectedReactComponentAdapter from '/path/ReactComponentAdapter.es';
//
// const ReactComponent = ({children, className}) => <div className={className}>{children}</div>;
// const ReactComponentAdapter = getConnectedReactComponentAdapter(
// ReactComponent
// );
//
// In the rendering of Metal
// render() {
// return (
// <ReactComponentAdapter className="h1-title">
// <h1>{'Title'}</h1>
// </ReactComponentAdapter>
// );
// }
To call the React component in the context of Metal + soy, where varient is not an option,
you can use Metal's `Soy.register` to create a fake component so that you can call the React
component in Soy. The use of children from Soy components for React does not work.
// import Soy from 'metal-soy';
// import getConnectedReactComponentAdapter from '/path/ReactComponentAdapter.es';
// import templates from './FakeAdapter.soy';
//
// const ReactComponent = ({className}) => <div className={className} />;
// const ReactComponentAdapter = getConnectedReactComponentAdapter(
// ReactComponent
// );
// Soy.register(ReactComponentAdapter, templates);
//
// In soy
// {call FakeAdapter.render}
// {param className: 'test' /}
// {/call}
getDataDefinitionField(field)
Gets a data definition from a field
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
field |
object | The field
Properties
|
- Source:
getDefinitionField(dataDefinition, field)
Get unformatted definition field
Parameters:
Name | Type | Description |
---|---|---|
dataDefinition |
object | |
field |
object |
- Source:
getFieldNameGenerator()
This is a literary copy of the logic of the old LayoutProvider,
check the documentation for more details.
- Source:
getFieldSetDDMForm()
Converts a FieldSet from data-engine to form-builder data definition
- Source:
getSearchRegex()
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:
identity()
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:
isDroppingFieldIntoFieldAndSameGroup()
Determines whether are moving the source Field into inside the Field
in the same FieldGroup to create another FieldGroup but with only
two fields.
- Source:
isDroppingFieldIntoSingleField()
Determines whether the source Field is being moved into inside a Field
where its parent is a FieldGroup with just that element.
- Source:
isFieldGroupMovingIntoItself()
Just check if the Field is a FieldGroup before checking if it is moving into
itself. The index of the source and target are added to the loc, at the
level where `useDrop` is used it is not visible the loc of the Field being
rendered.
- Source:
isMovingIntoItself()
Checks whether Field is moving into itself. In conventional mode, we would be
visiting all the fields within it to check if the target belongs to the Field
root (in this case the source), but this can be very slow depending on the
depth and it is very expensive in this hot path instead this method implement
heuristic algorithm based on two assumptions:
- The target indexes are the same as the source indexes
- The target depth is greater than the source
The indexes are an Array
- Source:
isStaleRaw()
Compare the values of the properties at the reference level, the properties
should only be for readonly, the raw object and props will always be different
objects because props contain all the properties of the store but raw only
the properties that the schema needs.
- Source:
mountStruct()
This only assembles the expected structure of the Forms field
event, creates a makeup to maintain compatibility with the
mechanism, the fields in React do not need to assemble this
structure, they must only provide a native event or value in
the case of an onChange
- Source:
normalizeDataDefinition(dataDefinition, defaultLanguageIdnullable, normalizeFieldsetnullable)
Normalize Data Definition
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataDefinition |
Object | ||
defaultLanguageId |
String |
<nullable> |
|
normalizeFieldset |
boolean |
<nullable> |
- Source:
normalizeDataLayout(dataLayout, defaultLanguageIdnullable)
Normalize Data Layout
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataLayout |
Object | ||
defaultLanguageId |
String |
<nullable> |
- Source:
normalizeDataLayoutRows(dataLayoutPages)
Normalize data layout rows
Parameters:
Name | Type | Description |
---|---|---|
dataLayoutPages |
Array |
- Source:
normalizeField(availableLanguageIds, field, defaultLanguageIdnullable)
some fields are translated with the language of
themeDisplay.getDefaultLanguageId() which is not necessarily the language of dataDefinition,
so we need to normalize all fields so that they receive themeDisplay.getDefaultLanguageId()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
availableLanguageIds |
Array | ||
field |
Object | ||
defaultLanguageId |
String |
<nullable> |
- Source:
normalizeRule(dataRule)
Normalize rule
Parameters:
Name | Type | Description |
---|---|---|
dataRule |
Object |
- Source:
ObserverSubscribe()
Adds a sub observer to maintain the updated state of the
component.
- Source:
Page()
Renderer is the main component for dealing with Forms `pages` structure,
you can use the renderer to render fields from different layouts.
Renderer supports some rendering modes by default
- multi-pages
- paginated
- single-page
- success
- tabbed
- wizard
You can replace all major components or just a few to change the layout
structure, consider the following components
- Container
- Page
- Rows
- Row
- Column
Use the `overrides` API to pass the components you want to replace,
an example of Page.
children
}}
/>
- Source:
partitionPanels()
Instead of using fake panels with an ID of `separator`, partition the panels
array into an array of arrays; we'll draw a separator between each group.
- Source:
StateSync()
Updates the state of the FieldSettings when any value coming
from layers above changes.
- Source:
useFormSubmit()
This is a copy of the old implementation made in Metal.js, deals with
the submit of the Form in the User View, removes the default behavior
of the submit and uses Liferay.Util.submitForm.
- Source:
usePropagateAction()
Propagate Action is used in conjunction with useReducer that "listens"
for any action in a dispatch call.
const [state, dispatch] = usePropagateAction(useReducer(...));
- Source:
usePublicAPI()
Exposes methods to manipulate some states within the application in
User View through the ref via React and exposed by the
Liferay.Component register.
- Source:
validator()
The validator only removes properties with the value undefined to allow
the initialProps to be added.