UNPKG

17.8 kBSource Map (JSON)View Raw
1{"version":3,"file":"ng-simplegrid.umd.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 9509c4dbb0426087793d","webpack:///external \"@angular/core\"","webpack:///./src/grid/grid.component.ts","webpack:///./src/grid/pagination.component.ts","webpack:///./src/grid/index.ts","webpack:///./src/grid/grid.module.ts","webpack:///./src/index.ts","webpack:///./src/grid/grid.component.scss","webpack:///./src/grid/pagination.component.scss","webpack:///./src/grid/grid.component.html","webpack:///./src/grid/pagination.component.html","webpack:///external \"@angular/common\""],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@angular/core\"), require(\"@angular/common\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ng-simplegrid\", [\"@angular/core\", \"@angular/common\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ng-simplegrid\"] = factory(require(\"@angular/core\"), require(\"@angular/common\"));\n\telse\n\t\troot[\"ng-simplegrid\"] = factory(root[\"@angular/core\"], root[\"@angular/common\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_10__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9509c4dbb0426087793d","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@angular/core\"\n// module id = 0\n// module chunks = 0 1","import { Component, Input, OnInit, ViewChild } from '@angular/core';\nimport { GridColumn, GridOption, GridEvent } from './grid.model';\n\n@Component({\n selector: 'ng-simpleGrid',\n styles: [require('./grid.component.scss')],\n template: require('./grid.component.html')\n})\n\nexport class GridComponent implements OnInit {\n\n @Input()\n columns: GridColumn[];\n\n @Input()\n event: GridEvent;\n\n @Input()\n rowsPerPage: number = 10;\n\n @Input()\n dataList: any[] = [];\n\n @Input()\n emptyMessage: string = '검색한 내역이 없습니다';\n\n @Input()\n emptySubMessage: string;\n\n dataListToShow: any[] = [];\n\n dataListPerPage: any[];\n\n totalPageCount: number = 1;\n\n currentPageIndex: number = 0;\n\n emptyRows: any[] = [];\n\n constructor() { \n }\n\n ngOnInit(): void {\n if(!this.columns) \n console.error('ng-simpleGrid: grid.columns is not exists.');\n }\n \n setDataList(dataList: any[]): void {\n this.dataList = dataList;\n \n this.initializeData(dataList);\n }\n\n initializeData(dataList: any[]) {\n this.totalPageCount = this._getTotalPageCount(this.rowsPerPage, dataList);\n this.dataListPerPage = this._getDataListPerPage(this.rowsPerPage, dataList);\n this.dataListToShow = this.dataListPerPage[0];\n this.emptyRows = this._getEmptyRowsToBeFilled(this.rowsPerPage, this.dataListToShow);\n }\n\n search(key: string, value: string): void {\n if(!this.dataList)\n return ;\n\n if(value === '') {\n this.initializeData(this.dataList);\n return ;\n }\n\n let filteredList = [];\n \n for(let data of this.dataList) {\n if(data[key].include(data))\n filteredList.push(data);\n }\n\n this.initializeData(filteredList);\n }\n\n onClickDataItem(e: any, value: any, datarow: any, key: string, index: number): void {\n let column: GridColumn = this._getColumnByProperty(this.columns, key, 'onClick');\n\n if(column == null)\n return ;\n\n column.onClick(e, value, index, datarow);\n }\n\n onMovePage(pageIndex: number): void {\n if(!this.dataListPerPage) \n return ;\n\n this.dataListToShow = this.dataListPerPage[pageIndex];\n this.emptyRows = this._getEmptyRowsToBeFilled(this.rowsPerPage, this.dataListToShow);\n this.currentPageIndex = pageIndex;\n }\n\n onClickDataRow(e: any, row: any, index: number) {\n if(this.event && this.event.onClickRow) {\n this.event.onClickRow(row, index);\n }\n }\n\n private _getColumnByProperty(columns: GridColumn[], key: string, property: string): GridColumn {\n let selectedColumn: GridColumn = null;\n\n for(let column of columns) {\n if(column.key == key) {\n if(column.hasOwnProperty(property)) {\n selectedColumn = column;\n break;\n }\n }\n }\n\n return selectedColumn;\n }\n\n private _getTotalPageCount(rowsPerPage: number, dataList: any[]): any {\n let dataListSize = dataList.length;\n \n return Math.ceil(dataListSize / rowsPerPage);\n }\n\n private _getDataListPerPage(rowsPerPage: number, dataList: any[]): any {\n let dataListPerPage = [];\n\n for(let i = 0; i <= this.totalPageCount; i++) {\n dataListPerPage.push(this.dataList.splice(0, rowsPerPage));\n }\n\n return dataListPerPage;\n }\n\n private _getEmptyRowsToBeFilled(rowsPerPage: number, dataList: any[]) {\n let emptyRowsCount = rowsPerPage - dataList.length;\n\n return new Array(emptyRowsCount);\n }\n}\n\n\n// WEBPACK FOOTER //\n// node_modules/angular2-template-loader!./src/grid/grid.component.ts","import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'ng-simplePagination',\n styles: [require('./pagination.component.scss')],\n template: require('./pagination.component.html')\n})\n\nexport class PaginationComponent implements OnInit {\n\n @Input()\n totalPageCount: number;\n\n @Input()\n currentPageIndex: number;\n\n @Output()\n movePage: EventEmitter<any> = new EventEmitter<any>();\n \n constructor() { }\n\n ngOnInit() { \n console.log('oninit pagination');\n }\n\n createRange(number: number): any[]{\n var numberList: number[] = [];\n for(var i = 0; i < number; i++){\n numberList.push(i);\n }\n return numberList;\n }\n\n onMovePage(pageIndex: number): void {\n this.movePage.emit(pageIndex);\n }\n\n onMoveFirst(): void {\n const FIRST_PAGE_INDEX = 0;\n\n if(this.currentPageIndex == FIRST_PAGE_INDEX) return;\n\n this.onMovePage(FIRST_PAGE_INDEX);\n }\n\n onMoveLast(): void {\n const LAST_PAGE_INDEX = this.totalPageCount - 1;\n\n if(this.currentPageIndex == LAST_PAGE_INDEX) return;\n\n this.onMovePage(LAST_PAGE_INDEX);\n }\n\n onMoveNext(): void {\n const LAST_PAGE_INDEX = this.totalPageCount - 1;\n\n if(this.currentPageIndex == LAST_PAGE_INDEX) return;\n\n this.currentPageIndex = this.currentPageIndex + 1;\n this.onMovePage(this.currentPageIndex);\n }\n \n onMovePrev(): void {\n const FIRST_PAGE_INDEX = 0;\n\n if(this.currentPageIndex == FIRST_PAGE_INDEX) return;\n\n this.currentPageIndex = this.currentPageIndex - 1;\n this.onMovePage(this.currentPageIndex);\n }\n}\n\n\n// WEBPACK FOOTER //\n// node_modules/angular2-template-loader!./src/grid/pagination.component.ts","export { GridComponent } from './grid.component';\nexport { PaginationComponent } from './pagination.component';\nexport { GridEvent, GridOption, GridColumn } from './grid.model';\nexport { GridModule } from './grid.module';\n\n\n// WEBPACK FOOTER //\n// node_modules/angular2-template-loader!./src/grid/index.ts","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { GridComponent } from './grid.component';\nimport { PaginationComponent } from './pagination.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [GridComponent, PaginationComponent],\n exports: [CommonModule, GridComponent, PaginationComponent]\n})\nexport class GridModule {}\n\n\n\n// WEBPACK FOOTER //\n// node_modules/angular2-template-loader!./src/grid/grid.module.ts","export { GridModule, GridComponent, PaginationComponent, GridOption, GridEvent, GridColumn } from './grid/index';\n\n\n\n// WEBPACK FOOTER //\n// node_modules/angular2-template-loader!./src/index.ts","module.exports = \".tbl-search-result {\\n margin: 0;\\n padding: 0;\\n border: 0;\\n outline: 0;\\n vertical-align: middle;\\n background: transparent;\\n border-spacing: 0;\\n width: 100%;\\n border: 1px solid #dee1e6;\\n border-width: 1px 1px 0 1px;\\n table-layout: fixed; }\\n .tbl-search-result thead th {\\n border-top: 1px;\\n height: 40px;\\n text-align: center;\\n color: #6d6e73;\\n background: #f2f5fa;\\n font-size: 14px;\\n padding: 0 5px; }\\n .tbl-search-result tbody tr:hover {\\n background-color: beige; }\\n .tbl-search-result tbody td {\\n cursor: pointer;\\n text-align: center;\\n font-size: 14px;\\n color: #6d6e73;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n overflow: hidden;\\n height: 40px;\\n border-bottom: 1px solid #dee1e6;\\n padding: 0 5px; }\\n .tbl-search-result tbody td.no-data {\\n padding: 0;\\n height: 200px;\\n color: #4d5662;\\n font-size: 16px;\\n font-weight: bold; }\\n .tbl-search-result tbody td.no-data .sub {\\n font-size: 14px;\\n color: #6d6e73;\\n line-height: 150%;\\n margin-top: 20px;\\n font-weight: 400; }\\n .tbl-search-result tbody td button {\\n background-color: #555555;\\n /* Green */\\n cursor: pointer;\\n border: none;\\n color: white;\\n padding: 5px 10px;\\n margin: 5px;\\n text-align: center;\\n text-decoration: none;\\n display: inline-block;\\n font-size: 16px; }\\n\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/grid/grid.component.scss\n// module id = 6\n// module chunks = 0 1","module.exports = \".paginate {\\n text-align: center;\\n padding: 10px 0;\\n font: 0/0 \\\"Noto Sans KR\\\"; }\\n .paginate a {\\n display: inline-block;\\n width: 30px;\\n height: 30px;\\n text-align: center;\\n font-size: 15px;\\n line-height: 30px;\\n cursor: pointer;\\n vertical-align: middle; }\\n .paginate strong {\\n display: inline-block;\\n width: 30px;\\n height: 30px;\\n text-align: center;\\n font-size: 15px;\\n line-height: 30px;\\n cursor: pointer;\\n vertical-align: middle;\\n border: 1px solid #fcd20c;\\n font-size: 15px;\\n line-height: 26px; }\\n .paginate .button-prev {\\n font: 0/0 \\\"Noto Sans KR\\\";\\n background: url(\\\"/assets/images/icon/ico-paginate-prev.png\\\") 50% 50% no-repeat; }\\n .paginate .button-next {\\n font: 0/0 \\\"Noto Sans KR\\\";\\n background: url(\\\"/assets/images/icon/ico-paginate-next.png\\\") 50% 50% no-repeat; }\\n\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/grid/pagination.component.scss\n// module id = 7\n// module chunks = 0 1","module.exports = \"<table class=\\\"tbl-search-result\\\">\\n <thead>\\n <tr>\\n <ng-template ngFor let-column [ngForOf]=\\\"columns\\\">\\n <th [width]=\\\"column.width || '10%'\\\">{{ column.name }}</th>\\n </ng-template>\\n </tr>\\n </thead>\\n <tbody>\\n <ng-template ngFor let-datarow [ngForOf]=\\\"dataListToShow\\\" let-i=\\\"index\\\">\\n <tr (click)=\\\"onClickDataRow($event, datarow, i)\\\">\\n <ng-template ngFor let-column [ngForOf]=\\\"columns\\\" let-i=\\\"index\\\">\\n \\n <ng-template [ngIf]=\\\"column.type == 'text'\\\">\\n <td (click)=\\\"onClickDataItem($event, column.value ? column.value : datarow[column.key], datarow, column.key, i)\\\">\\n {{ column.value ? column.value : datarow[column.key] }}\\n </td>\\n </ng-template>\\n\\n <ng-template [ngIf]=\\\"column.type == 'button'\\\">\\n <td>\\n <button\\n (click)=\\\"onClickDataItem($event, column.value ? column.value : datarow[column.key], datarow, column.key, i)\\\">\\n {{ column.value ? column.value : datarow[column.key] }}\\n </button>\\n </td>\\n </ng-template>\\n\\n </ng-template>\\n </tr>\\n </ng-template>\\n <ng-template ngFor let-emptyRow [ngForOf]=\\\"emptyRows\\\">\\n <tr>\\n <ng-template ngFor let-column [ngForOf]=\\\"columns\\\" let-i=\\\"index\\\">\\n <td>\\n </td>\\n </ng-template>\\n </tr>\\n </ng-template>\\n <ng-template [ngIf]=\\\"dataListToShow.length === 0\\\">\\n <tr>\\n <td class=\\\"no-data\\\"\\n [style.height.px]=\\\"rowsPerPage * 30\\\"\\n [attr.colspan]=\\\"columns.length\\\">\\n <p>{{ emptyMessage }}</p>\\n <p class=\\\"sub\\\" [innerHTML]=\\\"emptySubMessage\\\">\\n </p>\\n </td>\\n </tr>\\n </ng-template>\\n </tbody>\\n</table>\\n<ng-simplePagination\\n [totalPageCount]=\\\"totalPageCount\\\"\\n [currentPageIndex]=\\\"currentPageIndex\\\"\\n (movePage)=\\\"onMovePage($event)\\\">\\n</ng-simplePagination>\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/grid/grid.component.html\n// module id = 8\n// module chunks = 0 1","module.exports = \"<div class=\\\"paginate\\\">\\n <a class=\\\"item\\\" (click)=\\\"onMoveFirst()\\\">First</a>\\n <a class=\\\"button-prev\\\" (click)=\\\"onMovePrev()\\\">처음</a>\\n \\n <ng-template ngFor let-pageIndex [ngForOf]=\\\"createRange(totalPageCount)\\\">\\n <ng-template [ngIf]=\\\"currentPageIndex === pageIndex\\\">\\n <strong (click)=\\\"onMovePage(pageIndex)\\\">\\n {{ pageIndex + 1 }} \\n </strong> \\n </ng-template>\\n\\n <ng-template [ngIf]=\\\"currentPageIndex !== pageIndex\\\">\\n <a (click)=\\\"onMovePage(pageIndex)\\\">\\n {{ pageIndex + 1 }} \\n </a>\\n </ng-template>\\n </ng-template>\\n \\n <a class=\\\"button-next\\\" (click)=\\\"onMoveNext()\\\">끝</a>\\n <a class=\\\"item\\\" (click)=\\\"onMoveLast()\\\">Last</a>\\n</div>\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/grid/pagination.component.html\n// module id = 9\n// module chunks = 0 1","module.exports = __WEBPACK_EXTERNAL_MODULE_10__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@angular/common\"\n// module id = 10\n// module chunks = 0 1"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;A;;;;AChEA;;;;;;;;;;;;;;;;;;ACAA;AASA;AA8BA;AArBA;AAGA;AAGA;AAKA;AAIA;AAEA;AAEA;AAGA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AA/HA;AADA;;AACA;AAGA;AADA;;AACA;AAGA;AADA;;AACA;AAGA;AADA;;AACA;AAGA;AADA;;AACA;AAGA;AADA;;AACA;AAlBA;AANA;AACA;AACA;AACA;AACA;;AAEA;AAAA;;;;;;;;;;;;;;;;;;;ACTA;AAQA;AAWA;AAFA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AAEA;AACA;AAEA;AACA;AAEA;AAAA;AAEA;AACA;AAEA;AACA;AAEA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AA3DA;AADA;;AACA;AAGA;AADA;;AACA;AAGA;AADA;AACA;AAAA;AATA;AANA;AACA;AACA;AACA;AACA;;AAEA;AAAA;;;;;;;;;;ACRA;AAAA;AACA;AAAA;AAEA;AAAA;;;;;;;;;;;;;;;;ACHA;AACA;AAEA;AACA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AALA;AACA;AACA;AACA;AACA;AACA;AAAA;;;;;;;;;;ACXA;AAAA;AAAA;AAAA;;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;A","sourceRoot":""}
\No newline at end of file