UNPKG

@raona/components

Version:

React components used at Raona to work with SPFx

73 lines (72 loc) 4.24 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 (b.hasOwnProperty(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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var __1 = require("../.."); var react_masonry_component_1 = require("react-masonry-component"); var sp_1 = require("@raona/sp"); var Cardx4 = /** @class */ (function (_super) { __extends(Cardx4, _super); function Cardx4() { return _super !== null && _super.apply(this, arguments) || this; } Cardx4.prototype.handleSelect = function (item, selectedItemIndex) { var handleSelect = this.props.handleSelect; if (handleSelect) handleSelect(item, selectedItemIndex); }; Cardx4.prototype.handleAddToCatalog = function (item, selectedItemIndex) { var handleAddToCatalog = this.props.handleAddToCatalog; if (handleAddToCatalog) handleAddToCatalog(item, selectedItemIndex); }; Cardx4.prototype.handleShare = function (item, selectedItemIndex) { var handleShare = this.props.handleShare; if (handleShare) handleShare(item, selectedItemIndex); }; Cardx4.prototype.handleDeleteItem = function (item, selectedItemIndex) { var handleDelete = this.props.handleDelete; if (handleDelete) handleDelete(item, selectedItemIndex); }; Cardx4.prototype.render = function () { var _this = this; var _a = this.props, itemsList = _a.itemsList, groupRows = _a.groupRows, groupColumns = _a.groupColumns, defaultImageUrl = _a.defaultImageUrl, openItemsOnNewPage = _a.openItemsOnNewPage, handleAddToCatalog = _a.handleAddToCatalog, handleShare = _a.handleShare, handleSelect = _a.handleSelect, handleDelete = _a.handleDelete, handleSaveAsFavorite = _a.handleSaveAsFavorite, alternateNewsBodyStyle = _a.alternateNewsBodyStyle, newsBodyStyle = _a.newsBodyStyle; return (React.createElement(react_masonry_component_1.default, null, itemsList.map(function (i, index) { return (React.createElement(__1.Card, { item: i, alternateNewsBodyStyle: alternateNewsBodyStyle, newsBodyStyle: newsBodyStyle, itemIndex: index, handleAddToCatalog: handleAddToCatalog && _this.handleAddToCatalog, handleShareClick: handleShare && _this.handleShare, handleDeleteClick: handleDelete && _this.handleDeleteItem, handleCheckBoxClick: handleSelect && _this.handleSelect, handleSaveAsFavorite: handleSaveAsFavorite, defaultImageUrl: defaultImageUrl, openItemsOnNewPage: openItemsOnNewPage, addToCatalogToolTipText: 'Add to catalog', saveFavoriteToolTipText: 'Add to favorites', deleteToolTipText: 'Delete product' })); }))); }; __decorate([ sp_1.Bind() ], Cardx4.prototype, "handleSelect", null); __decorate([ sp_1.Bind() ], Cardx4.prototype, "handleAddToCatalog", null); __decorate([ sp_1.Bind() ], Cardx4.prototype, "handleShare", null); __decorate([ sp_1.Bind() ], Cardx4.prototype, "handleDeleteItem", null); return Cardx4; }(React.Component)); exports.Cardx4 = Cardx4;