<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/headless_data_set_display/init.jsp" %>

<%
String randomNamespace = PortalUtil.generateRandomKey(request, "taglib_step_tracker") + StringPool.UNDERLINE;

String containerId = randomNamespace + "table-id";

JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer();
%>

<link href="<%= PortalUtil.getStaticResourceURL(request, PortalUtil.getPathModule() + "/frontend-taglib-clay/data_set_display/styles/main.css") %>" rel="stylesheet" />

<div class="table-root" id="<%= containerId %>">
	<span aria-hidden="true" class="loading-animation my-7"></span>
</div>

<aui:script require='<%= module + " as dataSetDisplay" %>'>
	dataSetDisplay.default(
		{
			actionParameterName: '<%= GetterUtil.getString(actionParameterName) %>',
			activeViewSettings: <%= activeViewSettingsJSON %>,
			apiURL: '<%= apiURL %>',
			appURL: '<%= appURL %>',
			bulkActions: <%= jsonSerializer.serializeDeep(bulkActionDropdownItems) %>,
			creationMenu: <%= jsonSerializer.serializeDeep(creationMenu) %>,
			currentURL: '<%= PortalUtil.getCurrentURL(request) %>',
			filters: <%= jsonSerializer.serializeDeep(clayDataSetFiltersContext) %>,
			formId: '<%= GetterUtil.getString(formId) %>',
			id: '<%= id %>',
			itemsActions: <%= jsonSerializer.serializeDeep(clayDataSetActionDropdownItems) %>,
			namespace: '<%= namespace %>',
			nestedItemsKey: '<%= GetterUtil.getString(nestedItemsKey) %>',
			nestedItemsReferenceKey:
				'<%= GetterUtil.getString(nestedItemsReferenceKey) %>',
			pagination: {
				deltas: <%= jsonSerializer.serializeDeep(clayPaginationEntries) %>,
				initialDelta: <%= itemsPerPage %>,
				initialPageNumber: <%= pageNumber %>,
			},
			portletId: '<%= portletDisplay.getRootPortletId() %>',
			portletURL: '<%= portletURL %>',
			selectedItems: <%= jsonSerializer.serializeDeep(selectedItems) %>,
			selectedItemsKey: '<%= GetterUtil.getString(selectedItemsKey) %>',
			showManagementBar: <%= showManagementBar %>,
			showSearch: <%= showSearch %>,
			style: '<%= style %>',
			selectionType: '<%= GetterUtil.getString(selectionType) %>',
			showPagination: <%= showPagination %>,
			sorting: <%= jsonSerializer.serializeDeep(sortItemList) %>,
			views: <%= jsonSerializer.serializeDeep(clayDataSetDisplayViewsContext) %>,
		},
		document.getElementById('<%= containerId %>')
	);
</aui:script>