@zeedhi/teknisa-components-common 1.37.0 → 1.41.0

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 (31) hide show
  1. package/coverage/clover.xml +789 -617
  2. package/coverage/coverage-final.json +30 -27
  3. package/coverage/lcov-report/block-navigation.js +8 -0
  4. package/coverage/lcov-report/index.html +55 -19
  5. package/coverage/lcov-report/sorter.js +26 -0
  6. package/coverage/lcov.info +1506 -1181
  7. package/dist/tek-components-common.esm.js +1808 -1347
  8. package/dist/tek-components-common.umd.js +1808 -1344
  9. package/package.json +2 -2
  10. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +20 -4
  11. package/tests/unit/components/tek-grid/filter-helper.spec.ts +145 -0
  12. package/tests/unit/components/tek-grid/grid.spec.ts +376 -58
  13. package/tests/unit/components/tek-grid/layout_options.spec.ts +58 -0
  14. package/tests/unit/components/tek-loading/Loading.spec.ts +30 -0
  15. package/tests/unit/components/tree-grid/tree-grid.spec.ts +469 -0
  16. package/tests/unit/{components/tek-grid → utils/grid-base}/grid-controller.spec.ts +3 -3
  17. package/types/components/index.d.ts +5 -0
  18. package/types/components/tek-datasource/memory-datasource.d.ts +1 -0
  19. package/types/components/tek-grid/filter-dynamic-values.d.ts +9 -0
  20. package/types/components/tek-grid/filter-helper.d.ts +9 -0
  21. package/types/components/tek-grid/grid-columns-button.d.ts +2 -0
  22. package/types/components/tek-grid/grid.d.ts +12 -19
  23. package/types/components/tek-grid/interfaces.d.ts +15 -1
  24. package/types/components/tek-grid/layout-options.d.ts +3 -2
  25. package/types/components/tek-loading/interfaces.d.ts +6 -0
  26. package/types/components/tek-loading/loading.d.ts +24 -0
  27. package/types/components/tek-tree-grid/interfaces.d.ts +19 -0
  28. package/types/components/tek-tree-grid/tree-grid.d.ts +76 -0
  29. package/types/utils/grid-base/grid-base.d.ts +267 -0
  30. package/types/utils/grid-base/grid-controller.d.ts +20 -0
  31. package/types/utils/index.d.ts +3 -1
@@ -1,5 +1,5 @@
1
- import { KeyMap, I18n, FormatterParserProvider, DatasourceFactory, RestDatasource, URL, MemoryDatasource, normalize, Messages, Loader, Metadata } from '@zeedhi/core';
2
- import { Form, Button, Tooltip, GridEditable, Grid, ComponentRender, Iterable, Carousel, GridColumnEditable, ModalService, Report, IterableColumnsButtonController, IterableColumnsButton } from '@zeedhi/common';
1
+ import { KeyMap, I18n, FormatterParserProvider, Messages, Metadata, DatasourceFactory, RestDatasource, URL, MemoryDatasource, normalize, Loader, dayjs, Config } from '@zeedhi/core';
2
+ import { Form, Button, Tooltip, GridEditable, Grid, ComponentRender, Iterable, Carousel, ModalService, GridColumnEditable, Report, IterableColumnsButtonController, IterableColumnsButton, TreeGridEditable } from '@zeedhi/common';
3
3
  import get from 'lodash.get';
4
4
  import debounce from 'lodash.debounce';
5
5
  import merge from 'lodash.merge';
@@ -549,6 +549,36 @@ class IterableCarousel extends Carousel {
549
549
  }
550
550
  }
551
551
 
552
+ // eslint-disable-next-line
553
+ const loading = 'data:image/gif;base64,R0lGODlhlgCWAPf/AC1oxPa+ADarUdmsFEB/m0yTcjiMhEafWjFova2SNDZotX10VsOfJDlosFZnge25BnJtXTukVWVmaFh1eIuOZ1x0ZEFopHpyWGFpcS5ow+q2CVNnhmVnZvW9AW5qYUyKXUJnofW+AKWNOV9mcS9owZuGQTporlCGXbWXLmNrazxnqeKyDoGDZVFniFZ6ZNSpGJ+IPoR4Ud+wEURnnmtpYklnlll5YbGUMcagIk5njmhnZWpoZGF0aWBmbkdnmbyaKUtnlEaBfWdmZTNou0WUW5WDRFtmeGZmZ82kHqecTXqIdzRouGJmbPC6BIB2VDxnrGNmakyHYPO8AkxnkUh0qmRpZl9wZVxndmRmaVhnffS9AqmPN09ni96vEUmQWzBowC1ow2FtZVR3gl5ndFGCYEVnnF1mdGR9i1dnf7qZK4l7TnRvXOK1FD6eV8ijIG6Cgl58lF1rfEBnpFVsi1pmeo5+Sk56dz9np5OCRjaqUi5pxNarFndw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K+645JZr7rnopqvuuuy26+678MYr77z01mvvvfjmq+++/Pbr778AByzwwAQXbPDBCCes8MIMN+zwwxBHLPHEFFds8cUYZ6zxxhx37PHHIIcs8sgkl2zyySinrPLKLLfs8sswxyzzzDTXbPPN3gYEACH5BAkEAP8ALAAAAACWAJYAAAj/AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cr155ExDjZsyDKiK8weU4R9AcAWTCgTLcyulFBrCdu7eAHITSmhEpi8gPeirJEBcGDBJR0UNpwXMUksChgfdhxyg+TJlD/eudw480cmdjnf9fxxDAnRo0l3vII6teqNZhajfs1xBILWemlrlNAAt+6NNXz/zjji9OzhGSu1Rp6RSW/RzDOaicw5esZJrqpbx4iFiynZd0mYgtiuEQuaSndMmJAzhY4E8vDjy59Pv779+/jz69/Pv7///wAGKOCABBZo4IEIJqjgggw26OCDEEYo4YQUVmjhhRhmqOGGHHbo4YcghijiiCSWaOKJKKao4oostujiizDGKOOMNNZo44045qjjjjz26OOPQAYp5JBEFmnkkUgmqSRVAQEAIfkEBQQA/wAsAAAAAJYAlgAACPEA/wkcSLCgwYMIEypcyLChw4cQI0qcSLGixYsYM2rcyLGjx48gQ4ocSbKkyZMoU6pcybKly5cwY8qcSbOmzZs4c+rcybOnz59AgwodSrSo0aNIkypdyrSp06dQo0qdSrWq1atYs2rdyrWr169gw4odS7as2bNo06pdy7at27dw48qdS7eu3bt48+rdy7ev37+AAwseTLiw4cOIEytezLix48eQI0ueTLmy5cuYM2vezLmz58+gQ4seTbq06dOoU6tezbq169ewY8ueTbu27du4c+vezbu379/AgwsfTry48ePIkytfzry58+fQo0ufbjggACH5BAUEAP8ALAAAAAABAAEAAAgEAP8FBAA7';
554
+ /**
555
+ * Teknisa component
556
+ */
557
+ class Loading extends ComponentRender {
558
+ /**
559
+ * Creates a new instance of TekLoading
560
+ * @param props Image Link props
561
+ */
562
+ constructor(props) {
563
+ super(props);
564
+ /**
565
+ * text to show in Loader Overlay
566
+ */
567
+ this.text = '';
568
+ /**
569
+ * zIndex value.
570
+ */
571
+ this.zIndex = '999';
572
+ /**
573
+ * loading path.
574
+ */
575
+ this.image = loading;
576
+ this.text = this.getInitValue('text', props.text, this.text);
577
+ this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
578
+ this.image = this.getInitValue('image', props.image, this.image);
579
+ }
580
+ }
581
+
552
582
  /**
553
583
  * Notifications component is used to show notifications
554
584
  */
@@ -676,568 +706,796 @@ class ReportFilter {
676
706
  }
677
707
  }
678
708
 
679
- const DynamicFilterOperations = {
680
- CONTAINS: true,
681
- NOT_CONTAINS: true,
682
- EQUALS: true,
683
- NOT_EQUALS: true,
684
- GREATER_THAN: true,
685
- LESS_THAN: true,
686
- GREATER_THAN_EQUALS: true,
687
- LESS_THAN_EQUALS: true,
688
- IN: true,
689
- NOT_IN: true,
690
- BETWEEN: true,
691
- };
692
- const DynamicFilterRelations = {
693
- AND: true,
694
- OR: true,
695
- };
696
-
697
- class TekRestDatasource extends RestDatasource {
698
- /**
699
- * Create new datasource
700
- * @param props Datasource properties
701
- */
702
- constructor(props) {
703
- super(Object.assign(Object.assign({}, props), { lazyLoad: true }));
704
- /**
705
- * Dynamic Filter Operations
706
- */
707
- this.dynamicFilterOperations = DynamicFilterOperations;
708
- /**
709
- * Dynamic Filter Relations
710
- */
711
- this.dynamicFilterRelations = DynamicFilterRelations;
712
- /**
713
- * Dynamic Filter applied flag
714
- */
715
- this.dynamicFilterApplied = '';
716
- if (!this.watchUrl) {
717
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
718
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
719
- }
720
- this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
721
- this.createAccessors();
722
- if (!this.lazyLoad) {
723
- this.get();
724
- }
709
+ class GridBase {
710
+ constructor(grid) {
711
+ this.exportConfigButtons = [];
712
+ this.grid = grid;
713
+ this.exportConfigButtons = this.getExportConfigButtons();
725
714
  }
726
- updateReservedKeys() {
727
- this.reservedKeys.dynamic_filter = true;
728
- this.reservedKeys.search_join = true;
715
+ getExportConfigButtons() {
716
+ return this.grid.exportConfig.map((config) => {
717
+ const { type, label, portrait = true, iconName, } = config;
718
+ const orientation = portrait ? 'portrait' : 'landscape';
719
+ return {
720
+ label,
721
+ iconName,
722
+ name: `${this.grid.name}_export_${type}_${orientation}`,
723
+ component: 'ZdButton',
724
+ flat: true,
725
+ events: {
726
+ click: () => this.grid.getReport(type, portrait),
727
+ },
728
+ };
729
+ });
729
730
  }
730
- updateInternalProperties(datasource = {}) {
731
- if (!this.watchUrl)
732
- return;
733
- this.updateReservedKeys();
734
- super.updateInternalProperties(datasource);
735
- const queryString = URL.getParsedQueryStringFromUrl();
736
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
737
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
731
+ createToolbarProps() {
732
+ return [
733
+ {
734
+ name: `${this.grid.name}_gridTitle`,
735
+ component: 'ZdText',
736
+ cssClass: 'toolbar-title',
737
+ tag: 'h2',
738
+ text: this.grid.title,
739
+ title: this.grid.title,
740
+ },
741
+ {
742
+ name: `${this.grid.name}_spacer`,
743
+ component: 'VSpacer',
744
+ },
745
+ {
746
+ name: `${this.grid.name}_notEditingSpan`,
747
+ component: 'ZdTag',
748
+ tag: 'span',
749
+ cssStyle: 'display: flex',
750
+ isVisible: `{{GridController_${this.grid.componentId}.isNotEditing}}`,
751
+ children: [
752
+ {
753
+ name: `${this.grid.name}_add_tooltip`,
754
+ component: 'ZdTooltip',
755
+ label: 'TEKGRID_ADD',
756
+ bottom: true,
757
+ children: [
758
+ {
759
+ name: `${this.grid.name}_addButton`,
760
+ component: 'ZdButton',
761
+ icon: true,
762
+ iconName: 'add',
763
+ isVisible: `{{GridController_${this.grid.componentId}.showAddButton}}`,
764
+ events: {
765
+ click: this.addButtonClick.bind(this),
766
+ },
767
+ },
768
+ ],
769
+ },
770
+ {
771
+ name: `${this.grid.name}_delete_tooltip`,
772
+ component: 'ZdTooltip',
773
+ label: 'TEKGRID_DELETE',
774
+ bottom: true,
775
+ children: [
776
+ {
777
+ name: `${this.grid.name}_deleteButton`,
778
+ component: 'ZdButton',
779
+ icon: true,
780
+ iconName: 'delete',
781
+ isVisible: `{{GridController_${this.grid.componentId}.showDeleteButton}}`,
782
+ disabled: `{{GridController_${this.grid.componentId}.disableDeleteButton}}`,
783
+ events: {
784
+ click: this.deleteButtonClick.bind(this),
785
+ },
786
+ },
787
+ ],
788
+ },
789
+ {
790
+ name: `${this.grid.name}_divider1`,
791
+ component: 'ZdDivider',
792
+ cssClass: 'toolbar-divider',
793
+ vertical: true,
794
+ isVisible: `{{GridController_${this.grid.componentId}.showFirstDivider}}`,
795
+ },
796
+ {
797
+ name: `${this.grid.name}_refresh_tooltip`,
798
+ component: 'ZdTooltip',
799
+ label: 'TEKGRID_REFRESH',
800
+ bottom: true,
801
+ children: [
802
+ {
803
+ name: `${this.grid.name}_refreshButton`,
804
+ component: 'ZdButton',
805
+ icon: true,
806
+ iconName: 'refresh',
807
+ isVisible: this.grid.showReload,
808
+ events: {
809
+ click: this.reloadGrid.bind(this),
810
+ },
811
+ },
812
+ ],
813
+ },
814
+ {
815
+ name: `${this.grid.name}_divider2`,
816
+ component: 'ZdDivider',
817
+ cssClass: 'toolbar-divider',
818
+ vertical: true,
819
+ isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}`,
820
+ },
821
+ {
822
+ name: `${this.grid.name}_columns_button_tooltip`,
823
+ component: 'ZdTooltip',
824
+ label: 'TEKGRID_COLUMNS',
825
+ bottom: true,
826
+ children: [
827
+ {
828
+ name: `${this.grid.name}_columnsButton`,
829
+ component: 'TekGridColumnsButton',
830
+ isVisible: `{{GridController_${this.grid.componentId}.showColumnsButton}}`,
831
+ iterableComponentName: this.grid.name,
832
+ hideGroups: !(this.grid instanceof TekGrid),
833
+ ignoreColumns: `{{GridController_${this.grid.componentId}.columnsButtonIgnore}}`,
834
+ },
835
+ ],
836
+ },
837
+ {
838
+ name: `${this.grid.name}_layout_options`,
839
+ component: 'TekGridLayoutOptions',
840
+ isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}}`,
841
+ },
842
+ {
843
+ name: `${this.grid.name}_dividerActions`,
844
+ component: 'ZdDivider',
845
+ cssClass: 'toolbar-divider',
846
+ vertical: true,
847
+ isVisible: `{{GridController_${this.grid.componentId}.showActionAndExportButton}}`,
848
+ },
849
+ {
850
+ name: `${this.grid.name}_export_dropdown`,
851
+ component: 'ZdDropdown',
852
+ cssClass: 'tekgrid-actions-dropdown',
853
+ offsetY: true,
854
+ activator: {
855
+ name: `${this.grid.name}_exportButton`,
856
+ component: 'ZdButton',
857
+ icon: true,
858
+ iconName: 'fileDownload',
859
+ isVisible: `{{GridController_${this.grid.componentId}.showExportButton}}`,
860
+ },
861
+ children: this.grid.exportActions || this.exportConfigButtons,
862
+ },
863
+ {
864
+ name: `${this.grid.name}_actions_dropdown`,
865
+ component: 'ZdDropdown',
866
+ cssClass: 'tekgrid-actions-dropdown',
867
+ offsetY: true,
868
+ activator: {
869
+ name: `${this.grid.name}_actionsButton`,
870
+ component: 'ZdButton',
871
+ icon: true,
872
+ iconName: 'more',
873
+ isVisible: `{{GridController_${this.grid.componentId}.showActionsButton}}`,
874
+ },
875
+ children: this.grid.actions,
876
+ },
877
+ {
878
+ name: `${this.grid.name}_divider3`,
879
+ component: 'ZdDivider',
880
+ cssClass: 'toolbar-divider',
881
+ vertical: true,
882
+ },
883
+ ],
884
+ },
885
+ {
886
+ name: `${this.grid.name}_saveButton`,
887
+ component: 'ZdButton',
888
+ label: 'TEKGRID_SAVE',
889
+ isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
890
+ small: true,
891
+ events: {
892
+ click: this.saveChanges.bind(this),
893
+ },
894
+ },
895
+ {
896
+ name: `${this.grid.name}_cancelButton`,
897
+ component: 'ZdButton',
898
+ label: 'TEKGRID_CANCEL',
899
+ outline: true,
900
+ cssClass: 'zd-mx-2',
901
+ isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
902
+ small: true,
903
+ events: {
904
+ click: this.cancelChanges.bind(this),
905
+ },
906
+ },
907
+ {
908
+ name: `${this.grid.name}_gridSearch`,
909
+ component: 'ZdSearch',
910
+ },
911
+ {
912
+ name: `${this.grid.name}_filter_tooltip`,
913
+ component: 'ZdTooltip',
914
+ label: 'TEKGRID_FILTER',
915
+ bottom: true,
916
+ children: [
917
+ {
918
+ name: `${this.grid.name}_filterButton`,
919
+ component: 'ZdButton',
920
+ icon: true,
921
+ iconName: 'filter',
922
+ isVisible: `{{GridController_${this.grid.componentId}.showFilterButton}}`,
923
+ events: {
924
+ click: this.filterClick.bind(this),
925
+ },
926
+ },
927
+ ],
928
+ },
929
+ ];
738
930
  }
739
- getEncodedParam(urlParam, datasourceParam = {}) {
740
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
931
+ addButtonClick({ event }) {
932
+ if (this.grid.events.addClick) {
933
+ this.grid.events.addClick({ component: this, event });
934
+ }
741
935
  }
742
- getQueryStringValues() {
743
- const values = super.getQueryStringValues();
744
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
745
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
936
+ deleteButtonClick({ event }) {
937
+ if (this.grid.events.beforeDelete) {
938
+ this.grid.events.beforeDelete({ component: this, event });
746
939
  }
747
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
748
- values.search_join = btoa(JSON.stringify(this.searchJoin));
940
+ if (!event.defaultPrevented) {
941
+ this.grid.deleteRows();
942
+ if (this.grid.events.afterDelete) {
943
+ this.grid.events.afterDelete({ component: this });
944
+ }
749
945
  }
750
- return values;
751
946
  }
752
- getUrlQueryString() {
753
- const superQueryString = super.getUrlQueryString();
754
- const query = URL.getParsedQueryStringFromUrl();
755
- let dynamicFilterQuerystring = '';
756
- if (query.dynamic_filter) {
757
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
758
- dynamic_filter: query.dynamic_filter,
759
- })}`;
947
+ reloadGrid() {
948
+ this.grid.reload();
949
+ }
950
+ saveChanges({ event }) {
951
+ if (this.grid.events.beforeSave) {
952
+ this.grid.events.beforeSave({ component: this, event });
760
953
  }
761
- let searchJoinQuerystring = '';
762
- if (query.search_join) {
763
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
764
- search_join: query.search_join,
765
- })}`;
954
+ if (!event.defaultPrevented) {
955
+ this.grid.saveEditedRows();
956
+ if (this.grid.events.afterSave) {
957
+ this.grid.events.afterSave({ component: this });
958
+ }
766
959
  }
767
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
768
960
  }
769
- /**
770
- * Adds a new dynamic filter position or replace if exists
771
- * @param column Dynamic Filter column name
772
- * @param value Dynamic Filter value
773
- * @returns Promise with data collection
774
- */
775
- addDynamicFilter(column, value) {
776
- if (this.isValidDynamicFilterValue(column, value)) {
777
- this.dynamicFilter[column] = value;
778
- return this.updateDynamicFilter();
961
+ cancelChanges({ event }) {
962
+ if (this.grid.events.beforeCancel) {
963
+ this.grid.events.beforeCancel({ component: this, event });
964
+ }
965
+ if (!event.defaultPrevented) {
966
+ this.grid.cancelEditedRows();
967
+ if (this.grid.events.afterCancel) {
968
+ this.grid.events.afterCancel({ component: this });
969
+ }
779
970
  }
780
- return this.removeDynamicFilter(column);
781
971
  }
782
- /**
783
- * Removes a dynamic filter position
784
- * @param column Dynamic Filter column name
785
- * @returns Promise with data collection
786
- */
787
- removeDynamicFilter(column) {
788
- delete this.dynamicFilter[column];
789
- return this.updateDynamicFilter();
972
+ filterClick({ event }) {
973
+ if (this.grid.events.filterClick) {
974
+ this.grid.events.filterClick({ event, component: this });
975
+ }
976
+ if (!event.defaultPrevented) {
977
+ this.createFilterFromColumns();
978
+ }
790
979
  }
791
- /**
792
- * Sets new dynamic filter value
793
- * @param filter Dynamic Filter value
794
- * @returns Promise with data collection
795
- */
796
- setDynamicFilter(filter) {
797
- this.dynamicFilter = {};
798
- Object.keys(filter).forEach((column) => {
799
- if (this.isValidDynamicFilterValue(column, filter[column])) {
800
- this.dynamicFilter[column] = filter[column];
801
- }
802
- else {
803
- delete this.dynamicFilter[column];
804
- }
805
- });
806
- return this.updateDynamicFilter();
980
+ createFilterFromColumns() {
981
+ if (!this.filterModal) {
982
+ const filterModalDef = {
983
+ name: `${this.grid.name}-filter-modal`,
984
+ persistent: true,
985
+ children: [
986
+ {
987
+ name: `${this.grid.name}-filter-modal-header`,
988
+ component: 'ZdHeader',
989
+ color: 'transparent',
990
+ padless: true,
991
+ elevation: 0,
992
+ leftSlot: [
993
+ {
994
+ name: `${this.grid.name}-filter-title`,
995
+ component: 'ZdText',
996
+ text: 'FILTER',
997
+ tag: 'h3',
998
+ },
999
+ ],
1000
+ rightSlot: [
1001
+ {
1002
+ name: `${this.grid.name}-filter-close-button`,
1003
+ component: 'ZdModalCloseButton',
1004
+ small: true,
1005
+ modalName: `${this.grid.name}-filter-modal`,
1006
+ },
1007
+ ],
1008
+ },
1009
+ {
1010
+ name: `${this.grid.name}-filter-form`,
1011
+ component: 'ZdForm',
1012
+ cssClass: 'zd-my-4',
1013
+ children: this.getFilterModalComponents(),
1014
+ events: {
1015
+ onMounted: this.loadFilterValues.bind(this),
1016
+ },
1017
+ },
1018
+ {
1019
+ name: `${this.grid.name}-filter-footer`,
1020
+ component: 'ZdFooter',
1021
+ color: 'transparent',
1022
+ padless: true,
1023
+ rightSlot: [
1024
+ {
1025
+ name: `${this.grid.name}-filter-cancelButton`,
1026
+ component: 'ZdButton',
1027
+ label: 'CANCEL',
1028
+ outline: true,
1029
+ events: {
1030
+ click: this.hideFilterModal.bind(this),
1031
+ },
1032
+ },
1033
+ {
1034
+ name: `${this.grid.name}-filter-okButton`,
1035
+ component: 'ZdButton',
1036
+ label: 'OK',
1037
+ events: {
1038
+ click: this.applyFilter.bind(this),
1039
+ },
1040
+ },
1041
+ ],
1042
+ },
1043
+ ],
1044
+ };
1045
+ this.filterModal = ModalService.create(filterModalDef);
1046
+ }
1047
+ this.filterModal.show();
807
1048
  }
808
- /**
809
- * Clears Dynamic filter value
810
- * @returns Promise with data collection
811
- */
812
- clearDynamicFilter() {
813
- this.dynamicFilter = {};
814
- return this.updateDynamicFilter();
1049
+ hideFilterModal() {
1050
+ this.filterModal.hide();
815
1051
  }
816
- /**
817
- * Resets page and selected rows and tries to update the url
818
- * @returns Promise with data collection
819
- */
820
- updateDynamicFilter() {
821
- return __awaiter(this, void 0, void 0, function* () {
822
- this.page = this.firstPage;
823
- this.selectedRows = [];
824
- this.visibleSelectedRows = [];
825
- if (this.watchUrl) {
826
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
827
- URL.updateQueryString({
828
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
829
- });
830
- }
831
- else {
832
- URL.updateQueryString({
833
- dynamic_filter: undefined,
834
- });
835
- }
1052
+ getFilterModalComponents() {
1053
+ const filterColumns = [];
1054
+ let columnComponentName;
1055
+ this.grid.columns.forEach((column) => {
1056
+ const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
1057
+ if (column.filterable && filterProps && filterProps.length > 0) {
1058
+ filterProps.forEach((filterItem, index) => {
1059
+ const { datasource } = this.grid;
1060
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1061
+ const relation = filterItem.relation || 'AND';
1062
+ const operation = filterItem.operation || 'CONTAINS';
1063
+ columnComponentName = `${this.grid.name}-filter-${relation}-${operation}-${column.name}-${index}`;
1064
+ }
1065
+ else {
1066
+ columnComponentName = `${this.grid.name}-filter-AND-CONTAINS-${column.name}-${index}`;
1067
+ }
1068
+ let newColumnComponent = Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: columnComponentName });
1069
+ if (filterItem.helperOptions) {
1070
+ newColumnComponent = this.getHelperValueComponent(newColumnComponent, filterItem.helperOptions, column);
1071
+ }
1072
+ filterColumns.push(newColumnComponent);
1073
+ });
836
1074
  }
837
- return this.get();
838
1075
  });
1076
+ return filterColumns;
839
1077
  }
840
- /**
841
- * Checks if a filter value is valid
842
- * @param value Filter value
843
- * @returns Is valid filter value
844
- */
845
- isValidDynamicFilterValue(column, value) {
846
- return !this.reservedKeys[column]
847
- && value
848
- && value.length > 0
849
- && value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation]
850
- && this.dynamicFilterRelations[filterValue.relation]
851
- && filterValue.value !== '' && filterValue.value !== null);
1078
+ getHelperValueComponent(component, helperValues, column) {
1079
+ return {
1080
+ name: `${component.name}_helperspan`,
1081
+ component: 'ZdTag',
1082
+ tag: 'span',
1083
+ cssClass: 'zd-display-flex',
1084
+ grid: component.grid,
1085
+ children: [
1086
+ Object.assign(Object.assign({}, component), { persistentHint: true, events: {
1087
+ onMounted: this.registerFilterComponentToForm.bind(this),
1088
+ change: this.clearFilterHelperValue.bind(this, column),
1089
+ } }),
1090
+ {
1091
+ name: `${component.name}_helperdropdown`,
1092
+ component: 'ZdDropdown',
1093
+ offsetY: true,
1094
+ activator: {
1095
+ name: `${component.name}_helperbutton`,
1096
+ component: 'ZdButton',
1097
+ iconName: 'magnify',
1098
+ icon: true,
1099
+ small: true,
1100
+ cssClass: `filter-helper-values-button ${component.showLabel !== false ? 'with-label' : ''}`,
1101
+ },
1102
+ children: this.createHelperValueOptions(component, helperValues, column),
1103
+ },
1104
+ ],
1105
+ };
852
1106
  }
853
- /**
854
- * Retrieves request params
855
- */
856
- getRequestParams() {
857
- const requestParams = super.getRequestParams();
858
- const isNotEmptyObj = (obj) => !!(obj && Object.keys(obj).length);
859
- const isValid = this.dynamicFilter && Object.keys(this.dynamicFilter).every((column) => {
860
- const value = this.dynamicFilter[column];
861
- return value && value.length > 0 && this.isValidDynamicFilterValue(column, value);
862
- });
863
- if (isNotEmptyObj(this.dynamicFilter) && isValid) {
864
- requestParams.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
865
- }
866
- if (isNotEmptyObj(this.searchJoin)) {
867
- requestParams.search_join = btoa(JSON.stringify(this.searchJoin));
868
- }
869
- return requestParams;
1107
+ createHelperValueOptions(component, helperValues, column) {
1108
+ return helperValues.map((value) => ({
1109
+ name: `${component.name}_helpervalue_${value}`,
1110
+ component: 'ZdText',
1111
+ cssClass: 'filter-helper-values-option',
1112
+ text: TekFilterHelper.getLabel(value),
1113
+ events: {
1114
+ click: this.helperValuesOptionClick.bind(this, component, value, column),
1115
+ },
1116
+ }));
870
1117
  }
871
- clone() {
872
- return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-rest' });
1118
+ helperValuesOptionClick(component, helperValue, column) {
1119
+ const value = TekFilterHelper.getValue(helperValue, column);
1120
+ const componentObject = Metadata.getInstance(component.name);
1121
+ componentObject.value = value;
1122
+ componentObject.hint = TekFilterHelper.getLabel(helperValue);
1123
+ this.setFilterPropsHelperValue(column, component.name, helperValue);
873
1124
  }
874
- }
875
- DatasourceFactory.register('tek-rest', TekRestDatasource);
876
-
877
- class TekMemoryDatasource extends MemoryDatasource {
878
- /**
879
- * Create new datasource
880
- * @param props Datasource properties
881
- */
882
- constructor(props) {
883
- super(props);
884
- /**
885
- * Dynamic Filter Operations
886
- */
887
- this.dynamicFilterOperations = DynamicFilterOperations;
888
- /**
889
- * Dynamic Filter Relations
890
- */
891
- this.dynamicFilterRelations = DynamicFilterRelations;
892
- /**
893
- * Dynamic Filter applied flag
894
- */
895
- this.dynamicFilterApplied = '';
896
- if (!this.watchUrl) {
897
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
898
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1125
+ setFilterPropsHelperValue(column, componentName, helperValue) {
1126
+ if (!Array.isArray(column.filterProps)) {
1127
+ column.filterProps.helperValue = helperValue;
1128
+ }
1129
+ else {
1130
+ column.filterProps.forEach((prop) => {
1131
+ const relationAndOperationAndName = componentName.split(`${this.grid.name}-filter-`)[1];
1132
+ const [relation, operation] = relationAndOperationAndName.split('-');
1133
+ if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
1134
+ prop.helperValue = helperValue;
1135
+ }
1136
+ });
899
1137
  }
900
- this.createAccessors();
901
- this.get();
902
- }
903
- updateReservedKeys() {
904
- this.reservedKeys.dynamic_filter = true;
905
- this.reservedKeys.search_join = true;
906
- }
907
- updateInternalProperties(datasource = {}) {
908
- if (!this.watchUrl)
909
- return;
910
- this.updateReservedKeys();
911
- super.updateInternalProperties(datasource);
912
- const queryString = URL.getParsedQueryStringFromUrl();
913
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
914
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
915
1138
  }
916
- getEncodedParam(urlParam, datasourceParam = {}) {
917
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
1139
+ registerFilterComponentToForm({ component }) {
1140
+ const form = Metadata.getInstance(`${this.grid.name}-filter-form`);
1141
+ form.registerInput(component);
918
1142
  }
919
- getQueryStringValues() {
920
- const values = super.getQueryStringValues();
921
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
922
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
923
- }
924
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
925
- values.search_join = btoa(JSON.stringify(this.searchJoin));
926
- }
927
- return values;
1143
+ clearFilterHelperValue(column, { component }) {
1144
+ this.setFilterPropsHelperValue(column, component.name, '');
1145
+ component.hint = '';
928
1146
  }
929
- getUrlQueryString() {
930
- const superQueryString = super.getUrlQueryString();
931
- const query = URL.getParsedQueryStringFromUrl();
932
- let dynamicFilterQuerystring = '';
933
- if (query.dynamic_filter) {
934
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
935
- dynamic_filter: query.dynamic_filter,
936
- })}`;
937
- }
938
- let searchJoinQuerystring = '';
939
- if (query.search_join) {
940
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
941
- search_join: query.search_join,
942
- })}`;
1147
+ loadFilterValues({ component }) {
1148
+ const { datasource } = this.grid;
1149
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1150
+ const { dynamicFilter } = datasource;
1151
+ Object.keys(dynamicFilter).forEach((column) => {
1152
+ if (dynamicFilter[column] && dynamicFilter[column].length > 0) {
1153
+ dynamicFilter[column].forEach((filterItem, index) => {
1154
+ const relation = filterItem.relation || 'AND';
1155
+ const operation = filterItem.operation || 'CONTAINS';
1156
+ const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
1157
+ component.value[compName] = filterItem.value;
1158
+ let helperValue = '';
1159
+ const columnObj = this.grid.getColumn(column);
1160
+ if (columnObj instanceof TekGridColumn) {
1161
+ const { filterProps } = columnObj;
1162
+ if (!Array.isArray(filterProps)) {
1163
+ helperValue = filterProps.helperValue || '';
1164
+ }
1165
+ else {
1166
+ filterProps.forEach((prop) => {
1167
+ if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
1168
+ helperValue = prop.helperValue || '';
1169
+ }
1170
+ });
1171
+ }
1172
+ const inputObj = Metadata.getInstances(compName);
1173
+ if (helperValue && inputObj.length && inputObj[0]) {
1174
+ inputObj[0].hint = TekFilterHelper.getLabel(helperValue);
1175
+ }
1176
+ }
1177
+ });
1178
+ }
1179
+ });
943
1180
  }
944
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
945
- }
946
- /**
947
- * Adds a new dynamic filter position or replace if exists
948
- * @param column Dynamic Filter column name
949
- * @param value Dynamic Filter value
950
- * @returns Promise with data collection
951
- */
952
- addDynamicFilter(column, value) {
953
- if (this.isValidDynamicFilterValue(column, value)) {
954
- this.dynamicFilter[column] = value;
955
- return this.updateDynamicFilter();
1181
+ else {
1182
+ const { filter } = datasource;
1183
+ Object.keys(filter).forEach((item) => {
1184
+ if (filter[item]) {
1185
+ component.value[`${this.grid.name}-filter-AND-CONTAINS-${item}-0`] = filter[item];
1186
+ }
1187
+ });
956
1188
  }
957
- return this.removeDynamicFilter(column);
958
- }
959
- /**
960
- * Removes a dynamic filter position
961
- * @param column Dynamic Filter column name
962
- * @returns Promise with data collection
963
- */
964
- removeDynamicFilter(column) {
965
- delete this.dynamicFilter[column];
966
- return this.updateDynamicFilter();
967
1189
  }
968
- /**
969
- * Sets new dynamic filter value
970
- * @param filter Dynamic Filter value
971
- * @returns Promise with data collection
972
- */
973
- setDynamicFilter(filter) {
974
- this.dynamicFilter = {};
975
- Object.keys(filter).forEach((column) => {
976
- if (this.isValidDynamicFilterValue(column, filter[column])) {
977
- this.dynamicFilter[column] = filter[column];
1190
+ applyFilter({ event }) {
1191
+ const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
1192
+ if (filterForm.validate()) {
1193
+ const { datasource } = this.grid;
1194
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1195
+ const dynamicFilter = {};
1196
+ Object.keys(filterForm.value).forEach((item) => {
1197
+ if (filterForm.value[item] && !(Array.isArray(filterForm.value[item]) && !filterForm.value[item].length)) {
1198
+ const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
1199
+ const [relation, operation] = relationAndOperationAndName.split('-');
1200
+ let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
1201
+ columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
1202
+ if (!dynamicFilter[columnName]) {
1203
+ dynamicFilter[columnName] = [];
1204
+ }
1205
+ const value = filterForm.value[item];
1206
+ dynamicFilter[columnName].push({
1207
+ relation,
1208
+ operation,
1209
+ value,
1210
+ });
1211
+ }
1212
+ });
1213
+ datasource.dynamicFilter = dynamicFilter;
978
1214
  }
979
1215
  else {
980
- delete this.dynamicFilter[column];
1216
+ Object.keys(filterForm.value).forEach((item) => {
1217
+ let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
1218
+ columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
1219
+ if (filterForm.value[item]) {
1220
+ datasource.filter[columnName] = filterForm.value[item];
1221
+ }
1222
+ else {
1223
+ delete datasource.filter[columnName];
1224
+ }
1225
+ });
981
1226
  }
982
- });
983
- return this.updateDynamicFilter();
984
- }
985
- /**
986
- * Clears Dynamic filter value
987
- * @returns Promise with data collection
988
- */
989
- clearDynamicFilter() {
990
- this.dynamicFilter = {};
991
- return this.updateDynamicFilter();
992
- }
993
- /**
994
- * Resets page and selected rows and tries to update the url
995
- * @returns Promise with data collection
996
- */
997
- updateDynamicFilter() {
998
- return __awaiter(this, void 0, void 0, function* () {
999
- this.page = this.firstPage;
1000
- this.selectedRows = [];
1001
- this.visibleSelectedRows = [];
1002
- if (this.watchUrl) {
1003
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1004
- URL.updateQueryString({
1005
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
1006
- });
1007
- }
1008
- else {
1009
- URL.updateQueryString({
1010
- dynamic_filter: undefined,
1011
- });
1012
- }
1227
+ if (this.grid.events.beforeApplyFilter) {
1228
+ this.grid.events.beforeApplyFilter({ event, component: this });
1013
1229
  }
1014
- return this.get();
1015
- });
1016
- }
1017
- /**
1018
- * Checks if a filter value is valid
1019
- * @param value Filter value
1020
- * @returns Is valid filter value
1021
- */
1022
- isValidDynamicFilterValue(column, value) {
1023
- return !this.reservedKeys[column]
1024
- && value
1025
- && value.length > 0
1026
- && value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation]
1027
- && this.dynamicFilterRelations[filterValue.relation]
1028
- && filterValue.value !== '' && filterValue.value !== null);
1029
- }
1030
- clone() {
1031
- return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-memory' });
1032
- }
1033
- /**
1034
- * Updates filtered data
1035
- */
1036
- updateFilteredData() {
1037
- super.updateFilteredData();
1038
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1039
- this.filteredData = this.filteredData.filter((row) => this.getRowByDynamicFilter(row));
1040
- }
1041
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
1042
- this.filteredData = this.filteredData.filter((row) => this.getRowBySearchJoin(row));
1230
+ if (!event.defaultPrevented) {
1231
+ datasource.get();
1232
+ this.filterModal.hide();
1233
+ }
1234
+ this.grid.changeLayout(event);
1043
1235
  }
1044
1236
  }
1045
- getRowByDynamicFilter(row) {
1046
- let filtered;
1047
- Object.keys(this.dynamicFilter).forEach((key) => {
1048
- const filterItems = this.dynamicFilter[key];
1049
- filterItems.forEach((item) => {
1050
- if (filtered === false && item.relation === 'AND')
1051
- return;
1052
- if (filtered === true && item.relation === 'OR')
1053
- return;
1054
- const columnValue = normalize(row[key].toString());
1055
- const value = normalize(item.value.toString());
1056
- let range;
1057
- switch (item.operation) {
1058
- case 'CONTAINS':
1059
- filtered = columnValue.indexOf(value) !== -1;
1060
- break;
1061
- case 'NOT_CONTAINS':
1062
- filtered = columnValue.indexOf(value) === -1;
1063
- break;
1064
- case 'EQUALS':
1065
- filtered = columnValue === value;
1066
- break;
1067
- case 'NOT_EQUALS':
1068
- filtered = columnValue !== value;
1069
- break;
1070
- case 'GREATER_THAN':
1071
- filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
1072
- break;
1073
- case 'LESS_THAN':
1074
- filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
1075
- break;
1076
- case 'GREATER_THAN_EQUALS':
1077
- filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
1078
- break;
1079
- case 'LESS_THAN_EQUALS':
1080
- filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
1081
- break;
1082
- case 'IN':
1083
- filtered = value.split(';').includes(columnValue);
1084
- break;
1085
- case 'NOT_IN':
1086
- filtered = !value.split(';').includes(columnValue);
1087
- break;
1088
- case 'BETWEEN':
1089
- range = value.split(';');
1090
- filtered = (Number(columnValue) || columnValue) >= (Number(range[0]) || range[0])
1091
- && (Number(columnValue) || columnValue) <= (Number(range[1]) || range[1]);
1092
- break;
1093
- }
1094
- });
1237
+ getFilterRelationsDatasource() {
1238
+ return DatasourceFactory.factory({
1239
+ data: this.getFilterOptionsData('relations'),
1240
+ loadAll: true,
1241
+ translate: ['text'],
1095
1242
  });
1096
- return filtered;
1097
1243
  }
1098
- getRowBySearchJoin(row) {
1099
- return Object.keys(this.searchJoin).some((key) => this.searchJoin[key].includes(row[key]));
1244
+ getFilterOperationsDatasource() {
1245
+ return DatasourceFactory.factory({
1246
+ data: this.getFilterOptionsData('operations'),
1247
+ loadAll: true,
1248
+ translate: ['text'],
1249
+ });
1100
1250
  }
1101
- }
1102
- DatasourceFactory.register('tek-memory', TekMemoryDatasource);
1103
-
1104
- /**
1105
- * Base class for TekGrid column
1106
- */
1107
- class TekGridColumn extends GridColumnEditable {
1108
- /* istanbul ignore next */
1109
- /**
1110
- * Creates a new TekGrid Column.
1111
- * @param props TekGrid column properties
1112
- */
1113
- constructor(props, grid) {
1114
- super(props);
1115
- /* filter component props */
1116
- this.filterProps = [];
1117
- /* column can be use to filter */
1118
- this.filterable = true;
1119
- /* column is fixed */
1120
- this.fixed = false;
1121
- /* column is grouped */
1122
- this.groupedValue = false;
1123
- /* Value to show when grouped value is empty */
1124
- this.groupLabelForEmptyValue = '';
1125
- /* column is visible */
1126
- this.isVisibleValue = true;
1127
- /**
1128
- * Defines if the column should store the componentProps datasource.data in memory
1129
- */
1130
- this.storeData = true;
1131
- this.lookup = debounce((lookupColumn) => __awaiter(this, void 0, void 0, function* () {
1132
- var _a, _b;
1133
- let data = [];
1134
- if (this.storeData) {
1135
- data = yield ((_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.get());
1251
+ getFilterOptionsData(prop) {
1252
+ const { datasource } = this.grid;
1253
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1254
+ let options;
1255
+ if (prop === 'relations') {
1256
+ options = Object.keys(datasource.dynamicFilterRelations);
1136
1257
  }
1137
1258
  else {
1138
- const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
1139
- this.dataToLookup = [];
1140
- data = yield ((_b = this.lookupDatasource) === null || _b === void 0 ? void 0 : _b.addFilter(lookupColumn, dataToLookup));
1259
+ options = Object.keys(datasource.dynamicFilterOperations);
1141
1260
  }
1142
- data.forEach((row) => {
1143
- this.lookupData[row[lookupColumn]] = row;
1144
- });
1145
- this.lookupDataCount += 1;
1146
- }), 100);
1147
- this.grid = grid;
1148
- this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
1149
- this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
1150
- this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
1151
- this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
1152
- this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
1153
- this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
1154
- this.aggregation = this.getInitValue('aggregation', props.aggregation, this.aggregation);
1155
- this.groupLabelForEmptyValue = this.getInitValue('groupLabelForEmptyValue', props.groupLabelForEmptyValue, this.groupLabelForEmptyValue);
1156
- this.storeData = this.getInitValue('storeData', props.storeData, this.storeData);
1157
- this.createAccessors();
1158
- }
1159
- getLookupData(lookupColumn, value) {
1160
- const emptyRow = {};
1161
- if (this.lookupData[value]) {
1162
- return this.lookupData[value];
1163
- }
1164
- this.lookupData[value] = emptyRow;
1165
- const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
1166
- if (dataIndex !== -1) {
1167
- this.lookupData[value] = this.lookupDatasource.data[dataIndex];
1168
- return this.lookupData[value];
1261
+ return options.map((item) => ({
1262
+ text: `TEKGRID_${item}`,
1263
+ value: item,
1264
+ }));
1169
1265
  }
1170
- this.dataToLookup = (this.dataToLookup || []);
1171
- this.dataToLookup.push(value);
1172
- this.lookup(lookupColumn);
1173
- return emptyRow;
1266
+ return [];
1174
1267
  }
1175
- /**
1176
- * Memory search, without changing lookupDatasource
1177
- */
1178
- memorySearch(search) {
1268
+ setSearch(search) {
1179
1269
  return __awaiter(this, void 0, void 0, function* () {
1180
- if (!this.lookupDatasource) {
1181
- throw new Error('Can\'t search in a column that doesn\'t have a datasource');
1182
- }
1183
- let { data } = this.lookupDatasource;
1184
- if (this.storeData) {
1185
- if (!data.length) {
1186
- data = yield this.lookupDatasource.get();
1187
- }
1188
- }
1189
- else {
1190
- // datasource without the lookup filters
1191
- const defaultDs = DatasourceFactory.factory(Object.assign(Object.assign({}, this.componentProps.datasource), { lazyLoad: true, loadAll: true }));
1192
- data = yield defaultDs.get();
1270
+ const { datasource } = this.grid;
1271
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1272
+ const lookupColumns = this.grid.columns.filter((column) => !!column.componentProps.datasource);
1273
+ const searchJoin = {};
1274
+ if (search) {
1275
+ const promises = lookupColumns.map((column) => __awaiter(this, void 0, void 0, function* () {
1276
+ const searchData = yield column.memorySearch(search);
1277
+ const lookupId = column.componentProps.datasource.uniqueKey;
1278
+ searchJoin[column.name] = searchData.map((row) => row[lookupId]);
1279
+ }));
1280
+ yield Promise.all(promises);
1281
+ }
1282
+ datasource.searchJoin = searchJoin;
1193
1283
  }
1194
- const { dataText } = this.componentProps;
1195
- const searchIn = Array.isArray(dataText) ? dataText : [dataText];
1196
- // get datasource as memory
1197
- const datasource = DatasourceFactory.factory({
1198
- searchIn,
1199
- data,
1200
- type: 'memory',
1201
- loadAll: true,
1202
- });
1203
1284
  return datasource.setSearch(search);
1204
1285
  });
1205
1286
  }
1206
- get grouped() {
1207
- return this.groupedValue;
1208
- }
1209
- set grouped(value) {
1210
- const changed = value !== this.groupedValue;
1211
- this.groupedValue = value;
1212
- if (changed) {
1213
- this.changeGrouping();
1214
- }
1215
- }
1216
- get aggregation() {
1217
- return this.aggregationValue;
1218
- }
1219
- set aggregation(value) {
1220
- const changed = value !== this.aggregationValue;
1221
- this.aggregationValue = value;
1222
- if (changed) {
1223
- this.changeGrouping();
1224
- }
1225
- }
1226
- get isVisible() {
1227
- return this.isVisibleValue && !this.grouped;
1228
- }
1229
- set isVisible(value) {
1230
- this.isVisibleValue = value;
1231
- }
1232
- changeGrouping() {
1233
- // wait for grid.constructor to be fully executed
1234
- setTimeout(() => {
1235
- this.grid.updateGrouping();
1236
- });
1237
- }
1238
- }
1287
+ }
1288
+ Messages.add({
1289
+ 'pt-BR': {
1290
+ translation: {
1291
+ TEKGRID_CONTAINS: 'contém',
1292
+ TEKGRID_NOT_CONTAINS: 'não contém',
1293
+ TEKGRID_EQUALS: igual a',
1294
+ TEKGRID_NOT_EQUALS: 'é diferente de',
1295
+ TEKGRID_GREATER_THAN: 'é maior que',
1296
+ TEKGRID_LESS_THAN: 'é menor que',
1297
+ TEKGRID_GREATER_THAN_EQUALS: maior ou igual a',
1298
+ TEKGRID_LESS_THAN_EQUALS: 'é menor ou igual a',
1299
+ TEKGRID_IN: 'um dos valores',
1300
+ TEKGRID_NOT_IN: 'nenhum dos valores',
1301
+ TEKGRID_BETWEEN: 'está entre',
1302
+ TEKGRID_AND: 'e',
1303
+ TEKGRID_OR: 'ou',
1304
+ TEKGRID_ADD: 'Adicionar',
1305
+ TEKGRID_DELETE: 'Excluir',
1306
+ TEKGRID_REFRESH: 'Atualizar',
1307
+ TEKGRID_COLUMNS: 'Colunas',
1308
+ TEKGRID_SAVE: 'Salvar',
1309
+ TEKGRID_CANCEL: 'Cancelar',
1310
+ TEKGRID_APPLY: 'Aplicar',
1311
+ TEKGRID_FILTER: 'Filtro',
1312
+ TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
1313
+ TEKGRID_EXPORT: 'Exportar',
1314
+ TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
1315
+ TEKGRID_COLUMN_VISIBLE: 'Visível',
1316
+ TEKGRID_COLUMN_GROUPED: 'Grupo',
1317
+ TEKGRID_COLUMN_AGGREGATION: 'Totalização',
1318
+ TEKGRID_COLUMN_LABEL: 'Rótulo',
1319
+ TEKGRID_COLUMN_ALIGNMENT: 'Alinhamento',
1320
+ TEKGRID_COLUMN_GROUP_OPENED: 'Aberto (grupo)',
1321
+ TEKGRID_COLUMN_ORDER: 'Ordem',
1322
+ TEKGRID_COLUMN_ORDER_DIRECTION: 'Direção (ordem)',
1323
+ TEKGRID_AGGREGATION_SUM: 'Soma',
1324
+ TEKGRID_AGGREGATION_AVG: 'Média',
1325
+ TEKGRID_AGGREGATION_MAX: 'Máximo',
1326
+ TEKGRID_AGGREGATION_MIN: 'Mínimo',
1327
+ TEKGRID_AGGREGATION_COUNT: 'Contador',
1328
+ TEKGRID_MORE_OPTIONS: 'Mais opções',
1329
+ TEKGRID_COLUMNS_OPTIONS: 'Configuração de colunas',
1330
+ TEKGRID_CLOSE: 'Fechar',
1331
+ TEKGRID_FIXED_COLUMNS: 'Colunas fixadas',
1332
+ TEKGRID_VISIBLE_COLUMNS: 'Colunas visíveis',
1333
+ TEKGRID_GROUPED_COLUMNS: 'Colunas agrupadas',
1334
+ TEKGRID_ORDER: 'Ordem',
1335
+ TEKGRID_OTHER_COLUMNS: 'Outras colunas',
1336
+ TEKGRID_DROP_COLUMNS: 'Arraste colunas aqui',
1337
+ TEKGRID_DETAILS_FOR: 'Detalhes para:',
1338
+ TEKGRID_LEFT: 'Esquerda',
1339
+ TEKGRID_CENTER: 'Centro',
1340
+ TEKGRID_RIGHT: 'Direita',
1341
+ TEKGRID_ASC: 'Crescente',
1342
+ TEKGRID_DESC: 'Decrescente',
1343
+ TEKGRID_SELECT_COLUMN: '(selecione uma ou mais colunas)',
1344
+ TEKGRID_SELECT_ALL: 'Selecionar todas',
1345
+ TEKGRID_HELPERVALUE_TODAY: 'Hoje',
1346
+ TEKGRID_HELPERVALUE_TOMORROW: 'Amanhã',
1347
+ TEKGRID_HELPERVALUE_YESTERDAY: 'Ontem',
1348
+ TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 Dias',
1349
+ TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 Dias',
1350
+ TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana Atual',
1351
+ TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mês Atual',
1352
+ TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Ano Atual',
1353
+ TEKGRID_WITH_GROUPS: '(Com grupos)',
1354
+ TEKGRID_WITHOUT_GROUPS: '(Sem grupos)',
1355
+ TEKGRID_GRID_MIRROR: '(Espelho do grid)',
1356
+ },
1357
+ },
1358
+ 'en-US': {
1359
+ translation: {
1360
+ TEKGRID_CONTAINS: 'contains',
1361
+ TEKGRID_NOT_CONTAINS: 'does not contain',
1362
+ TEKGRID_EQUALS: 'is equal to',
1363
+ TEKGRID_NOT_EQUALS: 'is differente from',
1364
+ TEKGRID_GREATER_THAN: 'is greater than',
1365
+ TEKGRID_LESS_THAN: 'is less than',
1366
+ TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
1367
+ TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
1368
+ TEKGRID_IN: 'is in',
1369
+ TEKGRID_NOT_IN: 'is not in',
1370
+ TEKGRID_BETWEEN: 'is between',
1371
+ TEKGRID_AND: 'and',
1372
+ TEKGRID_OR: 'or',
1373
+ TEKGRID_ADD: 'Add',
1374
+ TEKGRID_DELETE: 'Delete',
1375
+ TEKGRID_REFRESH: 'Refresh',
1376
+ TEKGRID_COLUMNS: 'Columns',
1377
+ TEKGRID_SAVE: 'Save',
1378
+ TEKGRID_CANCEL: 'Cancel',
1379
+ TEKGRID_APPLY: 'Apply',
1380
+ TEKGRID_FILTER: 'Filter',
1381
+ TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
1382
+ TEKGRID_EXPORT: 'Export',
1383
+ TEKGRID_EXPORT_AS: 'Export as {{ type }}',
1384
+ TEKGRID_COLUMN_VISIBLE: 'Visible',
1385
+ TEKGRID_COLUMN_GROUPED: 'Grouped',
1386
+ TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
1387
+ TEKGRID_COLUMN_LABEL: 'Label',
1388
+ TEKGRID_COLUMN_ALIGNMENT: 'Alignment',
1389
+ TEKGRID_COLUMN_GROUP_OPENED: 'Opened (group)',
1390
+ TEKGRID_COLUMN_ORDER: 'Order',
1391
+ TEKGRID_COLUMN_ORDER_DIRECTION: 'Direction (order)',
1392
+ TEKGRID_AGGREGATION_SUM: 'Sum',
1393
+ TEKGRID_AGGREGATION_AVG: 'Average',
1394
+ TEKGRID_AGGREGATION_MAX: 'Maximum',
1395
+ TEKGRID_AGGREGATION_MIN: 'Minimum',
1396
+ TEKGRID_AGGREGATION_COUNT: 'Count',
1397
+ TEKGRID_MORE_OPTIONS: 'More options',
1398
+ TEKGRID_COLUMNS_OPTIONS: 'Columns configuration',
1399
+ TEKGRID_CLOSE: 'Close',
1400
+ TEKGRID_FIXED_COLUMNS: 'Fixed columns',
1401
+ TEKGRID_VISIBLE_COLUMNS: 'Visible columns',
1402
+ TEKGRID_GROUPED_COLUMNS: 'Grouped columns',
1403
+ TEKGRID_ORDER: 'Order',
1404
+ TEKGRID_OTHER_COLUMNS: 'Other columns',
1405
+ TEKGRID_DROP_COLUMNS: 'Drop columns here',
1406
+ TEKGRID_DETAILS_FOR: 'Details for:',
1407
+ TEKGRID_LEFT: 'Left',
1408
+ TEKGRID_CENTER: 'Center',
1409
+ TEKGRID_RIGHT: 'Right',
1410
+ TEKGRID_ASC: 'Ascending',
1411
+ TEKGRID_DESC: 'Descending',
1412
+ TEKGRID_SELECT_COLUMN: '(select one or more columns)',
1413
+ TEKGRID_SELECT_ALL: 'Select all',
1414
+ TEKGRID_HELPERVALUE_TODAY: 'Today',
1415
+ TEKGRID_HELPERVALUE_TOMORROW: 'Tomorrow',
1416
+ TEKGRID_HELPERVALUE_YESTERDAY: 'Yesterday',
1417
+ TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Last 7 Days',
1418
+ TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Next 7 Days',
1419
+ TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Current Week',
1420
+ TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Current Month',
1421
+ TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Current Year',
1422
+ TEKGRID_WITH_GROUPS: '(With groups)',
1423
+ TEKGRID_WITHOUT_GROUPS: '(No groups)',
1424
+ TEKGRID_GRID_MIRROR: '(Grid mirror)',
1425
+ },
1426
+ },
1427
+ 'es-ES': {
1428
+ translation: {
1429
+ TEKGRID_CONTAINS: 'contiene',
1430
+ TEKGRID_NOT_CONTAINS: 'no contiene',
1431
+ TEKGRID_EQUALS: 'igual',
1432
+ TEKGRID_NOT_EQUALS: 'es diferente de',
1433
+ TEKGRID_GREATER_THAN: 'es mayor que',
1434
+ TEKGRID_LESS_THAN: 'es menor que',
1435
+ TEKGRID_GREATER_THAN_EQUALS: 'es mayor o igual que',
1436
+ TEKGRID_LESS_THAN_EQUALS: 'es menor o igual que',
1437
+ TEKGRID_IN: 'uno de los valores',
1438
+ TEKGRID_NOT_IN: 'ninguno de los valores',
1439
+ TEKGRID_BETWEEN: 'está entre',
1440
+ TEKGRID_AND: 'e',
1441
+ TEKGRID_OR: 'o',
1442
+ TEKGRID_ADD: 'Añadir',
1443
+ TEKGRID_DELETE: 'Eliminar',
1444
+ TEKGRID_REFRESH: 'Actualizar',
1445
+ TEKGRID_COLUMNS: 'Colunas',
1446
+ TEKGRID_SAVE: 'Guardar',
1447
+ TEKGRID_CANCEL: 'Cancelar',
1448
+ TEKGRID_APPLY: 'Aplicar',
1449
+ TEKGRID_FILTER: 'Filtro',
1450
+ TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
1451
+ TEKGRID_EXPORT: 'Exportar',
1452
+ TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
1453
+ TEKGRID_COLUMN_VISIBLE: 'Visible',
1454
+ TEKGRID_COLUMN_GROUPED: 'Grupo',
1455
+ TEKGRID_COLUMN_AGGREGATION: 'Totalización',
1456
+ TEKGRID_COLUMN_LABEL: 'Etiqueta',
1457
+ TEKGRID_COLUMN_ALIGNMENT: 'alineación',
1458
+ TEKGRID_COLUMN_GROUP_OPENED: 'Abierto (grupo)',
1459
+ TEKGRID_COLUMN_ORDER: 'Orden',
1460
+ TEKGRID_COLUMN_ORDER_DIRECTION: 'Dirección (orden)',
1461
+ TEKGRID_AGGREGATION_SUM: 'Suma',
1462
+ TEKGRID_AGGREGATION_AVG: 'Media',
1463
+ TEKGRID_AGGREGATION_MAX: 'Máximo',
1464
+ TEKGRID_AGGREGATION_MIN: 'Mínimo',
1465
+ TEKGRID_AGGREGATION_COUNT: 'Contar',
1466
+ TEKGRID_MORE_OPTIONS: 'Mas opciones',
1467
+ TEKGRID_COLUMNS_OPTIONS: 'Configuración de columna',
1468
+ TEKGRID_CLOSE: 'Cerrar',
1469
+ TEKGRID_FIXED_COLUMNS: 'Columnas fijas',
1470
+ TEKGRID_VISIBLE_COLUMNS: 'Columnas visibles',
1471
+ TEKGRID_GROUPED_COLUMNS: 'Columnas agrupadas',
1472
+ TEKGRID_ORDER: 'Orden',
1473
+ TEKGRID_OTHER_COLUMNS: 'Otras columnas',
1474
+ TEKGRID_DROP_COLUMNS: 'Arrastra columnas aquí',
1475
+ TEKGRID_DETAILS_FOR: 'Detalles para',
1476
+ TEKGRID_LEFT: 'Izquierda',
1477
+ TEKGRID_CENTER: 'Centro',
1478
+ TEKGRID_RIGHT: 'Derecha',
1479
+ TEKGRID_ASC: 'Creciente',
1480
+ TEKGRID_DESC: 'Decreciente',
1481
+ TEKGRID_SELECT_COLUMN: '(seleccione una o más columnas)',
1482
+ TEKGRID_SELECT_ALL: 'Seleccionar todas',
1483
+ TEKGRID_HELPERVALUE_TODAY: 'Hoy',
1484
+ TEKGRID_HELPERVALUE_TOMORROW: 'Mañana',
1485
+ TEKGRID_HELPERVALUE_YESTERDAY: 'Ayer',
1486
+ TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 días',
1487
+ TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 días',
1488
+ TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana actual',
1489
+ TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mes actual',
1490
+ TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Año actual',
1491
+ TEKGRID_WITH_GROUPS: '(Con grupos)',
1492
+ TEKGRID_WITHOUT_GROUPS: '(No grupos)',
1493
+ TEKGRID_GRID_MIRROR: '(Espejo de grid)',
1494
+ },
1495
+ },
1496
+ });
1239
1497
 
1240
- class TekGridController {
1498
+ class GridController {
1241
1499
  constructor(grid) {
1242
1500
  this.grid = grid;
1243
1501
  }
@@ -1286,572 +1544,713 @@ class TekGridController {
1286
1544
  }
1287
1545
  }
1288
1546
 
1289
- /* TekGrid Class */
1290
- class TekGrid extends GridEditable {
1547
+ const DynamicFilterOperations = {
1548
+ CONTAINS: true,
1549
+ NOT_CONTAINS: true,
1550
+ EQUALS: true,
1551
+ NOT_EQUALS: true,
1552
+ GREATER_THAN: true,
1553
+ LESS_THAN: true,
1554
+ GREATER_THAN_EQUALS: true,
1555
+ LESS_THAN_EQUALS: true,
1556
+ IN: true,
1557
+ NOT_IN: true,
1558
+ BETWEEN: true,
1559
+ };
1560
+ const DynamicFilterRelations = {
1561
+ AND: true,
1562
+ OR: true,
1563
+ };
1564
+
1565
+ class TekRestDatasource extends RestDatasource {
1291
1566
  /**
1292
- * TekGrid class constructor
1293
- * @param props TekGrid properties
1294
- */
1567
+ * Create new datasource
1568
+ * @param props Datasource properties
1569
+ */
1295
1570
  constructor(props) {
1296
- var _a;
1297
- super(Object.assign(Object.assign({}, props), { datasource: Object.assign(Object.assign({}, props.datasource), { lazyLoad: true }) }));
1298
- /* Grid Title */
1299
- this.title = '';
1300
- /* Show Add button */
1301
- this.addButton = false;
1302
- /* Show Delete button */
1303
- this.deleteButton = 'none';
1304
- /* Show Delete button */
1305
- this.actions = [];
1306
- /* Show Filter button */
1307
- this.filterButton = false;
1308
- /* Show Column Filter button */
1309
- this.columnFilterButton = false;
1310
- /* Show Columns button */
1311
- this.columnsButton = false;
1312
- /* Columns to be ignored on columns button */
1313
- this.columnsButtonIgnore = [];
1314
- /**
1315
- * Enables column dragging
1316
- * @public
1317
- */
1318
- this.dragColumns = true;
1319
- /**
1320
- * Enables column resizing
1321
- * @public
1322
- */
1323
- this.resizeColumns = true;
1324
- /**
1325
- * Enables layout saving
1326
- * @public
1327
- */
1328
- this.showLayoutOptions = true;
1329
- /**
1330
- * Show export button
1331
- */
1332
- this.showExport = false;
1333
- /**
1334
- * Show refresh button
1335
- */
1336
- this.showReload = true;
1571
+ super(Object.assign(Object.assign({}, props), { lazyLoad: true }));
1337
1572
  /**
1338
- * Export config
1573
+ * Dynamic Filter Operations
1339
1574
  */
1340
- this.exportConfig = [
1341
- {
1342
- type: 'pdf',
1343
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
1344
- },
1345
- {
1346
- type: 'xls',
1347
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'XLS' }),
1348
- },
1349
- {
1350
- type: 'csv',
1351
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
1352
- },
1353
- ];
1354
- this.exportConfigButtons = [];
1575
+ this.dynamicFilterOperations = DynamicFilterOperations;
1355
1576
  /**
1356
- * Groups should be opened by default after building
1577
+ * Dynamic Filter Relations
1357
1578
  */
1358
- this.groupsOpened = false;
1579
+ this.dynamicFilterRelations = DynamicFilterRelations;
1359
1580
  /**
1360
- * Show Total summary
1581
+ * Dynamic Filter applied flag
1361
1582
  */
1362
- this.showSummaryTotal = true;
1363
- this.groupColumnNames = [];
1364
- this.summaryColumns = [];
1365
- this.groupColumns = [];
1366
- this.groupedData = [];
1367
- this.toolbarSlotProps = false;
1368
- this.filterRelationsDatasource = DatasourceFactory.factory({
1369
- data: this.getFilterOptionsData('relations'),
1370
- loadAll: true,
1371
- translate: ['text'],
1372
- });
1373
- this.filterOperationsDatasource = DatasourceFactory.factory({
1374
- data: this.getFilterOptionsData('operations'),
1375
- loadAll: true,
1376
- translate: ['text'],
1377
- });
1378
- this.groups = [];
1379
- this.summary = {};
1380
- this.updateGrouping = debounce((lazyLoad = false) => {
1381
- this.updateGroupedData(lazyLoad);
1382
- }, 500);
1383
- this.title = this.getInitValue('title', props.title, this.title);
1384
- this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
1385
- this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
1386
- this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
1387
- this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
1388
- this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
1389
- this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
1390
- this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
1391
- this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
1392
- this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
1393
- this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
1394
- this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
1395
- this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
1396
- this.exportActions = props.exportActions || this.exportActions;
1397
- this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
1398
- this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
1399
- this.actions = props.actions || this.actions;
1400
- this.toolbarSlotProps = props.toolbarSlot !== undefined;
1401
- if (this.deleteButton === 'selection') {
1402
- this.selectable = true;
1583
+ this.dynamicFilterApplied = '';
1584
+ if (!this.watchUrl) {
1585
+ this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
1586
+ this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1403
1587
  }
1588
+ this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
1404
1589
  this.createAccessors();
1405
- this.exportConfigButtons = this.getExportConfigButtons();
1406
- this.initGrouping((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.lazyLoad);
1590
+ if (!this.lazyLoad) {
1591
+ this.get();
1592
+ }
1407
1593
  }
1408
- getExportConfigButtons() {
1409
- return this.exportConfig.map((config) => {
1410
- const { type, label, portrait = true, iconName, } = config;
1411
- const orientation = portrait ? 'portrait' : 'landscape';
1412
- return {
1413
- label,
1414
- iconName,
1415
- name: `${this.name}_export_${type}_${orientation}`,
1416
- component: 'ZdButton',
1417
- flat: true,
1418
- events: {
1419
- click: () => this.getReport(type, portrait),
1420
- },
1421
- };
1594
+ updateReservedKeys() {
1595
+ this.reservedKeys.dynamic_filter = true;
1596
+ this.reservedKeys.search_join = true;
1597
+ }
1598
+ updateInternalProperties(datasource = {}) {
1599
+ if (!this.watchUrl)
1600
+ return;
1601
+ this.updateReservedKeys();
1602
+ super.updateInternalProperties(datasource);
1603
+ const queryString = URL.getParsedQueryStringFromUrl();
1604
+ this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
1605
+ this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
1606
+ }
1607
+ getEncodedParam(urlParam, datasourceParam = {}) {
1608
+ return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
1609
+ }
1610
+ getQueryStringValues() {
1611
+ const values = super.getQueryStringValues();
1612
+ if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1613
+ values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
1614
+ }
1615
+ if (this.searchJoin && Object.keys(this.searchJoin).length) {
1616
+ values.search_join = btoa(JSON.stringify(this.searchJoin));
1617
+ }
1618
+ return values;
1619
+ }
1620
+ getUrlQueryString() {
1621
+ const superQueryString = super.getUrlQueryString();
1622
+ const query = URL.getParsedQueryStringFromUrl();
1623
+ let dynamicFilterQuerystring = '';
1624
+ if (query.dynamic_filter) {
1625
+ dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
1626
+ dynamic_filter: query.dynamic_filter,
1627
+ })}`;
1628
+ }
1629
+ let searchJoinQuerystring = '';
1630
+ if (query.search_join) {
1631
+ searchJoinQuerystring = `&${URL.getFormattedQueryString({
1632
+ search_join: query.search_join,
1633
+ })}`;
1634
+ }
1635
+ return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
1636
+ }
1637
+ /**
1638
+ * Adds a new dynamic filter position or replace if exists
1639
+ * @param column Dynamic Filter column name
1640
+ * @param value Dynamic Filter value
1641
+ * @returns Promise with data collection
1642
+ */
1643
+ addDynamicFilter(column, value) {
1644
+ if (this.isValidDynamicFilterValue(column, value)) {
1645
+ this.dynamicFilter[column] = value;
1646
+ return this.updateDynamicFilter();
1647
+ }
1648
+ return this.removeDynamicFilter(column);
1649
+ }
1650
+ /**
1651
+ * Removes a dynamic filter position
1652
+ * @param column Dynamic Filter column name
1653
+ * @returns Promise with data collection
1654
+ */
1655
+ removeDynamicFilter(column) {
1656
+ delete this.dynamicFilter[column];
1657
+ return this.updateDynamicFilter();
1658
+ }
1659
+ /**
1660
+ * Sets new dynamic filter value
1661
+ * @param filter Dynamic Filter value
1662
+ * @returns Promise with data collection
1663
+ */
1664
+ setDynamicFilter(filter) {
1665
+ this.dynamicFilter = {};
1666
+ Object.keys(filter).forEach((column) => {
1667
+ if (this.isValidDynamicFilterValue(column, filter[column])) {
1668
+ this.dynamicFilter[column] = filter[column];
1669
+ }
1670
+ else {
1671
+ delete this.dynamicFilter[column];
1672
+ }
1422
1673
  });
1674
+ return this.updateDynamicFilter();
1423
1675
  }
1424
- onCreated() {
1425
- super.onCreated();
1426
- Loader.addController(`TekGridController_${this.componentId}`, new TekGridController(this));
1427
- if (!this.toolbarSlotProps)
1428
- this.createToolbarProps();
1429
- this.navigationKeyMapping.left = {
1430
- event: this.navigateLeft.bind(this),
1431
- stop: true,
1432
- active: true,
1433
- };
1434
- this.navigationKeyMapping.right = {
1435
- event: this.navigateRight.bind(this),
1436
- stop: true,
1437
- active: true,
1438
- };
1676
+ /**
1677
+ * Clears Dynamic filter value
1678
+ * @returns Promise with data collection
1679
+ */
1680
+ clearDynamicFilter() {
1681
+ this.dynamicFilter = {};
1682
+ return this.updateDynamicFilter();
1439
1683
  }
1440
1684
  /**
1441
- * Get Grid columns objects
1442
- * @param columns Grid columns parameter
1685
+ * Resets page and selected rows and tries to update the url
1686
+ * @returns Promise with data collection
1443
1687
  */
1444
- getColumns(columns) {
1445
- return columns.map((column) => new TekGridColumn(column, this));
1688
+ updateDynamicFilter() {
1689
+ return __awaiter(this, void 0, void 0, function* () {
1690
+ this.page = this.firstPage;
1691
+ this.selectedRows = [];
1692
+ this.visibleSelectedRows = [];
1693
+ if (this.watchUrl) {
1694
+ if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1695
+ URL.updateQueryString({
1696
+ dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
1697
+ });
1698
+ }
1699
+ else {
1700
+ URL.updateQueryString({
1701
+ dynamic_filter: undefined,
1702
+ });
1703
+ }
1704
+ }
1705
+ return this.get();
1706
+ });
1446
1707
  }
1447
- createToolbarProps() {
1448
- this.toolbarSlot = [
1449
- {
1450
- name: `${this.name}_gridTitle`,
1451
- component: 'ZdText',
1452
- cssClass: 'toolbar-title',
1453
- tag: 'h2',
1454
- text: this.title,
1455
- title: this.title,
1456
- },
1457
- {
1458
- name: `${this.name}_spacer`,
1459
- component: 'VSpacer',
1460
- },
1461
- {
1462
- name: `${this.name}_notEditingSpan`,
1463
- component: 'ZdTag',
1464
- tag: 'span',
1465
- cssStyle: 'display: flex',
1466
- isVisible: `{{TekGridController_${this.componentId}.isNotEditing}}`,
1467
- children: [
1468
- {
1469
- name: `${this.name}_add_tooltip`,
1470
- component: 'ZdTooltip',
1471
- label: 'TEKGRID_ADD',
1472
- bottom: true,
1473
- children: [
1474
- {
1475
- name: `${this.name}_addButton`,
1476
- component: 'ZdButton',
1477
- icon: true,
1478
- iconName: 'add',
1479
- isVisible: `{{TekGridController_${this.componentId}.showAddButton}}`,
1480
- events: {
1481
- click: this.addButtonClick.bind(this),
1482
- },
1483
- },
1484
- ],
1485
- },
1486
- {
1487
- name: `${this.name}_delete_tooltip`,
1488
- component: 'ZdTooltip',
1489
- label: 'TEKGRID_DELETE',
1490
- bottom: true,
1491
- children: [
1492
- {
1493
- name: `${this.name}_deleteButton`,
1494
- component: 'ZdButton',
1495
- icon: true,
1496
- iconName: 'delete',
1497
- isVisible: `{{TekGridController_${this.componentId}.showDeleteButton}}`,
1498
- disabled: `{{TekGridController_${this.componentId}.disableDeleteButton}}`,
1499
- events: {
1500
- click: this.deleteButtonClick.bind(this),
1501
- },
1502
- },
1503
- ],
1504
- },
1505
- {
1506
- name: `${this.name}_divider1`,
1507
- component: 'ZdDivider',
1508
- cssClass: 'toolbar-divider',
1509
- vertical: true,
1510
- isVisible: `{{TekGridController_${this.componentId}.showFirstDivider}}`,
1511
- },
1512
- {
1513
- name: `${this.name}_refresh_tooltip`,
1514
- component: 'ZdTooltip',
1515
- label: 'TEKGRID_REFRESH',
1516
- bottom: true,
1517
- children: [
1518
- {
1519
- name: `${this.name}_refreshButton`,
1520
- component: 'ZdButton',
1521
- icon: true,
1522
- iconName: 'refresh',
1523
- isVisible: this.showReload,
1524
- events: {
1525
- click: this.reloadGrid.bind(this),
1526
- },
1527
- },
1528
- ],
1529
- },
1530
- {
1531
- name: `${this.name}_divider2`,
1532
- component: 'ZdDivider',
1533
- cssClass: 'toolbar-divider',
1534
- vertical: true,
1535
- isVisible: `{{TekGridController_${this.componentId}.showLayoutOptions}`,
1536
- },
1537
- {
1538
- name: `${this.name}_columns_button_tooltip`,
1539
- component: 'ZdTooltip',
1540
- label: 'TEKGRID_COLUMNS',
1541
- bottom: true,
1542
- children: [
1543
- {
1544
- name: `${this.name}_columnsButton`,
1545
- component: 'TekGridColumnsButton',
1546
- isVisible: `{{TekGridController_${this.componentId}.showColumnsButton}}`,
1547
- iterableComponentName: this.name,
1548
- ignoreColumns: `{{TekGridController_${this.componentId}.columnsButtonIgnore}}`,
1549
- },
1550
- ],
1551
- },
1552
- {
1553
- name: `${this.name}_layout_options`,
1554
- component: 'TekGridLayoutOptions',
1555
- isVisible: `{{TekGridController_${this.componentId}.showLayoutOptions}}`,
1556
- },
1557
- {
1558
- name: `${this.name}_dividerActions`,
1559
- component: 'ZdDivider',
1560
- cssClass: 'toolbar-divider',
1561
- vertical: true,
1562
- isVisible: `{{TekGridController_${this.componentId}.showActionAndExportButton}}`,
1563
- },
1564
- {
1565
- name: `${this.name}_export_dropdown`,
1566
- component: 'ZdDropdown',
1567
- cssClass: 'tekgrid-actions-dropdown',
1568
- offsetY: true,
1569
- activator: {
1570
- name: `${this.name}_exportButton`,
1571
- component: 'ZdButton',
1572
- icon: true,
1573
- iconName: 'fileDownload',
1574
- isVisible: `{{TekGridController_${this.componentId}.showExportButton}}`,
1575
- },
1576
- children: this.exportActions || this.exportConfigButtons,
1577
- },
1578
- {
1579
- name: `${this.name}_actions_dropdown`,
1580
- component: 'ZdDropdown',
1581
- cssClass: 'tekgrid-actions-dropdown',
1582
- offsetY: true,
1583
- activator: {
1584
- name: `${this.name}_actionsButton`,
1585
- component: 'ZdButton',
1586
- icon: true,
1587
- iconName: 'more',
1588
- isVisible: `{{TekGridController_${this.componentId}.showActionsButton}}`,
1589
- },
1590
- children: this.actions,
1591
- },
1592
- {
1593
- name: `${this.name}_divider3`,
1594
- component: 'ZdDivider',
1595
- cssClass: 'toolbar-divider',
1596
- vertical: true,
1597
- },
1598
- ],
1599
- },
1600
- {
1601
- name: `${this.name}_saveButton`,
1602
- component: 'ZdButton',
1603
- label: 'TEKGRID_SAVE',
1604
- isVisible: `{{TekGridController_${this.componentId}.isEditing}}`,
1605
- small: true,
1606
- events: {
1607
- click: this.saveChanges.bind(this),
1608
- },
1609
- },
1610
- {
1611
- name: `${this.name}_cancelButton`,
1612
- component: 'ZdButton',
1613
- label: 'TEKGRID_CANCEL',
1614
- outline: true,
1615
- cssClass: 'zd-mx-2',
1616
- isVisible: `{{TekGridController_${this.componentId}.isEditing}}`,
1617
- small: true,
1618
- events: {
1619
- click: this.cancelChanges.bind(this),
1620
- },
1621
- },
1622
- {
1623
- name: `${this.name}_gridSearch`,
1624
- component: 'ZdSearch',
1625
- },
1626
- {
1627
- name: `${this.name}_filter_tooltip`,
1628
- component: 'ZdTooltip',
1629
- label: 'TEKGRID_FILTER',
1630
- bottom: true,
1631
- children: [
1632
- {
1633
- name: `${this.name}_filterButton`,
1634
- component: 'ZdButton',
1635
- icon: true,
1636
- iconName: 'filter',
1637
- isVisible: `{{TekGridController_${this.componentId}.showFilterButton}}`,
1638
- events: {
1639
- click: this.filterClick.bind(this),
1640
- },
1641
- },
1642
- ],
1643
- },
1644
- ];
1708
+ /**
1709
+ * Checks if a filter value is valid
1710
+ * @param value Filter value
1711
+ * @returns Is valid filter value
1712
+ */
1713
+ isValidDynamicFilterValue(column, value) {
1714
+ return !this.reservedKeys[column]
1715
+ && value
1716
+ && value.length > 0
1717
+ && value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation]
1718
+ && this.dynamicFilterRelations[filterValue.relation]
1719
+ && filterValue.value !== '' && filterValue.value !== null);
1645
1720
  }
1646
- saveChanges({ event }) {
1647
- if (this.events.beforeSave) {
1648
- this.events.beforeSave({ component: this, event });
1721
+ /**
1722
+ * Retrieves request params
1723
+ */
1724
+ getRequestParams() {
1725
+ const requestParams = super.getRequestParams();
1726
+ const isNotEmptyObj = (obj) => !!(obj && Object.keys(obj).length);
1727
+ const isValid = this.dynamicFilter && Object.keys(this.dynamicFilter).every((column) => {
1728
+ const value = this.dynamicFilter[column];
1729
+ return value && value.length > 0 && this.isValidDynamicFilterValue(column, value);
1730
+ });
1731
+ if (isNotEmptyObj(this.dynamicFilter) && isValid) {
1732
+ requestParams.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
1649
1733
  }
1650
- if (!event.defaultPrevented) {
1651
- this.saveEditedRows();
1652
- if (this.events.afterSave) {
1653
- this.events.afterSave({ component: this });
1734
+ if (isNotEmptyObj(this.searchJoin)) {
1735
+ requestParams.search_join = btoa(JSON.stringify(this.searchJoin));
1736
+ }
1737
+ return requestParams;
1738
+ }
1739
+ clone() {
1740
+ return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-rest' });
1741
+ }
1742
+ }
1743
+ DatasourceFactory.register('tek-rest', TekRestDatasource);
1744
+
1745
+ class TekMemoryDatasource extends MemoryDatasource {
1746
+ /**
1747
+ * Create new datasource
1748
+ * @param props Datasource properties
1749
+ */
1750
+ constructor(props) {
1751
+ super(props);
1752
+ /**
1753
+ * Dynamic Filter Operations
1754
+ */
1755
+ this.dynamicFilterOperations = DynamicFilterOperations;
1756
+ /**
1757
+ * Dynamic Filter Relations
1758
+ */
1759
+ this.dynamicFilterRelations = DynamicFilterRelations;
1760
+ /**
1761
+ * Dynamic Filter applied flag
1762
+ */
1763
+ this.dynamicFilterApplied = '';
1764
+ if (!this.watchUrl) {
1765
+ this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
1766
+ this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1767
+ }
1768
+ this.createAccessors();
1769
+ this.get();
1770
+ }
1771
+ updateReservedKeys() {
1772
+ this.reservedKeys.dynamic_filter = true;
1773
+ this.reservedKeys.search_join = true;
1774
+ }
1775
+ updateInternalProperties(datasource = {}) {
1776
+ if (!this.watchUrl)
1777
+ return;
1778
+ this.updateReservedKeys();
1779
+ super.updateInternalProperties(datasource);
1780
+ const queryString = URL.getParsedQueryStringFromUrl();
1781
+ this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
1782
+ this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
1783
+ }
1784
+ getEncodedParam(urlParam, datasourceParam = {}) {
1785
+ return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
1786
+ }
1787
+ getQueryStringValues() {
1788
+ const values = super.getQueryStringValues();
1789
+ if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1790
+ values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
1791
+ }
1792
+ if (this.searchJoin && Object.keys(this.searchJoin).length) {
1793
+ values.search_join = btoa(JSON.stringify(this.searchJoin));
1794
+ }
1795
+ return values;
1796
+ }
1797
+ getUrlQueryString() {
1798
+ const superQueryString = super.getUrlQueryString();
1799
+ const query = URL.getParsedQueryStringFromUrl();
1800
+ let dynamicFilterQuerystring = '';
1801
+ if (query.dynamic_filter) {
1802
+ dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
1803
+ dynamic_filter: query.dynamic_filter,
1804
+ })}`;
1805
+ }
1806
+ let searchJoinQuerystring = '';
1807
+ if (query.search_join) {
1808
+ searchJoinQuerystring = `&${URL.getFormattedQueryString({
1809
+ search_join: query.search_join,
1810
+ })}`;
1811
+ }
1812
+ return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
1813
+ }
1814
+ /**
1815
+ * Adds a new dynamic filter position or replace if exists
1816
+ * @param column Dynamic Filter column name
1817
+ * @param value Dynamic Filter value
1818
+ * @returns Promise with data collection
1819
+ */
1820
+ addDynamicFilter(column, value) {
1821
+ if (this.isValidDynamicFilterValue(column, value)) {
1822
+ this.dynamicFilter[column] = value;
1823
+ return this.updateDynamicFilter();
1824
+ }
1825
+ return this.removeDynamicFilter(column);
1826
+ }
1827
+ /**
1828
+ * Removes a dynamic filter position
1829
+ * @param column Dynamic Filter column name
1830
+ * @returns Promise with data collection
1831
+ */
1832
+ removeDynamicFilter(column) {
1833
+ delete this.dynamicFilter[column];
1834
+ return this.updateDynamicFilter();
1835
+ }
1836
+ /**
1837
+ * Sets new dynamic filter value
1838
+ * @param filter Dynamic Filter value
1839
+ * @returns Promise with data collection
1840
+ */
1841
+ setDynamicFilter(filter) {
1842
+ this.dynamicFilter = {};
1843
+ Object.keys(filter).forEach((column) => {
1844
+ if (this.isValidDynamicFilterValue(column, filter[column])) {
1845
+ this.dynamicFilter[column] = filter[column];
1654
1846
  }
1655
- }
1656
- }
1657
- cancelChanges({ event }) {
1658
- if (this.events.beforeCancel) {
1659
- this.events.beforeCancel({ component: this, event });
1660
- }
1661
- if (!event.defaultPrevented) {
1662
- this.cancelEditedRows();
1663
- if (this.events.afterCancel) {
1664
- this.events.afterCancel({ component: this });
1847
+ else {
1848
+ delete this.dynamicFilter[column];
1665
1849
  }
1666
- }
1850
+ });
1851
+ return this.updateDynamicFilter();
1667
1852
  }
1668
- addButtonClick({ event }) {
1669
- if (this.events.addClick) {
1670
- this.events.addClick({ component: this, event });
1671
- }
1853
+ /**
1854
+ * Clears Dynamic filter value
1855
+ * @returns Promise with data collection
1856
+ */
1857
+ clearDynamicFilter() {
1858
+ this.dynamicFilter = {};
1859
+ return this.updateDynamicFilter();
1672
1860
  }
1673
- deleteButtonClick({ event }) {
1674
- if (this.events.beforeDelete) {
1675
- this.events.beforeDelete({ component: this, event });
1676
- }
1677
- if (!event.defaultPrevented) {
1678
- this.deleteRows();
1679
- if (this.events.afterDelete) {
1680
- this.events.afterDelete({ component: this });
1861
+ /**
1862
+ * Resets page and selected rows and tries to update the url
1863
+ * @returns Promise with data collection
1864
+ */
1865
+ updateDynamicFilter() {
1866
+ return __awaiter(this, void 0, void 0, function* () {
1867
+ this.page = this.firstPage;
1868
+ this.selectedRows = [];
1869
+ this.visibleSelectedRows = [];
1870
+ if (this.watchUrl) {
1871
+ if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1872
+ URL.updateQueryString({
1873
+ dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
1874
+ });
1875
+ }
1876
+ else {
1877
+ URL.updateQueryString({
1878
+ dynamic_filter: undefined,
1879
+ });
1880
+ }
1681
1881
  }
1682
- }
1882
+ return this.get();
1883
+ });
1683
1884
  }
1684
- reloadGrid() {
1685
- this.reload();
1885
+ /**
1886
+ * Checks if a filter value is valid
1887
+ * @param value Filter value
1888
+ * @returns Is valid filter value
1889
+ */
1890
+ isValidDynamicFilterValue(column, value) {
1891
+ return !this.reservedKeys[column]
1892
+ && value
1893
+ && value.length > 0
1894
+ && value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation]
1895
+ && this.dynamicFilterRelations[filterValue.relation]
1896
+ && filterValue.value !== '' && filterValue.value !== null);
1686
1897
  }
1687
- filterClick({ event }) {
1688
- if (this.events.filterClick) {
1689
- this.events.filterClick({ event, component: this });
1690
- }
1691
- if (!event.defaultPrevented) {
1692
- this.createFilterFromColumns();
1693
- }
1898
+ clone() {
1899
+ return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-memory' });
1694
1900
  }
1695
- createFilterFromColumns() {
1696
- if (!this.filterModal) {
1697
- const filterModalDef = {
1698
- name: `${this.name}-filter-modal`,
1699
- persistent: true,
1700
- children: [
1701
- {
1702
- name: `${this.name}-filter-modal-header`,
1703
- component: 'ZdHeader',
1704
- color: 'transparent',
1705
- padless: true,
1706
- elevation: 0,
1707
- leftSlot: [
1708
- {
1709
- name: `${this.name}-filter-title`,
1710
- component: 'ZdText',
1711
- text: 'FILTER',
1712
- tag: 'h3',
1713
- },
1714
- ],
1715
- rightSlot: [
1716
- {
1717
- name: `${this.name}-filter-close-button`,
1718
- component: 'ZdModalCloseButton',
1719
- small: true,
1720
- modalName: `${this.name}-filter-modal`,
1721
- },
1722
- ],
1723
- },
1724
- {
1725
- name: `${this.name}-filter-form`,
1726
- component: 'ZdForm',
1727
- cssClass: 'zd-my-4',
1728
- children: this.getFilterModalComponents(),
1729
- events: {
1730
- onMounted: this.loadFilterValues.bind(this),
1731
- },
1732
- },
1733
- {
1734
- name: `${this.name}-filter-footer`,
1735
- component: 'ZdFooter',
1736
- color: 'transparent',
1737
- padless: true,
1738
- rightSlot: [
1739
- {
1740
- name: `${this.name}-filter-cancelButton`,
1741
- component: 'ZdButton',
1742
- label: 'CANCEL',
1743
- outline: true,
1744
- events: {
1745
- click: this.hideFilterModal.bind(this),
1746
- },
1747
- },
1748
- {
1749
- name: `${this.name}-filter-okButton`,
1750
- component: 'ZdButton',
1751
- label: 'OK',
1752
- events: {
1753
- click: this.applyFilter.bind(this),
1754
- },
1755
- },
1756
- ],
1757
- },
1758
- ],
1759
- };
1760
- this.filterModal = ModalService.create(filterModalDef);
1901
+ /**
1902
+ * Updates filtered data
1903
+ */
1904
+ updateFilteredData() {
1905
+ super.updateFilteredData();
1906
+ if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1907
+ this.filteredData = this.filteredData.filter((row) => this.getRowByDynamicFilter(row));
1908
+ }
1909
+ if (this.searchJoin && Object.keys(this.searchJoin).length) {
1910
+ this.filteredData = this.filteredData.filter((row) => this.getRowBySearchJoin(row));
1761
1911
  }
1762
- this.filterModal.show();
1763
- }
1764
- hideFilterModal() {
1765
- this.filterModal.hide();
1766
1912
  }
1767
- getFilterModalComponents() {
1768
- const filterColumns = [];
1769
- this.columns.forEach((column) => {
1770
- const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
1771
- if (column.filterable && filterProps && filterProps.length > 0) {
1772
- filterProps.forEach((filterItem) => {
1773
- if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
1774
- const relation = filterItem.relation || 'AND';
1775
- const operation = filterItem.operation || 'CONTAINS';
1776
- filterColumns.push(Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: `${this.name}-filter-${relation}-${operation}-${column.name}` }));
1913
+ getRowByDynamicFilter(row) {
1914
+ let filtered;
1915
+ Object.keys(this.dynamicFilter).forEach((key) => {
1916
+ const filterItems = this.dynamicFilter[key];
1917
+ filterItems.forEach((item) => {
1918
+ if (filtered === false && item.relation === 'AND')
1919
+ return;
1920
+ if (filtered === true && item.relation === 'OR')
1921
+ return;
1922
+ const columnValue = normalize(row[key].toString());
1923
+ let value = '';
1924
+ if (Array.isArray(item.value)) {
1925
+ value = item.value.map((val) => normalize(val.toString()));
1926
+ switch (item.operation) {
1927
+ case 'IN':
1928
+ filtered = value.includes(columnValue);
1929
+ break;
1930
+ case 'NOT_IN':
1931
+ filtered = !value.includes(columnValue);
1932
+ break;
1933
+ case 'BETWEEN':
1934
+ filtered = (Number(columnValue) || columnValue) >= (Number(value[0]) || value[0])
1935
+ && (Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
1936
+ break;
1777
1937
  }
1778
- else {
1779
- filterColumns.push(Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: `${this.name}-filter-AND-CONTAINS-${column.name}` }));
1938
+ }
1939
+ else {
1940
+ value = normalize(item.value.toString());
1941
+ switch (item.operation) {
1942
+ case 'CONTAINS':
1943
+ filtered = columnValue.indexOf(value) !== -1;
1944
+ break;
1945
+ case 'NOT_CONTAINS':
1946
+ filtered = columnValue.indexOf(value) === -1;
1947
+ break;
1948
+ case 'EQUALS':
1949
+ filtered = columnValue === value;
1950
+ break;
1951
+ case 'NOT_EQUALS':
1952
+ filtered = columnValue !== value;
1953
+ break;
1954
+ case 'GREATER_THAN':
1955
+ filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
1956
+ break;
1957
+ case 'LESS_THAN':
1958
+ filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
1959
+ break;
1960
+ case 'GREATER_THAN_EQUALS':
1961
+ filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
1962
+ break;
1963
+ case 'LESS_THAN_EQUALS':
1964
+ filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
1965
+ break;
1780
1966
  }
1781
- });
1967
+ }
1968
+ });
1969
+ });
1970
+ return filtered;
1971
+ }
1972
+ getRowBySearchJoin(row) {
1973
+ return Object.keys(this.searchJoin).some((key) => this.searchJoin[key].includes(row[key]));
1974
+ }
1975
+ }
1976
+ DatasourceFactory.register('tek-memory', TekMemoryDatasource);
1977
+
1978
+ /**
1979
+ * Base class for TekGrid column
1980
+ */
1981
+ class TekGridColumn extends GridColumnEditable {
1982
+ /* istanbul ignore next */
1983
+ /**
1984
+ * Creates a new TekGrid Column.
1985
+ * @param props TekGrid column properties
1986
+ */
1987
+ constructor(props, grid) {
1988
+ super(props);
1989
+ /* filter component props */
1990
+ this.filterProps = [];
1991
+ /* column can be use to filter */
1992
+ this.filterable = true;
1993
+ /* column is fixed */
1994
+ this.fixed = false;
1995
+ /* column is grouped */
1996
+ this.groupedValue = false;
1997
+ /* Value to show when grouped value is empty */
1998
+ this.groupLabelForEmptyValue = '';
1999
+ /* column is visible */
2000
+ this.isVisibleValue = true;
2001
+ /**
2002
+ * Defines if the column should store the componentProps datasource.data in memory
2003
+ */
2004
+ this.storeData = true;
2005
+ this.lookup = debounce((lookupColumn) => __awaiter(this, void 0, void 0, function* () {
2006
+ var _a, _b;
2007
+ let data = [];
2008
+ if (this.storeData) {
2009
+ data = yield ((_a = this.lookupDatasource) === null || _a === void 0 ? void 0 : _a.get());
2010
+ }
2011
+ else {
2012
+ const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
2013
+ this.dataToLookup = [];
2014
+ data = yield ((_b = this.lookupDatasource) === null || _b === void 0 ? void 0 : _b.addFilter(lookupColumn, dataToLookup));
2015
+ }
2016
+ data.forEach((row) => {
2017
+ this.lookupData[row[lookupColumn]] = row;
2018
+ });
2019
+ this.lookupDataCount += 1;
2020
+ }), 100);
2021
+ this.grid = grid;
2022
+ this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
2023
+ this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
2024
+ this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
2025
+ this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
2026
+ this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
2027
+ this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
2028
+ this.aggregation = this.getInitValue('aggregation', props.aggregation, this.aggregation);
2029
+ this.groupLabelForEmptyValue = this.getInitValue('groupLabelForEmptyValue', props.groupLabelForEmptyValue, this.groupLabelForEmptyValue);
2030
+ this.storeData = this.getInitValue('storeData', props.storeData, this.storeData);
2031
+ this.createAccessors();
2032
+ }
2033
+ getLookupData(lookupColumn, value) {
2034
+ const emptyRow = {};
2035
+ if (this.lookupData[value]) {
2036
+ return this.lookupData[value];
2037
+ }
2038
+ this.lookupData[value] = emptyRow;
2039
+ const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
2040
+ if (dataIndex !== -1) {
2041
+ this.lookupData[value] = this.lookupDatasource.data[dataIndex];
2042
+ return this.lookupData[value];
2043
+ }
2044
+ this.dataToLookup = (this.dataToLookup || []);
2045
+ this.dataToLookup.push(value);
2046
+ this.lookup(lookupColumn);
2047
+ return emptyRow;
2048
+ }
2049
+ /**
2050
+ * Memory search, without changing lookupDatasource
2051
+ */
2052
+ memorySearch(search) {
2053
+ return __awaiter(this, void 0, void 0, function* () {
2054
+ if (!this.lookupDatasource) {
2055
+ throw new Error('Can\'t search in a column that doesn\'t have a datasource');
2056
+ }
2057
+ let { data } = this.lookupDatasource;
2058
+ if (this.storeData) {
2059
+ if (!data.length) {
2060
+ data = yield this.lookupDatasource.get();
2061
+ }
2062
+ }
2063
+ else {
2064
+ // datasource without the lookup filters
2065
+ const defaultDs = DatasourceFactory.factory(Object.assign(Object.assign({}, this.componentProps.datasource), { lazyLoad: true, loadAll: true }));
2066
+ data = yield defaultDs.get();
1782
2067
  }
2068
+ const { dataText } = this.componentProps;
2069
+ const searchIn = Array.isArray(dataText) ? dataText : [dataText];
2070
+ // get datasource as memory
2071
+ const datasource = DatasourceFactory.factory({
2072
+ searchIn,
2073
+ data,
2074
+ type: 'memory',
2075
+ loadAll: true,
2076
+ });
2077
+ return datasource.setSearch(search);
1783
2078
  });
1784
- return filterColumns;
1785
2079
  }
1786
- loadFilterValues({ component }) {
1787
- if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
1788
- const { dynamicFilter } = this.datasource;
1789
- Object.keys(dynamicFilter).forEach((column) => {
1790
- if (dynamicFilter[column] && dynamicFilter[column].length > 0) {
1791
- dynamicFilter[column].forEach((filterItem) => {
1792
- const relation = filterItem.relation || 'AND';
1793
- const operation = filterItem.operation || 'CONTAINS';
1794
- const compName = `${this.name}-filter-${relation}-${operation}-${column}`;
1795
- component.value[compName] = filterItem.value;
1796
- });
1797
- }
1798
- });
2080
+ get grouped() {
2081
+ return this.groupedValue;
2082
+ }
2083
+ set grouped(value) {
2084
+ const changed = value !== this.groupedValue;
2085
+ this.groupedValue = value;
2086
+ if (changed) {
2087
+ this.changeGrouping();
1799
2088
  }
1800
- else {
1801
- const { filter } = this.datasource;
1802
- Object.keys(filter).forEach((item) => {
1803
- if (filter[item]) {
1804
- component.value[`${this.name}-filter-AND-CONTAINS-${item}`] = filter[item];
1805
- }
1806
- });
2089
+ }
2090
+ get aggregation() {
2091
+ return this.aggregationValue;
2092
+ }
2093
+ set aggregation(value) {
2094
+ const changed = value !== this.aggregationValue;
2095
+ this.aggregationValue = value;
2096
+ if (changed) {
2097
+ this.changeGrouping();
1807
2098
  }
1808
2099
  }
1809
- applyFilter({ event }) {
1810
- const filterForm = Metadata.getInstance(`${this.name}-filter-form`);
1811
- if (filterForm.validate()) {
1812
- if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
1813
- const dynamicFilter = {};
1814
- Object.keys(filterForm.value).forEach((item) => {
1815
- if (filterForm.value[item]) {
1816
- const relationAndOperationAndName = item.split(`${this.name}-filter-`)[1];
1817
- const [relation, operation] = relationAndOperationAndName.split('-');
1818
- const columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
1819
- if (!dynamicFilter[columnName]) {
1820
- dynamicFilter[columnName] = [];
1821
- }
1822
- let value = filterForm.value[item];
1823
- if (['IN', 'NOT_IN', 'BETWEEN'].includes(operation) && !Array.isArray(value)) {
1824
- value = value.split(';').map((valueItem) => valueItem.trim());
1825
- }
1826
- dynamicFilter[columnName].push({
1827
- relation,
1828
- operation,
1829
- value,
1830
- });
1831
- }
1832
- });
1833
- this.datasource.dynamicFilter = dynamicFilter;
1834
- }
1835
- else {
1836
- Object.keys(filterForm.value).forEach((item) => {
1837
- const columnName = item.split(`${this.name}-filter-AND-CONTAINS-`)[1];
1838
- if (filterForm.value[item]) {
1839
- this.datasource.filter[columnName] = filterForm.value[item];
1840
- }
1841
- else {
1842
- delete this.datasource.filter[columnName];
1843
- }
1844
- });
1845
- }
1846
- if (this.events.beforeApplyFilter) {
1847
- this.events.beforeApplyFilter({ event, component: this });
1848
- }
1849
- if (!event.defaultPrevented) {
1850
- this.datasource.get();
1851
- this.filterModal.hide();
1852
- }
1853
- this.changeLayout(event);
2100
+ get isVisible() {
2101
+ return this.isVisibleValue && !this.grouped;
2102
+ }
2103
+ set isVisible(value) {
2104
+ this.isVisibleValue = value;
2105
+ }
2106
+ changeGrouping() {
2107
+ // wait for grid.constructor to be fully executed
2108
+ setTimeout(() => {
2109
+ this.grid.updateGrouping();
2110
+ });
2111
+ }
2112
+ }
2113
+
2114
+ /* TekGrid Class */
2115
+ class TekGrid extends GridEditable {
2116
+ /**
2117
+ * TekGrid class constructor
2118
+ * @param props TekGrid properties
2119
+ */
2120
+ constructor(props) {
2121
+ var _a;
2122
+ super(Object.assign(Object.assign({}, props), { datasource: Object.assign(Object.assign({}, props.datasource), { lazyLoad: true }) }));
2123
+ /* Grid Title */
2124
+ this.title = '';
2125
+ /* Show Add button */
2126
+ this.addButton = false;
2127
+ /* Show Delete button */
2128
+ this.deleteButton = 'none';
2129
+ /* Show Delete button */
2130
+ this.actions = [];
2131
+ /* Show Filter button */
2132
+ this.filterButton = false;
2133
+ /* Show Column Filter button */
2134
+ this.columnFilterButton = false;
2135
+ /* Show Columns button */
2136
+ this.columnsButton = false;
2137
+ /* Columns to be ignored on columns button */
2138
+ this.columnsButtonIgnore = [];
2139
+ /**
2140
+ * Enables column dragging
2141
+ * @public
2142
+ */
2143
+ this.dragColumns = true;
2144
+ /**
2145
+ * Enables column resizing
2146
+ * @public
2147
+ */
2148
+ this.resizeColumns = true;
2149
+ /**
2150
+ * Enables layout saving
2151
+ * @public
2152
+ */
2153
+ this.showLayoutOptions = true;
2154
+ /**
2155
+ * Show export button
2156
+ */
2157
+ this.showExport = false;
2158
+ /**
2159
+ * Show refresh button
2160
+ */
2161
+ this.showReload = true;
2162
+ /**
2163
+ * Export config
2164
+ */
2165
+ this.exportConfig = [
2166
+ {
2167
+ type: 'pdf',
2168
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
2169
+ },
2170
+ {
2171
+ type: 'xls',
2172
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: `XLS ${I18n.translate('TEKGRID_WITHOUT_GROUPS')}` }),
2173
+ },
2174
+ {
2175
+ type: 'xls2',
2176
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}` }),
2177
+ },
2178
+ {
2179
+ type: 'xls3',
2180
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}` }),
2181
+ },
2182
+ {
2183
+ type: 'csv',
2184
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
2185
+ },
2186
+ ];
2187
+ /**
2188
+ * Groups should be opened by default after building
2189
+ */
2190
+ this.groupsOpened = false;
2191
+ /**
2192
+ * Show Total summary
2193
+ */
2194
+ this.showSummaryTotal = true;
2195
+ this.groupColumnNames = [];
2196
+ this.summaryColumns = [];
2197
+ this.groupColumns = [];
2198
+ this.groupedData = [];
2199
+ this.toolbarSlotProps = false;
2200
+ this.groups = [];
2201
+ this.summary = {};
2202
+ this.updateGrouping = debounce((lazyLoad = false) => {
2203
+ this.updateGroupedData(lazyLoad);
2204
+ }, 500);
2205
+ this.title = this.getInitValue('title', props.title, this.title);
2206
+ this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2207
+ this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2208
+ this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2209
+ this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2210
+ this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2211
+ this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2212
+ this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2213
+ this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2214
+ this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
2215
+ this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
2216
+ this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
2217
+ this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
2218
+ this.exportActions = props.exportActions || this.exportActions;
2219
+ this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2220
+ this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2221
+ this.actions = props.actions || this.actions;
2222
+ this.toolbarSlotProps = props.toolbarSlot !== undefined;
2223
+ if (this.deleteButton === 'selection') {
2224
+ this.selectable = true;
1854
2225
  }
2226
+ this.gridBase = new GridBase(this);
2227
+ this.filterOperationsDatasource = this.gridBase.getFilterOperationsDatasource();
2228
+ this.filterRelationsDatasource = this.gridBase.getFilterRelationsDatasource();
2229
+ this.createAccessors();
2230
+ this.initGrouping((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.lazyLoad);
2231
+ }
2232
+ onCreated() {
2233
+ super.onCreated();
2234
+ Loader.addController(`GridController_${this.componentId}`, new GridController(this));
2235
+ if (!this.toolbarSlotProps)
2236
+ this.toolbarSlot = this.gridBase.createToolbarProps();
2237
+ this.navigationKeyMapping.left = {
2238
+ event: this.navigateLeft.bind(this),
2239
+ stop: true,
2240
+ active: true,
2241
+ };
2242
+ this.navigationKeyMapping.right = {
2243
+ event: this.navigateRight.bind(this),
2244
+ stop: true,
2245
+ active: true,
2246
+ };
2247
+ }
2248
+ /**
2249
+ * Get Grid columns objects
2250
+ * @param columns Grid columns parameter
2251
+ */
2252
+ getColumns(columns) {
2253
+ return columns.map((column) => new TekGridColumn(column, this));
1855
2254
  }
1856
2255
  columnHasFilterData(column) {
1857
2256
  if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
@@ -1860,22 +2259,6 @@ class TekGrid extends GridEditable {
1860
2259
  }
1861
2260
  return this.datasource.filter[column.name];
1862
2261
  }
1863
- getFilterOptionsData(prop) {
1864
- if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
1865
- let options;
1866
- if (prop === 'relations') {
1867
- options = Object.keys(this.datasource.dynamicFilterRelations);
1868
- }
1869
- else {
1870
- options = Object.keys(this.datasource.dynamicFilterOperations);
1871
- }
1872
- return options.map((item) => ({
1873
- text: `TEKGRID_${item}`,
1874
- value: item,
1875
- }));
1876
- }
1877
- return [];
1878
- }
1879
2262
  buildReportGroups() {
1880
2263
  return this.columns.filter((column) => column.grouped).map((column) => ({
1881
2264
  field: column.name,
@@ -1977,6 +2360,9 @@ class TekGrid extends GridEditable {
1977
2360
  groupBreak = true;
1978
2361
  }
1979
2362
  });
2363
+ this.groups.forEach((group) => {
2364
+ group.lastGroupHeaderRow.children.push(row);
2365
+ });
1980
2366
  this.groupedData.push(Object.assign(Object.assign({}, row), { groupHeaders: this.groups.map((group) => group.lastGroupHeaderRow).filter(Boolean) }));
1981
2367
  this.calcSummary(row);
1982
2368
  });
@@ -2018,6 +2404,7 @@ class TekGrid extends GridEditable {
2018
2404
  groupValue,
2019
2405
  groupOpened: group.column.groupOpened || this.groupsOpened,
2020
2406
  groupHeaders: [],
2407
+ children: [],
2021
2408
  };
2022
2409
  // add header for outer groups to the added row
2023
2410
  for (let i = 0; i < index; i += 1) {
@@ -2138,29 +2525,16 @@ class TekGrid extends GridEditable {
2138
2525
  const groupValue = groupColumn.formatterByRow(row, cellProps);
2139
2526
  return groupValue;
2140
2527
  }
2141
- getEditedRows() {
2142
- return super.getEditedRows().map((row) => {
2143
- const cleanRow = Object.assign({}, row);
2144
- delete cleanRow.groupHeaders;
2145
- return cleanRow;
2146
- });
2147
- }
2148
- setSearch(search) {
2149
- return __awaiter(this, void 0, void 0, function* () {
2150
- if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
2151
- const lookupColumns = this.columns.filter((column) => !!column.componentProps.datasource);
2152
- const searchJoin = {};
2153
- if (search) {
2154
- const promises = lookupColumns.map((column) => __awaiter(this, void 0, void 0, function* () {
2155
- const searchData = yield column.memorySearch(search);
2156
- const lookupId = column.componentProps.datasource.uniqueKey;
2157
- searchJoin[column.name] = searchData.map((row) => row[lookupId]);
2158
- }));
2159
- yield Promise.all(promises);
2160
- }
2161
- this.datasource.searchJoin = searchJoin;
2162
- }
2163
- return this.datasource.setSearch(search);
2528
+ getEditedRows() {
2529
+ return super.getEditedRows().map((row) => {
2530
+ const cleanRow = Object.assign({}, row);
2531
+ delete cleanRow.groupHeaders;
2532
+ return cleanRow;
2533
+ });
2534
+ }
2535
+ setSearch(search) {
2536
+ return __awaiter(this, void 0, void 0, function* () {
2537
+ return this.gridBase.setSearch(search);
2164
2538
  });
2165
2539
  }
2166
2540
  isGrouped() {
@@ -2192,253 +2566,96 @@ class TekGrid extends GridEditable {
2192
2566
  }
2193
2567
  navigateUp(params) {
2194
2568
  if (!this.isGrouped()) {
2195
- super.navigateUp();
2196
- }
2197
- else {
2198
- const { index } = params;
2199
- if (!this.groupedData.length || index === -1)
2200
- return;
2201
- const { uniqueKey, currentRow } = this.datasource;
2202
- let rowIndex;
2203
- rowIndex = index !== undefined ? index : this.groupedData.findIndex((row) => {
2204
- if (currentRow.group) {
2205
- return row.group && row.groupValue === currentRow.groupValue;
2206
- }
2207
- return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
2208
- });
2209
- if (rowIndex === -1)
2210
- rowIndex = this.groupedData.length;
2211
- const newRow = this.groupedData[rowIndex - 1];
2212
- if (newRow && this.isItemVisible(newRow) && !newRow.groupFooter) {
2213
- this.datasource.currentRow = newRow;
2214
- }
2215
- else {
2216
- this.navigateUp({ index: rowIndex - 1 });
2217
- }
2218
- }
2219
- }
2220
- navigateLeft() {
2221
- var _a;
2222
- const { currentRow } = this.datasource;
2223
- if (currentRow.group && currentRow.groupOpened) {
2224
- currentRow.groupOpened = false;
2225
- }
2226
- else if ((_a = currentRow.groupHeaders) === null || _a === void 0 ? void 0 : _a.length) {
2227
- this.datasource.currentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
2228
- }
2229
- }
2230
- navigateRight() {
2231
- const { currentRow } = this.datasource;
2232
- if (currentRow.group && !currentRow.groupOpened) {
2233
- currentRow.groupOpened = true;
2234
- }
2235
- }
2236
- /**
2237
- * Dispatches row click event
2238
- * @param row Grid row
2239
- * @param event DOM event
2240
- * @param element DOM Element
2241
- */
2242
- rowClick(row, event, element) {
2243
- if (!this.preventRowClick) {
2244
- this.datasource.currentRow = row;
2245
- this.callEvent('rowClick', {
2246
- event, element, row, component: this, column: undefined,
2247
- });
2248
- }
2249
- this.preventRowClick = false;
2250
- }
2251
- /**
2252
- * Dispatches group row click event
2253
- * @param row Grid row
2254
- * @param event DOM event
2255
- * @param element DOM Element
2256
- */
2257
- groupRowClick(row, event, element) {
2258
- if (!this.preventRowClick) {
2259
- this.callEvent('groupRowClick', {
2260
- event, element, row, component: this, column: undefined,
2261
- });
2262
- }
2263
- this.preventRowClick = false;
2264
- }
2265
- }
2266
- Messages.add({
2267
- 'pt-BR': {
2268
- translation: {
2269
- TEKGRID_CONTAINS: 'contém',
2270
- TEKGRID_NOT_CONTAINS: 'não contém',
2271
- TEKGRID_EQUALS: 'é igual a',
2272
- TEKGRID_NOT_EQUALS: diferente de',
2273
- TEKGRID_GREATER_THAN: maior que',
2274
- TEKGRID_LESS_THAN: 'é menor que',
2275
- TEKGRID_GREATER_THAN_EQUALS: maior ou igual a',
2276
- TEKGRID_LESS_THAN_EQUALS: 'é menor ou igual a',
2277
- TEKGRID_IN: 'um dos valores',
2278
- TEKGRID_NOT_IN: 'nenhum dos valores',
2279
- TEKGRID_BETWEEN: 'está entre',
2280
- TEKGRID_AND: 'e',
2281
- TEKGRID_OR: 'ou',
2282
- TEKGRID_ADD: 'Adicionar',
2283
- TEKGRID_DELETE: 'Excluir',
2284
- TEKGRID_REFRESH: 'Atualizar',
2285
- TEKGRID_COLUMNS: 'Colunas',
2286
- TEKGRID_SAVE: 'Salvar',
2287
- TEKGRID_CANCEL: 'Cancelar',
2288
- TEKGRID_APPLY: 'Aplicar',
2289
- TEKGRID_FILTER: 'Filtro',
2290
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
2291
- TEKGRID_EXPORT: 'Exportar',
2292
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
2293
- TEKGRID_COLUMN_VISIBLE: 'Visível',
2294
- TEKGRID_COLUMN_GROUPED: 'Grupo',
2295
- TEKGRID_COLUMN_AGGREGATION: 'Totalização',
2296
- TEKGRID_COLUMN_LABEL: 'Rótulo',
2297
- TEKGRID_COLUMN_ALIGNMENT: 'Alinhamento',
2298
- TEKGRID_COLUMN_GROUP_OPENED: 'Aberto (grupo)',
2299
- TEKGRID_COLUMN_ORDER: 'Ordem',
2300
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direção (ordem)',
2301
- TEKGRID_AGGREGATION_SUM: 'Soma',
2302
- TEKGRID_AGGREGATION_AVG: 'Média',
2303
- TEKGRID_AGGREGATION_MAX: 'Máximo',
2304
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
2305
- TEKGRID_AGGREGATION_COUNT: 'Contador',
2306
- TEKGRID_MORE_OPTIONS: 'Mais opções',
2307
- TEKGRID_COLUMNS_OPTIONS: 'Configuração de colunas',
2308
- TEKGRID_CLOSE: 'Fechar',
2309
- TEKGRID_FIXED_COLUMNS: 'Colunas fixadas',
2310
- TEKGRID_VISIBLE_COLUMNS: 'Colunas visíveis',
2311
- TEKGRID_GROUPED_COLUMNS: 'Colunas agrupadas',
2312
- TEKGRID_ORDER: 'Ordem',
2313
- TEKGRID_OTHER_COLUMNS: 'Outras colunas',
2314
- TEKGRID_DROP_COLUMNS: 'Arraste colunas aqui',
2315
- TEKGRID_DETAILS_FOR: 'Detalhes para:',
2316
- TEKGRID_LEFT: 'Esquerda',
2317
- TEKGRID_CENTER: 'Centro',
2318
- TEKGRID_RIGHT: 'Direita',
2319
- TEKGRID_ASC: 'Crescente',
2320
- TEKGRID_DESC: 'Decrescente',
2321
- TEKGRID_SELECT_COLUMN: '(selecione uma ou mais colunas)',
2322
- TEKGRID_SELECT_ALL: 'Selecionar todas',
2323
- },
2324
- },
2325
- 'en-US': {
2326
- translation: {
2327
- TEKGRID_CONTAINS: 'contains',
2328
- TEKGRID_NOT_CONTAINS: 'does not contain',
2329
- TEKGRID_EQUALS: 'is equal to',
2330
- TEKGRID_NOT_EQUALS: 'is differente from',
2331
- TEKGRID_GREATER_THAN: 'is greater than',
2332
- TEKGRID_LESS_THAN: 'is less than',
2333
- TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
2334
- TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
2335
- TEKGRID_IN: 'is in',
2336
- TEKGRID_NOT_IN: 'is not in',
2337
- TEKGRID_BETWEEN: 'is between',
2338
- TEKGRID_AND: 'and',
2339
- TEKGRID_OR: 'or',
2340
- TEKGRID_ADD: 'Add',
2341
- TEKGRID_DELETE: 'Delete',
2342
- TEKGRID_REFRESH: 'Refresh',
2343
- TEKGRID_COLUMNS: 'Columns',
2344
- TEKGRID_SAVE: 'Save',
2345
- TEKGRID_CANCEL: 'Cancel',
2346
- TEKGRID_APPLY: 'Apply',
2347
- TEKGRID_FILTER: 'Filter',
2348
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
2349
- TEKGRID_EXPORT: 'Export',
2350
- TEKGRID_EXPORT_AS: 'Export as {{ type }}',
2351
- TEKGRID_COLUMN_VISIBLE: 'Visible',
2352
- TEKGRID_COLUMN_GROUPED: 'Grouped',
2353
- TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
2354
- TEKGRID_COLUMN_LABEL: 'Label',
2355
- TEKGRID_COLUMN_ALIGNMENT: 'Alignment',
2356
- TEKGRID_COLUMN_GROUP_OPENED: 'Opened (group)',
2357
- TEKGRID_COLUMN_ORDER: 'Order',
2358
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direction (order)',
2359
- TEKGRID_AGGREGATION_SUM: 'Sum',
2360
- TEKGRID_AGGREGATION_AVG: 'Average',
2361
- TEKGRID_AGGREGATION_MAX: 'Maximum',
2362
- TEKGRID_AGGREGATION_MIN: 'Minimum',
2363
- TEKGRID_AGGREGATION_COUNT: 'Count',
2364
- TEKGRID_MORE_OPTIONS: 'More options',
2365
- TEKGRID_COLUMNS_OPTIONS: 'Columns configuration',
2366
- TEKGRID_CLOSE: 'Close',
2367
- TEKGRID_FIXED_COLUMNS: 'Fixed columns',
2368
- TEKGRID_VISIBLE_COLUMNS: 'Visible columns',
2369
- TEKGRID_GROUPED_COLUMNS: 'Grouped columns',
2370
- TEKGRID_ORDER: 'Order',
2371
- TEKGRID_OTHER_COLUMNS: 'Other columns',
2372
- TEKGRID_DROP_COLUMNS: 'Drop columns here',
2373
- TEKGRID_DETAILS_FOR: 'Details for:',
2374
- TEKGRID_LEFT: 'Left',
2375
- TEKGRID_CENTER: 'Center',
2376
- TEKGRID_RIGHT: 'Right',
2377
- TEKGRID_ASC: 'Ascending',
2378
- TEKGRID_DESC: 'Descending',
2379
- TEKGRID_SELECT_COLUMN: '(select one or more columns)',
2380
- TEKGRID_SELECT_ALL: 'Select all',
2381
- },
2382
- },
2383
- 'es-ES': {
2384
- translation: {
2385
- TEKGRID_CONTAINS: 'contiene',
2386
- TEKGRID_NOT_CONTAINS: 'no contiene',
2387
- TEKGRID_EQUALS: 'igual',
2388
- TEKGRID_NOT_EQUALS: 'es diferente de',
2389
- TEKGRID_GREATER_THAN: 'es mayor que',
2390
- TEKGRID_LESS_THAN: 'es menor que',
2391
- TEKGRID_GREATER_THAN_EQUALS: 'es mayor o igual que',
2392
- TEKGRID_LESS_THAN_EQUALS: 'es menor o igual que',
2393
- TEKGRID_IN: 'uno de los valores',
2394
- TEKGRID_NOT_IN: 'ninguno de los valores',
2395
- TEKGRID_BETWEEN: 'está entre',
2396
- TEKGRID_AND: 'e',
2397
- TEKGRID_OR: 'o',
2398
- TEKGRID_ADD: 'Añadir',
2399
- TEKGRID_DELETE: 'Eliminar',
2400
- TEKGRID_REFRESH: 'Actualizar',
2401
- TEKGRID_COLUMNS: 'Colunas',
2402
- TEKGRID_SAVE: 'Guardar',
2403
- TEKGRID_CANCEL: 'Cancelar',
2404
- TEKGRID_APPLY: 'Aplicar',
2405
- TEKGRID_FILTER: 'Filtro',
2406
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
2407
- TEKGRID_EXPORT: 'Exportar',
2408
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
2409
- TEKGRID_COLUMN_VISIBLE: 'Visible',
2410
- TEKGRID_COLUMN_GROUPED: 'Grupo',
2411
- TEKGRID_COLUMN_AGGREGATION: 'Totalización',
2412
- TEKGRID_COLUMN_LABEL: 'Etiqueta',
2413
- TEKGRID_COLUMN_ALIGNMENT: 'alineación',
2414
- TEKGRID_COLUMN_GROUP_OPENED: 'Abierto (grupo)',
2415
- TEKGRID_COLUMN_ORDER: 'Orden',
2416
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Dirección (orden)',
2417
- TEKGRID_AGGREGATION_SUM: 'Suma',
2418
- TEKGRID_AGGREGATION_AVG: 'Media',
2419
- TEKGRID_AGGREGATION_MAX: 'Máximo',
2420
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
2421
- TEKGRID_AGGREGATION_COUNT: 'Contar',
2422
- TEKGRID_MORE_OPTIONS: 'Mas opciones',
2423
- TEKGRID_COLUMNS_OPTIONS: 'Configuración de columna',
2424
- TEKGRID_CLOSE: 'Cerrar',
2425
- TEKGRID_FIXED_COLUMNS: 'Columnas fijas',
2426
- TEKGRID_VISIBLE_COLUMNS: 'Columnas visibles',
2427
- TEKGRID_GROUPED_COLUMNS: 'Columnas agrupadas',
2428
- TEKGRID_ORDER: 'Orden',
2429
- TEKGRID_OTHER_COLUMNS: 'Otras columnas',
2430
- TEKGRID_DROP_COLUMNS: 'Arrastra columnas aquí',
2431
- TEKGRID_DETAILS_FOR: 'Detalles para',
2432
- TEKGRID_LEFT: 'Izquierda',
2433
- TEKGRID_CENTER: 'Centro',
2434
- TEKGRID_RIGHT: 'Derecha',
2435
- TEKGRID_ASC: 'Creciente',
2436
- TEKGRID_DESC: 'Decreciente',
2437
- TEKGRID_SELECT_COLUMN: '(seleccione una o más columnas)',
2438
- TEKGRID_SELECT_ALL: 'Seleccionar todas',
2439
- },
2440
- },
2441
- });
2569
+ super.navigateUp();
2570
+ }
2571
+ else {
2572
+ const { index } = params;
2573
+ if (!this.groupedData.length || index === -1)
2574
+ return;
2575
+ const { uniqueKey, currentRow } = this.datasource;
2576
+ let rowIndex;
2577
+ rowIndex = index !== undefined ? index : this.groupedData.findIndex((row) => {
2578
+ if (currentRow.group) {
2579
+ return row.group && row.groupValue === currentRow.groupValue;
2580
+ }
2581
+ return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
2582
+ });
2583
+ if (rowIndex === -1)
2584
+ rowIndex = this.groupedData.length;
2585
+ const newRow = this.groupedData[rowIndex - 1];
2586
+ if (newRow && this.isItemVisible(newRow) && !newRow.groupFooter) {
2587
+ this.datasource.currentRow = newRow;
2588
+ }
2589
+ else {
2590
+ this.navigateUp({ index: rowIndex - 1 });
2591
+ }
2592
+ }
2593
+ }
2594
+ navigateLeft() {
2595
+ var _a;
2596
+ const { currentRow } = this.datasource;
2597
+ if (currentRow.group && currentRow.groupOpened) {
2598
+ currentRow.groupOpened = false;
2599
+ }
2600
+ else if ((_a = currentRow.groupHeaders) === null || _a === void 0 ? void 0 : _a.length) {
2601
+ this.datasource.currentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
2602
+ }
2603
+ }
2604
+ navigateRight() {
2605
+ const { currentRow } = this.datasource;
2606
+ if (currentRow.group && !currentRow.groupOpened) {
2607
+ currentRow.groupOpened = true;
2608
+ }
2609
+ }
2610
+ /**
2611
+ * Dispatches row click event
2612
+ * @param row Grid row
2613
+ * @param event DOM event
2614
+ * @param element DOM Element
2615
+ */
2616
+ rowClick(row, event, element) {
2617
+ if (!this.preventRowClick) {
2618
+ this.datasource.currentRow = row;
2619
+ this.callEvent('rowClick', {
2620
+ event, element, row, component: this, column: undefined,
2621
+ });
2622
+ }
2623
+ this.preventRowClick = false;
2624
+ }
2625
+ /**
2626
+ * Dispatches group row click event
2627
+ * @param row Grid row
2628
+ * @param event DOM event
2629
+ * @param element DOM Element
2630
+ */
2631
+ groupRowClick(row, event, element) {
2632
+ if (!this.preventRowClick) {
2633
+ this.callEvent('groupRowClick', {
2634
+ event, element, row, component: this, column: undefined,
2635
+ });
2636
+ }
2637
+ this.preventRowClick = false;
2638
+ }
2639
+ /**
2640
+ * Dispatches group select/unselect event
2641
+ * @param row Group row
2642
+ * @param isSelected Row is selected
2643
+ * @param event DOM event
2644
+ * @param element DOM Element
2645
+ */
2646
+ selectGroupClick(row, isSelected, event, element) {
2647
+ if (isSelected) {
2648
+ this.callEvent('groupSelected', {
2649
+ event, element, row, component: this, column: undefined,
2650
+ });
2651
+ }
2652
+ else {
2653
+ this.callEvent('groupUnselected', {
2654
+ event, element, row, component: this, column: undefined,
2655
+ });
2656
+ }
2657
+ }
2658
+ }
2442
2659
 
2443
2660
  class TekGridColumnsButtonController extends IterableColumnsButtonController {
2444
2661
  changeGroupedColumn(column, { component, event, element }) {
@@ -2462,9 +2679,12 @@ class TekGridColumnsButtonController extends IterableColumnsButtonController {
2462
2679
  * Base class for TekGrid Columns Button component
2463
2680
  */
2464
2681
  class TekGridColumnsButton extends IterableColumnsButton {
2465
- constructor() {
2466
- super(...arguments);
2682
+ constructor(props) {
2683
+ super(props);
2684
+ this.hideGroups = false;
2467
2685
  this.aggregationDataSet = [];
2686
+ this.hideGroups = this.getInitValue('hideGroups', props.hideGroups, this.hideGroups);
2687
+ this.createAccessors();
2468
2688
  }
2469
2689
  onCreated() {
2470
2690
  super.onCreated();
@@ -2511,20 +2731,19 @@ class TekGridLayoutOptions extends ComponentRender {
2511
2731
  this.originalDatasourceOrder = [...this.grid.datasource.order];
2512
2732
  this.originalDatasourceDynamicFilter = Object.assign({}, this.grid.datasource.dynamicFilter);
2513
2733
  this.originalDatasourceFilter = Object.assign({}, this.grid.datasource.filter);
2514
- this.originalColumnProps = this.grid.columns.map((column) => {
2515
- const obj = {};
2516
- obj.name = column.name;
2517
- obj.label = column.label;
2518
- obj.align = column.align;
2519
- obj.isVisible = column.isVisible;
2520
- obj.minWidth = column.minWidth;
2521
- obj.maxWidth = column.maxWidth;
2522
- obj.fixed = column.fixed;
2523
- obj.grouped = column.grouped;
2524
- obj.groupOpened = column.groupOpened;
2525
- obj.aggregation = column.aggregation;
2526
- return obj;
2527
- });
2734
+ this.originalColumnProps = this.grid.columns.map((column) => ({
2735
+ name: column.name,
2736
+ label: column.label,
2737
+ align: column.align,
2738
+ isVisible: column.isVisible,
2739
+ minWidth: column.minWidth,
2740
+ maxWidth: column.maxWidth,
2741
+ fixed: column.fixed,
2742
+ grouped: column.grouped,
2743
+ groupOpened: column.groupOpened,
2744
+ aggregation: column.aggregation,
2745
+ filterHelperValue: this.getHelperValue(column),
2746
+ }));
2528
2747
  let layoutsInfo = {};
2529
2748
  const eventFunction = this.events.loadLayouts || this.grid.events.loadLayouts;
2530
2749
  if (eventFunction && typeof eventFunction === 'function') {
@@ -2543,6 +2762,14 @@ class TekGridLayoutOptions extends ComponentRender {
2543
2762
  }
2544
2763
  });
2545
2764
  }
2765
+ getHelperValue(column) {
2766
+ if (column instanceof TekGridColumn) {
2767
+ if (!Array.isArray(column.filterProps))
2768
+ return column.filterProps.helperValue;
2769
+ return column.filterProps.map((prop) => prop.helperValue);
2770
+ }
2771
+ return '';
2772
+ }
2546
2773
  newLayout(newLayout) {
2547
2774
  this.currentLayoutName = newLayout.name;
2548
2775
  this.layouts[this.currentLayoutName] = newLayout;
@@ -2589,6 +2816,240 @@ class TekGridLayoutOptions extends ComponentRender {
2589
2816
  }
2590
2817
  }
2591
2818
 
2819
+ class TekFilterHelper {
2820
+ static formatDate(date, column) {
2821
+ if (column.componentProps.dateFormat) {
2822
+ return dayjs(date).format(column.componentProps.dateFormat);
2823
+ }
2824
+ return dayjs(date).format(Config.dateFormat);
2825
+ }
2826
+ static getLabel(name) {
2827
+ return I18n.translate(this.values[name].label);
2828
+ }
2829
+ static getValue(name, column) {
2830
+ if (!this.values[name])
2831
+ return '';
2832
+ const value = this.values[name].fn();
2833
+ if (Array.isArray(value)) {
2834
+ return value.map((item) => this.formatDate(item, column));
2835
+ }
2836
+ return this.formatDate(value, column);
2837
+ }
2838
+ static register(name, label, fn) {
2839
+ this.values[name] = {
2840
+ label,
2841
+ fn,
2842
+ };
2843
+ }
2844
+ static unregister(name) {
2845
+ delete this.values[name];
2846
+ }
2847
+ }
2848
+ TekFilterHelper.values = {
2849
+ TODAY: {
2850
+ label: 'TEKGRID_HELPERVALUE_TODAY',
2851
+ fn: () => dayjs().toDate(),
2852
+ },
2853
+ TOMORROW: {
2854
+ label: 'TEKGRID_HELPERVALUE_TOMORROW',
2855
+ fn: () => dayjs().add(1, 'day').toDate(),
2856
+ },
2857
+ YESTERDAY: {
2858
+ label: 'TEKGRID_HELPERVALUE_YESTERDAY',
2859
+ fn: () => dayjs().subtract(1, 'day').toDate(),
2860
+ },
2861
+ LAST_7_DAYS: {
2862
+ label: 'TEKGRID_HELPERVALUE_LAST_7_DAYS',
2863
+ fn: () => {
2864
+ const end = dayjs().toDate();
2865
+ const start = dayjs().subtract(7, 'day').toDate();
2866
+ return [start, end];
2867
+ },
2868
+ },
2869
+ NEXT_7_DAYS: {
2870
+ label: 'TEKGRID_HELPERVALUE_NEXT_7_DAYS',
2871
+ fn: () => {
2872
+ const start = dayjs().toDate();
2873
+ const end = dayjs().add(7, 'day').toDate();
2874
+ return [start, end];
2875
+ },
2876
+ },
2877
+ CURRENT_WEEK: {
2878
+ label: 'TEKGRID_HELPERVALUE_CURRENT_WEEK',
2879
+ fn: () => {
2880
+ const start = dayjs().startOf('week').toDate();
2881
+ const end = dayjs().endOf('week').toDate();
2882
+ return [start, end];
2883
+ },
2884
+ },
2885
+ CURRENT_MONTH: {
2886
+ label: 'TEKGRID_HELPERVALUE_CURRENT_MONTH',
2887
+ fn: () => {
2888
+ const start = dayjs().startOf('month').toDate();
2889
+ const end = dayjs().endOf('month').toDate();
2890
+ return [start, end];
2891
+ },
2892
+ },
2893
+ CURRENT_YEAR: {
2894
+ label: 'TEKGRID_HELPERVALUE_CURRENT_YEAR',
2895
+ fn: () => {
2896
+ const start = dayjs().startOf('year').toDate();
2897
+ const end = dayjs().endOf('year').toDate();
2898
+ return [start, end];
2899
+ },
2900
+ },
2901
+ };
2902
+
2903
+ /* TekTreeGrid Class */
2904
+ class TekTreeGrid extends TreeGridEditable {
2905
+ /**
2906
+ * TekTreeGrid class constructor
2907
+ * @param props TekTreeGrid properties
2908
+ */
2909
+ constructor(props) {
2910
+ super(props);
2911
+ /* Grid Title */
2912
+ this.title = '';
2913
+ /* Show Add button */
2914
+ this.addButton = false;
2915
+ /* Show Delete button */
2916
+ this.deleteButton = 'none';
2917
+ /* Show Delete button */
2918
+ this.actions = [];
2919
+ /* Show Filter button */
2920
+ this.filterButton = false;
2921
+ /* Show Column Filter button */
2922
+ this.columnFilterButton = false;
2923
+ /* Show Columns button */
2924
+ this.columnsButton = false;
2925
+ /* Columns to be ignored on columns button */
2926
+ this.columnsButtonIgnore = [];
2927
+ /**
2928
+ * Enables column dragging
2929
+ * @public
2930
+ */
2931
+ this.dragColumns = true;
2932
+ /**
2933
+ * Enables column resizing
2934
+ * @public
2935
+ */
2936
+ this.resizeColumns = true;
2937
+ /**
2938
+ * Enables layout saving
2939
+ * @public
2940
+ */
2941
+ this.showLayoutOptions = true;
2942
+ /**
2943
+ * Show export button
2944
+ */
2945
+ this.showExport = false;
2946
+ /**
2947
+ * Show refresh button
2948
+ */
2949
+ this.showReload = true;
2950
+ /**
2951
+ * Export config
2952
+ */
2953
+ this.exportConfig = [
2954
+ {
2955
+ type: 'pdf',
2956
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
2957
+ },
2958
+ {
2959
+ type: 'xls',
2960
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'XLS' }),
2961
+ },
2962
+ {
2963
+ type: 'csv',
2964
+ label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
2965
+ },
2966
+ ];
2967
+ this.toolbarSlotProps = false;
2968
+ this.title = this.getInitValue('title', props.title, this.title);
2969
+ this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2970
+ this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2971
+ this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2972
+ this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2973
+ this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2974
+ this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2975
+ this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2976
+ this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2977
+ this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
2978
+ this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
2979
+ this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
2980
+ this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
2981
+ this.exportActions = props.exportActions || this.exportActions;
2982
+ this.actions = props.actions || this.actions;
2983
+ this.toolbarSlotProps = props.toolbarSlot !== undefined;
2984
+ if (this.deleteButton === 'selection') {
2985
+ this.selectable = true;
2986
+ }
2987
+ this.gridBase = new GridBase(this);
2988
+ this.filterOperationsDatasource = this.gridBase.getFilterOperationsDatasource();
2989
+ this.filterRelationsDatasource = this.gridBase.getFilterRelationsDatasource();
2990
+ this.createAccessors();
2991
+ }
2992
+ onCreated() {
2993
+ super.onCreated();
2994
+ Loader.addController(`GridController_${this.componentId}`, new GridController(this));
2995
+ if (!this.toolbarSlotProps)
2996
+ this.toolbarSlot = this.gridBase.createToolbarProps();
2997
+ }
2998
+ /**
2999
+ * Get Grid columns objects
3000
+ * @param columns Grid columns parameter
3001
+ */
3002
+ getColumns(columns) {
3003
+ return columns.map((column) => new TekGridColumn(column, this));
3004
+ }
3005
+ columnHasFilterData(column) {
3006
+ if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
3007
+ const dynamicFilter = this.datasource.dynamicFilter[column.name];
3008
+ return dynamicFilter && dynamicFilter.length > 0;
3009
+ }
3010
+ return this.datasource.filter[column.name];
3011
+ }
3012
+ getReport(type, portrait, rowObj = {}) {
3013
+ return __awaiter(this, void 0, void 0, function* () {
3014
+ const report = new Report(this, this.title);
3015
+ const reportGroups = {};
3016
+ const reportAggregations = {};
3017
+ let filter;
3018
+ if (this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource) {
3019
+ const reportFilter = new ReportFilter(this.datasource.dynamicFilter);
3020
+ filter = reportFilter.build();
3021
+ }
3022
+ return report.getReport(type, portrait, {
3023
+ metaData: merge(rowObj, {
3024
+ filter,
3025
+ groups: reportGroups,
3026
+ columns: reportAggregations,
3027
+ }),
3028
+ }).then((reportUrl) => window.open(reportUrl));
3029
+ });
3030
+ }
3031
+ setSearch(search) {
3032
+ return __awaiter(this, void 0, void 0, function* () {
3033
+ return this.gridBase.setSearch(search);
3034
+ });
3035
+ }
3036
+ /**
3037
+ * Dispatches row click event
3038
+ * @param row Grid row
3039
+ * @param event DOM event
3040
+ * @param element DOM Element
3041
+ */
3042
+ rowClick(row, event, element) {
3043
+ if (!this.preventRowClick) {
3044
+ this.datasource.currentRow = row;
3045
+ this.callEvent('rowClick', {
3046
+ event, element, row, component: this, column: undefined,
3047
+ });
3048
+ }
3049
+ this.preventRowClick = false;
3050
+ }
3051
+ }
3052
+
2592
3053
  Messages.add({
2593
3054
  'pt-BR': {
2594
3055
  translation: {
@@ -2637,4 +3098,4 @@ Messages.add({
2637
3098
  },
2638
3099
  });
2639
3100
 
2640
- export { BreadcrumbHeader, CardTitle, CrudAddButton, CrudButton, CrudCancelButton, CrudDeleteButton, CrudForm, CrudSaveButton, DynamicFilterOperations, DynamicFilterRelations, Image, IterableCarousel, IterableComponentRender, Notifications, ProductCard, TekGrid, TekGridColumn, TekGridColumnsButton, TekGridLayoutOptions, TekMemoryDatasource, TekRestDatasource, columnAggregationValues };
3101
+ export { BreadcrumbHeader, CardTitle, CrudAddButton, CrudButton, CrudCancelButton, CrudDeleteButton, CrudForm, CrudSaveButton, DynamicFilterOperations, DynamicFilterRelations, Image, IterableCarousel, IterableComponentRender, Loading, Notifications, ProductCard, TekFilterHelper, TekGrid, TekGridColumn, TekGridColumnsButton, TekGridLayoutOptions, TekMemoryDatasource, TekRestDatasource, TekTreeGrid, columnAggregationValues };