UNPKG

react-application-core

Version:

A react-based application core for the business applications.

80 lines 3.52 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ChipsField = void 0; var React = require("react"); var R = require("ramda"); var inline_option_1 = require("../../inline-option"); var util_1 = require("../../../util"); var definition_1 = require("../../../definition"); var multifield_component_1 = require("../multifield/multifield.component"); /** * @component-impl * @stable [16.06.2020] */ var ChipsField = /** @class */ (function (_super) { __extends(ChipsField, _super); function ChipsField() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ChipsField.prototype, "attachmentBodyElement", { /** * @stable [15.10.2020] * @protected */ get: function () { var _this = this; var inlineOptions = this.inlineOptions; if (util_1.ObjectUtils.isObjectEmpty(inlineOptions)) { return null; } return (React.createElement(React.Fragment, null, inlineOptions.map(function (item) { return _this.getInlineOptionElement(item); }))); }, enumerable: false, configurable: true }); /** * @stable [16.06.2020] * @returns {string} */ ChipsField.prototype.getFieldClassName = function () { return util_1.ClsUtils.joinClassName(_super.prototype.getFieldClassName.call(this), definition_1.ChipsFieldClassesEnum.CHIPS_FIELD); }; /** * @stable [08.07.2020] * @param {INamedEntity} item * @returns {JSX.Element} */ ChipsField.prototype.getInlineOptionElement = function (item) { var _this = this; var inlineOptionClassName = this.originalProps.inlineOptionClassName; return (React.createElement(inline_option_1.InlineOption, { key: "key-" + item.id, disabled: this.isInactive, className: util_1.ClsUtils.joinClassName(inlineOptionClassName, definition_1.ChipsFieldClassesEnum.CHIPS_FIELD_INLINE_OPTION), option: this.fieldConverter.fromNamedEntityToRawDataLabeledValueEntity(item), onClose: function () { return _this.onDelete(item); } })); }; Object.defineProperty(ChipsField.prototype, "inlineOptions", { /** * @stable [16.06.2020] * @returns {INamedEntity[]} */ get: function () { return R.sort(function (o1, o2) { return util_1.SortUtils.NAME_ASC_SORTER(o1.name, o2.name); }, this.multiFieldPlugin.activeValue); }, enumerable: false, configurable: true }); ChipsField.defaultProps = util_1.PropsUtils.mergeWithParentDefaultProps({}, multifield_component_1.MultiField); return ChipsField; }(multifield_component_1.MultiField)); exports.ChipsField = ChipsField; //# sourceMappingURL=chips-field.component.js.map