UNPKG

@stvp/ng-shop-ui

Version:

Librería para crear los componentes de una tienda Online

505 lines (461 loc) 31.1 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/forms')) : typeof define === 'function' && define.amd ? define('@stvp/ng-shop-ui', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/forms'], factory) : (global = global || self, factory((global.stvp = global.stvp || {}, global.stvp['ng-shop-ui'] = {}), global.ng.core, global.ng.common, global.ng.router, global.ng.forms)); }(this, (function (exports, core, common, router, forms) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ 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); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(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); }; function __rest(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; } function __decorate(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; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } (function (CURRENCY_LIST) { CURRENCY_LIST["EURO"] = "EUR"; CURRENCY_LIST["US_DOLLAR"] = "USD"; CURRENCY_LIST["BRITISH_POUND"] = "GBP"; CURRENCY_LIST["CANADIAN_DOLAR"] = "CAD"; CURRENCY_LIST["COLOMBIAN_PESO"] = "COP"; CURRENCY_LIST["CHILEAN_PESO"] = "CLP"; CURRENCY_LIST["MEXICAN_PESO"] = "MXN"; CURRENCY_LIST["VENEZUELA_BOLIVAR"] = "VSD"; CURRENCY_LIST["PERUVIAN_SOL"] = "PEN"; })(exports.CURRENCY_LIST || (exports.CURRENCY_LIST = {})); (function (CURRENCIES_SYMBOL) { CURRENCIES_SYMBOL["EUR"] = "\u20AC"; CURRENCIES_SYMBOL["USD"] = "$"; CURRENCIES_SYMBOL["GBP"] = "\u00A3"; CURRENCIES_SYMBOL["CAD"] = "$"; CURRENCIES_SYMBOL["COP"] = "$"; CURRENCIES_SYMBOL["CLP"] = "$"; CURRENCIES_SYMBOL["MXN"] = "$"; CURRENCIES_SYMBOL["VSD"] = "Bs."; CURRENCIES_SYMBOL["PEN"] = "S/."; })(exports.CURRENCIES_SYMBOL || (exports.CURRENCIES_SYMBOL = {})); var ICON_CLASS = { nameClass: 'fas fa-star' }; var RatingComponent = /** @class */ (function () { function RatingComponent() { this.min = 1; this.max = 5; this.rating = undefined; this.classfontIcon = ICON_CLASS.nameClass; } RatingComponent.prototype.ngOnInit = function () { if (this.rating === undefined || this.rating === null) { this.rating.value = 0; this.rating.count = 0; } this.starsCssValues = Array(this.max).fill(''); }; __decorate([ core.Input() ], RatingComponent.prototype, "min", void 0); __decorate([ core.Input() ], RatingComponent.prototype, "max", void 0); __decorate([ core.Input() ], RatingComponent.prototype, "rating", void 0); __decorate([ core.Input() ], RatingComponent.prototype, "classfontIcon", void 0); RatingComponent = __decorate([ core.Component({ selector: 'shop-rating', template: "<div *ngIf=\"starsCssValues && rating.value\">\n <span *ngFor=\"let v of starsCssValues; let i = index\">\n <i class=\"{{classfontIcon}}\" [ngClass]=\"{ checked: rating.value >= i + 1 }\"></i>\n </span>\n {{ rating.value }} ({{ rating.count }})\n</div>\n", styles: ["\n .checked {\n color: orange;\n }\n\n .star,\n .star-20,\n .star-100 {\n color: transparent;\n -webkit-background-clip: text;\n background-clip: text;\n }\n\n .star-20 {\n background-image: -webkit-gradient(\n linear,\n left top,\n right top,\n color-stop(0.25, orange),\n color-stop(1, black)\n );\n background-image: gradient(\n linear,\n left top,\n right top,\n color-stop(0.25, orange),\n color-stop(1, black)\n );\n }\n\n .star-100 {\n background-image: -webkit-gradient(\n linear,\n left top,\n right top,\n color-stop(1, orange)\n );\n background-image: gradient(\n linear,\n left top,\n right top,\n color-stop(1, orange)\n );\n }\n "] }) ], RatingComponent); return RatingComponent; }()); var RatingModule = /** @class */ (function () { function RatingModule() { } RatingModule = __decorate([ core.NgModule({ declarations: [RatingComponent], imports: [ common.CommonModule ], exports: [RatingComponent] }) ], RatingModule); return RatingModule; }()); var CarouselItemsComponent = /** @class */ (function () { function CarouselItemsComponent(router) { this.router = router; this.items = []; } CarouselItemsComponent.prototype.open = function (i) { var urlsCommands = this.items[i].url.split('/'); this.router.navigate(__spread(urlsCommands)); }; CarouselItemsComponent.ctorParameters = function () { return [ { type: router.Router } ]; }; __decorate([ core.Input() ], CarouselItemsComponent.prototype, "items", void 0); CarouselItemsComponent = __decorate([ core.Component({ selector: 'shop-carousel-items', template: "<section>\n <div id=\"carouselExampleIndicators\" class=\"carousel slide\" data-ride=\"carousel\">\n <ol class=\"carousel-indicators\">\n <li data-target=\"#carouselExampleIndicators\" *ngFor=\"let slide of items; let slidePos = index\" data-slide-to=\"slidePos\" [ngClass]=\"{'active' : slidePos == 0}\"></li>\n </ol>\n <div class=\"carousel-inner\" role=\"listbox\">\n <div *ngFor=\"let item of items; let i = index\" class=\"carousel-item url-item\" \n title=\"{{ item.title }} - {{ item.description }}\"\n [ngClass]=\"{'active' : i == 0}\" (click)=\"open(i)\"\n [ngStyle]=\"{'background-image': 'url(' + item.background + ')'}\">\n <div class=\"carousel-caption d-none d-md-block\">\n <h3>{{ item.title }}</h3>\n <p>{{ item.description }}</p>\n </div>\n </div>\n </div>\n <a class=\"carousel-control-prev\" href=\"#carouselExampleIndicators\" role=\"button\" data-slide=\"prev\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Previous</span>\n </a>\n <a class=\"carousel-control-next\" href=\"#carouselExampleIndicators\" role=\"button\" data-slide=\"next\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Next</span>\n </a>\n </div>\n </section>\n ", styles: ["\n section {\n margin-bottom: 25px\n }\n .url-item {\n cursor: pointer;\n }\n\n .carousel-inner {\n height: 500px;\n }\n\n .carousel-item {\n height: 100%;\n min-height: 350px;\n background: no-repeat center center scroll;\n -webkit-background-size: cover;\n -moz-background-size: cover;\n -o-background-size: cover;\n background-size: cover;\n }\n\n @media (max-width: 1440px) {\n .carousel-item {\n max-height: 640px;\n }\n }\n @media (max-width: 400px) {\n .carousel-item {\n max-height: 240px;\n }\n }\n "] }) ], CarouselItemsComponent); return CarouselItemsComponent; }()); var CarouselItemsModule = /** @class */ (function () { function CarouselItemsModule() { } CarouselItemsModule = __decorate([ core.NgModule({ declarations: [CarouselItemsComponent], imports: [ common.CommonModule ], exports: [CarouselItemsComponent] }) ], CarouselItemsModule); return CarouselItemsModule; }()); var ProductItemComponent = /** @class */ (function () { function ProductItemComponent() { this.showDesc = false; this.add = new core.EventEmitter(); this.itemDetails = new core.EventEmitter(); this.selectCurrency = exports.CURRENCIES_SYMBOL[exports.CURRENCY_LIST.EURO]; } ProductItemComponent.prototype.ngOnInit = function () { this.product.qty = 0; }; ProductItemComponent.prototype.addToCart = function (product) { product.qty = product.qty + 1; this.add.emit(product); }; ProductItemComponent.prototype.showDetails = function (product) { this.itemDetails.emit(product); }; __decorate([ core.Input() ], ProductItemComponent.prototype, "product", void 0); __decorate([ core.Input() ], ProductItemComponent.prototype, "showDesc", void 0); __decorate([ core.Output() ], ProductItemComponent.prototype, "add", void 0); __decorate([ core.Output() ], ProductItemComponent.prototype, "itemDetails", void 0); __decorate([ core.Input() ], ProductItemComponent.prototype, "selectCurrency", void 0); ProductItemComponent = __decorate([ core.Component({ selector: 'shop-product-item', template: "<div class=\"product-grid\">\n <div class=\"product-image\">\n <a (click)=\"showDetails(product)\">\n <img src=\"{{ product.img }}\" class=\"pic-1\" [alt]=\"product.name\" />\n </a>\n </div>\n <div class=\"product-content\">\n <h3 class=\"title\">{{ product.name | truncate: 25 }}</h3>\n <p *ngIf=\"showDesc\">\n {{ product.description | truncate: 40 }}\n </p>\n <div>\n <ng-template #noDiscount>\n <div class=\"price\">\n {{ selectCurrency }} {{ product.price | number }}\n </div>\n </ng-template>\n <div class=\"price\" *ngIf=\"product.discount; else noDiscount\">\n {{ selectCurrency }} {{ product.priceDiscount | number }}\n <span >\n {{ selectCurrency }} {{ product.price | number }}\n <span class=\"discount-percentage\">({{ product.discount }}%)</span>\n </span>\n </div>\n </div>\n <shop-rating *ngIf=\"product.rating\" [rating]=\"product.rating\"></shop-rating>\n </div>\n <ul class=\"social\">\n <!--<li><a href=\"\" data-tip=\"A\u00F1adir a lista de deseos\"><i class=\"fa fa-shopping-bag\"></i></a></li>-->\n <li>\n <a\n class=\"item-button-options\"\n (click)=\"addToCart(product)\"\n data-tip=\"A\u00F1adir a la cesta\"\n ><i class=\"fas fa-cart-plus\"></i\n ></a>\n </li>\n <li>\n <a class=\"item-button-options\"\n (click)=\"showDetails(product)\" data-tip=\"Detalles del producto\"\n ><i class=\"fas fa-info\"></i\n ></a>\n </li>\n </ul>\n</div>\n", styles: ["\n /********************* Shopping Demo-6 **********************/\n .product-grid,\n .product-grid .product-image {\n overflow: hidden;\n }\n .product-grid {\n font-family: 'Open Sans', sans-serif;\n text-align: center;\n position: relative;\n transition: all 0.5s ease 0s;\n border: 1px solid #afa3a338;\n border-radius: 8px;\n }\n .product-grid:hover {\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);\n cursor: pointer\n }\n .product-grid .product-image a {\n display: block;\n }\n .product-grid .product-image img {\n width: 100%;\n min-height: 150px;\n max-height: 150px;\n transition: all 0.5s ease 0s;\n }\n .product-grid:hover .product-image img {\n transform: scale(1.1);\n }\n .product-grid .product-content {\n padding: 12px 12px 15px;\n transition: all 0.5s ease 0s;\n }\n .product-grid:hover .product-content {\n opacity: 0;\n }\n .product-grid .title {\n font-size: 18px;\n font-weight: 600;\n text-transform: capitalize;\n margin: 0 0 10px;\n transition: all 0.3s ease 0s;\n }\n .product-grid .title a {\n color: #000;\n }\n .product-grid .title a:hover {\n color: #333;\n }\n .product-grid .price {\n font-size: 22px;\n font-weight: 800;\n color: #cc1c39;\n text-align: left;\n margin-left: 20px;\n margin-bottom: 12px;\n }\n .product-grid .price span {\n color: #999;\n font-size: 15px;\n font-weight: 400;\n text-decoration: line-through;\n margin-left: 7px;\n display: inline-block;\n }\n .product-grid .price span.discount-percentage {\n text-decoration: none;\n }\n .product-grid .social {\n background-color: #fff;\n width: 100%;\n padding: 0;\n margin: 0;\n list-style: none;\n opacity: 0;\n transform: translateX(-50%);\n position: absolute;\n bottom: -50%;\n left: 50%;\n z-index: 1;\n transition: all 0.5s ease 0s;\n }\n .product-grid:hover .social {\n opacity: 1;\n bottom: 20px;\n }\n\n .product-grid .social li {\n display: inline-block;\n }\n .product-grid .social li a {\n color: #909090;\n font-size: 16px;\n line-height: 45px;\n text-align: center;\n height: 45px;\n width: 45px;\n margin: 0 7px;\n border: 1px solid #909090;\n border-radius: 50px;\n display: block;\n position: relative;\n transition: all 0.3s ease-in-out;\n }\n .product-grid .social li a:hover {\n color: #fff;\n background-color: #333;\n width: 80px;\n }\n .product-grid .social li a:after,\n .product-grid .social li a:before {\n content: attr(data-tip);\n color: #fff;\n background-color: #333;\n font-size: 12px;\n letter-spacing: 1px;\n line-height: 20px;\n padding: 1px 5px;\n border-radius: 5px;\n white-space: nowrap;\n opacity: 0;\n transform: translateX(-50%);\n position: absolute;\n left: 50%;\n top: -30px;\n }\n .product-grid .social li a:after {\n content: '';\n height: 15px;\n width: 15px;\n border-radius: 0;\n transform: translateX(-50%) rotate(45deg);\n top: -20px;\n z-index: -1;\n }\n .product-grid .social li a:hover:after,\n .product-grid .social li a:hover:before {\n opacity: 1;\n }\n .item-button-options:hover {\n background: #504a4a;\n cursor: pointer;\n }\n @media only screen and (max-width: 990px) {\n .product-grid {\n margin-bottom: 30px;\n }\n }\n "] }) ], ProductItemComponent); return ProductItemComponent; }()); var TruncatePipe = /** @class */ (function () { function TruncatePipe() { } TruncatePipe.prototype.transform = function (value, limit) { if (limit === void 0) { limit = 25; } return value.length > limit ? new common.SlicePipe().transform(value, 0, limit - 3).concat('...') : value; }; TruncatePipe = __decorate([ core.Pipe({ name: 'truncate', }) ], TruncatePipe); return TruncatePipe; }()); var ProductItemModule = /** @class */ (function () { function ProductItemModule() { } ProductItemModule = __decorate([ core.NgModule({ declarations: [ProductItemComponent, TruncatePipe], imports: [ common.CommonModule, RatingModule ], exports: [ProductItemComponent] }) ], ProductItemModule); return ProductItemModule; }()); var MODULES = [ forms.FormsModule, RatingModule, CarouselItemsModule, ProductItemModule ]; var ShopUiModule = /** @class */ (function () { function ShopUiModule() { } ShopUiModule = __decorate([ core.NgModule({ imports: MODULES, exports: MODULES }) ], ShopUiModule); return ShopUiModule; }()); var QuantitySelectorComponent = /** @class */ (function () { function QuantitySelectorComponent() { this.updateValue = new core.EventEmitter(); } QuantitySelectorComponent.prototype.changeValue = function (action) { if (action === '-' && this.qty > 1) { this.qty--; } else if (action === '+' && this.qty < this.stock) { this.qty++; } this.sendUpdate(); }; QuantitySelectorComponent.prototype.sendUpdate = function () { this.updateValue.emit(this.qty); }; __decorate([ core.Input() ], QuantitySelectorComponent.prototype, "qty", void 0); __decorate([ core.Input() ], QuantitySelectorComponent.prototype, "stock", void 0); __decorate([ core.Output() ], QuantitySelectorComponent.prototype, "updateValue", void 0); QuantitySelectorComponent = __decorate([ core.Component({ selector: 'shop-qty-selector', template: "<div>\n <button type=\"button\" class=\"btn btn-dark qty-btn\" (click)=\"changeValue('-')\">\n -\n </button>\n <input\n type=\"text\"\n [(ngModel)]=\"qty\"\n value=\"1\"\n name=\"quantity\"\n class=\"text-center quantity\"\n disabled\n />\n <button type=\"button\" class=\"btn btn-dark qty-btn\" (click)=\"changeValue('+')\">\n +\n </button>\n</div>\n\n", styles: ["\n div {\n margin-bottom: 5px;\n }\n .quantity {\n width: 20%;\n margin-bottom: 5px;\n }\n\n input[type='text']:disabled {\n color: black;\n width: 60px\n }\n\n .qty-btn {\n border-radius: 20px;\n padding-top: 3px;\n /* top - right - bottom - left => sentido de las agujas del reloj*/\n margin: -2px 3px 2px 3px;\n }\n "] }) ], QuantitySelectorComponent); return QuantitySelectorComponent; }()); var QuantitySelectorModule = /** @class */ (function () { function QuantitySelectorModule() { } QuantitySelectorModule = __decorate([ core.NgModule({ declarations: [QuantitySelectorComponent], imports: [ common.CommonModule, forms.FormsModule ], exports: [QuantitySelectorComponent], }) ], QuantitySelectorModule); return QuantitySelectorModule; }()); exports.CarouselItemsComponent = CarouselItemsComponent; exports.CarouselItemsModule = CarouselItemsModule; exports.ICON_CLASS = ICON_CLASS; exports.ProductItemComponent = ProductItemComponent; exports.ProductItemModule = ProductItemModule; exports.QuantitySelectorComponent = QuantitySelectorComponent; exports.QuantitySelectorModule = QuantitySelectorModule; exports.RatingComponent = RatingComponent; exports.RatingModule = RatingModule; exports.ShopUiModule = ShopUiModule; exports.TruncatePipe = TruncatePipe; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=stvp-ng-shop-ui.umd.js.map