ngx-aur-mat-table 0.1.69 → 12.1.8

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.
Files changed (41) hide show
  1. package/bundles/ngx-aur-mat-table.umd.js +497 -152
  2. package/bundles/ngx-aur-mat-table.umd.js.map +1 -1
  3. package/esm2015/lib/factories/ActionViewFactory.js +37 -0
  4. package/esm2015/lib/factories/DisplayColumnsFactory.js +6 -0
  5. package/esm2015/lib/factories/MatTableDataSourceFactory.js +15 -0
  6. package/esm2015/lib/factories/TableRowsFactory.js +18 -0
  7. package/esm2015/lib/model/ColumnConfig.js +1 -1
  8. package/esm2015/lib/model/EmptyValue.js +29 -0
  9. package/esm2015/lib/model/TableViewFactory.js +62 -0
  10. package/esm2015/lib/ngx-aur-mat-table.component.js +43 -45
  11. package/esm2015/lib/providers/IndexProvider.js +53 -7
  12. package/esm2015/lib/providers/PaginationProvider.js +18 -1
  13. package/esm2015/lib/providers/RowActionProvider.js +43 -29
  14. package/esm2015/lib/providers/SelectionProvider.js +37 -11
  15. package/esm2015/lib/providers/TotalRowProvider.js +41 -0
  16. package/esm2015/lib/style-builder/border.style-builder.js +54 -0
  17. package/esm2015/lib/style-builder/row.style-builder.js +32 -0
  18. package/esm2015/public-api.js +3 -1
  19. package/fesm2015/ngx-aur-mat-table.js +417 -106
  20. package/fesm2015/ngx-aur-mat-table.js.map +1 -1
  21. package/lib/factories/ActionViewFactory.d.ts +19 -0
  22. package/lib/factories/DisplayColumnsFactory.d.ts +4 -0
  23. package/lib/factories/MatTableDataSourceFactory.d.ts +12 -0
  24. package/lib/factories/TableRowsFactory.d.ts +12 -0
  25. package/lib/model/ColumnConfig.d.ts +9 -4
  26. package/lib/model/EmptyValue.d.ts +12 -0
  27. package/lib/model/TableViewFactory.d.ts +16 -0
  28. package/lib/ngx-aur-mat-table.component.d.ts +8 -11
  29. package/lib/providers/IndexProvider.d.ts +35 -2
  30. package/lib/providers/PaginationProvider.d.ts +8 -1
  31. package/lib/providers/RowActionProvider.d.ts +16 -12
  32. package/lib/providers/SelectionProvider.d.ts +13 -4
  33. package/lib/providers/TotalRowProvider.d.ts +20 -0
  34. package/lib/style-builder/border.style-builder.d.ts +24 -0
  35. package/lib/style-builder/row.style-builder.d.ts +10 -0
  36. package/package.json +1 -1
  37. package/public-api.d.ts +2 -0
  38. package/esm2015/lib/providers/TableDataProvider.js +0 -13
  39. package/esm2015/lib/providers/TableViewConverter.js +0 -59
  40. package/lib/providers/TableDataProvider.d.ts +0 -6
  41. package/lib/providers/TableViewConverter.d.ts +0 -10
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/sort'), require('@angular/material/table'), require('@angular/material/paginator'), require('@angular/cdk/collections'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/common'), require('@angular/material/tooltip'), require('@angular/material/checkbox'), require('@angular/material/button'), require('@angular/material/input')) :
3
3
  typeof define === 'function' && define.amd ? define('ngx-aur-mat-table', ['exports', '@angular/core', '@angular/material/sort', '@angular/material/table', '@angular/material/paginator', '@angular/cdk/collections', '@angular/material/form-field', '@angular/material/icon', '@angular/common', '@angular/material/tooltip', '@angular/material/checkbox', '@angular/material/button', '@angular/material/input'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["ngx-aur-mat-table"] = {}, global.ng.core, global.ng.material.sort, global.ng.material.table, global.ng.material.paginator, global.ng.cdk.collections, global.ng.material.formField, global.ng.material.icon, global.ng.common, global.ng.material.tooltip, global.ng.material.checkbox, global.ng.material.button, global.ng.material.input));
5
- })(this, (function (exports, i0, i7, i3$1, i8, collections, i1$1, i1, i9, i3, i5, i6, i10) { 'use strict';
5
+ })(this, (function (exports, i0, i7, i3, i8, collections, i1$1, i1, i9, i3$1, i5, i6, i10) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -24,59 +24,16 @@
24
24
 
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
26
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
27
- var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
27
+ var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3);
28
28
  var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
29
29
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
31
  var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
32
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
32
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3$1);
33
33
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
34
34
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
35
35
  var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
36
36
 
37
- var SelectionProvider = /** @class */ (function () {
38
- function SelectionProvider(ctx, columns, tableDataSource) {
39
- this.COLUMN_NAME = 'tbl_selects';
40
- this.config = ctx;
41
- this.selection = new collections.SelectionModel(ctx.multiple, []);
42
- this.tableDataSource = tableDataSource;
43
- this.initCheckboxColumn(columns);
44
- }
45
- SelectionProvider.prototype.initCheckboxColumn = function (columns) {
46
- if (this.config.position === 'start') {
47
- columns.unshift(this.COLUMN_NAME);
48
- }
49
- else {
50
- columns.push(this.COLUMN_NAME);
51
- }
52
- };
53
- SelectionProvider.prototype.bind = function (selected, onSelect, onDeselect) {
54
- var _this = this;
55
- this.selection.changed
56
- .subscribe(function (event) {
57
- if (event.added) {
58
- onSelect.emit(event.added);
59
- }
60
- if (event.removed) {
61
- onDeselect.emit(event.removed);
62
- }
63
- selected.emit(_this.selection.selected);
64
- });
65
- };
66
- SelectionProvider.prototype.masterToggle = function () {
67
- var _this = this;
68
- this.isAllSelected() ?
69
- this.selection.clear() :
70
- this.tableDataSource.data.forEach(function (row) { return _this.selection.select(row.rowSrc); });
71
- };
72
- SelectionProvider.prototype.isAllSelected = function () {
73
- var numSelected = this.selection.selected.length;
74
- var numRows = this.tableDataSource.data.length;
75
- return numSelected === numRows;
76
- };
77
- return SelectionProvider;
78
- }());
79
-
80
37
  /******************************************************************************
81
38
  Copyright (c) Microsoft Corporation.
82
39
 
@@ -462,15 +419,110 @@
462
419
  return typeof state === "function" ? receiver === state : state.has(receiver);
463
420
  }
464
421
 
465
- var RowActionProvider = /** @class */ (function () {
466
- function RowActionProvider(ctx, columns) {
467
- this.COLUMN_NAME = 'tbl_actions';
468
- if (ctx.position === 'start') {
422
+ var EmptyValue = /** @class */ (function () {
423
+ function EmptyValue() {
424
+ }
425
+ return EmptyValue;
426
+ }());
427
+ EmptyValue.SELECTION_CONFIG = {
428
+ enable: false,
429
+ };
430
+ EmptyValue.ACTION_CONFIG = {
431
+ enable: false,
432
+ actions: []
433
+ };
434
+ EmptyValue.INDEX_CONFIG = {
435
+ enable: false,
436
+ };
437
+ EmptyValue.PAGINATION_CONFIG = {
438
+ enable: false,
439
+ size: 0,
440
+ sizes: []
441
+ };
442
+ EmptyValue.TABLE_CONFIG = {
443
+ columnsCfg: [],
444
+ selectionCfg: EmptyValue.SELECTION_CONFIG,
445
+ actionCfg: EmptyValue.ACTION_CONFIG,
446
+ indexCfg: EmptyValue.INDEX_CONFIG,
447
+ pageableCfg: EmptyValue.PAGINATION_CONFIG
448
+ };
449
+ EmptyValue.MAT_TABLE_DATA_SOURCE = new i3.MatTableDataSource();
450
+ EmptyValue.RESIZE_OBSERVER = new ResizeObserver(function () {
451
+ });
452
+
453
+ var SelectionProvider = /** @class */ (function () {
454
+ function SelectionProvider(tableConfig, tableDataSource) {
455
+ this.isEnabled = true;
456
+ this.COLUMN_NAME = 'tbl_selects';
457
+ this.config = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.selectionCfg) || EmptyValue.SELECTION_CONFIG;
458
+ this.selection = new collections.SelectionModel(this.config.multiple, []);
459
+ this.tableDataSource = tableDataSource;
460
+ }
461
+ SelectionProvider.prototype.addCheckboxColumn = function (columns) {
462
+ if (this.config.position === 'start') {
469
463
  columns.unshift(this.COLUMN_NAME);
470
464
  }
471
465
  else {
472
466
  columns.push(this.COLUMN_NAME);
473
467
  }
468
+ return this;
469
+ };
470
+ SelectionProvider.prototype.bindEventEmitters = function (selected, onSelect, onDeselect) {
471
+ var _this = this;
472
+ this.selection.changed.subscribe(function (event) {
473
+ if (event.added) {
474
+ onSelect.emit(event.added);
475
+ }
476
+ if (event.removed) {
477
+ onDeselect.emit(event.removed);
478
+ }
479
+ selected.emit(_this.selection.selected);
480
+ });
481
+ return this;
482
+ };
483
+ SelectionProvider.prototype.masterToggle = function () {
484
+ var _this = this;
485
+ if (this.isAllSelected()) {
486
+ this.selection.clear();
487
+ }
488
+ else {
489
+ this.tableDataSource.data.forEach(function (row) { return _this.selection.select(row.rowSrc); });
490
+ }
491
+ };
492
+ SelectionProvider.prototype.isAllSelected = function () {
493
+ var numSelected = this.selection.selected.length;
494
+ var numRows = this.tableDataSource.data.length;
495
+ return numSelected === numRows;
496
+ };
497
+ SelectionProvider.canEnable = function (tableConfig) {
498
+ return (tableConfig.selectionCfg && tableConfig.selectionCfg.enable) || false;
499
+ };
500
+ SelectionProvider.create = function (tableConfig, tableDataSource) {
501
+ if (SelectionProvider.canEnable(tableConfig)) {
502
+ return new SelectionProvider(tableConfig, tableDataSource);
503
+ }
504
+ return new SelectionProviderDummy();
505
+ };
506
+ return SelectionProvider;
507
+ }());
508
+ var SelectionProviderDummy = /** @class */ (function (_super) {
509
+ __extends(SelectionProviderDummy, _super);
510
+ function SelectionProviderDummy() {
511
+ var _this = _super.call(this, EmptyValue.TABLE_CONFIG, EmptyValue.MAT_TABLE_DATA_SOURCE) || this;
512
+ _this.isEnabled = true;
513
+ return _this;
514
+ }
515
+ SelectionProviderDummy.prototype.addCheckboxColumn = function (columns) {
516
+ return this;
517
+ };
518
+ SelectionProviderDummy.prototype.bindEventEmitters = function (selected, onSelect, onDeselect) {
519
+ return this;
520
+ };
521
+ return SelectionProviderDummy;
522
+ }(SelectionProvider));
523
+
524
+ var ActionViewFactory = /** @class */ (function () {
525
+ function ActionViewFactory() {
474
526
  }
475
527
  /**
476
528
  * Convert rows and actions to a view format.
@@ -478,7 +530,7 @@
478
530
  * @param actionConfig - Configuration for actions on rows.
479
531
  * @return Map of row IDs to their associated action views.
480
532
  */
481
- RowActionProvider.prototype.toView = function (rows, actionConfig) {
533
+ ActionViewFactory.create = function (rows, actionConfig) {
482
534
  var e_1, _a;
483
535
  var result = new Map();
484
536
  try {
@@ -502,15 +554,14 @@
502
554
  * @param actionConfig - Configuration for actions on rows.
503
555
  * @return Array of actions for the row.
504
556
  */
505
- RowActionProvider.prototype.prepareActionsForRow = function (row, actionConfig) {
557
+ ActionViewFactory.prepareActionsForRow = function (row, actionConfig) {
506
558
  var _this = this;
507
- return actionConfig.actions.map(function (action) {
508
- var actionPrepared = action.action(row.rowSrc);
509
- var iconPrepared = _this.iconConfig(action.icon, row.rowSrc);
510
- return { action: actionPrepared, icon: iconPrepared };
511
- });
559
+ return actionConfig.actions.map(function (action) { return ({
560
+ action: action.action(row.rowSrc),
561
+ icon: _this.prepareIconConfig(action.icon, row.rowSrc)
562
+ }); });
512
563
  };
513
- RowActionProvider.prototype.iconConfig = function (iconSource, value) {
564
+ ActionViewFactory.prepareIconConfig = function (iconSource, value) {
514
565
  return {
515
566
  name: iconSource.name(value),
516
567
  color: iconSource.color ? iconSource.color(value) : undefined,
@@ -519,42 +570,107 @@
519
570
  wrapper: iconSource.wrapper ? { color: iconSource.wrapper.color(value) } : undefined
520
571
  };
521
572
  };
522
- return RowActionProvider;
573
+ return ActionViewFactory;
523
574
  }());
524
575
 
525
- var TableViewConverter = /** @class */ (function () {
526
- function TableViewConverter() {
576
+ var RowActionProvider = /** @class */ (function () {
577
+ function RowActionProvider(tableConfig) {
578
+ this.COLUMN_NAME = 'tbl_actions';
579
+ this.isEnabled = true;
580
+ // key is rowId
581
+ this.actionView = new Map();
582
+ if (!tableConfig.actionCfg) {
583
+ throw new Error("Actions is undefined");
584
+ }
585
+ this.config = tableConfig.actionCfg;
527
586
  }
528
- TableViewConverter.toView = function (rows, tableConfig) {
529
- var result = new Map();
587
+ RowActionProvider.prototype.addActionColumn = function (columns) {
588
+ if (!this.config) {
589
+ return this;
590
+ }
591
+ if (this.config.position === 'start') {
592
+ columns.unshift(this.COLUMN_NAME);
593
+ }
594
+ else {
595
+ columns.push(this.COLUMN_NAME);
596
+ }
597
+ return this;
598
+ };
599
+ /**
600
+ * Convert rows and actions to a view format.
601
+ * @param rows - The data rows to be converted.
602
+ * @param actionConfig - Configuration for actions on rows.
603
+ * @return Map of row IDs to their associated action views.
604
+ */
605
+ RowActionProvider.prototype.setView = function (rows) {
606
+ if (!this.config) {
607
+ throw new Error("ActionConfig is undefined");
608
+ }
609
+ this.actionView = ActionViewFactory.create(rows, this.config);
610
+ return this;
611
+ };
612
+ RowActionProvider.canEnabled = function (tableConfig) {
613
+ return (tableConfig.actionCfg && (tableConfig.actionCfg.enable === undefined || tableConfig.actionCfg.enable === null || tableConfig.actionCfg.enable)) || false;
614
+ };
615
+ RowActionProvider.create = function (tableConfig) {
616
+ if (RowActionProvider.canEnabled(tableConfig)) {
617
+ return new RowActionProvider(tableConfig);
618
+ }
619
+ return new RowActionProviderDummy();
620
+ };
621
+ return RowActionProvider;
622
+ }());
623
+ var RowActionProviderDummy = /** @class */ (function (_super) {
624
+ __extends(RowActionProviderDummy, _super);
625
+ function RowActionProviderDummy() {
626
+ var _this = _super.call(this, EmptyValue.TABLE_CONFIG) || this;
627
+ _this.isEnabled = false;
628
+ return _this;
629
+ }
630
+ RowActionProviderDummy.prototype.addActionColumn = function (columns) {
631
+ return this;
632
+ };
633
+ RowActionProviderDummy.prototype.setView = function (rows) {
634
+ return this;
635
+ };
636
+ return RowActionProviderDummy;
637
+ }(RowActionProvider));
638
+
639
+ var TableViewFactory = /** @class */ (function () {
640
+ function TableViewFactory() {
641
+ }
642
+ /**
643
+ * Converts rows into a view format based on table configuration.
644
+ * @param rows The rows of the table.
645
+ * @param tableConfig The configuration of the table.
646
+ * @returns An array of maps representing the view for each row.
647
+ */
648
+ TableViewFactory.toView = function (rows, tableConfig) {
649
+ var columnViewMap = new Map();
530
650
  tableConfig.columnsCfg.forEach(function (c) {
531
651
  if (c.valueView) {
532
- result.set(c.key, c.valueView);
652
+ columnViewMap.set(c.key, c.valueView);
533
653
  }
534
654
  });
535
- return this.toViewInternal(rows, result);
655
+ return TableViewFactory.toViewInternal(rows, columnViewMap);
536
656
  };
537
- TableViewConverter.toViewInternal = function (rows, source) {
538
- var _this = this;
539
- return rows.map(function (row) { return _this.columnConfig(source, row); });
657
+ TableViewFactory.toViewInternal = function (rows, source) {
658
+ return rows.map(function (row) { return TableViewFactory.createColumnConfig(row, source); });
540
659
  };
541
- TableViewConverter.columnConfig = function (source, row) {
542
- var _this = this;
660
+ TableViewFactory.createColumnConfig = function (row, columnViewMap) {
543
661
  var result = new Map();
544
- source.forEach(function (source, key) {
545
- var value = {
546
- icon: _this.iconConfig(source.icon, row),
547
- text: _this.textConfig(source.text, row),
548
- image: _this.imageConfig(source.image, row),
549
- };
550
- result.set(key, value);
662
+ columnViewMap.forEach(function (view, key) {
663
+ result.set(key, {
664
+ icon: TableViewFactory.configureIcon(view.icon, row),
665
+ text: TableViewFactory.configureText(view.text, row),
666
+ image: TableViewFactory.configureImage(view.image, row),
667
+ });
551
668
  });
552
669
  return result;
553
670
  };
554
- TableViewConverter.iconConfig = function (iconSource, row) {
555
- if (!iconSource) {
671
+ TableViewFactory.configureIcon = function (iconSource, row) {
672
+ if (!iconSource)
556
673
  return undefined;
557
- }
558
674
  return {
559
675
  name: iconSource.name(row),
560
676
  color: iconSource.color ? iconSource.color(row) : undefined,
@@ -563,41 +679,116 @@
563
679
  wrapper: iconSource.wrapper ? { color: iconSource.wrapper.color(row) } : undefined
564
680
  };
565
681
  };
566
- TableViewConverter.textConfig = function (textSource, row) {
567
- if (!textSource) {
682
+ TableViewFactory.configureText = function (textSource, row) {
683
+ var _a, _b;
684
+ if (!textSource)
568
685
  return undefined;
569
- }
570
686
  return {
571
687
  show: textSource.show,
572
- tooltip: textSource.tooltip ? textSource.tooltip(row) : undefined,
573
- color: textSource.color ? textSource.color(row) : undefined,
688
+ tooltip: (_a = textSource.tooltip) === null || _a === void 0 ? void 0 : _a.call(textSource, row),
689
+ color: (_b = textSource.color) === null || _b === void 0 ? void 0 : _b.call(textSource, row)
574
690
  };
575
691
  };
576
- TableViewConverter.imageConfig = function (imageSource, row) {
577
- if (!imageSource) {
692
+ TableViewFactory.configureImage = function (imageSource, row) {
693
+ if (!imageSource)
578
694
  return undefined;
579
- }
580
695
  return {
581
696
  src: imageSource.src(row),
582
697
  width: imageSource.width || undefined,
583
698
  height: imageSource.height || undefined
584
699
  };
585
700
  };
586
- return TableViewConverter;
701
+ return TableViewFactory;
587
702
  }());
588
703
 
704
+ /**
705
+ * Provides functionality to manage the index column in a table.
706
+ * The class can handle index configurations and modify the column array to include an index column.
707
+ */
589
708
  var IndexProvider = /** @class */ (function () {
590
- function IndexProvider(indexConfig, columns) {
709
+ function IndexProvider(indexConfig) {
710
+ this.indexConfig = indexConfig;
711
+ this.isEnabled = true;
591
712
  this.COLUMN_NAME = 'tbl_index';
592
- if (indexConfig) {
593
- columns.unshift(this.COLUMN_NAME);
594
- }
595
- this.headerView = indexConfig.headerColumn;
596
- this.name = indexConfig.name || '';
597
- this.offset = indexConfig.offset || 0;
713
+ this.headerView = indexConfig === null || indexConfig === void 0 ? void 0 : indexConfig.headerColumn;
714
+ this.name = (indexConfig === null || indexConfig === void 0 ? void 0 : indexConfig.name) || '';
715
+ this.offset = (indexConfig === null || indexConfig === void 0 ? void 0 : indexConfig.offset) || 0;
598
716
  }
717
+ /**
718
+ * Adds the index column to the beginning of the columns array.
719
+ * @param columns The array of column names to which the index column should be added.
720
+ * @returns The instance of IndexProvider for method chaining.
721
+ */
722
+ IndexProvider.prototype.addIndexColumn = function (columns) {
723
+ columns.unshift(this.COLUMN_NAME);
724
+ return this;
725
+ };
726
+ /**
727
+ * Factory method to create an instance of IndexProvider based on table configuration.
728
+ * Returns a dummy provider if the index is not enabled in the configuration.
729
+ * @param tableConfig The configuration of the table.
730
+ * @returns An instance of IndexProvider or IndexProviderDummy.
731
+ */
732
+ IndexProvider.create = function (tableConfig) {
733
+ if (IndexProvider.canCreate(tableConfig)) {
734
+ return new IndexProvider(tableConfig.indexCfg);
735
+ }
736
+ return new IndexProviderDummy();
737
+ };
738
+ IndexProvider.canCreate = function (tableConfig) {
739
+ return (tableConfig.indexCfg && tableConfig.indexCfg.enable) || false;
740
+ };
599
741
  return IndexProvider;
600
- }());
742
+ }());
743
+ /**
744
+ * A dummy implementation of IndexProvider that is used when index functionality is not enabled.
745
+ * This class overrides certain methods to provide no-operation implementations.
746
+ */
747
+ var IndexProviderDummy = /** @class */ (function (_super) {
748
+ __extends(IndexProviderDummy, _super);
749
+ function IndexProviderDummy() {
750
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
751
+ _this.isEnabled = false;
752
+ return _this;
753
+ }
754
+ /**
755
+ * Overrides the addIndexColumn method to return itself without modifying the columns array.
756
+ * @param columns The array of column names.
757
+ * @returns The instance of IndexProviderDummy for method chaining.
758
+ */
759
+ IndexProviderDummy.prototype.addIndexColumn = function (columns) {
760
+ // No operation performed as the index is not enabled.
761
+ return this;
762
+ };
763
+ return IndexProviderDummy;
764
+ }(IndexProvider));
765
+
766
+ var PaginationProvider = /** @class */ (function () {
767
+ function PaginationProvider(config) {
768
+ this.isEnabled = true;
769
+ this.sizes = config.sizes || [5, 10, 15, 25, 50];
770
+ this.size = config.size || this.sizes[1];
771
+ }
772
+ PaginationProvider.canEnable = function (tableConfig) {
773
+ return (tableConfig.pageableCfg && tableConfig.pageableCfg.enable) || false;
774
+ };
775
+ PaginationProvider.create = function (tableConfig) {
776
+ if (this.canEnable(tableConfig) && tableConfig.pageableCfg) {
777
+ return new PaginationProvider(tableConfig.pageableCfg);
778
+ }
779
+ return new PaginationProviderDummy();
780
+ };
781
+ return PaginationProvider;
782
+ }());
783
+ var PaginationProviderDummy = /** @class */ (function (_super) {
784
+ __extends(PaginationProviderDummy, _super);
785
+ function PaginationProviderDummy() {
786
+ var _this = _super.call(this, EmptyValue.PAGINATION_CONFIG) || this;
787
+ _this.isEnabled = false;
788
+ return _this;
789
+ }
790
+ return PaginationProviderDummy;
791
+ }(PaginationProvider));
601
792
 
602
793
  var TableRow = /** @class */ (function () {
603
794
  function TableRow(id, rowSrc) {
@@ -607,30 +798,97 @@
607
798
  return TableRow;
608
799
  }());
609
800
 
610
- var TableDataProvider = /** @class */ (function () {
611
- function TableDataProvider() {
801
+ var TableRowsFactory = /** @class */ (function () {
802
+ function TableRowsFactory() {
612
803
  }
613
- TableDataProvider.prototype.convert = function (data, config) {
804
+ /**
805
+ * Converts an array of data objects into an array of TableRow objects.
806
+ * @param data Array of data objects to be converted.
807
+ * @param config Configuration settings for each column.
808
+ * @returns An array of TableRow objects.
809
+ */
810
+ TableRowsFactory.convert = function (data, config) {
614
811
  var _this = this;
615
- var id = 0;
616
- return data.map(function (d) { return _this.tableRow(id++, d, config); });
812
+ return data.map(function (obj, index) { return _this.createTableRow(index, obj, config); });
617
813
  };
618
- TableDataProvider.prototype.tableRow = function (id, obj, config) {
814
+ TableRowsFactory.createTableRow = function (id, obj, config) {
619
815
  var row = new TableRow(id, obj);
620
816
  config.forEach(function (c) { return row[c.key] = c.valueConverter(obj); });
621
817
  return row;
622
818
  };
623
- return TableDataProvider;
819
+ return TableRowsFactory;
624
820
  }());
625
821
 
626
- var PaginationProvider = /** @class */ (function () {
627
- function PaginationProvider(config) {
628
- this.sizes = config.sizes || [5, 10, 15, 25, 50];
629
- this.size = config.size || this.sizes[1];
822
+ var MatTableDataSourceFactory = /** @class */ (function () {
823
+ function MatTableDataSourceFactory() {
630
824
  }
631
- return PaginationProvider;
825
+ /**
826
+ * Converts an array of data objects into MatTableDataSource.
827
+ * @param data Array of data objects to be converted.
828
+ * @param config Configuration settings for each column.
829
+ * @returns MatTableDataSource.
830
+ */
831
+ MatTableDataSourceFactory.convert = function (data, config) {
832
+ var tableRows = TableRowsFactory.convert(data, config);
833
+ return new i3.MatTableDataSource(tableRows);
834
+ };
835
+ return MatTableDataSourceFactory;
632
836
  }());
633
837
 
838
+ var DisplayColumnsFactory = /** @class */ (function () {
839
+ function DisplayColumnsFactory() {
840
+ }
841
+ DisplayColumnsFactory.create = function (tableConfig) {
842
+ return tableConfig.columnsCfg.map(function (tableColumn) { return tableColumn.key; });
843
+ };
844
+ return DisplayColumnsFactory;
845
+ }());
846
+
847
+ var TotalRowProvider = /** @class */ (function () {
848
+ function TotalRowProvider(tableConfig, tableDataSource) {
849
+ this.tableConfig = tableConfig;
850
+ this.tableDataSource = tableDataSource;
851
+ this.isEnabled = true;
852
+ this.totals = new Map();
853
+ }
854
+ TotalRowProvider.prototype.setStyle = function () {
855
+ var _a, _b;
856
+ this.style = (_b = (_a = this.tableConfig.tableView) === null || _a === void 0 ? void 0 : _a.totalRowView) === null || _b === void 0 ? void 0 : _b.style;
857
+ return this;
858
+ };
859
+ TotalRowProvider.prototype.setTotalRow = function () {
860
+ var _this = this;
861
+ this.tableConfig.columnsCfg.forEach(function (col) {
862
+ if (col.totalConverter) {
863
+ _this.totals.set(col.key, col.totalConverter(_this.tableDataSource.data));
864
+ }
865
+ });
866
+ return this;
867
+ };
868
+ TotalRowProvider.canEnable = function (tableConfig) {
869
+ return tableConfig.columnsCfg.some(function (col) { return col.totalConverter; });
870
+ };
871
+ TotalRowProvider.create = function (tableConfig, tableDataSource) {
872
+ if (TotalRowProvider.canEnable(tableConfig)) {
873
+ return new TotalRowProvider(tableConfig, tableDataSource);
874
+ }
875
+ return new TotalRowProviderDummy();
876
+ };
877
+ return TotalRowProvider;
878
+ }());
879
+ var TotalRowProviderDummy = /** @class */ (function (_super) {
880
+ __extends(TotalRowProviderDummy, _super);
881
+ function TotalRowProviderDummy() {
882
+ var _this = _super.call(this, EmptyValue.TABLE_CONFIG, EmptyValue.MAT_TABLE_DATA_SOURCE) || this;
883
+ _this.isEnabled = false;
884
+ return _this;
885
+ }
886
+ TotalRowProviderDummy.prototype.setTotalRow = function () {
887
+ return this;
888
+ };
889
+ return TotalRowProviderDummy;
890
+ }(TotalRowProvider));
891
+
634
892
  var ColumnViewComponent = /** @class */ (function () {
635
893
  function ColumnViewComponent() {
636
894
  }
@@ -674,11 +932,9 @@
674
932
 
675
933
  var NgxAurMatTableComponent = /** @class */ (function () {
676
934
  function NgxAurMatTableComponent() {
677
- this.tableDataSource = new i3$1.MatTableDataSource([]);
935
+ this.tableDataSource = new i3.MatTableDataSource([]);
678
936
  this.displayedColumns = [];
679
937
  this.tableView = [];
680
- // number rowId
681
- this.actionView = new Map();
682
938
  this.tableData = [];
683
939
  this.sort = new i0.EventEmitter();
684
940
  // events if enabled actions
@@ -696,17 +952,23 @@
696
952
  */
697
953
  this.onFilter = new i0.EventEmitter();
698
954
  this.columnOffsets = new i0.EventEmitter();
699
- this.tableDataProvider = new TableDataProvider();
955
+ // @ts-ignore
956
+ this.resizeColumnOffsetsObserver = EmptyValue.RESIZE_OBSERVER;
957
+ this.selectionProvider = new SelectionProviderDummy();
958
+ this.rowActionsProvider = new RowActionProviderDummy();
959
+ this.indexProvider = new IndexProviderDummy();
960
+ this.paginationProvider = new PaginationProviderDummy();
961
+ this.totalRowProvider = new TotalRowProviderDummy();
700
962
  }
701
963
  NgxAurMatTableComponent.prototype.ngOnChanges = function (changes) {
702
964
  if (changes['tableData'] && this.tableData) {
703
- this.prepare();
965
+ this.prepareTableData();
704
966
  }
705
967
  if (changes['highlight'] && this.highlight) {
706
- this.doExternalHighlightRow(this.highlight);
968
+ this.handleHighlightChange(this.highlight);
707
969
  }
708
970
  };
709
- NgxAurMatTableComponent.prototype.doExternalHighlightRow = function (h) {
971
+ NgxAurMatTableComponent.prototype.handleHighlightChange = function (h) {
710
972
  var _a, _b;
711
973
  if (this.highlighted === h.value) {
712
974
  this.highlight = undefined;
@@ -733,6 +995,7 @@
733
995
  NgxAurMatTableComponent.prototype.ngAfterViewInit = function () {
734
996
  var _this = this;
735
997
  this.tableDataSource.paginator = this.matPaginator;
998
+ this.tableDataSource.sort = this.matSort;
736
999
  this.updateColumnOffsets();
737
1000
  this.resizeColumnOffsetsObserver = new ResizeObserver(function () { return _this.updateColumnOffsets(); });
738
1001
  this.resizeColumnOffsetsObserver.observe(this.table.nativeElement);
@@ -743,30 +1006,25 @@
743
1006
  .map(function (c) { return ({ left: c.offsetLeft, width: c.offsetWidth }); });
744
1007
  this.columnOffsets.emit(offsets);
745
1008
  };
746
- NgxAurMatTableComponent.prototype.prepare = function () {
747
- this.setTableDataSource();
748
- this.tableView = TableViewConverter.toView(this.tableDataSource.data, this.tableConfig);
749
- this.displayedColumns = this.tableConfig.columnsCfg.map(function (tableColumn) { return tableColumn.key; });
750
- if (this.tableConfig.indexCfg && this.tableConfig.indexCfg.enable) {
751
- this.indexProvider = new IndexProvider(this.tableConfig.indexCfg, this.displayedColumns);
752
- }
753
- if (this.tableConfig.actionCfg && (this.tableConfig.actionCfg.enable === undefined || this.tableConfig.actionCfg.enable === null || this.tableConfig.actionCfg.enable)) {
754
- this.rowActionsProvider = new RowActionProvider(this.tableConfig.actionCfg, this.displayedColumns);
755
- this.actionView = this.rowActionsProvider.toView(this.tableDataSource.data, this.tableConfig.actionCfg);
756
- }
757
- if (this.tableConfig.selectionCfg && this.tableConfig.selectionCfg.enable) {
758
- this.selectionProvider = new SelectionProvider(this.tableConfig.selectionCfg, this.displayedColumns, this.tableDataSource);
759
- this.selectionProvider.bind(this.selected, this.onSelect, this.onDeselect);
760
- }
761
- if (this.tableConfig.pageableCfg) {
762
- this.paginationProvider = new PaginationProvider(this.tableConfig.pageableCfg);
763
- }
1009
+ NgxAurMatTableComponent.prototype.prepareTableData = function () {
1010
+ this.initTable();
1011
+ this.totalRowProvider = TotalRowProvider.create(this.tableConfig, this.tableDataSource)
1012
+ .setStyle()
1013
+ .setTotalRow();
1014
+ this.indexProvider = IndexProvider.create(this.tableConfig)
1015
+ .addIndexColumn(this.displayedColumns);
1016
+ this.rowActionsProvider = RowActionProvider.create(this.tableConfig)
1017
+ .addActionColumn(this.displayedColumns)
1018
+ .setView(this.tableDataSource.data);
1019
+ this.selectionProvider = SelectionProvider.create(this.tableConfig, this.tableDataSource)
1020
+ .addCheckboxColumn(this.displayedColumns)
1021
+ .bindEventEmitters(this.selected, this.onSelect, this.onDeselect);
1022
+ this.paginationProvider = PaginationProvider.create(this.tableConfig);
764
1023
  };
765
- NgxAurMatTableComponent.prototype.setTableDataSource = function () {
766
- var convert = this.tableDataProvider.convert(this.tableData, this.tableConfig.columnsCfg);
767
- this.tableDataSource = new i3$1.MatTableDataSource(convert);
768
- this.tableDataSource.paginator = this.matPaginator;
769
- this.tableDataSource.sort = this.matSort;
1024
+ NgxAurMatTableComponent.prototype.initTable = function () {
1025
+ this.tableDataSource = MatTableDataSourceFactory.convert(this.tableData, this.tableConfig.columnsCfg);
1026
+ this.tableView = TableViewFactory.toView(this.tableDataSource.data, this.tableConfig);
1027
+ this.displayedColumns = DisplayColumnsFactory.create(this.tableConfig);
770
1028
  };
771
1029
  NgxAurMatTableComponent.prototype.applyFilter = function (event) {
772
1030
  var filterValue = event.target.value;
@@ -792,12 +1050,6 @@
792
1050
  NgxAurMatTableComponent.prototype.castSrc = function (row) {
793
1051
  return row;
794
1052
  };
795
- NgxAurMatTableComponent.prototype.getView = function (row, columnKey) {
796
- return this.tableView[row.id] ? this.tableView[row.id].get(columnKey) : undefined;
797
- };
798
- NgxAurMatTableComponent.prototype.getActionsView = function (row) {
799
- return this.actionView.get(row.id) ? this.actionView.get(row.id) : undefined;
800
- };
801
1053
  NgxAurMatTableComponent.prototype.rowClick = function (row) {
802
1054
  var _a;
803
1055
  if (row.rowSrc !== this.highlighted || (row.rowSrc === this.highlighted && !((_a = this.tableConfig.clickCfg) === null || _a === void 0 ? void 0 : _a.cancelable))) {
@@ -816,13 +1068,14 @@
816
1068
  return NgxAurMatTableComponent;
817
1069
  }());
818
1070
  NgxAurMatTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxAurMatTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
819
- NgxAurMatTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: NgxAurMatTableComponent, selector: "aur-mat-table", inputs: { tableConfig: "tableConfig", tableData: "tableData", highlight: "highlight" }, outputs: { sort: "sort", onRowAction: "onRowAction", selected: "selected", onSelect: "onSelect", onDeselect: "onDeselect", onSelectedRowsAction: "onSelectedRowsAction", onRowClick: "onRowClick", onFilter: "onFilter", columnOffsets: "columnOffsets" }, viewQueries: [{ propertyName: "table", first: true, predicate: ["table"], descendants: true, read: i0.ElementRef }, { propertyName: "matPaginator", first: true, predicate: i8.MatPaginator, descendants: true }, { propertyName: "matSort", first: true, predicate: i7.MatSort, descendants: true, static: true }, { propertyName: "rows", predicate: ["rowLink"], descendants: true, read: i0.ElementRef }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"aur-mat-table\">\r\n <ng-container>\r\n\r\n <!-- Filter -->\r\n <ng-container *ngIf=\"tableConfig.filterCfg\">\r\n <mat-form-field>\r\n <mat-label>{{tableConfig.filterCfg?.label}}</mat-label>\r\n <input matInput (keyup)=\"applyFilter($event)\"\r\n placeholder=\"{{tableConfig.filterCfg?.placeholder}}\"\r\n style=\"font-size: 18px;\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Table -->\r\n <table\r\n #table\r\n mat-table\r\n matSort\r\n [dataSource]=\"tableDataSource\"\r\n (matSortChange)=\"sortTable($event)\"\r\n [style.height]=\"tableConfig.tableView?.height\"\r\n [style.max-height]=\"tableConfig.tableView?.maxHeight\"\r\n [style.min-height]=\"tableConfig.tableView?.minHeight\"\r\n >\r\n\r\n <!-- index-column-->\r\n <ng-container *ngIf=\"indexProvider\" [matColumnDef]=\"indexProvider.COLUMN_NAME\">\r\n\r\n <th mat-header-cell *matHeaderCellDef>\r\n <lib-column-view [config]=\"indexProvider.headerView\">\r\n {{indexProvider.name}}\r\n </lib-column-view>\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let element; let rowIndex = index\">\r\n {{rowIndex + indexProvider.offset}}\r\n </td>\r\n </ng-container>\r\n\r\n <!-- selection-column-->\r\n <ng-container [matColumnDef]=\"selectionProvider.COLUMN_NAME\" *ngIf=\"selectionProvider\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <div class=\"flex-container\">\r\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n [checked]=\"selectionProvider.selection.hasValue() && isAllSelected()\"\r\n [indeterminate]=\"selectionProvider.selection.hasValue() && !isAllSelected()\">\r\n </mat-checkbox>\r\n <div\r\n *ngIf=\"tableConfig.selectionCfg?.showSelectedCount && selectionProvider.selection.hasValue()\">\r\n ({{selectionProvider.selection.selected.length}}/{{tableDataSource.data.length}})\r\n </div>\r\n\r\n <div *ngIf=\"selectionProvider.selection.hasValue() && tableConfig?.selectionCfg?.actions\">\r\n <button mat-icon-button\r\n (click)=\"emitSelectedRowsAction(action.action, selectionProvider.selection.selected)\"\r\n [matTooltip]=\"action.icon.tooltip || ''\"\r\n *ngFor=\"let action of tableConfig.selectionCfg!.actions\">\r\n <mat-icon [style.color]=\"action.icon.color\">\r\n {{action.icon.name}}\r\n </mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? selectionProvider.selection.toggle(castSrc(row).rowSrc) : null\"\r\n [checked]=\"selectionProvider.selection.isSelected(castSrc(row).rowSrc)\">\r\n </mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- action column -->\r\n <ng-container *ngIf=\"rowActionsProvider\" [matColumnDef]=\"rowActionsProvider.COLUMN_NAME\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button mat-icon-button\r\n (click)=\"emitRowAction(action.action, castSrc(element).rowSrc, $event)\"\r\n [matTooltip]=\"action.icon.tooltip || ''\"\r\n *ngFor=\"let action of getActionsView(castSrc(element))\">\r\n <mat-icon [style.color]=\"action.icon.color\">\r\n {{action.icon.name}}\r\n </mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- value-icon-->\r\n <ng-container *ngFor=\"let columnConfig of tableConfig.columnsCfg\" [matColumnDef]=\"columnConfig.key\">\r\n\r\n <!-- if sortable column header -->\r\n <ng-container *ngIf=\"columnConfig.sort; else notSortable\">\r\n <th mat-header-cell *matHeaderCellDef [mat-sort-header]=\"columnConfig.key\"\r\n [arrowPosition]=\"columnConfig.sort.position === 'right' ? 'before' : 'after'\">\r\n <ng-container *ngTemplateOutlet=\"headerValue\"></ng-container>\r\n </th>\r\n </ng-container>\r\n\r\n <!-- else not sortable -->\r\n <ng-template #notSortable>\r\n <th mat-header-cell *matHeaderCellDef>\r\n <ng-container *ngTemplateOutlet=\"headerValue\"></ng-container>\r\n </th>\r\n </ng-template>\r\n\r\n <!-- header value-->\r\n <ng-template #headerValue>\r\n <lib-column-view [config]=\"columnConfig.headerView\"\r\n [value]=\"columnConfig.name\"\r\n >\r\n </lib-column-view>\r\n </ng-template>\r\n\r\n <!-- column value \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u043D\u0443\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437 getView(rowIndex, columnConfig.key) \u0442\u0430\u043C \u043D\u0430\u0445\u043E\u0434\u044F\u0442\u0441\u044F \u0443\u0436\u0435\r\n \u043F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F-->\r\n <td mat-cell *matCellDef=\"let element;\">\r\n <lib-column-view\r\n [config]=\"getView(element, columnConfig.key)\"\r\n [value]=\"element | dataPropertyGetter: columnConfig.key\"\r\n >\r\n </lib-column-view>\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: this.tableConfig.stickyCfg?.header\"></tr>\r\n <tr mat-row\r\n (click)=\"rowClick(row)\"\r\n *matRowDef=\"let row; columns: displayedColumns;\"\r\n [ngClass]=\"{'pointer': tableConfig.clickCfg?.pointer || false, 'new-color': highlighted===row.rowSrc && tableConfig?.clickCfg?.highlightClicked?.color}\"\r\n [ngStyle]=\"{\r\n 'color': highlighted===row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.color : undefined,\r\n 'background-color': highlighted === row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.background : undefined,\r\n 'border': highlighted === row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.border : undefined\r\n }\"\r\n #rowLink\r\n ></tr>\r\n </table>\r\n\r\n <!-- Pagination -->\r\n <mat-paginator *ngIf=\"paginationProvider\"\r\n [pageSizeOptions]=\"paginationProvider.sizes\"\r\n [pageSize]=\"paginationProvider.size\"\r\n showFirstLastButtons>\r\n </mat-paginator>\r\n </ng-container>\r\n</div>\r\n", styles: [".aur-mat-table table{width:100%;border-collapse:collapse}.aur-mat-table th,td{padding:10px!important}.aur-mat-table .new-color td.mat-cell,.aur-mat-table .new-color td.mat-footer-cell{color:inherit}.aur-mat-table mat-form-field{width:100%}.aur-mat-table .text-right{text-align:right!important}.aur-mat-table .pointer:hover{background-color:#f2f2f2;cursor:pointer}.aur-mat-table .flex-container{display:flex;align-items:center}\n"], components: [{ type: i1__namespace$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i1__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: ColumnViewComponent, selector: "lib-column-view", inputs: ["config", "value"] }, { type: i5__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i7__namespace.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "arrowPosition", "sortActionDescription", "disableClear", "mat-sort-header", "start"], exportAs: ["matSortHeader"] }, { type: i3__namespace$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i3__namespace$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i8__namespace.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }], directives: [{ type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$1.MatLabel, selector: "mat-label" }, { type: i10__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace$1.MatPrefix, selector: "[matPrefix]" }, { type: i7__namespace.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortActive"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { type: i3__namespace$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i3__namespace$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i3__namespace$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i3__namespace$1.MatCellDef, selector: "[matCellDef]" }, { type: i3__namespace$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i3__namespace$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "dataPropertyGetter": DataPropertyGetterPipe } });
1071
+ NgxAurMatTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: NgxAurMatTableComponent, selector: "aur-mat-table", inputs: { tableConfig: "tableConfig", tableData: "tableData", highlight: "highlight" }, outputs: { sort: "sort", onRowAction: "onRowAction", selected: "selected", onSelect: "onSelect", onDeselect: "onDeselect", onSelectedRowsAction: "onSelectedRowsAction", onRowClick: "onRowClick", onFilter: "onFilter", columnOffsets: "columnOffsets" }, viewQueries: [{ propertyName: "table", first: true, predicate: ["table"], descendants: true, read: i0.ElementRef }, { propertyName: "matPaginator", first: true, predicate: i8.MatPaginator, descendants: true }, { propertyName: "matSort", first: true, predicate: i7.MatSort, descendants: true, static: true }, { propertyName: "rows", predicate: ["rowLink"], descendants: true, read: i0.ElementRef }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"aur-mat-table\">\r\n <ng-container>\r\n\r\n <!-- Filter -->\r\n <ng-container *ngIf=\"tableConfig.filterCfg\">\r\n <mat-form-field>\r\n <mat-label>{{tableConfig.filterCfg?.label}}</mat-label>\r\n <input matInput (keyup)=\"applyFilter($event)\"\r\n placeholder=\"{{tableConfig.filterCfg?.placeholder}}\"\r\n style=\"font-size: 18px;\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n </mat-form-field>\r\n </ng-container>\r\n\r\n <!-- Table -->\r\n <table #table mat-table matSort\r\n [dataSource]=\"tableDataSource\"\r\n (matSortChange)=\"sortTable($event)\"\r\n [style.height]=\"tableConfig.tableView?.height\"\r\n [style.max-height]=\"tableConfig.tableView?.maxHeight\"\r\n [style.min-height]=\"tableConfig.tableView?.minHeight\">\r\n\r\n <!-- index-column-->\r\n <ng-container *ngIf=\"indexProvider.isEnabled\" [matColumnDef]=\"indexProvider.COLUMN_NAME\">\r\n\r\n <th mat-header-cell *matHeaderCellDef>\r\n <lib-column-view [config]=\"indexProvider.headerView\">\r\n {{indexProvider.name}}\r\n </lib-column-view>\r\n </th>\r\n\r\n <td mat-cell *matCellDef=\"let element; let rowIndex = index\">\r\n {{rowIndex + indexProvider.offset}}\r\n </td>\r\n </ng-container>\r\n\r\n <!-- selection-column-->\r\n <ng-container [matColumnDef]=\"selectionProvider.COLUMN_NAME\" *ngIf=\"selectionProvider.isEnabled\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <div class=\"flex-container\">\r\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n [checked]=\"selectionProvider.selection.hasValue() && isAllSelected()\"\r\n [indeterminate]=\"selectionProvider.selection.hasValue() && !isAllSelected()\">\r\n </mat-checkbox>\r\n <div\r\n *ngIf=\"tableConfig.selectionCfg?.showSelectedCount && selectionProvider.selection.hasValue()\">\r\n ({{selectionProvider.selection.selected.length}}/{{tableDataSource.data.length}})\r\n </div>\r\n\r\n <div *ngIf=\"selectionProvider.selection.hasValue() && tableConfig?.selectionCfg?.actions\">\r\n <button mat-icon-button\r\n (click)=\"emitSelectedRowsAction(action.action, selectionProvider.selection.selected)\"\r\n [matTooltip]=\"action.icon.tooltip || ''\"\r\n *ngFor=\"let action of tableConfig.selectionCfg!.actions\">\r\n <mat-icon [style.color]=\"action.icon.color\">\r\n {{action.icon.name}}\r\n </mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? selectionProvider.selection.toggle(castSrc(row).rowSrc) : null\"\r\n [checked]=\"selectionProvider.selection.isSelected(castSrc(row).rowSrc)\">\r\n </mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- action column -->\r\n <ng-container *ngIf=\"rowActionsProvider.isEnabled\" [matColumnDef]=\"rowActionsProvider.COLUMN_NAME\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button mat-icon-button\r\n (click)=\"emitRowAction(action.action, element.rowSrc, $event)\"\r\n [matTooltip]=\"action.icon.tooltip || ''\"\r\n *ngFor=\"let action of rowActionsProvider.actionView.get(element.id)\">\r\n <mat-icon [style.color]=\"action.icon.color\">\r\n {{action.icon.name}}\r\n </mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- value-icon-->\r\n <ng-container *ngFor=\"let columnConfig of tableConfig.columnsCfg\" [matColumnDef]=\"columnConfig.key\">\r\n\r\n <!-- if sortable column header -->\r\n <ng-container *ngIf=\"columnConfig.sort; else notSortable\">\r\n <th mat-header-cell *matHeaderCellDef [mat-sort-header]=\"columnConfig.key\"\r\n [arrowPosition]=\"columnConfig.sort.position === 'right' ? 'before' : 'after'\">\r\n <ng-container *ngTemplateOutlet=\"headerValue\"></ng-container>\r\n </th>\r\n </ng-container>\r\n\r\n <!-- else not sortable -->\r\n <ng-template #notSortable>\r\n <th mat-header-cell *matHeaderCellDef>\r\n <ng-container *ngTemplateOutlet=\"headerValue\"></ng-container>\r\n </th>\r\n </ng-template>\r\n\r\n <!-- header value-->\r\n <ng-template #headerValue>\r\n <lib-column-view [config]=\"columnConfig.headerView\"\r\n [value]=\"columnConfig.name\">\r\n </lib-column-view>\r\n </ng-template>\r\n\r\n <!-- column value \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u043D\u0443\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437 getView(rowIndex, columnConfig.key) \u0442\u0430\u043C \u043D\u0430\u0445\u043E\u0434\u044F\u0442\u0441\u044F \u0443\u0436\u0435\r\n \u043F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u044F-->\r\n <td mat-cell *matCellDef=\"let element;\">\r\n <lib-column-view\r\n [config]=\"tableView[element.id]?.get(columnConfig.key)\"\r\n [value]=\"element | dataPropertyGetter: columnConfig.key\">\r\n </lib-column-view>\r\n </td>\r\n <div *ngIf=\"totalRowProvider.isEnabled\">\r\n <td mat-footer-cell *matFooterCellDef [style]=\"totalRowProvider.style\">\r\n {{totalRowProvider.totals.get(columnConfig.key)}}\r\n </td>\r\n </div>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky: this.tableConfig.stickyCfg?.header\"></tr>\r\n <tr mat-row #rowLink\r\n *matRowDef=\"let row; columns: displayedColumns;\"\r\n (click)=\"rowClick(row)\"\r\n [ngClass]=\"{'pointer': tableConfig.clickCfg?.pointer || false, 'new-color': highlighted===row.rowSrc && tableConfig?.clickCfg?.highlightClicked?.color}\"\r\n [ngStyle]=\"{\r\n 'color': highlighted===row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.color : undefined,\r\n 'background-color': highlighted === row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.background : undefined,\r\n 'border': highlighted === row.rowSrc? tableConfig?.clickCfg?.highlightClicked?.border : undefined\r\n }\">\r\n </tr>\r\n <div *ngIf=\"totalRowProvider.isEnabled\">\r\n <tr mat-footer-row *matFooterRowDef=\"displayedColumns\" [style]=\"totalRowProvider.style\"></tr>\r\n </div>\r\n </table>\r\n\r\n <!-- Pagination -->\r\n <mat-paginator *ngIf=\"paginationProvider.isEnabled\"\r\n [pageSizeOptions]=\"paginationProvider.sizes\"\r\n [pageSize]=\"paginationProvider.size\"\r\n showFirstLastButtons>\r\n </mat-paginator>\r\n </ng-container>\r\n</div>\r\n", styles: [".aur-mat-table table{width:100%;border-collapse:collapse}.aur-mat-table th,td{padding:10px!important}.aur-mat-table .new-color td.mat-cell,.aur-mat-table .new-color td.mat-footer-cell{color:inherit}.aur-mat-table mat-form-field{width:100%}.aur-mat-table .text-right{text-align:right!important}.aur-mat-table .pointer:hover{background-color:#f2f2f2;cursor:pointer}.aur-mat-table .flex-container{display:flex;align-items:center}\n"], components: [{ type: i1__namespace$1.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i1__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: ColumnViewComponent, selector: "lib-column-view", inputs: ["config", "value"] }, { type: i5__namespace.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i6__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i7__namespace.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "arrowPosition", "sortActionDescription", "disableClear", "mat-sort-header", "start"], exportAs: ["matSortHeader"] }, { type: i3__namespace$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i3__namespace$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { type: i3__namespace$1.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { type: i8__namespace.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }], directives: [{ type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$1.MatLabel, selector: "mat-label" }, { type: i10__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace$1.MatPrefix, selector: "[matPrefix]" }, { type: i7__namespace.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortActive"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { type: i3__namespace$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i3__namespace$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i3__namespace$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i3__namespace$1.MatCellDef, selector: "[matCellDef]" }, { type: i3__namespace$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i9__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.MatFooterCellDef, selector: "[matFooterCellDef]" }, { type: i3__namespace$1.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { type: i3__namespace$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i3__namespace$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i9__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3__namespace$1.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }], pipes: { "dataPropertyGetter": DataPropertyGetterPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
820
1072
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxAurMatTableComponent, decorators: [{
821
1073
  type: i0.Component,
822
1074
  args: [{
823
1075
  selector: 'aur-mat-table',
824
1076
  templateUrl: './ngx-aur-mat-table.component.html',
825
1077
  styleUrls: ['./ngx-aur-mat-table.component.scss'],
1078
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
826
1079
  }]
827
1080
  }], ctorParameters: function () { return []; }, propDecorators: { rows: [{
828
1081
  type: i0.ViewChildren,
@@ -872,24 +1125,24 @@
872
1125
  DataPropertyGetterPipe,
873
1126
  ColumnViewComponent], imports: [i9.CommonModule,
874
1127
  i1.MatIconModule,
875
- i3$1.MatTableModule,
1128
+ i3.MatTableModule,
876
1129
  i8.MatPaginatorModule,
877
1130
  i6.MatButtonModule,
878
1131
  i10.MatInputModule,
879
1132
  i7.MatSortModule,
880
- i3.MatTooltipModule,
1133
+ i3$1.MatTooltipModule,
881
1134
  i5.MatCheckboxModule,
882
1135
  i1$1.MatFormFieldModule], exports: [NgxAurMatTableComponent,
883
1136
  DataPropertyGetterPipe] });
884
1137
  NgxAurMatTableModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxAurMatTableModule, imports: [[
885
1138
  i9.CommonModule,
886
1139
  i1.MatIconModule,
887
- i3$1.MatTableModule,
1140
+ i3.MatTableModule,
888
1141
  i8.MatPaginatorModule,
889
1142
  i6.MatButtonModule,
890
1143
  i10.MatInputModule,
891
1144
  i7.MatSortModule,
892
- i3.MatTooltipModule,
1145
+ i3$1.MatTooltipModule,
893
1146
  i5.MatCheckboxModule,
894
1147
  i1$1.MatFormFieldModule
895
1148
  ]] });
@@ -904,12 +1157,12 @@
904
1157
  imports: [
905
1158
  i9.CommonModule,
906
1159
  i1.MatIconModule,
907
- i3$1.MatTableModule,
1160
+ i3.MatTableModule,
908
1161
  i8.MatPaginatorModule,
909
1162
  i6.MatButtonModule,
910
1163
  i10.MatInputModule,
911
1164
  i7.MatSortModule,
912
- i3.MatTooltipModule,
1165
+ i3$1.MatTooltipModule,
913
1166
  i5.MatCheckboxModule,
914
1167
  i1$1.MatFormFieldModule
915
1168
  ],
@@ -920,6 +1173,93 @@
920
1173
  }]
921
1174
  }] });
922
1175
 
1176
+ var BorderStyleBuilder = /** @class */ (function () {
1177
+ function BorderStyleBuilder() {
1178
+ this._top = '';
1179
+ this._bottom = '';
1180
+ this._right = '';
1181
+ this._left = '';
1182
+ }
1183
+ BorderStyleBuilder.prototype.top = function (width, style, color) {
1184
+ this._top = width + " " + style + " " + color;
1185
+ return this;
1186
+ };
1187
+ BorderStyleBuilder.prototype.bottom = function (width, style, color) {
1188
+ this._bottom = width + " " + style + " " + color;
1189
+ return this;
1190
+ };
1191
+ BorderStyleBuilder.prototype.right = function (width, style, color) {
1192
+ this._right = width + " " + style + " " + color;
1193
+ return this;
1194
+ };
1195
+ BorderStyleBuilder.prototype.left = function (width, style, color) {
1196
+ this._left = width + " " + style + " " + color;
1197
+ return this;
1198
+ };
1199
+ BorderStyleBuilder.prototype.allBorders = function (width, style, color) {
1200
+ this._top = this._bottom = this._right = this._left = width + " " + style + " " + color;
1201
+ return this;
1202
+ };
1203
+ BorderStyleBuilder.prototype.build = function () {
1204
+ var styles = '';
1205
+ if (this._top)
1206
+ styles += "border-top: " + this._top + "; ";
1207
+ if (this._bottom)
1208
+ styles += "border-bottom: " + this._bottom + "; ";
1209
+ if (this._right)
1210
+ styles += "border-right: " + this._right + "; ";
1211
+ if (this._left)
1212
+ styles += "border-left: " + this._left + "; ";
1213
+ return styles;
1214
+ };
1215
+ return BorderStyleBuilder;
1216
+ }());
1217
+ exports.BorderStyle = void 0;
1218
+ (function (BorderStyle) {
1219
+ BorderStyle["SOLID"] = "solid";
1220
+ BorderStyle["DOTTED"] = "dotted";
1221
+ BorderStyle["DASHED"] = "dashed";
1222
+ BorderStyle["DOUBLE"] = "double";
1223
+ BorderStyle["GROOVE"] = "groove";
1224
+ BorderStyle["RIDGE"] = "ridge";
1225
+ BorderStyle["INSET"] = "inset";
1226
+ BorderStyle["OUTSET"] = "outset";
1227
+ BorderStyle["NONE"] = "none";
1228
+ BorderStyle["HIDDEN"] = "hidden";
1229
+ })(exports.BorderStyle || (exports.BorderStyle = {}));
1230
+
1231
+ var RowStyleBuilder = /** @class */ (function () {
1232
+ function RowStyleBuilder() {
1233
+ this._background = '';
1234
+ this._color = '';
1235
+ this._border = '';
1236
+ }
1237
+ RowStyleBuilder.prototype.background = function (color) {
1238
+ this._background = color;
1239
+ return this;
1240
+ };
1241
+ RowStyleBuilder.prototype.color = function (color) {
1242
+ this._color = color;
1243
+ return this;
1244
+ };
1245
+ RowStyleBuilder.prototype.border = function (borderBuilderFn) {
1246
+ var borderBuilder = new BorderStyleBuilder();
1247
+ this._border = borderBuilderFn(borderBuilder).build();
1248
+ return this;
1249
+ };
1250
+ RowStyleBuilder.prototype.build = function () {
1251
+ var styles = '';
1252
+ if (this._background)
1253
+ styles += "background: " + this._background + "; ";
1254
+ if (this._color)
1255
+ styles += "color: " + this._color + "; ";
1256
+ if (this._border)
1257
+ styles += "" + this._border;
1258
+ return styles;
1259
+ };
1260
+ return RowStyleBuilder;
1261
+ }());
1262
+
923
1263
  /*
924
1264
  * Public API Surface of ngx-aur-mat-table
925
1265
  */
@@ -928,12 +1268,17 @@
928
1268
  * Generated bundle index. Do not edit.
929
1269
  */
930
1270
 
1271
+ exports.BorderStyleBuilder = BorderStyleBuilder;
931
1272
  exports.DataPropertyGetterPipe = DataPropertyGetterPipe;
932
1273
  exports.IndexProvider = IndexProvider;
1274
+ exports.IndexProviderDummy = IndexProviderDummy;
933
1275
  exports.NgxAurMatTableComponent = NgxAurMatTableComponent;
934
1276
  exports.NgxAurMatTableModule = NgxAurMatTableModule;
935
1277
  exports.RowActionProvider = RowActionProvider;
1278
+ exports.RowActionProviderDummy = RowActionProviderDummy;
1279
+ exports.RowStyleBuilder = RowStyleBuilder;
936
1280
  exports.SelectionProvider = SelectionProvider;
1281
+ exports.SelectionProviderDummy = SelectionProviderDummy;
937
1282
  exports.TableRow = TableRow;
938
1283
 
939
1284
  Object.defineProperty(exports, '__esModule', { value: true });