@sankhyalabs/sankhyablocks 9.2.0-dev.2 → 9.2.0-dev.20
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.
- package/dist/cjs/{ConfigStorage-1931defc.js → ConfigStorage-8b6def32.js} +2 -2
- package/dist/cjs/{DataFetcher-ad9fb3bb.js → DataFetcher-2c37b6a1.js} +52 -1
- package/dist/cjs/{ISave-18ffb73e.js → ISave-b22b3cf0.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-65e5288e.js → SnkFormConfigManager-477a27de.js} +2 -2
- package/dist/cjs/{ClientSideExporterProvider-994f6e26.js → SnkMultiSelectionListDataSource-b7ab26ba.js} +82 -79
- package/dist/cjs/{auth-fetcher-afbe69ab.js → auth-fetcher-78a90b36.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-c7253b02.js → dataunit-fetcher-877944a9.js} +1 -1
- package/dist/cjs/filter-validate-6993f6f2.js +30 -0
- package/dist/cjs/{form-config-fetcher-f6e66d64.js → form-config-fetcher-dee08eb4.js} +1 -1
- package/dist/cjs/{index-0ad2baeb.js → index-13d05f03.js} +21 -5
- package/dist/cjs/index-1cf293c1.js +8 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_8.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +6 -9
- package/dist/cjs/snk-attach.cjs.entry.js +7 -7
- package/dist/cjs/snk-crud.cjs.entry.js +7 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-448fce74.js → snk-data-unit-6b0101fe.js} +13 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
- package/dist/cjs/snk-entity-list.cjs.entry.js +10 -3
- package/dist/cjs/snk-expression-group_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +189 -115
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +23 -2
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +20 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +25 -8
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +9 -14
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +16 -3
- package/dist/cjs/snk-filter-number.cjs.entry.js +34 -3
- package/dist/cjs/snk-filter-period.cjs.entry.js +59 -14
- package/dist/cjs/snk-filter-search.cjs.entry.js +14 -3
- package/dist/cjs/snk-filter-text.cjs.entry.js +18 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +31 -5
- package/dist/cjs/snk-grid.cjs.entry.js +158 -66
- package/dist/cjs/{snk-guides-viewer-c23ed218.js → snk-guides-viewer-38277265.js} +6 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -6
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
- package/dist/cjs/snk-simple-bar.cjs.entry.js +5 -5
- package/dist/cjs/snk-simple-crud.cjs.entry.js +60 -23
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-3b74cd21.js → taskbar-elements-fb5d1e08.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +0 -2
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +4 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +173 -28
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +28 -4
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +72 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +73 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +51 -5
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +83 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +118 -27
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +49 -5
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +71 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +62 -11
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +70 -8
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +0 -4
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +112 -16
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +8 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +315 -114
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-filter-bar/utils/filter-validate.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +133 -22
- package/dist/collection/components/snk-grid/snk-grid.js +488 -133
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +83 -21
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -14
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +9 -9
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +414 -119
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +102 -36
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/custom-xhr-override.js +39 -0
- package/dist/collection/lib/message/resources/en-us/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/en-us/snk-grid.msg.js +4 -0
- package/dist/collection/lib/message/resources/es-es/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/es-es/snk-grid.msg.js +4 -0
- package/dist/collection/lib/message/resources/pt-br/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/pt-br/snk-grid.msg.js +4 -0
- package/dist/components/ContinuousInsertUtils.js +4 -1
- package/dist/components/DataFetcher.js +52 -1
- package/dist/components/index2.js +21 -5
- package/dist/components/snk-application2.js +0 -3
- package/dist/components/snk-crud.js +62 -44
- package/dist/components/snk-data-unit2.js +11 -1
- package/dist/components/snk-detail-view2.js +89 -56
- package/dist/components/snk-entity-list.js +11 -3
- package/dist/components/snk-filter-bar2.js +103 -108
- package/dist/components/snk-filter-binary-select.js +27 -3
- package/dist/components/snk-filter-checkbox-list.js +24 -3
- package/dist/components/snk-filter-detail2.js +28 -9
- package/dist/components/snk-filter-item2.js +70 -8
- package/dist/components/snk-filter-modal-item2.js +7 -12
- package/dist/components/snk-filter-modal.js +1 -325
- package/dist/components/snk-filter-modal2.js +391 -0
- package/dist/components/snk-filter-multi-select.js +19 -4
- package/dist/components/snk-filter-number.js +38 -4
- package/dist/components/snk-filter-period.js +64 -16
- package/dist/components/snk-filter-search.js +17 -4
- package/dist/components/snk-filter-text.js +22 -2
- package/dist/components/snk-form.js +29 -2
- package/dist/components/snk-grid2.js +188 -75
- package/dist/components/snk-personalized-filter2.js +10 -2
- package/dist/components/snk-simple-bar2.js +5 -5
- package/dist/components/snk-simple-crud2.js +45 -8
- package/dist/esm/{ConfigStorage-b5a1dba3.js → ConfigStorage-22eace3a.js} +2 -2
- package/dist/esm/{DataFetcher-6f6de657.js → DataFetcher-f6b2961a.js} +52 -1
- package/dist/esm/{ISave-7ecdca20.js → ISave-6b7b0423.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-34fc1dc7.js → SnkFormConfigManager-968b97e7.js} +2 -2
- package/dist/esm/{ClientSideExporterProvider-7c2781f4.js → SnkMultiSelectionListDataSource-1136c4e7.js} +87 -84
- package/dist/esm/{auth-fetcher-7332a9a9.js → auth-fetcher-cf39e42b.js} +1 -1
- package/dist/esm/{dataunit-fetcher-f21cbad0.js → dataunit-fetcher-6314b19d.js} +1 -1
- package/dist/esm/filter-validate-d765d450.js +27 -0
- package/dist/esm/{form-config-fetcher-6ab4e805.js → form-config-fetcher-bc6f0f1f.js} +1 -1
- package/dist/esm/{index-b72af127.js → index-446f9341.js} +21 -5
- package/dist/esm/index-479e1293.js +8 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_8.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +6 -9
- package/dist/esm/snk-attach.entry.js +7 -7
- package/dist/esm/snk-crud.entry.js +7 -7
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-b7e6e7a6.js → snk-data-unit-d4a42b59.js} +13 -3
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-entity-list.entry.js +10 -3
- package/dist/esm/snk-expression-group_2.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +190 -116
- package/dist/esm/snk-filter-binary-select.entry.js +23 -2
- package/dist/esm/snk-filter-checkbox-list.entry.js +20 -2
- package/dist/esm/snk-filter-detail.entry.js +25 -8
- package/dist/esm/snk-filter-modal-item.entry.js +9 -14
- package/dist/esm/snk-filter-multi-select.entry.js +16 -3
- package/dist/esm/snk-filter-number.entry.js +34 -3
- package/dist/esm/snk-filter-period.entry.js +59 -14
- package/dist/esm/snk-filter-search.entry.js +14 -3
- package/dist/esm/snk-filter-text.entry.js +18 -1
- package/dist/esm/snk-form_2.entry.js +31 -5
- package/dist/esm/snk-grid.entry.js +152 -60
- package/dist/esm/{snk-guides-viewer-fbfece85.js → snk-guides-viewer-19cb7f1f.js} +6 -6
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter.entry.js +14 -6
- package/dist/esm/snk-pesquisa.entry.js +4 -4
- package/dist/esm/snk-simple-bar.entry.js +5 -5
- package/dist/esm/snk-simple-crud.entry.js +55 -18
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-171476d4.js → taskbar-elements-faaf5d8f.js} +1 -1
- package/dist/sankhyablocks/{p-0e495575.js → p-0237c565.js} +1 -1
- package/dist/sankhyablocks/p-093f58fa.entry.js +1 -0
- package/dist/sankhyablocks/{p-8d1508aa.entry.js → p-0affc07a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ad2ae575.entry.js → p-0e1f0344.entry.js} +1 -1
- package/dist/sankhyablocks/p-29cacaf3.entry.js +1 -0
- package/dist/sankhyablocks/{p-eb0616d3.entry.js → p-32450ea2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b49281be.entry.js → p-3c29939c.entry.js} +1 -1
- package/dist/sankhyablocks/p-3ed04f0d.entry.js +1 -0
- package/dist/sankhyablocks/{p-4872dc3a.entry.js → p-44c5ec49.entry.js} +1 -1
- package/dist/sankhyablocks/p-49ddc27a.entry.js +1 -0
- package/dist/sankhyablocks/p-4c763b10.entry.js +1 -0
- package/dist/sankhyablocks/p-4eeb06fc.js +1 -0
- package/dist/sankhyablocks/p-505172c8.entry.js +1 -0
- package/dist/sankhyablocks/p-55798617.js +1 -0
- package/dist/sankhyablocks/{p-158adf33.entry.js → p-605ef7b2.entry.js} +1 -1
- package/dist/sankhyablocks/p-658f67a5.js +1 -0
- package/dist/sankhyablocks/p-72a9285d.entry.js +1 -0
- package/dist/sankhyablocks/p-7f7fe6c4.entry.js +1 -0
- package/dist/sankhyablocks/p-88b7bc09.js +1 -0
- package/dist/sankhyablocks/{p-c6331595.js → p-8d256def.js} +1 -1
- package/dist/sankhyablocks/p-8f37b75b.entry.js +1 -0
- package/dist/sankhyablocks/{p-b35574b5.js → p-9062d640.js} +1 -1
- package/dist/sankhyablocks/{p-72c8c847.entry.js → p-95c71f5e.entry.js} +1 -1
- package/dist/sankhyablocks/p-96d45943.entry.js +1 -0
- package/dist/sankhyablocks/{p-eacff4b7.entry.js → p-b2d7f4cd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6a015ba2.js → p-b7f5caf6.js} +1 -1
- package/dist/sankhyablocks/p-b9200e77.entry.js +11 -0
- package/dist/sankhyablocks/{p-7de79adf.js → p-b987e15d.js} +1 -1
- package/dist/sankhyablocks/{p-ba4979b4.js → p-bf017a1f.js} +1 -1
- package/dist/sankhyablocks/{p-735a1175.entry.js → p-c3dbf441.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3dba3468.js → p-c71dcb2d.js} +1 -1
- package/dist/sankhyablocks/{p-5e282b33.entry.js → p-c95f20d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-c98e2085.js +1 -0
- package/dist/sankhyablocks/p-cb4343c4.entry.js +1 -0
- package/dist/sankhyablocks/p-d03ae54e.entry.js +1 -0
- package/dist/sankhyablocks/p-d235314c.entry.js +1 -0
- package/dist/sankhyablocks/p-d75a732c.js +1 -0
- package/dist/sankhyablocks/{p-f39b0ebe.entry.js → p-df7979fd.entry.js} +1 -1
- package/dist/sankhyablocks/p-e258de96.entry.js +1 -0
- package/dist/sankhyablocks/{p-d377aa7a.entry.js → p-f8e87cf1.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +46 -3
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +8 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +12 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +16 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +17 -3
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +10 -2
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +8 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +27 -4
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +17 -3
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +2 -3
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +60 -30
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +4 -2
- package/dist/types/components/snk-filter-bar/utils/filter-validate.d.ts +11 -0
- package/dist/types/components/snk-form/snk-form.d.ts +29 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +132 -58
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +53 -5
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +44 -6
- package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +15 -15
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +100 -43
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +23 -21
- package/dist/types/components.d.ts +771 -255
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/package.json +4 -3
- package/dist/collection/lib/licenses/sankhyalicense.module.js +0 -1
- package/dist/sankhyablocks/p-012208e0.entry.js +0 -1
- package/dist/sankhyablocks/p-07b14811.entry.js +0 -1
- package/dist/sankhyablocks/p-0dac8fef.js +0 -1
- package/dist/sankhyablocks/p-1210500e.js +0 -1
- package/dist/sankhyablocks/p-16fc4acd.js +0 -1
- package/dist/sankhyablocks/p-25209340.entry.js +0 -1
- package/dist/sankhyablocks/p-295b83ae.entry.js +0 -1
- package/dist/sankhyablocks/p-398cdd67.entry.js +0 -1
- package/dist/sankhyablocks/p-4e63ffed.entry.js +0 -1
- package/dist/sankhyablocks/p-5bab470d.entry.js +0 -1
- package/dist/sankhyablocks/p-5c7af8a9.entry.js +0 -1
- package/dist/sankhyablocks/p-81769310.entry.js +0 -11
- package/dist/sankhyablocks/p-9fd87bfd.entry.js +0 -1
- package/dist/sankhyablocks/p-a349689a.js +0 -1
- package/dist/sankhyablocks/p-a76e6d51.entry.js +0 -1
- package/dist/sankhyablocks/p-a86eee47.entry.js +0 -1
- package/dist/sankhyablocks/p-c6a8a8bc.entry.js +0 -1
- package/dist/sankhyablocks/p-c9e6d720.js +0 -1
- package/dist/sankhyablocks/p-dff65083.entry.js +0 -1
- package/dist/sankhyablocks/p-fa18530e.entry.js +0 -1
@@ -3,8 +3,6 @@ ez-modal {
|
|
3
3
|
}
|
4
4
|
|
5
5
|
.snk-filter-modal__container {
|
6
|
-
width: 344px;
|
7
|
-
max-width: 344px;
|
8
6
|
min-width: 344px;
|
9
7
|
overflow: hidden;
|
10
8
|
}
|
@@ -24,8 +22,6 @@ ez-modal {
|
|
24
22
|
|
25
23
|
.snk-filter-modal__rendered-items {
|
26
24
|
max-height: 760px;
|
27
|
-
overflow-x: hidden;
|
28
|
-
overflow-y: auto;
|
29
25
|
}
|
30
26
|
|
31
27
|
.snk-filter-modal__rendered-items::-webkit-scrollbar {
|
@@ -1,18 +1,22 @@
|
|
1
|
-
import {
|
1
|
+
import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
|
2
2
|
import { ModalAction } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
|
3
3
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
|
4
|
+
import { h } from '@stencil/core';
|
5
|
+
import { DefaultFilter } from '../../snk-personalized-filter/interfaces';
|
7
6
|
import { PersonalizedFilterUtils } from '../../snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
|
8
7
|
import { FilterNumberVariation } from '../filter-item/editors/enum/filterNumberVariation';
|
8
|
+
import FilterItemType from '../filter-item/filter-item-type.enum';
|
9
9
|
import { ActionDefaultFilter } from '../types/default-filters';
|
10
|
-
import
|
10
|
+
import FilterType from '../types/filter-type.enum';
|
11
|
+
import { getInvalidFilters } from '../utils/filter-validate';
|
11
12
|
export class SnkFilterModal {
|
12
13
|
constructor() {
|
14
|
+
this.filters = [];
|
15
|
+
this.filtersWithError = [];
|
13
16
|
this.getMessage = undefined;
|
14
17
|
this.configName = undefined;
|
15
|
-
this.
|
18
|
+
this.filterConfig = undefined;
|
19
|
+
this.opened = false;
|
16
20
|
this.applyFilters = undefined;
|
17
21
|
this.closeModal = undefined;
|
18
22
|
this.addPersonalizedFilter = undefined;
|
@@ -21,6 +25,11 @@ export class SnkFilterModal {
|
|
21
25
|
this.filtersToDelete = [];
|
22
26
|
this.filterDefaultToDelete = undefined;
|
23
27
|
this.disablePersonalizedFilter = undefined;
|
28
|
+
this.filterCustomConfigInterceptor = undefined;
|
29
|
+
}
|
30
|
+
filterConfigChangeHandler(newValue) {
|
31
|
+
this.filters = ObjectUtils.copy(newValue);
|
32
|
+
this.validateFilters();
|
24
33
|
}
|
25
34
|
/**
|
26
35
|
* Emitido quando um filtro personalizado é deletado.
|
@@ -79,7 +88,7 @@ export class SnkFilterModal {
|
|
79
88
|
});
|
80
89
|
}
|
81
90
|
hasChangeToSave() {
|
82
|
-
const hasChangesPersonalizedFilters = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this.
|
91
|
+
const hasChangesPersonalizedFilters = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this.filters);
|
83
92
|
return hasChangesPersonalizedFilters;
|
84
93
|
}
|
85
94
|
handleClose() {
|
@@ -94,6 +103,9 @@ export class SnkFilterModal {
|
|
94
103
|
});
|
95
104
|
}
|
96
105
|
handleApplyFilters() {
|
106
|
+
if (!this.validateFilters()) {
|
107
|
+
return;
|
108
|
+
}
|
97
109
|
const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER || filter.filterType === FilterType.DEFAULT_FILTER);
|
98
110
|
if (this.isValidCustomFilter(filterPersonalized)) {
|
99
111
|
this.applyFilters(this.filters);
|
@@ -134,8 +146,14 @@ export class SnkFilterModal {
|
|
134
146
|
break;
|
135
147
|
}
|
136
148
|
}
|
137
|
-
handleFilterChange(
|
138
|
-
|
149
|
+
handleFilterChange(event) {
|
150
|
+
event.stopPropagation();
|
151
|
+
const filterConfig = event.detail;
|
152
|
+
let config = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
|
153
|
+
if (this.filterCustomConfigInterceptor) {
|
154
|
+
config = this.filterCustomConfigInterceptor(config);
|
155
|
+
}
|
156
|
+
this.filters = ObjectUtils.copy(config);
|
139
157
|
}
|
140
158
|
handleClearFilterList(filterList) {
|
141
159
|
this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
@@ -168,8 +186,22 @@ export class SnkFilterModal {
|
|
168
186
|
});
|
169
187
|
return valueList;
|
170
188
|
}
|
189
|
+
validateFilters() {
|
190
|
+
const notValidFilters = getInvalidFilters(this.filters);
|
191
|
+
this.filtersWithError = notValidFilters.map(item => item.id);
|
192
|
+
if (notValidFilters.length === 0) {
|
193
|
+
return true;
|
194
|
+
}
|
195
|
+
notValidFilters.forEach(item => {
|
196
|
+
const filterItem = this._element.querySelector(`#filter-item-${item.id}`);
|
197
|
+
if (filterItem) {
|
198
|
+
filterItem["errorMessage"] = item.requiredMessage || this.getCustomMessage('validations.requiredFilter');
|
199
|
+
}
|
200
|
+
});
|
201
|
+
return false;
|
202
|
+
}
|
171
203
|
renderFilterItem(filterItem, fullRow) {
|
172
|
-
return (h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event
|
204
|
+
return (h("snk-filter-modal-item", { key: `modal-item-${filterItem.id}`, class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
|
173
205
|
}
|
174
206
|
isDefaultFilterNumberVariation(filter) {
|
175
207
|
var _a;
|
@@ -206,8 +238,9 @@ export class SnkFilterModal {
|
|
206
238
|
}
|
207
239
|
getIformedFiltersCount(listItems) {
|
208
240
|
let countInformedItens = 0;
|
209
|
-
listItems.forEach(
|
241
|
+
listItems.forEach(localItem => {
|
210
242
|
var _a, _b, _c, _d, _e, _f;
|
243
|
+
const item = this.filterConfig.find(filter => filter.id === localItem.id);
|
211
244
|
if (FilterItemType.MULTI_LIST === item.type) {
|
212
245
|
countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
|
213
246
|
return;
|
@@ -233,7 +266,8 @@ export class SnkFilterModal {
|
|
233
266
|
return null;
|
234
267
|
const appliedFilters = this.getIformedFiltersCount(listItems);
|
235
268
|
const lines = this.mountFiltersLines(listItems);
|
236
|
-
|
269
|
+
const countFiltersWithError = this.filtersWithError.filter(item => listItems.some(filter => filter.id === item)).length;
|
270
|
+
return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, h("div", { class: "ez-flex ez-flex--justify-end grow", slot: "rightSlot" }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), !!countFiltersWithError && (h("ez-badge", { class: "ez-badge--error-subtle", label: countFiltersWithError === null || countFiltersWithError === void 0 ? void 0 : countFiltersWithError.toString() }))), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: this.getCustomMessage("clearModal"), onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
|
237
271
|
}
|
238
272
|
handleDeleteFilter() {
|
239
273
|
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.info.deleteDefaultFilterConfirm'), "alert-circle-inverted", "critical").then((actionConfirmed) => {
|
@@ -269,6 +303,7 @@ export class SnkFilterModal {
|
|
269
303
|
}
|
270
304
|
componentWillLoad() {
|
271
305
|
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
306
|
+
this.filters = ObjectUtils.copy(this.filterConfig);
|
272
307
|
}
|
273
308
|
componentWillRender() {
|
274
309
|
this._modalTitle = this.getCustomMessage('title');
|
@@ -276,15 +311,14 @@ export class SnkFilterModal {
|
|
276
311
|
this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
|
277
312
|
}
|
278
313
|
componentDidLoad() {
|
279
|
-
|
280
|
-
this._originalFilterConfig = this.filters;
|
314
|
+
this.validateFilters();
|
281
315
|
}
|
282
316
|
render() {
|
283
317
|
this._defaultFilter = this.getDefaultFilter(this.filters);
|
284
318
|
const customFilters = this.getCustomFilter(this.filters);
|
285
319
|
const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
|
286
320
|
const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
|
287
|
-
return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, h("snk-default-filter", { getMessage: this.getCustomMessage.bind(this), hasDefaultFilter: !!this._defaultFilter, onActionSelected: this.handleActionSelectedDefaultFilter.bind(this) }), !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
321
|
+
return (h("ez-modal", { opened: this.opened, modalSize: "col--sd-3", align: "right", heightMode: "full", closeEsc: true }, h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, h("snk-default-filter", { getMessage: this.getCustomMessage.bind(this), hasDefaultFilter: !!this._defaultFilter, onActionSelected: this.handleActionSelectedDefaultFilter.bind(this) }), !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true))))));
|
288
322
|
}
|
289
323
|
static get is() { return "snk-filter-modal"; }
|
290
324
|
static get originalStyleUrls() {
|
@@ -331,7 +365,7 @@ export class SnkFilterModal {
|
|
331
365
|
"attribute": "config-name",
|
332
366
|
"reflect": false
|
333
367
|
},
|
334
|
-
"
|
368
|
+
"filterConfig": {
|
335
369
|
"type": "unknown",
|
336
370
|
"mutable": true,
|
337
371
|
"complexType": {
|
@@ -354,6 +388,24 @@ export class SnkFilterModal {
|
|
354
388
|
"text": "Filtros a serem apresentados"
|
355
389
|
}
|
356
390
|
},
|
391
|
+
"opened": {
|
392
|
+
"type": "boolean",
|
393
|
+
"mutable": false,
|
394
|
+
"complexType": {
|
395
|
+
"original": "boolean",
|
396
|
+
"resolved": "boolean",
|
397
|
+
"references": {}
|
398
|
+
},
|
399
|
+
"required": false,
|
400
|
+
"optional": false,
|
401
|
+
"docs": {
|
402
|
+
"tags": [],
|
403
|
+
"text": "Define se o modal est\u00E1 aberto ou n\u00E3o."
|
404
|
+
},
|
405
|
+
"attribute": "opened",
|
406
|
+
"reflect": false,
|
407
|
+
"defaultValue": "false"
|
408
|
+
},
|
357
409
|
"applyFilters": {
|
358
410
|
"type": "unknown",
|
359
411
|
"mutable": false,
|
@@ -499,9 +551,53 @@ export class SnkFilterModal {
|
|
499
551
|
},
|
500
552
|
"attribute": "disable-personalized-filter",
|
501
553
|
"reflect": false
|
554
|
+
},
|
555
|
+
"filterCustomConfigInterceptor": {
|
556
|
+
"type": "unknown",
|
557
|
+
"mutable": false,
|
558
|
+
"complexType": {
|
559
|
+
"original": "(config: Array<SnkFilterItemConfig>) => Array<SnkFilterItemConfig>",
|
560
|
+
"resolved": "(config: SnkFilterItemConfig[]) => SnkFilterItemConfig[]",
|
561
|
+
"references": {
|
562
|
+
"Array": {
|
563
|
+
"location": "global"
|
564
|
+
},
|
565
|
+
"SnkFilterItemConfig": {
|
566
|
+
"location": "import",
|
567
|
+
"path": "../filter-item/snk-filter-item"
|
568
|
+
}
|
569
|
+
}
|
570
|
+
},
|
571
|
+
"required": false,
|
572
|
+
"optional": true,
|
573
|
+
"docs": {
|
574
|
+
"tags": [{
|
575
|
+
"name": "description",
|
576
|
+
"text": "Intercepta a configura\u00E7\u00E3o dos filtros antes de serem aplicadas."
|
577
|
+
}, {
|
578
|
+
"name": "param",
|
579
|
+
"text": "config - Lista de configura\u00E7\u00F5es de filtros."
|
580
|
+
}, {
|
581
|
+
"name": "returns",
|
582
|
+
"text": "Retorna a lista de configura\u00E7\u00F5es de filtros."
|
583
|
+
}],
|
584
|
+
"text": ""
|
585
|
+
}
|
502
586
|
}
|
503
587
|
};
|
504
588
|
}
|
589
|
+
static get states() {
|
590
|
+
return {
|
591
|
+
"filtersWithError": {}
|
592
|
+
};
|
593
|
+
}
|
594
|
+
static get elementRef() { return "_element"; }
|
595
|
+
static get watchers() {
|
596
|
+
return [{
|
597
|
+
"propName": "filterConfig",
|
598
|
+
"methodName": "filterConfigChangeHandler"
|
599
|
+
}];
|
600
|
+
}
|
505
601
|
static get listeners() {
|
506
602
|
return [{
|
507
603
|
"name": "deleteFilter",
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { h, Host } from '@stencil/core';
|
2
1
|
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
import
|
4
|
-
import { EPresentationMode } from '../../filter-item/editors/enum/presentationMode';
|
2
|
+
import { h, Host } from '@stencil/core';
|
5
3
|
import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
|
4
|
+
import { EPresentationMode } from '../../filter-item/editors/enum/presentationMode';
|
5
|
+
import FilterItemType from '../../filter-item/filter-item-type.enum';
|
6
6
|
import FilterType from '../../types/filter-type.enum';
|
7
7
|
export class SnkFilterModalItem {
|
8
8
|
constructor() {
|
@@ -10,12 +10,6 @@ export class SnkFilterModalItem {
|
|
10
10
|
this.configName = undefined;
|
11
11
|
this.resourceID = undefined;
|
12
12
|
}
|
13
|
-
observeFilterItem(newValue) {
|
14
|
-
var _a, _b;
|
15
|
-
this._editor && (this._editor["config"] = newValue);
|
16
|
-
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
|
17
|
-
this.filterChange.emit(newValue);
|
18
|
-
}
|
19
13
|
getContentEditorConfig() {
|
20
14
|
const props = { presentationMode: EPresentationMode.MODAL };
|
21
15
|
switch (this.filterItem.type) {
|
@@ -50,6 +44,7 @@ export class SnkFilterModalItem {
|
|
50
44
|
return !this.filterItem.visible ? newValue !== undefined : true;
|
51
45
|
}
|
52
46
|
updateFilterValue(data) {
|
47
|
+
var _a, _b;
|
53
48
|
const newValue = (data === null || data === void 0 ? void 0 : data.value) !== undefined ? data.value : data;
|
54
49
|
if (this.filterItem.groupedItems != undefined) {
|
55
50
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
|
@@ -57,6 +52,9 @@ export class SnkFilterModalItem {
|
|
57
52
|
else {
|
58
53
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
|
59
54
|
}
|
55
|
+
this._editor && (this._editor["config"] = this.filterItem);
|
56
|
+
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
|
57
|
+
this.filterChange.emit(this.filterItem);
|
60
58
|
}
|
61
59
|
handleDeleteFilter(filter, filterItemType) {
|
62
60
|
if (filterItemType === FilterItemType.PERSONALIZED) {
|
@@ -86,7 +84,7 @@ export class SnkFilterModalItem {
|
|
86
84
|
}
|
87
85
|
render() {
|
88
86
|
const { tag: ContentEditor, props } = this.getContentEditorConfig();
|
89
|
-
return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("
|
87
|
+
return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin-bottom--extra-small", htmlFor: `filter-item-${this.filterItem.id}` }, this.filterItem.detailModal)), h(ContentEditor, Object.assign({ ref: ref => this._editor = ref, id: `filter-item-${this.filterItem.id}`, config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, props)))));
|
90
88
|
}
|
91
89
|
static get is() { return "snk-filter-modal-item"; }
|
92
90
|
static get originalStyleUrls() {
|
@@ -211,10 +209,4 @@ export class SnkFilterModalItem {
|
|
211
209
|
}];
|
212
210
|
}
|
213
211
|
static get elementRef() { return "_element"; }
|
214
|
-
static get watchers() {
|
215
|
-
return [{
|
216
|
-
"propName": "filterItem",
|
217
|
-
"methodName": "observeFilterItem"
|
218
|
-
}];
|
219
|
-
}
|
220
212
|
}
|