@experteam-mx/ngx-table 1.0.1 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experteam-mx-ngx-table.mjs","sources":["../../../projects/ngx-table/src/lib/ngx-table.service.ts","../../../projects/ngx-table/src/lib/ngx-table.component.ts","../../../projects/ngx-table/src/lib/ngx-table.component.html","../../../projects/ngx-table/src/lib/ngx-table.module.ts","../../../projects/ngx-table/src/public-api.ts","../../../projects/ngx-table/src/experteam-mx-ngx-table.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxTableService {\n\n constructor() { }\n}\n","import { Component, OnInit, OnChanges, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';\n\n@Component({\n selector: 'ngx-table',\n templateUrl: './ngx-table.component.html',\n styleUrls: ['./ngx-table.component.scss']\n})\nexport class NgxTableComponent implements OnInit, OnChanges {\n\n constructor() { }\n\n @Input() headRow: any[] = new Array()\n headRowRender: any[] = new Array()\n\n @Input() registers: any[] = new Array()\n @Input() registersRender: any[] = new Array()\n\n @Input() configs: any\n configsRender: any = {}\n\n @Output() changePage = new EventEmitter<Object>();\n @Output() clickEvent = new EventEmitter<Object>();\n\n configsDefault: any = {\n titleTable: null,\n loading: false,\n paginationActive: false,\n page: 1,\n pageSize: 15,\n collectionSize: 0,\n search:{\n active: false,\n textSearch: '',\n placeholderSearch: 'Search'\n },\n order: {\n active: false,\n field: null,\n asc: false\n },\n actions: {\n add:{\n active: false,\n labelHtml: null\n },\n select:{\n active: false,\n labelHtml: null\n },\n edit:{\n active: false,\n labelHtml: null\n },\n delete:{\n active: false,\n labelHtml: null\n },\n },\n colHead:{\n label: null,\n type: 'string', // string, number\n field: null,\n order: {\n active: false\n }\n }\n }\n\n objectKeys( registers: any ){\n let registros = new Array()\n for( let key of Object.keys(registers) ){\n if( key != 'configRegister' ){\n registros.push( key )\n }\n }\n\n return registros\n }\n\n onPageChange() {\n this.configs = this.configsRender\n this.changePage.emit({\n ...this.configsRender\n });\n }\n\n onKeySearch() {\n this.configs = this.configsRender\n this.changePage.emit({\n ...this.configsRender\n });\n }\n\n onRestarSeach() {\n this.configs = this.configsRender\n this.changePage.emit({\n ...this.configsRender\n });\n }\n\n onActionClick(object: any) {\n object.event.preventDefault()\n object.event.stopPropagation()\n\n this.clickEvent.emit({\n type: object.type,\n data: object.data\n });\n }\n\n render(){\n this.headRowRender = new Array()\n for( let head of this.headRow ){\n this.headRowRender.push({\n ...this.configsDefault.colHead,\n ...head\n })\n }\n\n this.configsRender = {\n titleTable: this.configsDefault.titleTable,\n paginationActive: this.configsDefault.paginationActive,\n page: this.configsDefault.page,\n pageSize: this.configsDefault.pageSize,\n search: this.configsDefault.search,\n order: this.configsDefault.order,\n actions: this.configsDefault.actions,\n ...this.configs,\n collectionSize: this.registers.length,\n }\n\n this.registersRender = new Array()\n for( let register of this.registers ){\n this.registersRender.push({\n configRegister: {\n actions: this.configsRender.actions,\n },\n ...register\n })\n }\n }\n\n ngOnInit(): void {\n this.render()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n console.log(\"ngOnChanges\",this.registers)\n this.render()\n }\n\n}\n","<div class=\"container-fluid\">\r\n <h3 class=\"text-center\" *ngIf=\"configsRender.titleTable != null\">{{ configsRender.titleTable }}</h3>\r\n <div *ngIf=\"!configsRender.search.active && configsRender.actions.add?.active\" class=\"row justify-content-end mb-2\">\r\n <div class=\"col d-flex justify-content-end\">\r\n <button *ngIf=\"configsRender.actions.add?.active\" class=\"btn btn-success\" type=\"button\" (click)=\"onActionClick({event: $event,type: 'add'})\">\r\n <span [innerHTML]=\"configsRender.actions.add?.labelHtml\"></span>\r\n </button>\r\n </div>\r\n </div>\r\n <div *ngIf=\"configsRender.search.active\" class=\"row justify-content-end mb-2\">\r\n <div class=\"col d-flex justify-content-end\">\r\n <button *ngIf=\"configsRender.actions.add?.active\" class=\"btn btn-success\" type=\"button\" (click)=\"onActionClick({event: $event,type: 'add'})\">\r\n <span [innerHTML]=\"configsRender.actions.add?.labelHtml\"></span>\r\n </button>\r\n </div>\r\n <div class=\"col-lg-3\">\r\n <div class=\"input-group\">\r\n <input type=\"text\" class=\"form-control\" [(ngModel)]=\"configsRender.search.textSearch\" [placeholder]=\"configsRender.search.placeholderSearch != undefined ? configsRender.search.placeholderSearch : ''\" (input)=\"onKeySearch()\">\r\n <button class=\"btn btn-primary\" type=\"button\" (click)=\"onRestarSeach()\">\r\n <i class=\"bi bi-arrow-counterclockwise\"></i>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <ngx-skeleton-loader *ngIf=\"configsRender.loading\" count=\"5\"></ngx-skeleton-loader>\r\n <table *ngIf=\"!configsRender.loading\" class=\"table table-striped table-bordered\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let col of headRowRender\">{{ col.label }}</th>\r\n <th class=\"col-compact\" *ngIf=\"configsRender.actions.edit?.active || configsRender.actions.delete?.active\">\r\n Actions\r\n </th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <ng-container *ngFor=\"let register of registersRender; let i = index\">\r\n <tr [class.pointer]=\"register.configRegister?.actions?.select?.active\" (click)=\"register.configRegister?.actions?.select?.active ? onActionClick({event: $event,type: 'select',data: register}):return\">\r\n <ng-container *ngFor=\"let key of objectKeys(register); let j = index\">\r\n <td [class.text-end]=\"headRow[j].type == 'number'\">{{register[key]}}</td>\r\n </ng-container>\r\n <td class=\"text-nowrap\" *ngIf=\"configsRender.actions.edit?.active || configsRender.actions.delete?.active\">\r\n <button *ngIf=\"register.configRegister?.actions?.edit?.active\" type=\"button\" class=\"btn btn-primary mx-1\" (click)=\"onActionClick({event: $event,type: 'edit',data: register})\">\r\n <span [innerHTML]=\"register.configRegister?.actions?.edit?.labelHtml\"></span>\r\n </button>\r\n <button *ngIf=\"register.configRegister?.actions?.delete?.active\" type=\"button\" class=\"btn btn-danger mx-1\" (click)=\"onActionClick({event: $event,type: 'delete',data: register})\">\r\n <span [innerHTML]=\"register.configRegister?.actions?.delete?.labelHtml\"></span>\r\n </button>\r\n </td>\r\n </tr>\r\n </ng-container>\r\n </tbody>\r\n </table>\r\n <div class=\"position-sticky bottom-0 bg-white\" *ngIf=\"configsRender.paginationActive && configsRender.collectionSize > 0\">\r\n <div class=\"row justify-content-end border-top pt-2\">\r\n <div class=\"col-sm-6\">\r\n <ngb-pagination\r\n class=\"d-flex justify-content-center\"\r\n [pageSize]=\"configsRender.pageSize\"\r\n [collectionSize]=\"configsRender.collectionSize\"\r\n [(page)]=\"configsRender.page\"\r\n [maxSize]=\"5\"\r\n [rotate]=\"true\"\r\n [boundaryLinks]=\"true\"\r\n [ellipses]=\"true\"\r\n (pageChange)=\"onPageChange()\"\r\n size=\"sm\"\r\n >\r\n <ng-template ngbPaginationNumber let-page>{{ page }}</ng-template>\r\n </ngb-pagination>\r\n </div>\r\n <div class=\"col-sm-3\">\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n","import { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { FormsModule } from '@angular/forms';\n\nimport { NgxTableComponent } from './ngx-table.component';\nimport { NgbModule } from '@ng-bootstrap/ng-bootstrap';\nimport { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';\n\n@NgModule({\n declarations: [\n NgxTableComponent\n ],\n imports: [\n BrowserModule,\n FormsModule,\n NgbModule,\n NgxSkeletonLoaderModule,\n ],\n exports: [\n NgxTableComponent\n ]\n})\nexport class NgxTableModule { }\n","/*\n * Public API Surface of ngx-table\n */\n\nexport * from './lib/ngx-table.service';\nexport * from './lib/ngx-table.component';\nexport * from './lib/ngx-table.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAKa,eAAe;IAE1B,iBAAiB;;4GAFN,eAAe;gHAAf,eAAe,cAFd,MAAM;2FAEP,eAAe;kBAH3B,UAAU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B,aAGjB,aAAa;QACb,WAAW;QACX,SAAS;QACT,uBAAuB,aAGvB,iBAAiB;4GAGR,cAAc,YAVhB;YACP,aAAa;YACb,WAAW;YACX,SAAS;YACT,uBAAuB;SACxB;2FAKU,cAAc;kBAd1B,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,iBAAiB;qBAClB;oBACD,OAAO,EAAE;wBACP,aAAa;wBACb,WAAW;wBACX,SAAS;wBACT,uBAAuB;qBACxB;oBACD,OAAO,EAAE;wBACP,iBAAiB;qBAClB;iBACF;;;ACrBD;;;;ACAA;;;;;;"}
@@ -0,0 +1,24 @@
1
+ import { OnInit, OnChanges, EventEmitter, SimpleChanges } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class NgxTableComponent implements OnInit, OnChanges {
4
+ constructor();
5
+ headRow: any[];
6
+ headRowRender: any[];
7
+ registers: any[];
8
+ registersRender: any[];
9
+ configs: any;
10
+ configsRender: any;
11
+ changePage: EventEmitter<Object>;
12
+ clickEvent: EventEmitter<Object>;
13
+ configsDefault: any;
14
+ objectKeys(registers: any): any[];
15
+ onPageChange(): void;
16
+ onKeySearch(): void;
17
+ onRestarSeach(): void;
18
+ onActionClick(object: any): void;
19
+ render(): void;
20
+ ngOnInit(): void;
21
+ ngOnChanges(changes: SimpleChanges): void;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxTableComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxTableComponent, "ngx-table", never, { "headRow": "headRow"; "registers": "registers"; "registersRender": "registersRender"; "configs": "configs"; }, { "changePage": "changePage"; "clickEvent": "clickEvent"; }, never, never>;
24
+ }
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./ngx-table.component";
3
+ import * as i2 from "@angular/platform-browser";
4
+ import * as i3 from "@angular/forms";
5
+ import * as i4 from "@ng-bootstrap/ng-bootstrap";
6
+ import * as i5 from "ngx-skeleton-loader";
7
+ export declare class NgxTableModule {
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxTableModule, never>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxTableModule, [typeof i1.NgxTableComponent], [typeof i2.BrowserModule, typeof i3.FormsModule, typeof i4.NgbModule, typeof i5.NgxSkeletonLoaderModule], [typeof i1.NgxTableComponent]>;
10
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxTableModule>;
11
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NgxTableService {
3
+ constructor();
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxTableService, never>;
5
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxTableService>;
6
+ }
package/package.json CHANGED
@@ -1,16 +1,36 @@
1
1
  {
2
2
  "name": "@experteam-mx/ngx-table",
3
- "version": "1.0.1",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.0.2",
7
7
  "@angular/core": "^12.0.2"
8
8
  },
9
9
  "dependencies": {
10
- "@angular/localize": "^13.2.2",
10
+ "@angular/localize": "^12.0.2",
11
11
  "@ng-bootstrap/ng-bootstrap": "^10.0.0",
12
12
  "bootstrap": "^5.1.3",
13
- "ngx-skeleton-loader": "^5.0.0",
13
+ "ngx-skeleton-loader": "^4.0.0",
14
14
  "tslib": "^2.1.0"
15
- }
16
- }
15
+ },
16
+ "module": "fesm2015/experteam-mx-ngx-table.mjs",
17
+ "es2020": "fesm2020/experteam-mx-ngx-table.mjs",
18
+ "esm2020": "esm2020/experteam-mx-ngx-table.mjs",
19
+ "fesm2020": "fesm2020/experteam-mx-ngx-table.mjs",
20
+ "fesm2015": "fesm2015/experteam-mx-ngx-table.mjs",
21
+ "typings": "experteam-mx-ngx-table.d.ts",
22
+ "exports": {
23
+ "./package.json": {
24
+ "default": "./package.json"
25
+ },
26
+ ".": {
27
+ "types": "./experteam-mx-ngx-table.d.ts",
28
+ "esm2020": "./esm2020/experteam-mx-ngx-table.mjs",
29
+ "es2020": "./fesm2020/experteam-mx-ngx-table.mjs",
30
+ "es2015": "./fesm2015/experteam-mx-ngx-table.mjs",
31
+ "node": "./fesm2015/experteam-mx-ngx-table.mjs",
32
+ "default": "./fesm2020/experteam-mx-ngx-table.mjs"
33
+ }
34
+ },
35
+ "sideEffects": false
36
+ }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of ngx-table
3
- */
4
-
5
- export * from './lib/ngx-table.service';
6
- export * from './lib/ngx-table.component';
7
- export * from './lib/ngx-table.module';
1
+ export * from './lib/ngx-table.service';
2
+ export * from './lib/ngx-table.component';
3
+ export * from './lib/ngx-table.module';
package/.browserslistrc DELETED
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
package/karma.conf.js DELETED
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/ngx-table'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
package/ng-package.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ngx-table",
4
- "deleteDestPath": false,
5
- "lib": {
6
- "entryFile": "src/public-api.ts"
7
- },
8
- "allowedNonPeerDependencies": [
9
- "."
10
- ]
11
- }
@@ -1,75 +0,0 @@
1
- <div class="container-fluid">
2
- <h3 class="text-center" *ngIf="configsRender.titleTable != null">{{ configsRender.titleTable }}</h3>
3
- <div *ngIf="!configsRender.search.active && configsRender.actions.add?.active" class="row justify-content-end mb-2">
4
- <div class="col d-flex justify-content-end">
5
- <button *ngIf="configsRender.actions.add?.active" class="btn btn-success" type="button" (click)="onActionClick({event: $event,type: 'add'})">
6
- <span [innerHTML]="configsRender.actions.add?.labelHtml"></span>
7
- </button>
8
- </div>
9
- </div>
10
- <div *ngIf="configsRender.search.active" class="row justify-content-end mb-2">
11
- <div class="col d-flex justify-content-end">
12
- <button *ngIf="configsRender.actions.add?.active" class="btn btn-success" type="button" (click)="onActionClick({event: $event,type: 'add'})">
13
- <span [innerHTML]="configsRender.actions.add?.labelHtml"></span>
14
- </button>
15
- </div>
16
- <div class="col-lg-3">
17
- <div class="input-group">
18
- <input type="text" class="form-control" [(ngModel)]="configsRender.search.textSearch" [placeholder]="configsRender.search.placeholderSearch != undefined ? configsRender.search.placeholderSearch : ''" (input)="onKeySearch()">
19
- <button class="btn btn-primary" type="button" (click)="onRestarSeach()">
20
- <i class="bi bi-arrow-counterclockwise"></i>
21
- </button>
22
- </div>
23
- </div>
24
- </div>
25
- <ngx-skeleton-loader *ngIf="configsRender.loading" count="5"></ngx-skeleton-loader>
26
- <table *ngIf="!configsRender.loading" class="table table-striped table-bordered">
27
- <thead>
28
- <tr>
29
- <th *ngFor="let col of headRowRender">{{ col.label }}</th>
30
- <th class="col-compact" *ngIf="configsRender.actions.edit?.active || configsRender.actions.delete?.active">
31
- Actions
32
- </th>
33
- </tr>
34
- </thead>
35
- <tbody>
36
- <ng-container *ngFor="let register of registersRender; let i = index">
37
- <tr [class.pointer]="register.configRegister?.actions?.select?.active" (click)="register.configRegister?.actions?.select?.active ? onActionClick({event: $event,type: 'select',data: register}):return">
38
- <ng-container *ngFor="let key of objectKeys(register); let j = index">
39
- <td [class.text-end]="headRow[j].type == 'number'">{{register[key]}}</td>
40
- </ng-container>
41
- <td class="text-nowrap" *ngIf="configsRender.actions.edit?.active || configsRender.actions.delete?.active">
42
- <button *ngIf="register.configRegister?.actions?.edit?.active" type="button" class="btn btn-primary mx-1" (click)="onActionClick({event: $event,type: 'edit',data: register})">
43
- <span [innerHTML]="register.configRegister?.actions?.edit?.labelHtml"></span>
44
- </button>
45
- <button *ngIf="register.configRegister?.actions?.delete?.active" type="button" class="btn btn-danger mx-1" (click)="onActionClick({event: $event,type: 'delete',data: register})">
46
- <span [innerHTML]="register.configRegister?.actions?.delete?.labelHtml"></span>
47
- </button>
48
- </td>
49
- </tr>
50
- </ng-container>
51
- </tbody>
52
- </table>
53
- <div class="position-sticky bottom-0 bg-white" *ngIf="configsRender.paginationActive && configsRender.collectionSize > 0">
54
- <div class="row justify-content-end border-top pt-2">
55
- <div class="col-sm-6">
56
- <ngb-pagination
57
- class="d-flex justify-content-center"
58
- [pageSize]="configsRender.pageSize"
59
- [collectionSize]="configsRender.collectionSize"
60
- [(page)]="configsRender.page"
61
- [maxSize]="5"
62
- [rotate]="true"
63
- [boundaryLinks]="true"
64
- [ellipses]="true"
65
- (pageChange)="onPageChange()"
66
- size="sm"
67
- >
68
- <ng-template ngbPaginationNumber let-page>{{ page }}</ng-template>
69
- </ngb-pagination>
70
- </div>
71
- <div class="col-sm-3">
72
- </div>
73
- </div>
74
- </div>
75
- </div>
@@ -1,102 +0,0 @@
1
- /* You can add global styles to this file, and also import other style files */
2
- $dhlYellow: #FFCC00;
3
- $dhlYellowOpaque: #fff0b3;
4
- $darkBlue: #273c5a;
5
- $medBlue: #002147;
6
- $lightBlue: #ddf1fa;
7
- $inputBG: #f9f9f9;
8
- $inputText: #2664ab;
9
- $dhlRed: #bb133d;
10
- $dhlGreen: #007c39;
11
- $gray80: #333333;
12
- $gray60: #666666;
13
- $gray45: #8C8C8C;
14
- $gray30: #B2B2B2;
15
- $gray20: #CCCCCC;
16
- $gray10: #E5E5E5;
17
- $gray08: #EBEBEB;
18
- $gray05: #F2F2F2;
19
-
20
- $primary: $dhlYellow;
21
- $success: $dhlGreen;
22
- $danger: $dhlRed;
23
-
24
- @import "~bootstrap/scss/functions";
25
- @import "~bootstrap/scss/variables";
26
- @import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css");
27
-
28
- $pagination-color: color-contrast($primary);
29
- $pagination-active-color: color-contrast($primary);
30
-
31
- :host ::ng-deep{
32
- @import "~bootstrap/scss/bootstrap";
33
- }
34
-
35
- .pointer{
36
- cursor: pointer;
37
- }
38
-
39
- .col-compact{
40
- width: 1px;
41
- }
42
-
43
- .bg-white{
44
- background-color: #fff !important;
45
- }
46
-
47
- table {
48
- margin: auto;
49
- width: fit-content!important;
50
- thead{
51
- font-weight: bolder;
52
- position: sticky;
53
- top: -1px;
54
- background-color: #fff;
55
- td:first-child,
56
- th:first-child{
57
- &::before{
58
- content: "";
59
- position: absolute;
60
- bottom: 0;
61
- left: 0;
62
- height: 1px;
63
- width: 100%;
64
- background-color: #00000017;
65
- }
66
- }
67
- td,th{
68
- background-color: $primary;
69
- color: color-contrast($primary);
70
- }
71
- }
72
- tfoot{
73
- font-weight: bolder;
74
- position: sticky;
75
- bottom: 0;
76
- background-color: #fff;
77
- td:first-child,
78
- th:first-child{
79
- &::before{
80
- content: "";
81
- position: absolute;
82
- left: 0;
83
- top: 0;
84
- height: 1px;
85
- width: 100%;
86
- background-color: #000000;
87
- }
88
- &::after{
89
- content: "";
90
- position: absolute;
91
- bottom: 0;
92
- left: 0;
93
- height: 2px;
94
- width: 100%;
95
- background-color: #000000;
96
- }
97
- }
98
- td,th{
99
- background-color: $dhlYellowOpaque;
100
- }
101
- }
102
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { NgxTableComponent } from './ngx-table.component';
4
-
5
- describe('NgxTableComponent', () => {
6
- let component: NgxTableComponent;
7
- let fixture: ComponentFixture<NgxTableComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ NgxTableComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(NgxTableComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,152 +0,0 @@
1
- import { Component, OnInit, OnChanges, Input, Output, EventEmitter, SimpleChanges } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'ngx-table',
5
- templateUrl: './ngx-table.component.html',
6
- styleUrls: ['./ngx-table.component.scss']
7
- })
8
- export class NgxTableComponent implements OnInit, OnChanges {
9
-
10
- constructor() { }
11
-
12
- @Input() headRow: any[] = new Array()
13
- headRowRender: any[] = new Array()
14
-
15
- @Input() registers: any[] = new Array()
16
- @Input() registersRender: any[] = new Array()
17
-
18
- @Input() configs: any
19
- configsRender: any = {}
20
-
21
- @Output() changePage = new EventEmitter<Object>();
22
- @Output() clickEvent = new EventEmitter<Object>();
23
-
24
- configsDefault: any = {
25
- titleTable: null,
26
- loading: false,
27
- paginationActive: false,
28
- page: 1,
29
- pageSize: 15,
30
- collectionSize: 0,
31
- search:{
32
- active: false,
33
- textSearch: '',
34
- placeholderSearch: 'Search'
35
- },
36
- order: {
37
- active: false,
38
- field: null,
39
- asc: false
40
- },
41
- actions: {
42
- add:{
43
- active: false,
44
- labelHtml: null
45
- },
46
- select:{
47
- active: false,
48
- labelHtml: null
49
- },
50
- edit:{
51
- active: false,
52
- labelHtml: null
53
- },
54
- delete:{
55
- active: false,
56
- labelHtml: null
57
- },
58
- },
59
- colHead:{
60
- label: null,
61
- type: 'string', // string, number
62
- field: null,
63
- order: {
64
- active: false
65
- }
66
- }
67
- }
68
-
69
- objectKeys( registers: any ){
70
- let registros = new Array()
71
- for( let key of Object.keys(registers) ){
72
- if( key != 'configRegister' ){
73
- registros.push( key )
74
- }
75
- }
76
-
77
- return registros
78
- }
79
-
80
- onPageChange() {
81
- this.configs = this.configsRender
82
- this.changePage.emit({
83
- ...this.configsRender
84
- });
85
- }
86
-
87
- onKeySearch() {
88
- this.configs = this.configsRender
89
- this.changePage.emit({
90
- ...this.configsRender
91
- });
92
- }
93
-
94
- onRestarSeach() {
95
- this.configs = this.configsRender
96
- this.changePage.emit({
97
- ...this.configsRender
98
- });
99
- }
100
-
101
- onActionClick(object: any) {
102
- object.event.preventDefault()
103
- object.event.stopPropagation()
104
-
105
- this.clickEvent.emit({
106
- type: object.type,
107
- data: object.data
108
- });
109
- }
110
-
111
- render(){
112
- this.headRowRender = new Array()
113
- for( let head of this.headRow ){
114
- this.headRowRender.push({
115
- ...this.configsDefault.colHead,
116
- ...head
117
- })
118
- }
119
-
120
- this.configsRender = {
121
- titleTable: this.configsDefault.titleTable,
122
- paginationActive: this.configsDefault.paginationActive,
123
- page: this.configsDefault.page,
124
- pageSize: this.configsDefault.pageSize,
125
- search: this.configsDefault.search,
126
- order: this.configsDefault.order,
127
- actions: this.configsDefault.actions,
128
- ...this.configs,
129
- collectionSize: this.registers.length,
130
- }
131
-
132
- this.registersRender = new Array()
133
- for( let register of this.registers ){
134
- this.registersRender.push({
135
- configRegister: {
136
- actions: this.configsRender.actions,
137
- },
138
- ...register
139
- })
140
- }
141
- }
142
-
143
- ngOnInit(): void {
144
- this.render()
145
- }
146
-
147
- ngOnChanges(changes: SimpleChanges): void {
148
- console.log("ngOnChanges",this.registers)
149
- this.render()
150
- }
151
-
152
- }
@@ -1,23 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { BrowserModule } from '@angular/platform-browser';
3
- import { FormsModule } from '@angular/forms';
4
-
5
- import { NgxTableComponent } from './ngx-table.component';
6
- import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
7
- import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
8
-
9
- @NgModule({
10
- declarations: [
11
- NgxTableComponent
12
- ],
13
- imports: [
14
- BrowserModule,
15
- FormsModule,
16
- NgbModule,
17
- NgxSkeletonLoaderModule,
18
- ],
19
- exports: [
20
- NgxTableComponent
21
- ]
22
- })
23
- export class NgxTableModule { }
@@ -1,16 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
-
3
- import { NgxTableService } from './ngx-table.service';
4
-
5
- describe('NgxTableService', () => {
6
- let service: NgxTableService;
7
-
8
- beforeEach(() => {
9
- TestBed.configureTestingModule({});
10
- service = TestBed.inject(NgxTableService);
11
- });
12
-
13
- it('should be created', () => {
14
- expect(service).toBeTruthy();
15
- });
16
- });
@@ -1,9 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class NgxTableService {
7
-
8
- constructor() { }
9
- }
package/src/test.ts DELETED
@@ -1,27 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- <T>(id: string): T;
14
- keys(): string[];
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(),
22
- );
23
-
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().map(context);
package/tsconfig.lib.json DELETED
@@ -1,23 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "angularCompilerOptions": {
12
- "skipTemplateCodegen": true,
13
- "strictMetadataEmit": true,
14
- "enableResourceInlining": true,
15
- "strictTemplates": false,
16
- "fullTemplateTypeCheck": false,
17
- "enableIvy": true
18
- },
19
- "exclude": [
20
- "src/test.ts",
21
- "**/*.spec.ts"
22
- ]
23
- }