solrkit
Version:
  UI Components for Solr, using TypeScript + React
61 lines • 4.02 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as React from 'react';
import { ResultsLayout } from '../../../layout/ResultsLayout';
import { ResultsList } from '../../../component/ResultsList';
import { SearchBox } from '../../../component/SearchBox';
import { Pagination } from '../../../component/Pagination';
import { databind } from '../../../context/DataBinding';
import { suggestions } from './data/suggestions';
import { CheckFacet } from '../../../component/facet/CheckFacet';
import { RadioFacet } from '../../../component/facet/RadioFacet';
import { AppDataStore } from './data/AppDataStore';
import { ToggleFacet } from '../../../component/facet/ToggleFacet';
import { DropdownFacet } from '../../../component/facet/DropdownFacet';
import { TagFacet } from '../../../component/facet/TagFacet';
import { SingleNumber } from '../../../component/statistics/SingleNumber';
import { Link } from 'react-router-dom';
var dataStore = new AppDataStore();
var SearchPageApp = (function (_super) {
__extends(SearchPageApp, _super);
function SearchPageApp() {
var _this = _super.call(this) || this;
_this.left =
databind(dataStore.talks.registerFacet(['features_ss']), dataStore.talks, function (data) { return (React.createElement("div", null,
React.createElement(CheckFacet, { title: "Features", values: data, facet: "features_ss", render: function (label, value) { return label + ': ' + value.toLocaleString(); } }),
React.createElement(DropdownFacet, { title: "Features", facet: "features_ss", values: data }),
React.createElement(RadioFacet, { title: "Features", facet: "features_ss", values: data }),
React.createElement(ToggleFacet, { title: "Features", facet: "features_ss", values: data }),
React.createElement(TagFacet, { title: "Features", facet: "features_ss", values: data }))); });
var databindTalksQuery = function (fn) {
return databind(dataStore.talks.onQuery, dataStore.talks, fn);
};
_this.right = databindTalksQuery(function (talks, pagination) {
return (React.createElement(ResultsList, { docs: talks, render: function (talk) {
return React.createElement(Link, { to: '/view/' + talk.id }, talk.title_s);
} }));
});
_this.header = databindTalksQuery(function (talks, pagination) { return (React.createElement("div", { className: "ui grid" },
React.createElement("div", { className: "three wide column" },
React.createElement(SingleNumber, { horizontal: true, value: pagination.numFound, label: "Talks" })),
React.createElement("div", { className: "thirteen wide column" },
React.createElement(SearchBox, { placeholder: "Search...", loading: false, sampleSearches: suggestions })))); });
_this.footer = databindTalksQuery(function (talks, pagination) { return (React.createElement(Pagination, { numRows: pagination.numFound, pageSize: pagination.pageSize })); });
return _this;
}
SearchPageApp.prototype.render = function () {
return (React.createElement(ResultsLayout, { leftComponent: this.left, rightComponent: this.right, headerComponent: this.header, footerComponent: this.footer, rightRailComponent: this.rightRail }));
};
SearchPageApp.dataStore = dataStore;
return SearchPageApp;
}(React.Component));
export { SearchPageApp };
//# sourceMappingURL=SearchPage.js.map