@progress/sitefinity-nextjs-sdk
Version:
Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.
33 lines (32 loc) • 1.88 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { StyleGenerator } from '../styling/style-generator.service';
import { classNames } from '../../editor/utils/classNames';
import { htmlAttributes, getCustomAttributes } from '../../editor/widget-framework/attributes';
import { getMinimumWidgetContext } from '../../editor/widget-framework/widget-context';
import { Tracer } from '@progress/sitefinity-nextjs-sdk/diagnostics/empty';
import { RenderView } from '../common/render-view';
import { SearchFacetsDefaultView } from './search-facets.view';
export async function SearchFacets(props) {
const { span, ctx } = Tracer.traceWidget(props, true);
const model = props.model;
const entity = model.Properties;
const dataAttributes = htmlAttributes(props);
const defaultClass = entity.WidgetCssClass;
const marginClass = entity.Margins && StyleGenerator.getMarginClasses(entity.Margins);
const customAttributes = getCustomAttributes(entity.Attributes, 'SearchFacets');
dataAttributes['className'] = classNames(defaultClass, marginClass);
const viewProps = {
indexCatalogue: entity.IndexCatalogue,
appliedFiltersLabel: entity.AppliedFiltersLabel,
clearAllLabel: entity.ClearAllLabel,
filterResultsLabel: entity.FilterResultsLabel,
showMoreLabel: entity.ShowMoreLabel,
showLessLabel: entity.ShowLessLabel,
isShowMoreLessButtonActive: entity.IsShowMoreLessButtonActive,
displayItemCount: entity.DisplayItemCount,
isEdit: props.requestContext.isEdit,
attributes: { ...dataAttributes, ...customAttributes },
widgetContext: getMinimumWidgetContext(props)
};
return (_jsx(RenderView, { viewName: entity.SfViewName, widgetKey: props.model.Name, traceSpan: span, viewProps: viewProps, children: _jsx(SearchFacetsDefaultView, { ...viewProps }) }));
}