* @type {!Object}
 * @static
 */

LayoutDragDrop.STATE = {

	/**
	 * Internal DragDrop instance.
	 * @default null
	 * @instance
	 * @memberOf LayoutDragDrop
	 * @review
	 * @type {object|null}
	 */

	_dragDrop: Config.internal().value(null),

	/**
	 * Position of the dragging card
	 * @default undefined
	 * @instance
	 * @memberOf LayoutDragDrop
	 * @review
	 * @type {!string}
	 */

	_draggingItemPosition: Config.internal().string()
};

export {
	DROP_TARGET_BORDERS,
								if (selectedItem) {
									const itemValue = JSON.parse(selectedItem.value);

									this.one('#layoutPageTemplateEntryId').value = itemData.layoutPageTemplateEntryId;
									this.one('#fileEntryId').value = itemValue.fileEntryId;

									submitForm(this.one('#layoutPageTemplateEntryPreviewFm'));
								}
							}.bind(this)
						},
						'strings.add': Liferay.Language.get('ok'),
						title: Liferay.Language.get('page-template-thumbnail'),
						url: itemData.itemSelectorURL
					}
				);

				itemSelectorDialog.open();
			}
		);
	}

	_send(url) {
		submitForm(document.hrefFm, url);
	}
}

LayoutPageTemplateEntryDropdownDefaultEventHandler.STATE = {
	spritemap: Config.string()
};

export default LayoutPageTemplateEntryDropdownDefaultEventHandler;
/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
ContextualSidebar.STATE = {
	/**
	 * Sidebar body content
	 * @default undefined
	 * @instance
	 * @memberOf ContextualSidebar
	 * @review
	 * @type {!string}
	 */
	body: Config.func().required(),

	/**
	 * Optional CSS classes added to the sidebar body wrapper
	 * @default ''
	 * @instance
	 * @memberOf ContextualSidebar
	 * @review
	 * @type {string}
	 */
	bodyClasses: Config.string().value(''),

	/**
	 * Optional CSS classes added to the sidebar wrapper
	 * @default ''
	 * @instance
			this.ignoreCollision = false;
		}
	}

}

/**
 * State definition.
 *
 * @ignore
 * @static
 * @type {!Object}
 */
PublishChangeList.STATE = {

	changeListDescription: Config.string(),

	changeListName: Config.string(),

	ignoreCollision: Config.bool(),

	/**
	 * Path to the images.
	 *
	 * @instance
	 * @memberOf PublishChangeList
	 * @type {String}
	 */
	spritemap: Config.string().required(),

	urlChangeListsHistory: Config.string().required(),
/**
 * State definition.
 *
 * @static
 * @type {!Object}
 */
ChangeListsConfiguration.STATE = {

	/**
	 * If <code>true</code>, change tracking is allowed.
	 *
	 * @instance
	 * @memberOf ChangeListsConfiguration
	 * @type {boolean}
	 */
	changeTrackingAllowed: Config.bool(),

	/**
	 * If <code>true</code>, change tracking is enabled.
	 *
	 * @instance
	 * @memberOf ChangeListsConfiguration
	 * @type {boolean}
	 */
	changeTrackingEnabled: Config.bool(),

	/**
	 * If <code>true</code>, an initial fetch has already occurred.
	 *
	 * @default false
	 * @instance
		Liferay.Util.openWindow(
			{
				dialog: {
					destroyOnHide: true,
					modal: true
				},
				dialogIframe: {
					bodyCssClass: 'dialog-with-footer'
				},
				title: Liferay.Language.get('permissions'),
				uri: itemData.permissionsURL
			}
		);
	}

	publishToLive(itemData) {
		if (confirm(Liferay.Language.get('are-you-sure-you-want-to-publish-to-live'))) {
			this._send(itemData.publishEntryURL);
		}
	}

	_send(url) {
		submitForm(document.hrefFm, url);
	}
}

ElementsDefaultEventHandler.STATE = {
	trashEnabled: Config.bool()
};

export default ElementsDefaultEventHandler;
					position: {
						address: place.formatted_address,
						location: {
							lat: geolocation.lat(),
							lng: geolocation.lng()
						}
					}
				}
			);
		}
	}
}

/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
GoogleMapsSearch.STATE = {

	/**
	 * Input element that will be used for searching addresses.
	 * @review
	 * @type {HTMLInputElement}
	 */
	inputNode: Config.validator(isInputNode).value(null)
};

export default GoogleMapsSearch;
export {GoogleMapsSearch};
		}
	}
}

/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
ImagePreviewer.STATE = {
	/**
	 * The current zoom value that is shown in the toolbar.
	 * @type {Number}
	 */
	currentZoom: Config.number().internal(),

	/**
	 * The height of the <img> element.
	 * @type {Number}
	 */
	imageHeight: Config.number().internal(),

	/**
	 * The margin of the <img> element
	 * @type {String}
	 */
	imageMargin: Config.string().internal(),

	/**
	 * The "src" attribute of the <img> element
	_showRuleCreation() {
		this.setState({
			mode: 'create'
		});
	}

	_showRuleList() {
		this.setState({
			mode: 'view'
		});
	}
}

RuleBuilder.PROPS = {
	dataProviderInstanceParameterSettingsURL: Config.string().required(),

	dataProviderInstancesURL: Config.string().required(),

	functionsMetadata: Config.object({
		number: Config.arrayOf(
			Config.shapeOf({
				label: Config.string(),
				name: Config.string(),
				parameterTypes: Config.array(),
				returnType: Config.string()
			})
		),
		text: Config.arrayOf(
			Config.shapeOf({
				label: Config.string(),
import Component from 'metal-component';
import Soy from 'metal-soy';
import templates from './PageRenderer.soy.js';
import {Config} from 'metal-state';

class PageRenderer extends Component {}

PageRenderer.STATE = {
	items: Config.arrayOf(
		Config.shapeOf(
			{
				type: Config.string()
			}
		)
	)
};

Soy.register(PageRenderer, templates);

export default PageRenderer;
Example #11
0
/**
 * Button component.
 */
class Button extends Component {}

/**
 * @static
 * @type {!Object}
 */
Button.STATE = {
  /**
   * @default false
   * @type {?boolean}
   */
  block: Config.bool().value(false),

  /**
   * @default false
   * @type {?boolean}
   */
  disabled: Config.bool().value(false),

  /**
   * @default undefined
   * @type {?(string|undefined)}
   */
  elementClasses: Config.string(),

  /**
   * @default false
		);
	}
}

AssetVocabularyCategoriesSelector.STATE = {

	/**
	 * Synchronizes the input value of MultiSelect.
	 * @default undefined
	 * @instance
	 * @memberof AssetVocabularyCategoriesSelector
	 * @private
	 * @type {?(string|undefined)}
	 */

	_inputValue: Config.string().internal(),

	/**
	 * @default false
	 * @instance
	 * @memberof AssetVocabularyCategoriesSelector
	 * @private
	 * @type {?bool}
	 */

	_unexistingCategoryError: Config.bool().value(false),

	/**
	 * Flag to indicate whether input can create item.
	 * @default false
	 * @instance
const getConnectedComponent = (Component, properties) => {

	/**
	 * ConnectedComponent
	 */
	class ConnectedComponent extends Component {

		/**
		 * @inheritdoc
		 * @param {object} props
		 * @param  {...any} ...args
		 */
		constructor(props, ...args) {
			super(props, ...args);

			this.on(
				'storeChanged',
				change => {
					const newStore = change.newVal;
					const prevStore = change.prevVal;

					if (newStore !== prevStore) {
						disconnect(this);

						if (newStore instanceof Store) {
							connect(this, newStore);
						}
					}
				}
			);

			this.on(
				'disposed',
				() => {
					disconnect(this);
				}
			);

			if (props.store instanceof Store) {
				connect(this, props.store);
			}
		}

	}

	/**
	 * Connected component state
	 */
	ConnectedComponent.STATE = {
		store: Config
			.instanceOf(Store)
			.value(null)
	};

	properties.forEach(
		property => {
			try {
				ConnectedComponent.STATE[property] = INITIAL_STATE[property].internal();
			}
			catch (e) {
				throw new Error(
					`${property} is not available from ${Component.name}`
				);
			}
		}
	);

	return ConnectedComponent;
};
Example #14
0
						}
					}
				);
			}
		}

		return rules;
	}
}

RuleList.STATE = {
	dataProvider: Config.arrayOf(
		Config.shapeOf(
			{
				id: Config.string(),
				name: Config.string(),
				uuid: Config.string()
			}
		)
	),

	dropdownExpandedIndex: Config.number().internal(),

	pages: Config.array().required(),

	roles: Config.arrayOf(
		Config.shapeOf(
			{
				id: Config.string(),
				name: Config.string()
			}
	}

	_successPageSettingsValueFn() {
		return this.props.initialSuccessPageSettings;
	}
}

LayoutProvider.PROPS = {
	/**
	 * @default undefined
	 * @instance
	 * @memberof LayoutProvider
	 * @type {?string}
	 */

	defaultLanguageId: Config.string(),

	/**
	 * @default undefined
	 * @instance
	 * @memberof LayoutProvider
	 * @type {?string}
	 */

	editingLanguageId: Config.string(),

	/**
	 * @default {}
	 * @instance
	 * @memberof LayoutProvider
	 * @type {?object}
	_handleFunctionsDropdownItemClicked({data}) {
		const {item} = data;

		this.addTokenToExpression(Token.FUNCTION, item.value);
		this.addTokenToExpression(Token.LEFT_PARENTHESIS, '(');
	}

	_repeatableFieldsValueFn() {
		const {fields} = this;

		return fields.filter(({repeatable}) => repeatable === true);
	}
}

Calculator.STATE = {
	expression: Config.string().value(''),

	fields: Config.arrayOf(
		Config.shapeOf(
			{
				fieldName: Config.string(),
				label: Config.string(),
				repeatable: Config.bool(),
				value: Config.string()
			}
		)
	).value([]),

	functions: Config.array().value([]),

	index: Config.number().value(0),
import DefaultEventHandler from 'frontend-js-web/liferay/DefaultEventHandler.es';
import {Config} from 'metal-state';

class ManagementToolbarDefaultEventHandler extends DefaultEventHandler {
	deleteEntries() {
		if (this.trashEnabled || confirm(Liferay.Language.get('are-you-sure-you-want-to-delete-this'))) {
			const form = this.one('#fm');

			Liferay.Util.postForm(
				form,
				{
					data: {
						cmd: this.deleteEntriesCmd,
						deleteEntryIds: Liferay.Util.listCheckedExcept(form, this.ns('allRowIds'))
					},
					url: this.deleteEntriesURL
				}
			);
		}
	}
}

ManagementToolbarDefaultEventHandler.STATE = {
	deleteEntriesCmd: Config.string(),
	deleteEntriesURL: Config.string(),
	trashEnabled: Config.bool()
};

export default ManagementToolbarDefaultEventHandler;
Example #18
0
MapBase.POSITION_MAP = {};

/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
MapBase.STATE = {
	/**
	 * DOM node selector identifying the element that will be used
	 * for rendering the map
	 * @review
	 * @type {string}
	 */
	boundingBox: Config.string().value(''),

	/**
	 * List of controls that will be shown on the map.
	 * The full control list is kept inside MapBase.CONTROLS.
	 * @review
	 * @type {Array<string>}
	 */
	controls: Config.validator(isSubsetOf(Object.values(MapBase.CONTROLS))).value(
		[MapBase.CONTROLS.PAN, MapBase.CONTROLS.TYPE, MapBase.CONTROLS.ZOOM]
	),

	/**
	 * Data that will be parsed as GeoJSONData
	 * @review
	 * @type {Object}
Example #19
0
		}

		return formattedValue;
	}
}

Options.STATE = {

	/**
	 * @default undefined
	 * @instance
	 * @memberof Options
	 * @type {?string}
	 */

	defaultLanguageId: Config.string(),

	/**
	 * @default false
	 * @instance
	 * @memberof Options
	 * @type {?bool}
	 */

	defaultOption: Config.bool().internal().value(false),

	/**
	 * @default undefined
	 * @instance
	 * @memberof Options
	 * @type {?string}
/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
LayoutPageTemplateSidebarAddedFragment.STATE = {
	/**
	 * Fragment index
	 * @default undefined
	 * @instance
	 * @memberOf LayoutPageTemplateSidebarAddedFragment
	 * @type {!number}
	 */
	index: Config.number().required(),

	/**
	 * Fragment name
	 * @default undefined
	 * @instance
	 * @memberOf LayoutPageTemplateSidebarAddedFragment
	 * @type {!string}
	 */
	name: Config.string().required(),

	/**
	 * Path of the available icons.
	 * @default undefined
	 * @instance
	 * @memberOf LayoutPageTemplateSidebarAddedFragment
/**
 * State definition.
 *
 * @static
 * @type {!Object}
 */
ChangeListsConfiguration.STATE = {

	/**
	 * If <code>true</code>, change tracking is allowed.
	 *
	 * @instance
	 * @memberOf ChangeListsConfiguration
	 * @type {boolean}
	 */
	changeTrackingAllowed: Config.bool(),

	/**
	 * If <code>true</code>, change tracking is enabled.
	 *
	 * @instance
	 * @memberOf ChangeListsConfiguration
	 * @type {boolean}
	 */
	changeTrackingEnabled: Config.bool(),

	/**
	 * If <code>true</code>, checkout change tracking confirmation is enabled.
	 *
	 * @instance
	 * @memberOf ChangeListsConfiguration
			value
		});
	}
}

Soy.register(Checkbox, templates);

Checkbox.STATE = {
	/**
	 * @default 'string'
	 * @instance
	 * @memberof Text
	 * @type {?(string|undefined)}
	 */

	dataType: Config.string().value('boolean'),

	/**
	 * @default undefined
	 * @instance
	 * @memberof FieldBase
	 * @type {?bool}
	 */

	evaluable: Config.bool().value(false),

	/**
	 * @default undefined
	 * @instance
	 * @memberof FieldBase
	 * @type {?(string|undefined)}
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
SidebarPageStructurePanel.STATE = {

	/**
	 * List of expanded nodes.
	 * @default ['root']
	 * @instance
	 * @memberOf SidebarPageStructurePanel
	 * @review
	 * @type {string[]}
	 */
	_expandedNodes: Config
		.arrayOf(Config.string())
		.internal()
		.value(['root'])
};

const ConnectedSidebarPageStructurePanel = getConnectedComponent(
	SidebarPageStructurePanel,
	[
		'activeItemId',
		'activeItemType',
		'fragmentEntryLinks',
		'hoveredItemId',
		'hoveredItemType',
		'layoutData',
		'spritemap'
	]
Example #24
0
}

Form.PROPS = {

	/**
	 * The context for rendering a layout that represents a form.
	 * @default undefined
	 * @instance
	 * @memberof Form
	 * @type {!array}
	 */

	context: Config.shapeOf(
		{
			pages: Config.arrayOf(Config.object()),
			paginationMode: Config.string(),
			rules: Config.array(),
			successPageSettings: Config.object()
		}
	).required().setter('_setContext'),

	/**
	 * The rules of a form.
	 * @default undefined
	 * @instance
	 * @memberof Form
	 * @type {!array}
	 */

	dataProviderInstanceParameterSettingsURL: Config.string().required(),

	/**
 * @review
 * @static
 * @type {!Object}
 */
ChangeListsIndicator.STATE = {

	/**
	 * Name of the tooltip css class.
	 * @default
	 * @instance
	 * @memberOf ChangeListsIndicator
	 * @review
	 * @type {!string}
	 */

	_tooltipCssClassName: Config.string().value(''),

	/**
	 * Name of the active change list.
	 * @default
	 * @instance
	 * @memberOf ChangeListsIndicator
	 * @review
	 * @type {!string}
	 */

	activeChangeListName: Config.string().value(''),

	/**
	 * Name of production collection.
	 * @default
	}
}

/**
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
FloatingToolbarBackgroundColorPanel.STATE = {

	/**
	 * @default undefined
	 * @memberof FloatingToolbarBackgroundColorPanel
	 * @review
	 * @type {!string}
	 */
	itemId: Config
		.string()
		.required()
};

const ConnectedFloatingToolbarBackgroundColorPanel = getConnectedComponent(
	FloatingToolbarBackgroundColorPanel,
	['themeColorsCssClasses']
);

Soy.register(ConnectedFloatingToolbarBackgroundColorPanel, templates);

export {ConnectedFloatingToolbarBackgroundColorPanel, FloatingToolbarBackgroundColorPanel};
export default ConnectedFloatingToolbarBackgroundColorPanel;
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
AudioPreviewer.STATE = {

	/**
	 * The max witdh of audio player based in
	 * video player width
	 * @instance
	 * @memberof AudioPreviewer
	 * @review
	 * @type {!number}
	 */
	audioMaxWidth: Config.number().required(),

	/**
	 * List of of audio sources
	 * @instance
	 * @memberof AudioPreviewer
	 * @review
	 * @type {!Array<object>}
	 */
	audioSources: Config.arrayOf(
		Config.shapeOf(
			{
				type: Config.string().required(),
				url: Config.string().required()
			}
		)
 * State definition.
 * @ignore
 * @static
 * @type {!Object}
 */
EditCategories.STATE = {

	/**
	 * Description
	 *
	 * @instance
	 * @memberof EditCategories
	 * @review
	 * @type {String}
	 */
	description: Config.string(),

	/**
	 * List of selected file entries.
	 *
	 * @instance
	 * @memberof EditCategories
	 * @review
	 * @type {List<String>}
	 */
	fileEntries: Config.array(),

	/**
	 * Folder Id
	 *
	 * @instance
 * State definition.
 * @review
 * @static
 * @type {!Object}
 */
SidebarWidgetsPanel.STATE = {

	/**
	 * @default ''
	 * @instance
	 * @memberOf SidebarWidgetsPanel
	 * @private
	 * @review
	 * @type {string}
	 */
	_keywords: Config
		.string()
		.internal()
		.value('')
};

const ConnectedSidebarWidgetsPanel = getConnectedComponent(
	SidebarWidgetsPanel,
	[
		'spritemap',
		'widgets'
	]
);

Soy.register(ConnectedSidebarWidgetsPanel, templates);

export {ConnectedSidebarWidgetsPanel, SidebarWidgetsPanel};
Example #30
0
				</li>
			</ul>
		);
	}
}

Sidebar.STATE = {

	/**
	 * @default 0
	 * @instance
	 * @memberof Sidebar
	 * @type {?number}
	 */

	activeTab: Config.number().value(0).internal(),

	/**
	 * @default _dropdownFieldTypesValueFn
	 * @instance
	 * @memberof Sidebar
	 * @type {?array}
	 */

	dropdownFieldTypes: Config.array().valueFn('_dropdownFieldTypesValueFn'),

	/**
	 * @instance
	 * @memberof Sidebar
	 * @type {array}
	 */