UNPKG

react-application-core

Version:

A react-based application core for the business applications.

49 lines 2.53 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.CardList = void 0; var React = require("react"); var util_1 = require("../../util"); var definition_1 = require("../../definition"); var base_list_component_1 = require("../list/base-list.component"); var card_1 = require("./card"); var CardList = /** @class */ (function (_super) { __extends(CardList, _super); function CardList() { return _super !== null && _super.apply(this, arguments) || this; } /** * @stable [04.05.2020] * @returns {JSX.Element} */ CardList.prototype.getView = function () { var mergedProps = this.mergedProps; var className = mergedProps.className; return (React.createElement("div", { ref: this.actualRef, className: util_1.ClsUtils.joinClassName(definition_1.ListClassesEnum.LIST, definition_1.ListClassesEnum.CARD_LIST, util_1.WrapperUtils.isFull(mergedProps) && definition_1.ListClassesEnum.FULL_LIST, className) }, this.dataSource.map(this.getItem, this))); }; /** * @stable [04.05.2020] * @param {IEntity} entity * @param {number} index * @returns {JSX.Element} */ CardList.prototype.getItem = function (entity, index) { var _a = this.props, onSelect = _a.onSelect, _b = _a.itemConfiguration, itemConfiguration = _b === void 0 ? {} : _b; return (React.createElement(card_1.Card, { key: this.toRowKey(entity), className: util_1.ClsUtils.joinClassName(definition_1.ListClassesEnum.LIST_ITEM, "rac-list-item-" + index, util_1.CalcUtils.calc(itemConfiguration.className, entity)), selected: this.isEntitySelected(entity), entity: entity, onClick: onSelect }, itemConfiguration.renderer(entity))); }; return CardList; }(base_list_component_1.BaseList)); exports.CardList = CardList; //# sourceMappingURL=card-list.component.js.map