@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
38 lines • 2.27 kB
JavaScript
;
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 });
exports.SuggestField = SuggestField;
const react_1 = __importDefault(require("react"));
const constants_1 = require("../../configuration/constants");
const AutoCompleteField_1 = __importDefault(require("../AutocompleteField/AutoCompleteField"));
/**
* A component with the appearance of an input field that allows to select and optionally create new items.
* It shows suggestions for the entered text from which the user can select any option.
* It has the following fixed behavior:
*
* - When not focused, a different representation of the item value can be shown, e.g. the label of the value.
* - When changing an existing item the input text is set to the original value in order to be able to edit the original value.
* - When for a specific input text, the only item returns is the currently set item itself, all items are shown below it, to make
* clear that there are still other items to choose from.
* - The suggestions are fetched with a short delay, so not too many unnecessary requests are fired.
* - Items where itemRenderer returns a string have a default representation, i.e. highlighting of search words, active flag etc.
*/
function SuggestField(_a) {
var { className } = _a, otherProps = __rest(_a, ["className"]);
// Currently this works only as an alias element for `AutoCompleteField`.
return (react_1.default.createElement(AutoCompleteField_1.default, Object.assign({ className: `${constants_1.CLASSPREFIX}-suggestfield` + (className ? ` ${className}` : "") }, otherProps)));
}
//# sourceMappingURL=SuggestField.js.map