UNPKG

11.9 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-simplegrid",["@angular/core","@angular/common"],e):"object"==typeof exports?exports["ng-simplegrid"]=e(require("@angular/core"),require("@angular/common")):t["ng-simplegrid"]=e(t["@angular/core"],t["@angular/common"])}(this,function(t,e){return function(t){function e(o){if(n[o])return n[o].exports;var a=n[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}([function(e,n){e.exports=t},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var a,r=arguments.length,i=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=function(){function t(){this.rowsPerPage=10,this.dataList=[],this.emptyMessage="검색한 내역이 없습니다",this.dataListToShow=[],this.totalPageCount=1,this.currentPageIndex=0,this.emptyRows=[]}return t.prototype.ngOnInit=function(){this.columns||console.error("ng-simpleGrid: grid.columns is not exists.")},t.prototype.setDataList=function(t){this.dataList=t,this.initializeData(t)},t.prototype.initializeData=function(t){this.totalPageCount=this._getTotalPageCount(this.rowsPerPage,t),this.dataListPerPage=this._getDataListPerPage(this.rowsPerPage,t),this.dataListToShow=this.dataListPerPage[0],this.emptyRows=this._getEmptyRowsToBeFilled(this.rowsPerPage,this.dataListToShow)},t.prototype.search=function(t,e){if(this.dataList){if(""===e)return void this.initializeData(this.dataList);for(var n=[],o=0,a=this.dataList;o<a.length;o++){var r=a[o];r[t].include(r)&&n.push(r)}this.initializeData(n)}},t.prototype.onClickDataItem=function(t,e,n,o,a){var r=this._getColumnByProperty(this.columns,o,"onClick");null!=r&&r.onClick(t,e,a,n)},t.prototype.onMovePage=function(t){this.dataListPerPage&&(this.dataListToShow=this.dataListPerPage[t],this.emptyRows=this._getEmptyRowsToBeFilled(this.rowsPerPage,this.dataListToShow),this.currentPageIndex=t)},t.prototype.onClickDataRow=function(t,e,n){this.event&&this.event.onClickRow&&this.event.onClickRow(e,n)},t.prototype._getColumnByProperty=function(t,e,n){for(var o=null,a=0,r=t;a<r.length;a++){var i=r[a];if(i.key==e&&i.hasOwnProperty(n)){o=i;break}}return o},t.prototype._getTotalPageCount=function(t,e){var n=e.length;return Math.ceil(n/t)},t.prototype._getDataListPerPage=function(t,e){for(var n=[],o=0;o<=this.totalPageCount;o++)n.push(this.dataList.splice(0,t));return n},t.prototype._getEmptyRowsToBeFilled=function(t,e){var n=t-e.length;return new Array(n)},t}();o([r.Input(),a("design:type",Array)],i.prototype,"columns",void 0),o([r.Input(),a("design:type",Object)],i.prototype,"event",void 0),o([r.Input(),a("design:type",Number)],i.prototype,"rowsPerPage",void 0),o([r.Input(),a("design:type",Array)],i.prototype,"dataList",void 0),o([r.Input(),a("design:type",String)],i.prototype,"emptyMessage",void 0),o([r.Input(),a("design:type",String)],i.prototype,"emptySubMessage",void 0),i=o([r.Component({selector:"ng-simpleGrid",styles:[n(6)],template:n(8)}),a("design:paramtypes",[])],i),e.GridComponent=i},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var a,r=arguments.length,i=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=function(){function t(){this.movePage=new r.EventEmitter}return t.prototype.ngOnInit=function(){console.log("oninit pagination")},t.prototype.createRange=function(t){for(var e=[],n=0;n<t;n++)e.push(n);return e},t.prototype.onMovePage=function(t){this.movePage.emit(t)},t.prototype.onMoveFirst=function(){0!=this.currentPageIndex&&this.onMovePage(0)},t.prototype.onMoveLast=function(){var t=this.totalPageCount-1;this.currentPageIndex!=t&&this.onMovePage(t)},t.prototype.onMoveNext=function(){var t=this.totalPageCount-1;this.currentPageIndex!=t&&(this.currentPageIndex=this.currentPageIndex+1,this.onMovePage(this.currentPageIndex))},t.prototype.onMovePrev=function(){0!=this.currentPageIndex&&(this.currentPageIndex=this.currentPageIndex-1,this.onMovePage(this.currentPageIndex))},t}();o([r.Input(),a("design:type",Number)],i.prototype,"totalPageCount",void 0),o([r.Input(),a("design:type",Number)],i.prototype,"currentPageIndex",void 0),o([r.Output(),a("design:type",r.EventEmitter)],i.prototype,"movePage",void 0),i=o([r.Component({selector:"ng-simplePagination",styles:[n(7)],template:n(9)}),a("design:paramtypes",[])],i),e.PaginationComponent=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.GridComponent=o.GridComponent;var a=n(2);e.PaginationComponent=a.PaginationComponent;var r=n(4);e.GridModule=r.GridModule},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var a,r=arguments.length,i=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(i=(r<3?a(i):r>3?a(e,n,i):a(e,n))||i);return r>3&&i&&Object.defineProperty(e,n,i),i};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),r=n(10),i=n(1),l=n(2),s=function(){function t(){}return t}();s=o([a.NgModule({imports:[r.CommonModule],declarations:[i.GridComponent,l.PaginationComponent],exports:[r.CommonModule,i.GridComponent,l.PaginationComponent]})],s),e.GridModule=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3);e.GridModule=o.GridModule,e.GridComponent=o.GridComponent,e.PaginationComponent=o.PaginationComponent},function(t,e){t.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"},function(t,e){t.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'},function(t,e){t.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>'},function(t,e){t.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>'},function(t,n){t.exports=e}])});
\No newline at end of file