@main-class/componentes 1.19.3 → 1.19.7

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.
@@ -4,251 +4,6 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['main-class'] = global['main-class'] || {}, global['main-class'].componentes = global['main-class'].componentes || {}, global['main-class'].componentes.table = {}), global.ng.core, global.ng.common, global.ng.material.table, global.rxjs, global['main-class'].componentes.core, global['main-class'].componentes.loader, global.ng.material.paginator, global.ng.material.button, global.ng.material.icon, global.core$2, global.ng.material.formField, global.ng.material.select, global.ng.material.tooltip));
5
5
  }(this, (function (exports, core, common, table, rxjs, core$1, loader, paginator, button, icon, core$2, formField, select, tooltip) { 'use strict';
6
6
 
7
- var ColumnHeaderDirective = /** @class */ (function () {
8
- function ColumnHeaderDirective(template) {
9
- this.template = template;
10
- }
11
- return ColumnHeaderDirective;
12
- }());
13
- ColumnHeaderDirective.decorators = [
14
- { type: core.Directive, args: [{
15
- selector: '[mclColumnHeader]'
16
- },] }
17
- ];
18
- ColumnHeaderDirective.ctorParameters = function () { return [
19
- { type: core.TemplateRef }
20
- ]; };
21
-
22
- var ColumnCellDirective = /** @class */ (function () {
23
- function ColumnCellDirective(template) {
24
- this.template = template;
25
- }
26
- return ColumnCellDirective;
27
- }());
28
- ColumnCellDirective.decorators = [
29
- { type: core.Directive, args: [{
30
- selector: '[mclColumnCell]'
31
- },] }
32
- ];
33
- ColumnCellDirective.ctorParameters = function () { return [
34
- { type: core.TemplateRef }
35
- ]; };
36
-
37
- var ColumnFooterDirective = /** @class */ (function () {
38
- function ColumnFooterDirective(template) {
39
- this.template = template;
40
- }
41
- return ColumnFooterDirective;
42
- }());
43
- ColumnFooterDirective.decorators = [
44
- { type: core.Directive, args: [{
45
- selector: '[mclColumnFooter]'
46
- },] }
47
- ];
48
- ColumnFooterDirective.ctorParameters = function () { return [
49
- { type: core.TemplateRef }
50
- ]; };
51
-
52
- var ColumnDirective = /** @class */ (function () {
53
- function ColumnDirective() {
54
- this.name = 'column_' + (++ColumnDirective.lastId);
55
- this.viewType = 'both';
56
- }
57
- Object.defineProperty(ColumnDirective.prototype, "columnDefName", {
58
- get: function () {
59
- return this.viewType + '-' + this.name;
60
- },
61
- enumerable: false,
62
- configurable: true
63
- });
64
- return ColumnDirective;
65
- }());
66
- ColumnDirective.lastId = 0;
67
- ColumnDirective.decorators = [
68
- { type: core.Directive, args: [{
69
- selector: 'mcl-column,[mclColumn]'
70
- },] }
71
- ];
72
- ColumnDirective.ctorParameters = function () { return []; };
73
- ColumnDirective.propDecorators = {
74
- name: [{ type: core.Input }],
75
- viewType: [{ type: core.Input }],
76
- header: [{ type: core.ContentChild, args: [ColumnHeaderDirective,] }],
77
- cell: [{ type: core.ContentChild, args: [ColumnCellDirective,] }],
78
- footer: [{ type: core.ContentChild, args: [ColumnFooterDirective,] }]
79
- };
80
-
81
- var TableComponent = /** @class */ (function () {
82
- function TableComponent(mobileService) {
83
- var _this = this;
84
- this.mobileService = mobileService;
85
- this.itemsSubject = new rxjs.BehaviorSubject([]);
86
- this.emptyStateMessage = 'mcl.table.nenhum_registro_encontrado';
87
- this.sticky = false;
88
- this.currentColumns = [];
89
- this.$activeColumnNames = [];
90
- this.oldLength = 0;
91
- this.mobileListener = function (mobile) { return _this.mergeColumnsDef(mobile); };
92
- this.mobileService.addListener(this.mobileListener);
93
- }
94
- Object.defineProperty(TableComponent.prototype, "activeColumnNames", {
95
- get: function () {
96
- return this.$activeColumnNames;
97
- },
98
- enumerable: false,
99
- configurable: true
100
- });
101
- Object.defineProperty(TableComponent.prototype, "hasFooter", {
102
- get: function () {
103
- return !!this.currentColumns.find(function (col) { return !!col.footerCell; });
104
- },
105
- enumerable: false,
106
- configurable: true
107
- });
108
- TableComponent.prototype.mergeColumnsDef = function (mobile) {
109
- var _this = this;
110
- if (mobile === void 0) { mobile = this.mobileService.mobile; }
111
- clearTimeout(this.$loading);
112
- this.$loading = setTimeout(function () {
113
- var ngContentModels = _this.columnsDef
114
- .toArray().filter(function (model) { return (mobile && model.viewType !== 'web') ||
115
- (!mobile && model.viewType !== 'mobile'); });
116
- var _loop_1 = function (i) {
117
- var model = _this.currentColumns[i];
118
- if (!ngContentModels.find(function (col) { return col.columnDefName === model.name; })) {
119
- _this.currentColumns.splice(i, 1);
120
- _this.removeColumnDef(model);
121
- }
122
- else {
123
- i++;
124
- }
125
- out_i_1 = i;
126
- };
127
- var out_i_1;
128
- for (var i = 0; i < _this.currentColumns.length;) {
129
- _loop_1(i);
130
- i = out_i_1;
131
- }
132
- ngContentModels.forEach(function (model) {
133
- if (!_this.currentColumnsContains(model)) {
134
- var columnDef = _this.mapColumnDef(model);
135
- _this.currentColumns.push(columnDef);
136
- _this.addColumnDef(columnDef);
137
- }
138
- });
139
- _this.items = _this.getItems() || [];
140
- _this.itemsSubject.next(_this.items);
141
- _this.$activeColumnNames = _this.currentColumns.map(function (col) { return col.name; });
142
- }, 80);
143
- };
144
- TableComponent.prototype.ngAfterViewInit = function () {
145
- var _this = this;
146
- this.columnsChangeSubscription = this.columnsDef.changes.subscribe(function (_) {
147
- _this.mergeColumnsDef();
148
- });
149
- this.mergeColumnsDef();
150
- };
151
- TableComponent.prototype.ngDoCheck = function () {
152
- var currentLength = this.getCurrentLength();
153
- if (this.oldLength !== currentLength) {
154
- this.oldLength = currentLength;
155
- this.items = this.getItems() || [];
156
- this.itemsSubject.next(this.items);
157
- }
158
- else if (this.items !== this.getItems()) {
159
- this.items = this.getItems() || [];
160
- this.itemsSubject.next(this.items);
161
- }
162
- };
163
- TableComponent.prototype.getItems = function () {
164
- return this.outerItems;
165
- };
166
- TableComponent.prototype.getCurrentLength = function () {
167
- return (this.outerItems ? this.outerItems.length : 0);
168
- };
169
- TableComponent.prototype.ngOnDestroy = function () {
170
- this.mobileService.removeListener(this.mobileListener);
171
- this.columnsChangeSubscription.unsubscribe();
172
- this.itemsSubject.complete();
173
- };
174
- TableComponent.prototype.removeColumnDef = function (columnDef) {
175
- this.table.removeColumnDef(columnDef);
176
- };
177
- TableComponent.prototype.addColumnDef = function (columnDef) {
178
- this.table.addColumnDef(columnDef);
179
- };
180
- TableComponent.prototype.mapColumnDef = function (column) {
181
- var cdef = new table.MatColumnDef();
182
- cdef.name = column.viewType + '-' + column.name;
183
- cdef.cell = new table.MatCellDef(column.cell.template);
184
- cdef.headerCell = new table.MatHeaderCellDef(column.header.template);
185
- if (column.footer) {
186
- cdef.footerCell = new table.MatFooterCellDef(column.footer.template);
187
- }
188
- return cdef;
189
- };
190
- TableComponent.prototype.currentColumnsContains = function (model) {
191
- return !!this.currentColumns.find(function (def) { return def.name === model.columnDefName; });
192
- };
193
- return TableComponent;
194
- }());
195
- TableComponent.decorators = [
196
- { type: core.Component, args: [{
197
- selector: 'mcl-table:not([page])',
198
- template: "<table mat-table [dataSource]=\"itemsSubject\">\n\n <tr mat-header-row *matHeaderRowDef=\"activeColumnNames; sticky: sticky\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: activeColumnNames;\"></tr>\n <ng-container *ngIf=\"hasFooter\">\n <tr mat-footer-row *matFooterRowDef=\"activeColumnNames;\"></tr>\n </ng-container>\n\n</table>\n\n<div *ngIf=\"!items?.length && !emptyStatePlaceholder\" class=\"empty-state\">\n {{emptyStateMessage | translate}}\n</div>\n<ng-container *ngIf=\"!items?.length && emptyStatePlaceholder\">\n <ng-content select=\"[mclEmptyState]\"></ng-content>\n</ng-container>\n",
199
- styles: ["table{width:100%}table::ng-deep th:not(:last-child),table td:not(:last-child){padding-right:5px}table::ng-deep th.text-center,table td.text-center{text-align:center}table::ng-deep th.text-right,table td.text-right{text-align:right}table::ng-deep th.text-left,table td.text-left{text-align:left}.empty-state{padding:10px;text-align:center}table::ng-deep tbody tr{transition:.5s}table::ng-deep tbody tr:hover{background-color:rgba(0,0,0,.03)}table::ng-deep tbody td[routerLink]{cursor:pointer}"]
200
- },] }
201
- ];
202
- TableComponent.ctorParameters = function () { return [
203
- { type: core$1.MobileService }
204
- ]; };
205
- TableComponent.propDecorators = {
206
- emptyStateMessage: [{ type: core.Input }],
207
- table: [{ type: core.ViewChild, args: [table.MatTable,] }],
208
- emptyStatePlaceholder: [{ type: core.ContentChild, args: ['[mclEmptyState]', { read: core.ElementRef },] }],
209
- columnsDef: [{ type: core.ContentChildren, args: [ColumnDirective,] }],
210
- outerItems: [{ type: core.Input, args: ['items',] }],
211
- sticky: [{ type: core.Input }]
212
- };
213
-
214
- var ThComponent = /** @class */ (function () {
215
- function ThComponent(element) {
216
- element.nativeElement.classList.add('mat-header-cell');
217
- }
218
- ThComponent.prototype.ngOnInit = function () {
219
- };
220
- return ThComponent;
221
- }());
222
- ThComponent.decorators = [
223
- { type: core.Component, args: [{
224
- selector: 'th,mcl-th',
225
- template: "<ng-content></ng-content>\n",
226
- styles: [""]
227
- },] }
228
- ];
229
- ThComponent.ctorParameters = function () { return [
230
- { type: core.ElementRef, decorators: [{ type: core.Self }] }
231
- ]; };
232
-
233
- var TdComponent = /** @class */ (function () {
234
- function TdComponent(element) {
235
- element.nativeElement.classList.add('mat-cell');
236
- }
237
- TdComponent.prototype.ngOnInit = function () {
238
- };
239
- return TdComponent;
240
- }());
241
- TdComponent.decorators = [
242
- { type: core.Component, args: [{
243
- selector: 'td,mcl-td',
244
- template: "<ng-content></ng-content>\n",
245
- styles: [""]
246
- },] }
247
- ];
248
- TdComponent.ctorParameters = function () { return [
249
- { type: core.ElementRef, decorators: [{ type: core.Self }] }
250
- ]; };
251
-
252
7
  /*! *****************************************************************************
253
8
  Copyright (c) Microsoft Corporation. All rights reserved.
254
9
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -520,6 +275,248 @@
520
275
  return (mod && mod.__esModule) ? mod : { default: mod };
521
276
  }
522
277
 
278
+ var ColumnHeaderDirective = /** @class */ (function () {
279
+ function ColumnHeaderDirective(template) {
280
+ this.template = template;
281
+ }
282
+ return ColumnHeaderDirective;
283
+ }());
284
+ ColumnHeaderDirective.decorators = [
285
+ { type: core.Directive, args: [{
286
+ selector: '[mclColumnHeader]'
287
+ },] }
288
+ ];
289
+ ColumnHeaderDirective.ctorParameters = function () { return [
290
+ { type: core.TemplateRef }
291
+ ]; };
292
+
293
+ var ColumnCellDirective = /** @class */ (function () {
294
+ function ColumnCellDirective(template) {
295
+ this.template = template;
296
+ }
297
+ return ColumnCellDirective;
298
+ }());
299
+ ColumnCellDirective.decorators = [
300
+ { type: core.Directive, args: [{
301
+ selector: '[mclColumnCell]'
302
+ },] }
303
+ ];
304
+ ColumnCellDirective.ctorParameters = function () { return [
305
+ { type: core.TemplateRef }
306
+ ]; };
307
+
308
+ var ColumnFooterDirective = /** @class */ (function () {
309
+ function ColumnFooterDirective(template) {
310
+ this.template = template;
311
+ }
312
+ return ColumnFooterDirective;
313
+ }());
314
+ ColumnFooterDirective.decorators = [
315
+ { type: core.Directive, args: [{
316
+ selector: '[mclColumnFooter]'
317
+ },] }
318
+ ];
319
+ ColumnFooterDirective.ctorParameters = function () { return [
320
+ { type: core.TemplateRef }
321
+ ]; };
322
+
323
+ var ColumnDirective = /** @class */ (function () {
324
+ function ColumnDirective() {
325
+ this.name = 'column_' + (++ColumnDirective.lastId);
326
+ this.viewType = 'both';
327
+ }
328
+ Object.defineProperty(ColumnDirective.prototype, "columnDefName", {
329
+ get: function () {
330
+ return this.viewType + '-' + this.name;
331
+ },
332
+ enumerable: false,
333
+ configurable: true
334
+ });
335
+ return ColumnDirective;
336
+ }());
337
+ ColumnDirective.lastId = 0;
338
+ ColumnDirective.decorators = [
339
+ { type: core.Directive, args: [{
340
+ selector: 'mcl-column,[mclColumn]'
341
+ },] }
342
+ ];
343
+ ColumnDirective.ctorParameters = function () { return []; };
344
+ ColumnDirective.propDecorators = {
345
+ name: [{ type: core.Input }],
346
+ viewType: [{ type: core.Input }],
347
+ header: [{ type: core.ContentChild, args: [ColumnHeaderDirective,] }],
348
+ cell: [{ type: core.ContentChild, args: [ColumnCellDirective,] }],
349
+ footer: [{ type: core.ContentChild, args: [ColumnFooterDirective,] }]
350
+ };
351
+
352
+ var TableComponent = /** @class */ (function () {
353
+ function TableComponent(mobileService) {
354
+ var _this = this;
355
+ this.mobileService = mobileService;
356
+ this.itemsSubject = new rxjs.BehaviorSubject([]);
357
+ this.emptyStateMessage = 'mcl.table.nenhum_registro_encontrado';
358
+ this.sticky = false;
359
+ this.currentColumns = [];
360
+ this.$activeColumnNames = [];
361
+ this.oldLength = 0;
362
+ this.mobileListener = function (mobile) { return _this.mergeColumnsDef(mobile); };
363
+ this.mobileService.addListener(this.mobileListener);
364
+ }
365
+ Object.defineProperty(TableComponent.prototype, "activeColumnNames", {
366
+ get: function () {
367
+ return this.$activeColumnNames;
368
+ },
369
+ enumerable: false,
370
+ configurable: true
371
+ });
372
+ Object.defineProperty(TableComponent.prototype, "hasFooter", {
373
+ get: function () {
374
+ return !!this.currentColumns.find(function (col) { return !!col.footerCell; });
375
+ },
376
+ enumerable: false,
377
+ configurable: true
378
+ });
379
+ TableComponent.prototype.mergeColumnsDef = function (mobile) {
380
+ var _this = this;
381
+ if (mobile === void 0) { mobile = this.mobileService.mobile; }
382
+ clearTimeout(this.$loading);
383
+ this.$loading = setTimeout(function () {
384
+ var e_1, _a;
385
+ var ngContentModels = _this.columnsDef
386
+ .toArray().filter(function (model) { return (mobile && model.viewType !== 'web') ||
387
+ (!mobile && model.viewType !== 'mobile'); });
388
+ try {
389
+ for (var _b = __values(_this.currentColumns), _c = _b.next(); !_c.done; _c = _b.next()) {
390
+ var column = _c.value;
391
+ _this.removeColumnDef(column);
392
+ }
393
+ }
394
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
395
+ finally {
396
+ try {
397
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
398
+ }
399
+ finally { if (e_1) throw e_1.error; }
400
+ }
401
+ _this.currentColumns.slice(0, _this.currentColumns.length);
402
+ ngContentModels.forEach(function (model, i) {
403
+ var columnDef = _this.mapColumnDef(model);
404
+ _this.currentColumns.splice(i, 0, columnDef);
405
+ _this.addColumnDef(columnDef);
406
+ });
407
+ _this.items = _this.getItems() || [];
408
+ _this.itemsSubject.next(_this.items);
409
+ _this.$activeColumnNames = _this.currentColumns.map(function (col) { return col.name; });
410
+ }, 80);
411
+ };
412
+ TableComponent.prototype.ngAfterViewInit = function () {
413
+ var _this = this;
414
+ this.columnsChangeSubscription = this.columnsDef.changes.subscribe(function (_) {
415
+ _this.mergeColumnsDef();
416
+ });
417
+ this.mergeColumnsDef();
418
+ };
419
+ TableComponent.prototype.ngDoCheck = function () {
420
+ var currentLength = this.getCurrentLength();
421
+ if (this.oldLength !== currentLength) {
422
+ this.oldLength = currentLength;
423
+ this.items = this.getItems() || [];
424
+ this.itemsSubject.next(this.items);
425
+ }
426
+ else if (this.items !== this.getItems()) {
427
+ this.items = this.getItems() || [];
428
+ this.itemsSubject.next(this.items);
429
+ }
430
+ };
431
+ TableComponent.prototype.getItems = function () {
432
+ return this.outerItems;
433
+ };
434
+ TableComponent.prototype.getCurrentLength = function () {
435
+ return (this.outerItems ? this.outerItems.length : 0);
436
+ };
437
+ TableComponent.prototype.ngOnDestroy = function () {
438
+ this.mobileService.removeListener(this.mobileListener);
439
+ this.columnsChangeSubscription.unsubscribe();
440
+ this.itemsSubject.complete();
441
+ };
442
+ TableComponent.prototype.removeColumnDef = function (columnDef) {
443
+ this.table.removeColumnDef(columnDef);
444
+ };
445
+ TableComponent.prototype.addColumnDef = function (columnDef) {
446
+ this.table.addColumnDef(columnDef);
447
+ };
448
+ TableComponent.prototype.mapColumnDef = function (column) {
449
+ var cdef = new table.MatColumnDef();
450
+ cdef.name = column.viewType + '-' + column.name;
451
+ cdef.cell = new table.MatCellDef(column.cell.template);
452
+ cdef.headerCell = new table.MatHeaderCellDef(column.header.template);
453
+ if (column.footer) {
454
+ cdef.footerCell = new table.MatFooterCellDef(column.footer.template);
455
+ }
456
+ return cdef;
457
+ };
458
+ TableComponent.prototype.currentColumnsContains = function (model) {
459
+ return !!this.currentColumns.find(function (def) { return def.name === model.columnDefName; });
460
+ };
461
+ return TableComponent;
462
+ }());
463
+ TableComponent.decorators = [
464
+ { type: core.Component, args: [{
465
+ selector: 'mcl-table:not([page])',
466
+ template: "<table mat-table [dataSource]=\"itemsSubject\">\n\n <tr mat-header-row *matHeaderRowDef=\"activeColumnNames; sticky: sticky\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: activeColumnNames;\"></tr>\n <ng-container *ngIf=\"hasFooter\">\n <tr mat-footer-row *matFooterRowDef=\"activeColumnNames;\"></tr>\n </ng-container>\n\n</table>\n\n<div *ngIf=\"!items?.length && !emptyStatePlaceholder\" class=\"empty-state\">\n {{emptyStateMessage | translate}}\n</div>\n<ng-container *ngIf=\"!items?.length && emptyStatePlaceholder\">\n <ng-content select=\"[mclEmptyState]\"></ng-content>\n</ng-container>\n",
467
+ styles: ["table{width:100%}table::ng-deep th:not(:last-child),table td:not(:last-child){padding-right:5px}table::ng-deep th.text-center,table td.text-center{text-align:center}table::ng-deep th.text-right,table td.text-right{text-align:right}table::ng-deep th.text-left,table td.text-left{text-align:left}.empty-state{padding:10px;text-align:center}table::ng-deep tbody tr{transition:.5s}table::ng-deep tbody tr:hover{background-color:rgba(0,0,0,.03)}table::ng-deep tbody td[routerLink]{cursor:pointer}"]
468
+ },] }
469
+ ];
470
+ TableComponent.ctorParameters = function () { return [
471
+ { type: core$1.MobileService }
472
+ ]; };
473
+ TableComponent.propDecorators = {
474
+ emptyStateMessage: [{ type: core.Input }],
475
+ table: [{ type: core.ViewChild, args: [table.MatTable,] }],
476
+ emptyStatePlaceholder: [{ type: core.ContentChild, args: ['[mclEmptyState]', { read: core.ElementRef },] }],
477
+ columnsDef: [{ type: core.ContentChildren, args: [ColumnDirective,] }],
478
+ outerItems: [{ type: core.Input, args: ['items',] }],
479
+ sticky: [{ type: core.Input }]
480
+ };
481
+
482
+ var ThComponent = /** @class */ (function () {
483
+ function ThComponent(element) {
484
+ element.nativeElement.classList.add('mat-header-cell');
485
+ }
486
+ ThComponent.prototype.ngOnInit = function () {
487
+ };
488
+ return ThComponent;
489
+ }());
490
+ ThComponent.decorators = [
491
+ { type: core.Component, args: [{
492
+ selector: 'th,mcl-th',
493
+ template: "<ng-content></ng-content>\n",
494
+ styles: [""]
495
+ },] }
496
+ ];
497
+ ThComponent.ctorParameters = function () { return [
498
+ { type: core.ElementRef, decorators: [{ type: core.Self }] }
499
+ ]; };
500
+
501
+ var TdComponent = /** @class */ (function () {
502
+ function TdComponent(element) {
503
+ element.nativeElement.classList.add('mat-cell');
504
+ }
505
+ TdComponent.prototype.ngOnInit = function () {
506
+ };
507
+ return TdComponent;
508
+ }());
509
+ TdComponent.decorators = [
510
+ { type: core.Component, args: [{
511
+ selector: 'td,mcl-td',
512
+ template: "<ng-content></ng-content>\n",
513
+ styles: [""]
514
+ },] }
515
+ ];
516
+ TdComponent.ctorParameters = function () { return [
517
+ { type: core.ElementRef, decorators: [{ type: core.Self }] }
518
+ ]; };
519
+
523
520
  var PAGINATION_CONFIGURATION = new core.InjectionToken('PAGINATION_CONFIGURATION');
524
521
  var PaginatedTableComponent = /** @class */ (function (_super) {
525
522
  __extends(PaginatedTableComponent, _super);