apisearch-ui
Version:
Javascript User Interface of Apisearch.
69 lines (68 loc) • 2.7 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
exports.__esModule = true;
var preact_1 = require("preact");
var InformationComponent_1 = require("../components/Information/InformationComponent");
var Widget_1 = require("./Widget");
/**
* Information
*/
var Information = /** @class */ (function (_super) {
__extends(Information, _super);
/**
* Constructor
*
* @param target
* @param classNames
* @param template
* @param formatData
*/
function Information(_a) {
var target = _a.target, classNames = _a.classNames, template = _a.template, formatData = _a.formatData;
var _this = _super.call(this) || this;
_this.target = target;
_this.component = preact_1.h(InformationComponent_1["default"], { target: target, classNames: __assign(__assign({}, InformationComponent_1["default"].defaultProps.classNames), classNames), template: __assign(__assign({}, InformationComponent_1["default"].defaultProps.template), template), formatData: formatData });
return _this;
}
/**
* @param environmentId
* @param store
* @param repository
* @param dictionary
*/
Information.prototype.render = function (environmentId, store, repository, dictionary) {
this.component.props = __assign(__assign({}, this.component.props), { environmentId: environmentId, repository: repository, store: store, dictionary: dictionary });
var targetNode = document.querySelector(this.target);
preact_1.render(this.component, targetNode);
};
return Information;
}(Widget_1["default"]));
/**
* Information widget
*
* @param settings
*/
exports["default"] = (function (settings) { return new Information(settings); });