UNPKG

sp-grid

Version:

<div align="center"> <h1>sp-grid</h1>

492 lines (460 loc) 36.4 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/sort'), require('@angular/animations'), require('@angular/material/paginator'), require('@angular/material/table'), require('@angular/common'), require('@angular/material/checkbox'), require('ng-click-outside'), require('@angular/material/button'), require('@angular/forms'), require('@angular/material/datepicker'), require('@angular/material/core')) : typeof define === 'function' && define.amd ? define('sp-grid', ['exports', '@angular/core', '@angular/material/sort', '@angular/animations', '@angular/material/paginator', '@angular/material/table', '@angular/common', '@angular/material/checkbox', 'ng-click-outside', '@angular/material/button', '@angular/forms', '@angular/material/datepicker', '@angular/material/core'], factory) : (global = global || self, factory(global['sp-grid'] = {}, global.ng.core, global.ng.material.sort, global.ng.animations, global.ng.material.paginator, global.ng.material.table, global.ng.common, global.ng.material.checkbox, global.ngClickOutside, global.ng.material.button, global.ng.forms, global.ng.material.datepicker, global.ng.material.core)); }(this, (function (exports, core, sort, animations, paginator, table, common, checkbox, ngClickOutside, button, forms, datepicker, core$1) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* 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) { 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) : new P(function (resolve) { resolve(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 __exportStar(m, exports) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } 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 }; } var SettingsVM = /** @class */ (function () { function SettingsVM() { this.expandable = false; this.paginable = false; this.pageSize = 5; this.pageSizeOptions = [5, 10, 20, 50]; this.theme = "default"; } return SettingsVM; }()); var SpGridComponent = /** @class */ (function () { function SpGridComponent() { this.settings = new SettingsVM(); //output this.rowClickEmit = new core.EventEmitter; this.updatedRow = new core.EventEmitter; this.getDetails = new core.EventEmitter(); this.sortEvent = new core.EventEmitter(); this.pageEvent = new core.EventEmitter(); //private this.clickedCol = false; } SpGridComponent.prototype.ngOnInit = function () { }; SpGridComponent.prototype.ngOnChanges = function (changes) { if (changes && changes.settings) { this._setColor(); } if (changes && changes.colDef) { if (this.settings.expandable) this.colDef.splice(0, 0, ({ key: 'expand', label: '', sortable: false, template: this.expandTemplate })); } if (changes && changes.data) { //set colums to display this.displayedColumns = this.colDef.map(function (col) { return col['key']; }); //set dataSopurce this.dataSource = new table.MatTableDataSource(this.data); this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; } if (changes && changes.dataExpanded) { if (this.dataExpanded && this.dataExpanded.length > 0) { //set colums to display this.displayedColumnsExpanded = this.colDefExpanded.map(function (col) { return col['key']; }); } ; this.dataSourceExpanded = this.dataExpanded; this.expandedElement = this.clickedElement; } ; }; SpGridComponent.prototype.sortData = function (sort) { var data = this.data.slice(); if (!sort.active || sort.direction === '') { return; } this.sortEvent.emit(sort); }; SpGridComponent.prototype.expandClick = function (element) { this.dataSourceExpanded = []; if (this.expandedElement == element) { this.expandedElement = ""; } else { this.clickedElement = element; //emit this.getDetails.emit(element); } }; SpGridComponent.prototype.clickCol = function (col, element) { //set clicked col this.clickedCol = true; //reset all editing this.dataSource.data.forEach(function (cc) { cc.isEditingCol = ""; }); //set specific editing field if (col.editable) { element.isEditingCol = col.key; element.editValue = element[col.key]; switch (col.inputType) { case 'text': this.editingTemplate = this.inputTextTemplate; break; case 'select': this.editingTemplate = this.selectTemplate; break; case 'date': this.editingTemplate = this.datePickerTemplate; break; default: break; } } }; SpGridComponent.prototype.setDate = function (element, evt) { element.editValue = evt.value; }; SpGridComponent.prototype.removeEditing = function (element) { element.isEditingCol = ""; }; SpGridComponent.prototype.saveEditing = function (element, key) { element[key] = element.editValue; this.updatedRow.emit(element); element.isEditingCol = ""; }; SpGridComponent.prototype.page = function (evt) { this.pageEvent.emit(evt); }; SpGridComponent.prototype._setColor = function () { //setting default theme if (this.settings.theme) { switch (this.settings.theme) { case 'green': document.documentElement.style.setProperty('--accent-color', "#009500"); document.documentElement.style.setProperty('--border-color', "#B4BFCC"); document.documentElement.style.setProperty('--title-color', "white"); document.documentElement.style.setProperty('--title-background', "#00C300"); document.documentElement.style.setProperty('--light-background', "rgb(237, 237, 237)"); document.documentElement.style.setProperty('--hover-color', "#B4BFCC"); break; case 'dark': document.documentElement.style.setProperty('--accent-color', "#88629A"); document.documentElement.style.setProperty('--border-color', "#B4BFCC"); document.documentElement.style.setProperty('--title-color', "white"); document.documentElement.style.setProperty('--title-background', "#222423"); document.documentElement.style.setProperty('--light-background', "rgb(237, 237, 237)"); document.documentElement.style.setProperty('--hover-color', "#B4BFCC"); break; case 'gray': document.documentElement.style.setProperty('--accent-color', "#5E3C4C"); document.documentElement.style.setProperty('--border-color', "#B4BFCC"); document.documentElement.style.setProperty('--title-color', "white"); document.documentElement.style.setProperty('--title-background', "#C9C7B0"); document.documentElement.style.setProperty('--light-background', "rgb(237, 237, 237)"); document.documentElement.style.setProperty('--hover-color', "#B4BFCC"); break; default: document.documentElement.style.setProperty('--accent-color', "#22406d"); document.documentElement.style.setProperty('--border-color', "#B4BFCC"); document.documentElement.style.setProperty('--title-color', "white"); document.documentElement.style.setProperty('--title-background', "#47618E"); document.documentElement.style.setProperty('--light-background', "rgb(237, 237, 237)"); document.documentElement.style.setProperty('--hover-color', "#B4BFCC"); break; } } //setting custom color if (this.settings.colorTitleBackground) document.documentElement.style.setProperty('--title-background', this.settings.colorTitleBackground); if (this.settings.colorLightBackground) document.documentElement.style.setProperty('--light-background', this.settings.colorLightBackground); if (this.settings.colorAccent) document.documentElement.style.setProperty('--accent-color', this.settings.colorAccent); if (this.settings.colorBorder) document.documentElement.style.setProperty('--border-color', this.settings.colorBorder); if (this.settings.colorHover) document.documentElement.style.setProperty('--hover-color', this.settings.colorHover); if (this.settings.colorTitle) document.documentElement.style.setProperty('--title-color', this.settings.colorTitle); }; __decorate([ core.ViewChild('percTemplate', { static: true }) ], SpGridComponent.prototype, "percTemplate", void 0); __decorate([ core.ViewChild('currencyTemplate', { static: true }) ], SpGridComponent.prototype, "currencyTemplate", void 0); __decorate([ core.ViewChild('expandTemplate', { static: true }) ], SpGridComponent.prototype, "expandTemplate", void 0); __decorate([ core.ViewChild('inputTextTemplate', { static: true }) ], SpGridComponent.prototype, "inputTextTemplate", void 0); __decorate([ core.ViewChild('selectTemplate', { static: true }) ], SpGridComponent.prototype, "selectTemplate", void 0); __decorate([ core.ViewChild('datePickerTemplate', { static: true }) ], SpGridComponent.prototype, "datePickerTemplate", void 0); __decorate([ core.ViewChild(paginator.MatPaginator, { static: true }) ], SpGridComponent.prototype, "paginator", void 0); __decorate([ core.ViewChild(sort.MatSort, { static: true }) ], SpGridComponent.prototype, "sort", void 0); __decorate([ core.Input() ], SpGridComponent.prototype, "data", void 0); __decorate([ core.Input() ], SpGridComponent.prototype, "colDef", void 0); __decorate([ core.Input() ], SpGridComponent.prototype, "dataExpanded", void 0); __decorate([ core.Input() ], SpGridComponent.prototype, "colDefExpanded", void 0); __decorate([ core.Input() ], SpGridComponent.prototype, "settings", void 0); __decorate([ core.Output() ], SpGridComponent.prototype, "rowClickEmit", void 0); __decorate([ core.Output() ], SpGridComponent.prototype, "updatedRow", void 0); __decorate([ core.Output() ], SpGridComponent.prototype, "getDetails", void 0); __decorate([ core.Output() ], SpGridComponent.prototype, "sortEvent", void 0); __decorate([ core.Output() ], SpGridComponent.prototype, "pageEvent", void 0); SpGridComponent = __decorate([ core.Component({ selector: 'app-sp-grid', template: "<table multiTemplateDataRows mat-table [dataSource]=\"dataSource\" matSort (matSortChange)=\"sortData($event)\"\r\n class=\"data-table-custom\">\r\n\r\n <ng-container [matColumnDef]=\"col?.key\" *ngFor=\"let col of colDef; let i = index\">\r\n\r\n\r\n <th [ngStyle]=\"{'width': col?.width ? col.width : 'auto'}\" class=\"fade-in\" mat-header-cell *matHeaderCellDef mat-sort-header [disabled]=\"!col?.sortable\">{{col?.label}}</th>\r\n <td mat-cell *matCellDef=\"let element\" [ngClass]=\"{'editable-cell': col?.editable}\">\r\n <div class=\"edit-icon\" *ngIf=\"element.isEditingCol!==col.key\" (click)=\"clickCol(col,element)\"> <i class=\"material-icons\">edit</i> </div>\r\n\r\n <div *ngIf=\"!col?.template && !col?.defaultTemplate\">\r\n <span [hidden]=\"element.isEditingCol==col.key\" (click)=\"clickCol(col,element)\">\r\n <span *ngIf=\"col?.type=='date'\">{{element[col?.key] | date: col?.formatDate}}</span>\r\n <span *ngIf=\"col?.type=='number'\">{{element[col?.key] | number: col?.formatNumber}}</span>\r\n <span *ngIf=\"col?.type!=='date' && col?.type!=='number'\">{{element[col?.key]}}</span>\r\n </span>\r\n <div *ngIf=\"element.isEditingCol==col.key\">\r\n <ng-container\r\n *ngTemplateOutlet=\"editingTemplate;context:{$implicit: element, col: col.key, options: col?.optionsSelect}\">\r\n </ng-container>\r\n </div>\r\n </div>\r\n <!-- Perc Template -->\r\n <div *ngIf=\" col?.defaultTemplate=='percTemplate'\">\r\n <ng-container *ngTemplateOutlet=\" percTemplate;context:{$implicit: element[col?.key]}\">\r\n </ng-container>\r\n </div>\r\n <!-- Currency template -->\r\n <div *ngIf=\"col?.defaultTemplate=='currencyTemplate'\">\r\n <ng-container\r\n *ngTemplateOutlet=\"currencyTemplate;context:{$implicit: element[col?.key], symbol: col?.currency}\">\r\n </ng-container>\r\n </div>\r\n <!-- Expand template -->\r\n <div *ngIf=\"col?.template && col?.template==expandTemplate\">\r\n <ng-container *ngTemplateOutlet=\"col?.template;context:{$implicit: element}\">\r\n </ng-container>\r\n </div>\r\n <!-- Template custom -->\r\n <div *ngIf=\"col?.template && col?.template!==expandTemplate\">\r\n <ng-container\r\n *ngTemplateOutlet=\"col?.template;context:{$implicit: element[col?.key], secondVal: element[col?.secondVal], thirdVal: element[col?.thirdVal]}\">\r\n </ng-container>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <!-- Expanded details -->\r\n <ng-container matColumnDef=\"expandedDetail\">\r\n <td mat-cell *matCellDef=\"let element\" [attr.colspan]=\"displayedColumns.length\">\r\n <div class=\"example-element-detail\" [@detailExpand]=\"element == expandedElement ? 'expanded' : 'collapsed'\">\r\n <table mat-table [dataSource]=\"dataSourceExpanded\" class=\"data-table-custom inner-after-open-table\">\r\n <ng-container [matColumnDef]=\"colExpanded?.key\"\r\n *ngFor=\"let colExpanded of colDefExpanded; let iExpanded = index\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{colExpanded?.label}}</th>\r\n <td mat-cell class=\"cell-expanded\" *matCellDef=\"let element\">\r\n <div *ngIf=\"!colExpanded?.template && !colExpanded?.defaultTemplate\">\r\n <span [hidden]=\"element.isEditingCol==colExpanded.key\" (click)=\"clickCol(colExpanded,element)\">\r\n <span\r\n *ngIf=\"colExpanded?.type=='date'\">{{element[colExpanded?.key] | date: colExpanded?.formatDate}}</span>\r\n <span *ngIf=\"colExpanded?.type!=='date'\">{{element[colExpanded?.key]}}</span>\r\n </span>\r\n <div *ngIf=\"element.isEditingCol==colExpanded.key\">\r\n <ng-container\r\n *ngTemplateOutlet=\"editingTemplate;context:{$implicit: element, col: colExpanded.key, options: colExpanded?.optionsSelect}\">\r\n </ng-container>\r\n </div>\r\n </div>\r\n <!-- Perc Template -->\r\n <div *ngIf=\" colExpanded?.defaultTemplate=='percTemplate'\">\r\n <ng-container *ngTemplateOutlet=\" percTemplate;context:{$implicit: element[colExpanded?.key]}\">\r\n </ng-container>\r\n </div>\r\n <!-- Currency template -->\r\n <div *ngIf=\"colExpanded?.defaultTemplate=='currencyTemplate'\">\r\n <ng-container\r\n *ngTemplateOutlet=\"currencyTemplate;context:{$implicit: element[colExpanded?.key], symbol: colExpanded?.currency}\">\r\n </ng-container>\r\n </div>\r\n <!-- Template custom -->\r\n <div *ngIf=\"colExpanded?.template\">\r\n <ng-container\r\n *ngTemplateOutlet=\"colExpanded?.template;context:{$implicit: element[colExpanded?.key], secondVal: element[colExpanded?.secondVal], thirdVal: element[colExpanded?.thirdVal]}\">\r\n </ng-container>\r\n </div>\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumnsExpanded\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumnsExpanded;\"></tr>\r\n </table>\r\n </div>\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let element; columns: displayedColumns;\"\r\n [ngClass]=\"{'expandable-row': settings.expandable}\" [class.example-expanded-row]=\"expandedElement === element\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['expandedDetail']\" class=\"example-detail-row\"></tr>\r\n</table>\r\n<div [hidden]=\"!settings.paginable\">\r\n <mat-paginator (page)=\"page($event)\" [pageSizeOptions]=\"settings.pageSizeOptions\" [pageSize]=\"settings.pageSize\">\r\n </mat-paginator>\r\n</div>\r\n\r\n<ng-template #percTemplate let-value>\r\n {{value | number}} %\r\n</ng-template>\r\n\r\n<ng-template #numberTemplate let-value>\r\n {{value | number}}\r\n</ng-template>\r\n\r\n<ng-template #currencyTemplate let-value let-symbol=\"symbol\">\r\n {{value | number}} {{symbol}}\r\n</ng-template>\r\n\r\n<ng-template #expandTemplate let-value>\r\n <div class=\"master-detail-button\">\r\n <div (click)=\"expandClick(value)\">+</div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inputTextTemplate let-value let-key=\"col\">\r\n <div class=\"wrap-editor fade-in\">\r\n <div><input class=\"custom-editing-item\" type=\"text\" [(ngModel)]=\"value.editValue\"></div>\r\n <div><button class=\"save-button\" mat-button (click)=\"saveEditing(value,key)\">Save</button></div>\r\n <div> <button class=\"save-button\" mat-button (click)=\"removeEditing(value)\">Undo</button> </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #selectTemplate let-value let-key=\"col\" let-optionsList=\"options\">\r\n <div class=\"wrap-editor fade-in\">\r\n <select [(ngModel)]=\"value.editValue\" class=\"custom-editing-item\">\r\n <option *ngFor=\"let opt of optionsList\" [value]=\"opt\">{{opt}}</option>\r\n </select><br>\r\n <button class=\"save-button\" mat-button (click)=\"saveEditing(value,key)\">Save</button>\r\n <button class=\"save-button\" mat-button (click)=\"removeEditing(value)\">Undo</button>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #datePickerTemplate let-value let-key=\"col\">\r\n <div class=\"wrap-editor fade-in\">\r\n\r\n <input class=\"custom-editing-item\" matInput [matDatepicker]=\"picker\" placeholder=\"Date\"\r\n (dateChange)=\"setDate(value, $event)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n <br>\r\n <button class=\"save-button\" mat-button (click)=\"saveEditing(value,key)\">Save</button>\r\n <button class=\"save-button\" mat-button (click)=\"removeEditing(value)\">Undo</button>\r\n </div>\r\n</ng-template>\r\n", animations: [ animations.trigger('detailExpand', [ animations.state('collapsed', animations.style({ height: '0px', minHeight: '0' })), animations.state('expanded', animations.style({ height: '*' })), animations.transition('expanded <=> collapsed', animations.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), ]), ], styles: ["@charset \"UTF-8\";@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700);@import url(https://fonts.googleapis.com/icon?family=Material+Icons);.fade-in{animation:1s fadein;-moz-animation:1s fadein;-webkit-animation:1s fadein;-o-animation:1s fadein}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}input,select,td,tr{transition:.3s}.data-table-custom{width:100%;font-family:\"Source Sans Pro\",sans-serif}.data-table-custom tr.mat-header-row,.data-table-custom tr.mat-row{padding:0}.wrap-editor input,.wrap-editor select{font-family:\"Source Sans Pro\",sans-serif;margin-right:10px;outline:0!important;margin-top:0!important;border:0;line-height:25px;background:rgba(0,0,0,.1);padding:0 10px;border-radius:40px}.wrap-editor input:focus,.wrap-editor select:focus{outline:0;background:rgba(0,0,0,.2)}tr.example-detail-row{height:0}.example-element-detail{overflow:hidden;display:flex}.example-element-detail .mat-tab-group{width:100%}.example-element-detail ::ng-deep .mat-tab-body-content{height:auto}.example-element-diagram{min-width:80px;border:2px solid #000;padding:8px;font-weight:lighter;margin:8px 0;height:104px}.example-element-symbol{font-weight:700;font-size:40px;line-height:normal}.example-element-description{padding:16px}.example-element-description-attribution{opacity:.5}.ng-trigger{margin-top:0!important}.mat-column-expandedDetail{padding:0!important}.expandable-row{cursor:pointer}.example-expanded-row{background-color:var(--accent-color);box-shadow:0 3px 3px rgba(0,0,0,.3);mix-blend-mode:multiply}.example-expanded-row .mat-cell{color:#fff;border-left:none;border-bottom:0!important;cursor:default}.example-detail-row .mat-cell{border-bottom:0}.example-detail-row .cell-expanded{border-bottom:1px solid var(--border-color)}.inner-after-open-table{padding:12px;background:var(--light-background);box-shadow:none!important}.inner-after-open-table td:last-child{border-right:1px solid rgba(0,0,0,.12)!important;border-bottom:1px solid var(--border-color)}.inner-after-open-table .table-title{padding:0;text-align:center}.inner-after-open-table tr{background:#fff}.inner-after-open-table tr:hover{background:var(--hover-color)}.first-layer-row{box-shadow:2px 2px 2px #000}.mat-column-arrow{padding:10px 16px!important;text-align:center}.mat-column-arrow::after{font-family:\"Font Awesome 5 Free\";font-weight:900;content:\"\uF054\";font-style:normal;font-variant:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}th.mat-column-arrow::after{display:none}.example-expanded-row .mat-column-arrow::after{font-family:\"Font Awesome 5 Free\";font-weight:900;content:\"\uF078\";font-style:normal;font-variant:normal;text-rendering:auto;-webkit-font-smoothing:antialiased}td.mat-cell{border-bottom:.5px solid var(--border-color);border-bottom-width:.5px}td.mat-cell:last-of-type.mat-column-expand{border-bottom:1px solid var(--border-color)}th.mat-header-cell{border-bottom-color:var(--border-color);background-color:var(--title-background);text-transform:uppercase;color:var(--title-color);letter-spacing:1px}::ng-deep button.mat-sort-header-button{color:var(--title-color);letter-spacing:1px;text-transform:uppercase;font-weight:700}.custom-editing-item{float:left}.save-button{background-color:var(--title-background);line-height:25px;border-radius:40px;margin-right:5px;font-size:10px;font-weight:500;text-transform:uppercase;float:left;color:var(--title-color)}.wrap-editor{display:flex;align-items:center}.edit-icon{display:none;float:left;padding:2px}.edit-icon i{font-size:14px;line-height:1;color:var(--title-background)}.editable-cell{cursor:pointer}.editable-cell .edit-icon{display:flex!important}"] }) ], SpGridComponent); return SpGridComponent; }()); var SpGridModule = /** @class */ (function () { function SpGridModule() { } SpGridModule = __decorate([ core.NgModule({ declarations: [ SpGridComponent ], imports: [ common.CommonModule, table.MatTableModule, sort.MatSortModule, checkbox.MatCheckboxModule, button.MatButtonModule, ngClickOutside.ClickOutsideModule, forms.FormsModule, datepicker.MatDatepickerModule, core$1.MatNativeDateModule, paginator.MatPaginatorModule ], providers: [ datepicker.MatDatepickerModule, ], exports: [ SpGridComponent ] }) ], SpGridModule); return SpGridModule; }()); var ColumnDefinition = /** @class */ (function () { function ColumnDefinition() { } return ColumnDefinition; }()); exports.ColumnDefinition = ColumnDefinition; exports.SettingsVM = SettingsVM; exports.SpGridModule = SpGridModule; exports.ɵa = SpGridComponent; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=sp-grid.umd.js.map