lucid-ui
Version:
A UI component library from AppNexus.
89 lines • 4.49 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);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var lodash_1 = __importDefault(require("lodash"));
var index_1 = require("../../../index");
function P(_a) {
var children = _a.children, rest = __rest(_a, ["children"]);
return react_1.default.createElement("p", __assign({}, rest), children);
}
var OptionCols = function (_a) {
var col1 = _a.col1, col2 = _a.col2, textMatch = _a.textMatch;
return (react_1.default.createElement("div", { style: { display: 'flex' } },
react_1.default.createElement("div", { style: { width: 100 } },
react_1.default.createElement(P, { match: textMatch }, col1)),
react_1.default.createElement("div", null,
react_1.default.createElement(P, { match: textMatch }, col2))));
};
var optionFilter = function (searchText, _a) {
var filterText = _a.filterText;
if (filterText) {
return new RegExp(lodash_1.default.escapeRegExp(searchText), 'i').test(filterText);
}
return true;
};
var default_1 = /** @class */ (function (_super) {
__extends(default_1, _super);
function default_1() {
return _super !== null && _super.apply(this, arguments) || this;
}
default_1.prototype.render = function () {
return (react_1.default.createElement(index_1.SearchableMultiSelect, { optionFilter: optionFilter },
react_1.default.createElement(index_1.SearchableMultiSelect.OptionGroup, { Selected: '' },
react_1.default.createElement("div", { style: { marginLeft: 27 } },
react_1.default.createElement(OptionCols, { col1: 'ID', col2: 'NAME' })),
react_1.default.createElement(index_1.SearchableMultiSelect.Option, { filterText: 'Foo', Selected: 'Foo (1234)' }, function (_a) {
var searchText = _a.searchText;
return (react_1.default.createElement(OptionCols, { col1: '1234', col2: 'Foo', textMatch: searchText }));
}),
react_1.default.createElement(index_1.SearchableMultiSelect.Option, { filterText: 'Bar', Selected: 'Bar (2345)' }, function (_a) {
var searchText = _a.searchText;
return (react_1.default.createElement(OptionCols, { col1: '2345', col2: 'Bar', textMatch: searchText }));
}),
react_1.default.createElement(index_1.SearchableMultiSelect.Option, { filterText: 'Baz', Selected: 'Baz (3456)' }, function (_a) {
var searchText = _a.searchText;
return (react_1.default.createElement(OptionCols, { col1: '3456', col2: 'Baz', textMatch: searchText }));
}))));
};
return default_1;
}(react_1.default.Component));
exports.default = default_1;
//# sourceMappingURL=07.formatted-options.js.map