@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-74224.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.
- package/dist/cjs/{ConfigStorage-f079f5fd.js → ConfigStorage-ecc0ed20.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-29b65619.js} +20 -29
- package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-cadeef8e.js} +5 -7
- package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-f1c92f79.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-7691a2c1.js → SnkMessageBuilder-bae64d0d.js} +0 -10
- package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-f89461c1.js} +3 -3
- package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-ed497282.js} +1 -1
- package/dist/cjs/index-f9e81701.js +28 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-ca89181c.js} +2 -7
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +30 -27
- package/dist/cjs/snk-application.cjs.entry.js +60 -102
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-config-options.cjs.entry.js +239 -0
- package/dist/cjs/snk-crud.cjs.entry.js +5 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-7dbdad0e.js → snk-data-unit-668dc5e8.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
- package/dist/cjs/{snk-filter-bar_4.cjs.entry.js → snk-filter-bar.cjs.entry.js} +3 -688
- package/dist/cjs/snk-filter-item.cjs.entry.js +312 -0
- package/dist/cjs/snk-filter-list.cjs.entry.js +152 -0
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal.cjs.entry.js +249 -0
- package/dist/cjs/{snk-config-options_3.cjs.entry.js → snk-form-config.cjs.entry.js} +3 -365
- package/dist/cjs/snk-form.cjs.entry.js +144 -0
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/{snk-guides-viewer-eee43c8b.js → snk-guides-viewer-4236cb9d.js} +5 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -14
- package/dist/collection/collection-manifest.json +31 -14
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
- package/dist/collection/components/snk-application/snk-application.js +53 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +0 -3
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +7 -7
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -6
- package/dist/collection/lib/message/SnkMessageBuilder.js +0 -2
- package/dist/collection/lib/utils/CrudUtils.js +16 -25
- package/dist/components/ContinuousInsertUtils.js +16 -25
- package/dist/components/DataFetcher.js +5 -7
- package/dist/components/SnkMessageBuilder.js +0 -10
- package/dist/components/dataunit-fetcher.js +2 -2
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -3
- package/dist/components/pesquisa-fetcher.js +1 -6
- package/dist/components/snk-actions-button2.js +27 -26
- package/dist/components/snk-application2.js +53 -95
- package/dist/components/snk-detail-view2.js +0 -3
- package/dist/components/snk-simple-crud2.js +7 -7
- package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-7b36d041.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-30caa626.js} +20 -29
- package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-a9c598f2.js} +5 -7
- package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-139f09fa.js} +3 -3
- package/dist/esm/{SnkMessageBuilder-7ace6803.js → SnkMessageBuilder-6fff4a4c.js} +0 -10
- package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{constants-7302ee87.js → constants-8457af36.js} +1 -1
- package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-c24c76c6.js} +3 -3
- package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-adbe5d34.js} +1 -1
- package/dist/esm/index-a7d3d3f1.js +28 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-8edaa8cd.js} +2 -7
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +32 -29
- package/dist/esm/snk-application.entry.js +60 -102
- package/dist/esm/snk-attach.entry.js +6 -6
- package/dist/esm/snk-config-options.entry.js +235 -0
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +6 -6
- package/dist/esm/snk-data-exporter.entry.js +7 -7
- package/dist/esm/{snk-data-unit-7a579dbd.js → snk-data-unit-0fdfb6c2.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/{snk-filter-bar_4.entry.js → snk-filter-bar.entry.js} +5 -687
- package/dist/esm/snk-filter-item.entry.js +308 -0
- package/dist/esm/snk-filter-list.entry.js +148 -0
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-filter-modal.entry.js +245 -0
- package/dist/esm/{snk-config-options_3.entry.js → snk-form-config.entry.js} +6 -366
- package/dist/esm/snk-form.entry.js +140 -0
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/{snk-guides-viewer-e8ca764a.js → snk-guides-viewer-8934c537.js} +6 -9
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +15 -15
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/sankhyablocks/p-01086ff7.entry.js +1 -0
- package/dist/sankhyablocks/{p-126c58ea.js → p-06421fdb.js} +1 -1
- package/dist/sankhyablocks/{p-e3a285a2.js → p-16869f77.js} +1 -1
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-341465ce.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-2923c1b5.js +1 -0
- package/dist/sankhyablocks/p-3b60db06.entry.js +1 -0
- package/dist/sankhyablocks/{p-00f9fe5c.entry.js → p-430e4d3c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9ffd9fc7.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/p-4f35399c.entry.js +1 -0
- package/dist/sankhyablocks/{p-c75fae8e.js → p-5dd8cf4f.js} +1 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/{p-41793e17.entry.js → p-7663f597.entry.js} +1 -1
- package/dist/sankhyablocks/{p-47d24ac8.js → p-7ac7932c.js} +2 -2
- package/dist/sankhyablocks/{p-2d3f9482.entry.js → p-8eb67fa4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f0aaad2b.entry.js → p-92eadb1c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8b4fc28f.entry.js → p-95df461f.entry.js} +1 -1
- package/dist/sankhyablocks/p-a42e7a1e.entry.js +11 -0
- package/dist/sankhyablocks/p-a724e798.entry.js +1 -0
- package/dist/sankhyablocks/{p-1dbd5c18.entry.js → p-a75d242d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0e206e62.js → p-afbb070d.js} +1 -1
- package/dist/sankhyablocks/{p-95ce311a.js → p-b0ef4383.js} +1 -1
- package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
- package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-b9c67e45.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b389ed49.entry.js → p-be5d8fcb.entry.js} +1 -1
- package/dist/sankhyablocks/p-ca5ec380.js +1 -0
- package/dist/sankhyablocks/p-d3f53df2.entry.js +1 -0
- package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-dcead955.entry.js} +1 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
- package/dist/sankhyablocks/{p-00278e07.js → p-f3434fc4.js} +1 -1
- package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-feba9d4b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
- package/dist/types/components/snk-application/snk-application.d.ts +12 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/dist/types/components.d.ts +1 -393
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -1
- package/dist/types/lib/utils/CrudUtils.d.ts +0 -1
- package/package.json +2 -3
- package/react/components.d.ts +0 -3
- package/react/components.js +0 -3
- package/react/components.js.map +1 -1
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +0 -471
- package/dist/cjs/snk-distinct-search.cjs.entry.js +0 -123
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +0 -28
- package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +0 -16
- package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +0 -52
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +0 -4
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +0 -372
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +0 -110
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +0 -544
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +0 -28
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +0 -593
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +0 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +0 -25
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +0 -9
- package/dist/collection/sw.js +0 -46
- package/dist/components/filter-distinct-search.js +0 -17
- package/dist/components/input-distinct-search.d.ts +0 -11
- package/dist/components/input-distinct-search.js +0 -6
- package/dist/components/input-distinct-search2.js +0 -264
- package/dist/components/search-modal.d.ts +0 -11
- package/dist/components/search-modal.js +0 -6
- package/dist/components/search-modal2.js +0 -264
- package/dist/components/snk-distinct-search.d.ts +0 -11
- package/dist/components/snk-distinct-search.js +0 -163
- package/dist/esm/input-distinct-search_2.entry.js +0 -466
- package/dist/esm/snk-distinct-search.entry.js +0 -119
- package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
- package/dist/sankhyablocks/p-154aa2a6.entry.js +0 -11
- package/dist/sankhyablocks/p-18cb1acb.entry.js +0 -1
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +0 -1
- package/dist/sankhyablocks/p-3755b46f.entry.js +0 -1
- package/dist/sankhyablocks/p-3858a2e4.entry.js +0 -1
- package/dist/sankhyablocks/p-42130213.entry.js +0 -1
- package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
- package/dist/sankhyablocks/p-aaf94476.js +0 -1
- package/dist/sankhyablocks/p-d8665750.js +0 -1
- package/dist/sankhyablocks/p-e4391e16.js +0 -1
- package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +0 -11
- package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +0 -12
- package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +0 -13
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +0 -83
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +0 -105
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +0 -127
- package/dist/types/components/snk-distinct-search/types/index.d.ts +0 -12
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +0 -4
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +0 -6
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +0 -2
- /package/dist/collection/components/{snk-distinct-search/types → snk-actions-button/interfaces}/index.js +0 -0
|
@@ -5,17 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index$1 = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
|
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
8
|
+
const ConfigStorage = require('./ConfigStorage-ecc0ed20.js');
|
|
9
9
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
10
10
|
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
|
|
11
11
|
const index = require('./index-c5771aba.js');
|
|
12
12
|
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
|
13
13
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
14
14
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
require('./form-config-fetcher-39397ac5.js');
|
|
18
|
-
require('./DataFetcher-e059eb72.js');
|
|
15
|
+
require('./form-config-fetcher-ed497282.js');
|
|
16
|
+
require('./DataFetcher-cadeef8e.js');
|
|
19
17
|
require('./PrintUtils-bcaeb82f.js');
|
|
20
18
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
21
19
|
|
|
@@ -725,687 +723,4 @@ const SnkFilterBar = class {
|
|
|
725
723
|
};
|
|
726
724
|
SnkFilterBar.style = snkFilterBarCss;
|
|
727
725
|
|
|
728
|
-
const SnkFilterItem = class {
|
|
729
|
-
constructor(hostRef) {
|
|
730
|
-
index$1.registerInstance(this, hostRef);
|
|
731
|
-
this.visibleChanged = index$1.createEvent(this, "visibleChanged", 7);
|
|
732
|
-
this.filterChange = index$1.createEvent(this, "filterChange", 3);
|
|
733
|
-
this.innerClickCheck = (_floatingContainer, node) => {
|
|
734
|
-
if (node.id != core.FloatingManager.MODAL_ELEMENT_ID) {
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
this.detailIsVisible = false;
|
|
738
|
-
return false;
|
|
739
|
-
};
|
|
740
|
-
this.detailIsVisible = undefined;
|
|
741
|
-
this.config = undefined;
|
|
742
|
-
this.getMessage = undefined;
|
|
743
|
-
this.showChips = true;
|
|
744
|
-
}
|
|
745
|
-
observeDetailIsVisible(value) {
|
|
746
|
-
this.visibleChanged.emit(value);
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Exibe os detalhes de um item da lista.
|
|
750
|
-
*/
|
|
751
|
-
async showUp(open = false) {
|
|
752
|
-
return new Promise(resolve => {
|
|
753
|
-
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
754
|
-
if (open) {
|
|
755
|
-
this._closeCallback = resolve;
|
|
756
|
-
window.requestAnimationFrame(() => {
|
|
757
|
-
this._floatingID = core.FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
|
|
758
|
-
this._popover.show();
|
|
759
|
-
this.detailIsVisible = true;
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
updatePosition() {
|
|
765
|
-
if (this._floatingID == undefined) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
core.FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
|
|
769
|
-
}
|
|
770
|
-
getFloatOptions() {
|
|
771
|
-
return {
|
|
772
|
-
autoClose: true,
|
|
773
|
-
innerClickTest: this.innerClickCheck,
|
|
774
|
-
backClickListener: () => this.onDetailCloseCallback(),
|
|
775
|
-
left: this.getOffsetLeft(),
|
|
776
|
-
top: this.getOffsetTop(),
|
|
777
|
-
useOverlay: true,
|
|
778
|
-
overlayClassName: 'ez-scrim ez-scrim--light',
|
|
779
|
-
isFixed: true
|
|
780
|
-
};
|
|
781
|
-
}
|
|
782
|
-
getOffsetLeft() {
|
|
783
|
-
const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
|
|
784
|
-
const rect = this._filterItemElement.getBoundingClientRect();
|
|
785
|
-
// Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
|
|
786
|
-
const filterDetailWidth = 430;
|
|
787
|
-
const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
|
|
788
|
-
return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
|
|
789
|
-
}
|
|
790
|
-
getOffsetTop() {
|
|
791
|
-
const rect = this._filterItemElement.getBoundingClientRect();
|
|
792
|
-
return (rect.y + rect.height) + "px";
|
|
793
|
-
}
|
|
794
|
-
controlScrollPage() {
|
|
795
|
-
window.removeEventListener("scroll", this.updatePosition.bind(this));
|
|
796
|
-
window.addEventListener("scroll", this.updatePosition.bind(this));
|
|
797
|
-
}
|
|
798
|
-
getConfigChanges() {
|
|
799
|
-
var _a;
|
|
800
|
-
const configToBeCleared = this.config;
|
|
801
|
-
if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
802
|
-
configToBeCleared.visible = false;
|
|
803
|
-
configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
|
|
804
|
-
}
|
|
805
|
-
const hasMultiValues = configToBeCleared.type === filterItemType_enum.FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
|
|
806
|
-
const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
|
|
807
|
-
return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Oculta os detalhes de um item da lista.
|
|
811
|
-
*/
|
|
812
|
-
async hideDetail() {
|
|
813
|
-
if (this.detailIsVisible) {
|
|
814
|
-
if (this._floatingID != undefined) {
|
|
815
|
-
core.FloatingManager.close(this._floatingID);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
onDetailCloseCallback() {
|
|
820
|
-
this._floatingID = undefined;
|
|
821
|
-
this.detailIsVisible = false;
|
|
822
|
-
if (this._closeCallback) {
|
|
823
|
-
this._closeCallback();
|
|
824
|
-
this._closeCallback = undefined;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
//---------------------------------------------
|
|
828
|
-
// Event handlers
|
|
829
|
-
//---------------------------------------------
|
|
830
|
-
clickListener(evt) {
|
|
831
|
-
if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
832
|
-
if (evt.target === this._rightIconElement && this.canClearFilter()) {
|
|
833
|
-
const configChanged = this.getConfigChanges();
|
|
834
|
-
this.filterChange.emit(configChanged);
|
|
835
|
-
}
|
|
836
|
-
else {
|
|
837
|
-
if (this.detailIsVisible) {
|
|
838
|
-
this.hideDetail();
|
|
839
|
-
}
|
|
840
|
-
else {
|
|
841
|
-
this.showUp(true);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
evt.preventDefault();
|
|
845
|
-
evt.stopImmediatePropagation();
|
|
846
|
-
evt.stopPropagation();
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
mouseDownListener(evt) {
|
|
850
|
-
if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
851
|
-
evt.preventDefault();
|
|
852
|
-
evt.stopImmediatePropagation();
|
|
853
|
-
evt.stopPropagation();
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
getLabel(isTooltipLabel = false) {
|
|
857
|
-
var _a, _b;
|
|
858
|
-
const { type, value, label, props, groupedItems = [] } = this.config;
|
|
859
|
-
if (value || groupedItems.length) {
|
|
860
|
-
if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
861
|
-
const [optOne, optTwo] = props.options;
|
|
862
|
-
const tooltip = this.getMessage('snkFilterBar.binarySelectTooltip');
|
|
863
|
-
if (optOne.name === value) {
|
|
864
|
-
return isTooltipLabel ? `${tooltip} ${String(optOne.label).toLowerCase()}` : optOne.label;
|
|
865
|
-
}
|
|
866
|
-
if (optTwo.name === value) {
|
|
867
|
-
return isTooltipLabel ? `${tooltip} ${String(optTwo.label).toLowerCase()}` : optTwo.label;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (type === filterItemType_enum.FilterItemType.MULTI_SELECT) {
|
|
871
|
-
const opt = props.options.find(opt => opt.value === value);
|
|
872
|
-
return `${label}: ${opt.label}`;
|
|
873
|
-
}
|
|
874
|
-
if (type === filterItemType_enum.FilterItemType.PERIOD) {
|
|
875
|
-
let { end, start } = value;
|
|
876
|
-
if (typeof end === "string") {
|
|
877
|
-
end = new Date(end);
|
|
878
|
-
end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
|
|
879
|
-
}
|
|
880
|
-
if (typeof start === "string") {
|
|
881
|
-
start = new Date(start);
|
|
882
|
-
start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
|
|
883
|
-
}
|
|
884
|
-
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
885
|
-
if (end && start) {
|
|
886
|
-
const isSameYear = start.getFullYear() === end.getFullYear();
|
|
887
|
-
const formatOptions = Object.assign({ day: '2-digit', month: '2-digit' }, ((!isSameYear || isTooltipLabel) && { year: '2-digit' }));
|
|
888
|
-
const startLabel = core.DateUtils.formatDate(start, formatOptions);
|
|
889
|
-
const endLabel = core.DateUtils.formatDate(end, formatOptions);
|
|
890
|
-
if (isTooltipLabel) {
|
|
891
|
-
return this.getMessage('snkFilterBar.fullPeriodTooltip', { LABEL: label, START_LABEL: startLabel, END_LABEL: endLabel });
|
|
892
|
-
}
|
|
893
|
-
return `${label}: ${startLabel} \u2192 ${endLabel}`;
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
if (start) {
|
|
897
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${dateFormater.format(start)}`;
|
|
898
|
-
}
|
|
899
|
-
else if (end) {
|
|
900
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${dateFormater.format(end)}`;
|
|
901
|
-
}
|
|
902
|
-
else {
|
|
903
|
-
return label;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
if (type === filterItemType_enum.FilterItemType.SEARCH) {
|
|
908
|
-
return `${label}: ${value.value} - ${value.label}`;
|
|
909
|
-
}
|
|
910
|
-
if (type === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
|
911
|
-
const activeCount = this.calculateActiveCount(groupedItems);
|
|
912
|
-
if (activeCount <= 0)
|
|
913
|
-
return label;
|
|
914
|
-
return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
|
|
915
|
-
}
|
|
916
|
-
if (type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
917
|
-
const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
|
|
918
|
-
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
|
919
|
-
}
|
|
920
|
-
if (type === filterItemType_enum.FilterItemType.CHECK_BOX_LIST) {
|
|
921
|
-
const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
|
|
922
|
-
.filter(([_, value]) => value === true)
|
|
923
|
-
.map(([key, _]) => key);
|
|
924
|
-
const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
|
|
925
|
-
const selectedOptions = options.filter(option => selectedValues.includes(option.name));
|
|
926
|
-
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
|
927
|
-
}
|
|
928
|
-
if (type === filterItemType_enum.FilterItemType.NUMBER && props.variation === filterNumberVariation.FilterNumberVariation.INTERVAL) {
|
|
929
|
-
const { start, end } = value;
|
|
930
|
-
if (start && end) {
|
|
931
|
-
return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
|
|
932
|
-
}
|
|
933
|
-
if (start) {
|
|
934
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
|
|
935
|
-
}
|
|
936
|
-
if (end) {
|
|
937
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
return `${label}: ${value}`;
|
|
941
|
-
}
|
|
942
|
-
return label;
|
|
943
|
-
}
|
|
944
|
-
getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
|
|
945
|
-
const checkedAmount = selectedOptions.length;
|
|
946
|
-
if (checkedAmount === 0) {
|
|
947
|
-
return `${label}`;
|
|
948
|
-
}
|
|
949
|
-
if (checkedAmount > 1) {
|
|
950
|
-
if (isTooltipLabel) {
|
|
951
|
-
const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
|
|
952
|
-
return `${label}: ${selectedOptionsDescrptions.join(',')}`;
|
|
953
|
-
}
|
|
954
|
-
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
|
955
|
-
}
|
|
956
|
-
return `${label}: ${selectedOptions[0].label}`;
|
|
957
|
-
}
|
|
958
|
-
calculateActiveCount(groupedItems) {
|
|
959
|
-
return groupedItems.reduce((total, item) => {
|
|
960
|
-
if (!!item.visible)
|
|
961
|
-
return total + 1;
|
|
962
|
-
return total;
|
|
963
|
-
}, 0);
|
|
964
|
-
}
|
|
965
|
-
componentDidLoad() {
|
|
966
|
-
if (this._filterItemElement) {
|
|
967
|
-
core.ElementIDUtils.addIDInfo(this._filterItemElement);
|
|
968
|
-
this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
|
|
969
|
-
}
|
|
970
|
-
this.controlScrollPage();
|
|
971
|
-
}
|
|
972
|
-
componentDidRender() {
|
|
973
|
-
if (this._floatingID == undefined) {
|
|
974
|
-
if (this._popover) {
|
|
975
|
-
this._popover.remove();
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* Emitido quando o estado do filtro é alterado.
|
|
981
|
-
*/
|
|
982
|
-
filterChangeListener() {
|
|
983
|
-
this.hideDetail();
|
|
984
|
-
}
|
|
985
|
-
canClearFilter() {
|
|
986
|
-
const { value, groupedItems = [] } = this.config;
|
|
987
|
-
if (value != undefined && this.config.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
988
|
-
return value.some((item) => item.check);
|
|
989
|
-
}
|
|
990
|
-
return value !== undefined || groupedItems.some(item => item.visible);
|
|
991
|
-
}
|
|
992
|
-
getRightIconName() {
|
|
993
|
-
if (this.canClearFilter())
|
|
994
|
-
return "close";
|
|
995
|
-
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
996
|
-
}
|
|
997
|
-
getLeftIconName() {
|
|
998
|
-
switch (this.config.type) {
|
|
999
|
-
case filterItemType_enum.FilterItemType.PERIOD:
|
|
1000
|
-
return "calendar";
|
|
1001
|
-
case filterItemType_enum.FilterItemType.PERSONALIZED:
|
|
1002
|
-
return "tune";
|
|
1003
|
-
}
|
|
1004
|
-
return undefined;
|
|
1005
|
-
}
|
|
1006
|
-
hasActiveElements(value) {
|
|
1007
|
-
var _a, _b, _c;
|
|
1008
|
-
return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
1009
|
-
}
|
|
1010
|
-
hasActiveValue(config) {
|
|
1011
|
-
return (config.type !== filterItemType_enum.FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
|
|
1012
|
-
}
|
|
1013
|
-
getEnabledChip() {
|
|
1014
|
-
if (this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
|
1015
|
-
const { groupedItems = [] } = this.config;
|
|
1016
|
-
return groupedItems.some(item => item.visible);
|
|
1017
|
-
}
|
|
1018
|
-
return this.hasActiveValue(this.config);
|
|
1019
|
-
}
|
|
1020
|
-
render() {
|
|
1021
|
-
const leftIcon = this.getLeftIconName();
|
|
1022
|
-
return (index$1.h(index$1.Host, null, this.showChips && (index$1.h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon && (index$1.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), index$1.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" }))), index$1.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index$1.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
|
|
1023
|
-
}
|
|
1024
|
-
get _filterItemElement() { return index$1.getElement(this); }
|
|
1025
|
-
static get watchers() { return {
|
|
1026
|
-
"detailIsVisible": ["observeDetailIsVisible"]
|
|
1027
|
-
}; }
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
|
|
1031
|
-
const MAX_FILTERS = 5;
|
|
1032
|
-
const SnkFilterList = class {
|
|
1033
|
-
constructor(hostRef) {
|
|
1034
|
-
index$1.registerInstance(this, hostRef);
|
|
1035
|
-
this.snkItemSelected = index$1.createEvent(this, "snkItemSelected", 7);
|
|
1036
|
-
this._preselection = -1;
|
|
1037
|
-
this.innerClickCheck = (_floatingContainer, node) => {
|
|
1038
|
-
if (node.id != core.FloatingManager.MODAL_ELEMENT_ID) {
|
|
1039
|
-
return true;
|
|
1040
|
-
}
|
|
1041
|
-
this._detailIsVisible = false;
|
|
1042
|
-
return false;
|
|
1043
|
-
};
|
|
1044
|
-
this._filterArgument = undefined;
|
|
1045
|
-
this._showAll = undefined;
|
|
1046
|
-
this.label = undefined;
|
|
1047
|
-
this.iconName = undefined;
|
|
1048
|
-
this.items = undefined;
|
|
1049
|
-
this.getMessage = undefined;
|
|
1050
|
-
this.emptyText = undefined;
|
|
1051
|
-
this.findFilterText = undefined;
|
|
1052
|
-
this.buttonClass = undefined;
|
|
1053
|
-
}
|
|
1054
|
-
showDetail() {
|
|
1055
|
-
this._preselection = -1;
|
|
1056
|
-
this._floatingID = core.FloatingManager.float(this._popover, this._popoverContainer, {
|
|
1057
|
-
autoClose: true,
|
|
1058
|
-
innerClickTest: this.innerClickCheck,
|
|
1059
|
-
backClickListener: () => this.onListCloseCallback(),
|
|
1060
|
-
useOverlay: true
|
|
1061
|
-
});
|
|
1062
|
-
this._detailIsVisible = true;
|
|
1063
|
-
this._showAll = false;
|
|
1064
|
-
this._filterArgument = "";
|
|
1065
|
-
this._filterInput.setFocus();
|
|
1066
|
-
}
|
|
1067
|
-
/**
|
|
1068
|
-
* Oculta os detalhes do componente snk-filter-list.
|
|
1069
|
-
*/
|
|
1070
|
-
async hideDetail() {
|
|
1071
|
-
if (this._floatingID != undefined) {
|
|
1072
|
-
core.FloatingManager.close(this._floatingID);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
onListCloseCallback() {
|
|
1076
|
-
this._floatingID = undefined;
|
|
1077
|
-
this._detailIsVisible = false;
|
|
1078
|
-
}
|
|
1079
|
-
buttonClick() {
|
|
1080
|
-
if (this._detailIsVisible) {
|
|
1081
|
-
this.hideDetail();
|
|
1082
|
-
}
|
|
1083
|
-
else {
|
|
1084
|
-
this.showDetail();
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
componentDidLoad() {
|
|
1088
|
-
if (this._element) {
|
|
1089
|
-
core.ElementIDUtils.addIDInfo(this._element);
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
componentDidRender() {
|
|
1093
|
-
if (this._floatingID == undefined) {
|
|
1094
|
-
if (this._popover) {
|
|
1095
|
-
this._popover.remove();
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
buildIdElement(buttonElement, name) {
|
|
1100
|
-
if (!buttonElement)
|
|
1101
|
-
return;
|
|
1102
|
-
const dataElement = { id: name };
|
|
1103
|
-
buttonElement.removeAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
|
1104
|
-
core.ElementIDUtils.addIDInfoIfNotExists(buttonElement, "filterItemList", dataElement);
|
|
1105
|
-
}
|
|
1106
|
-
buildItemElement(item) {
|
|
1107
|
-
const itemId = ++this._selectableItemsCount;
|
|
1108
|
-
return (index$1.h("button", { ref: elem => elem && this.buildIdElement(elem, item.label), id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name), name: item.label, key: itemId }, item.iconName ? index$1.h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, index$1.h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
|
|
1109
|
-
}
|
|
1110
|
-
itemSelected(itemName) {
|
|
1111
|
-
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
1112
|
-
this._showAll = true;
|
|
1113
|
-
}
|
|
1114
|
-
else {
|
|
1115
|
-
this.hideDetail();
|
|
1116
|
-
this.snkItemSelected.emit(itemName);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
getFilterItems() {
|
|
1120
|
-
const items = this.items ? core.ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
|
|
1121
|
-
if (items.length === 0) {
|
|
1122
|
-
return index$1.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
|
|
1123
|
-
}
|
|
1124
|
-
const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
|
|
1125
|
-
if (hideItems) {
|
|
1126
|
-
items.splice(MAX_FILTERS);
|
|
1127
|
-
items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
|
|
1128
|
-
}
|
|
1129
|
-
this._selectableItemsCount = 0;
|
|
1130
|
-
return index$1.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
1131
|
-
}
|
|
1132
|
-
getFooterItems() {
|
|
1133
|
-
return this.items.filter(item => item.kind === "FOOTER");
|
|
1134
|
-
}
|
|
1135
|
-
keyDownHandler(event) {
|
|
1136
|
-
switch (event.key) {
|
|
1137
|
-
case "ArrowDown":
|
|
1138
|
-
this.changePreselection(this._preselection + 1);
|
|
1139
|
-
//Paramos a propagação do evento para evitar scroll indesejado
|
|
1140
|
-
event.stopImmediatePropagation();
|
|
1141
|
-
event.stopPropagation();
|
|
1142
|
-
event.preventDefault();
|
|
1143
|
-
break;
|
|
1144
|
-
case "ArrowUp":
|
|
1145
|
-
this.changePreselection(this._preselection - 1);
|
|
1146
|
-
//Paramos a propagação do evento para evitar scroll indesejado
|
|
1147
|
-
event.stopImmediatePropagation();
|
|
1148
|
-
event.stopPropagation();
|
|
1149
|
-
event.preventDefault();
|
|
1150
|
-
break;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
changePreselection(newSelection) {
|
|
1154
|
-
if (newSelection < 0) {
|
|
1155
|
-
newSelection = this._selectableItemsCount;
|
|
1156
|
-
}
|
|
1157
|
-
this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
|
|
1158
|
-
if (this._preselection === 0) {
|
|
1159
|
-
this._filterInput.setFocus();
|
|
1160
|
-
}
|
|
1161
|
-
else {
|
|
1162
|
-
const item = this._element.querySelector(`#filter-item${this._preselection}`);
|
|
1163
|
-
if (item) {
|
|
1164
|
-
item.focus();
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
render() {
|
|
1169
|
-
return (index$1.h(index$1.Host, { class: "ez-flex ez-flex--column" }, index$1.h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, index$1.h("slot", { name: "leftIcon" })), index$1.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index$1.h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--4", ref: elem => this._popover = elem }, index$1.h("ez-filter-input", { ref: ref => this._filterInput = ref, "data-element-id": "serachFilters", mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail, onFocus: () => this._preselection = 0 }), this.getFilterItems(), index$1.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
1170
|
-
}
|
|
1171
|
-
get _element() { return index$1.getElement(this); }
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
|
1175
|
-
|
|
1176
|
-
const SnkFilterModal = class {
|
|
1177
|
-
constructor(hostRef) {
|
|
1178
|
-
index$1.registerInstance(this, hostRef);
|
|
1179
|
-
this.getMessage = undefined;
|
|
1180
|
-
this.configName = undefined;
|
|
1181
|
-
this.filters = undefined;
|
|
1182
|
-
this.applyFilters = undefined;
|
|
1183
|
-
this.closeModal = undefined;
|
|
1184
|
-
this.addPersonalizedFilter = undefined;
|
|
1185
|
-
this.editPersonalizedFilter = undefined;
|
|
1186
|
-
this.deletePersonalizedFilter = undefined;
|
|
1187
|
-
this.filtersToDelete = [];
|
|
1188
|
-
this.disablePersonalizedFilter = undefined;
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Emitido quando um filtro personalizado é deletado.
|
|
1192
|
-
*/
|
|
1193
|
-
deletePersonalizedFilterListener(event) {
|
|
1194
|
-
this.filtersToDelete.push(event.detail);
|
|
1195
|
-
}
|
|
1196
|
-
getCustomMessage(key, params) {
|
|
1197
|
-
var _a;
|
|
1198
|
-
return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
|
|
1199
|
-
}
|
|
1200
|
-
//TODO: tratar clear all dos filtros personalizados
|
|
1201
|
-
handleClearAll() {
|
|
1202
|
-
const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
|
|
1203
|
-
if (filter.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
1204
|
-
acc.multiListFilters.push(filter);
|
|
1205
|
-
return acc;
|
|
1206
|
-
}
|
|
1207
|
-
if (filter.filterType === filterType_enum.FilterType.QUICK_FILTER) {
|
|
1208
|
-
acc.quickFilters.push(filter);
|
|
1209
|
-
return acc;
|
|
1210
|
-
}
|
|
1211
|
-
if (filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER) {
|
|
1212
|
-
acc.customFilters.push(filter);
|
|
1213
|
-
return acc;
|
|
1214
|
-
}
|
|
1215
|
-
if (filter.filterType === filterType_enum.FilterType.OTHER_FILTERS) {
|
|
1216
|
-
acc.otherFilters.push(filter);
|
|
1217
|
-
return acc;
|
|
1218
|
-
}
|
|
1219
|
-
return acc;
|
|
1220
|
-
}, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
|
|
1221
|
-
this.handleClearFilterList(quickFilters);
|
|
1222
|
-
this.handleClearCustomFilters(customFilters);
|
|
1223
|
-
this.handleClearOthersFilters(otherFilters);
|
|
1224
|
-
multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
|
|
1225
|
-
}
|
|
1226
|
-
handleClearOthersFilters(otherFilters) {
|
|
1227
|
-
this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
|
1228
|
-
}
|
|
1229
|
-
handleClearCustomFilters(customFilters) {
|
|
1230
|
-
this.filters.forEach((filter, index) => {
|
|
1231
|
-
if (filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER)
|
|
1232
|
-
this.filters[index] = this.clearAllCustomFilter(customFilters).shift();
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
clearAllCustomFilter(filterConfigSnapshot) {
|
|
1236
|
-
return filterConfigSnapshot.map(filterItem => {
|
|
1237
|
-
const copy = Object.assign({}, filterItem);
|
|
1238
|
-
delete copy.value;
|
|
1239
|
-
copy.visible = false;
|
|
1240
|
-
if (copy.groupedItems) {
|
|
1241
|
-
copy.groupedItems = this.clearAllCustomFilter(copy.groupedItems);
|
|
1242
|
-
}
|
|
1243
|
-
return copy;
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
handleClose() {
|
|
1247
|
-
const hasChangesToSave = core.ObjectUtils.objectToString(this.filters) !== core.ObjectUtils.objectToString(this._originalFilterConfig);
|
|
1248
|
-
if (!hasChangesToSave) {
|
|
1249
|
-
this.closeModal();
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
return utils.ApplicationUtils.confirm(this.getCustomMessage('validations.notSaved.title'), this.getCustomMessage('validations.notSaved.message')).then((cancelAction) => {
|
|
1253
|
-
if (cancelAction)
|
|
1254
|
-
this.closeModal();
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
handleApplyFilters() {
|
|
1258
|
-
const filterPersonalized = this.filters.find(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER);
|
|
1259
|
-
if (this.isValidCustomFilter(filterPersonalized)) {
|
|
1260
|
-
this.applyFilters(this.filters);
|
|
1261
|
-
}
|
|
1262
|
-
if (this.filtersToDelete.length > 0) {
|
|
1263
|
-
this.filtersToDelete.forEach(filter => {
|
|
1264
|
-
this.deletePersonalizedFilter(filter, this.configName);
|
|
1265
|
-
});
|
|
1266
|
-
this.filtersToDelete = [];
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
isValidCustomFilter(filterPersonalized) {
|
|
1270
|
-
const isValid = PersonalizedFilterUtils.PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
|
1271
|
-
if (!isValid) {
|
|
1272
|
-
utils.ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
|
|
1273
|
-
return false;
|
|
1274
|
-
}
|
|
1275
|
-
return true;
|
|
1276
|
-
}
|
|
1277
|
-
modalActionListener(evt) {
|
|
1278
|
-
const modalAction = evt.detail;
|
|
1279
|
-
switch (modalAction) {
|
|
1280
|
-
case ezModalContainer.ModalAction.CANCEL:
|
|
1281
|
-
this.handleClearAll();
|
|
1282
|
-
break;
|
|
1283
|
-
case ezModalContainer.ModalAction.OK:
|
|
1284
|
-
this.handleApplyFilters();
|
|
1285
|
-
break;
|
|
1286
|
-
case ezModalContainer.ModalAction.CLOSE:
|
|
1287
|
-
this.handleClose();
|
|
1288
|
-
break;
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
handleFilterChange(filterConfig) {
|
|
1292
|
-
this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
|
|
1293
|
-
}
|
|
1294
|
-
handleClearFilterList(filterList) {
|
|
1295
|
-
this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
|
1296
|
-
}
|
|
1297
|
-
handleClearSigleFilter(filterItem) {
|
|
1298
|
-
if (filterItemType_enum.FilterItemType.MULTI_LIST === filterItem.type) {
|
|
1299
|
-
let filterItemCopy = core.ObjectUtils.copy(filterItem);
|
|
1300
|
-
this.uncheckFilterValues(filterItemCopy.value);
|
|
1301
|
-
const filterListCopy = core.ObjectUtils.copy(this.filters);
|
|
1302
|
-
const index = filterListCopy.findIndex(item => item.id === filterItem.id);
|
|
1303
|
-
filterListCopy.splice(index, 1, filterItemCopy);
|
|
1304
|
-
this.filters = core.ObjectUtils.copy(filterListCopy);
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
if (filterItemType_enum.FilterItemType.CHECK_BOX_LIST === filterItem.type) {
|
|
1308
|
-
const filterListCopy = core.ObjectUtils.copy(this.filters);
|
|
1309
|
-
filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
|
|
1310
|
-
this.filters = core.ObjectUtils.copy(filterListCopy);
|
|
1311
|
-
return;
|
|
1312
|
-
}
|
|
1313
|
-
this.filters.find(filter => filter.id === filterItem.id).value = undefined;
|
|
1314
|
-
}
|
|
1315
|
-
uncheckFilterValues(valueList) {
|
|
1316
|
-
valueList.forEach(value => {
|
|
1317
|
-
if (!!value) {
|
|
1318
|
-
value.check = false;
|
|
1319
|
-
}
|
|
1320
|
-
});
|
|
1321
|
-
return valueList;
|
|
1322
|
-
}
|
|
1323
|
-
renderFilterItem(filterItem, fullRow) {
|
|
1324
|
-
return (index$1.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.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
|
|
1325
|
-
}
|
|
1326
|
-
isDefaultFilterNumberVariation(filter) {
|
|
1327
|
-
var _a;
|
|
1328
|
-
return filter.type === filterItemType_enum.FilterItemType.NUMBER
|
|
1329
|
-
&& (!filter.props.variation || ((_a = filter.props) === null || _a === void 0 ? void 0 : _a.variation) === filterNumberVariation.FilterNumberVariation.DEFAULT);
|
|
1330
|
-
}
|
|
1331
|
-
mountFiltersLines(filters) {
|
|
1332
|
-
const MAX_LINE_LENGTH = 2;
|
|
1333
|
-
let currentLine = 0;
|
|
1334
|
-
let forceAddCurrent = false;
|
|
1335
|
-
const filtersLines = {};
|
|
1336
|
-
for (let curr = 0; curr < filters.length; curr++) {
|
|
1337
|
-
filtersLines[currentLine] = filtersLines[currentLine] || [];
|
|
1338
|
-
const item = filters[curr];
|
|
1339
|
-
const isLast = curr === filters.length - 1;
|
|
1340
|
-
const currentItemMatch = item.type === filterItemType_enum.FilterItemType.TEXT || this.isDefaultFilterNumberVariation(item);
|
|
1341
|
-
const nextItemMatch = isLast ? false : filters[curr + 1].type === filterItemType_enum.FilterItemType.TEXT || this.isDefaultFilterNumberVariation(filters[curr + 1]);
|
|
1342
|
-
if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
|
|
1343
|
-
filtersLines[currentLine].push(item);
|
|
1344
|
-
forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
|
|
1345
|
-
if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
|
|
1346
|
-
++currentLine;
|
|
1347
|
-
continue;
|
|
1348
|
-
}
|
|
1349
|
-
filtersLines[currentLine] = filtersLines[currentLine] || [];
|
|
1350
|
-
filtersLines[currentLine].push(item);
|
|
1351
|
-
++currentLine;
|
|
1352
|
-
}
|
|
1353
|
-
return Object.values(filtersLines);
|
|
1354
|
-
}
|
|
1355
|
-
renderFilterLine(filters) {
|
|
1356
|
-
const fullLine = filters.length === 1;
|
|
1357
|
-
return filters.map((filter) => this.renderFilterItem(filter, fullLine));
|
|
1358
|
-
}
|
|
1359
|
-
getIformedFiltersCount(listItems) {
|
|
1360
|
-
let countInformedItens = 0;
|
|
1361
|
-
listItems.forEach(item => {
|
|
1362
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1363
|
-
if (filterItemType_enum.FilterItemType.MULTI_LIST === item.type) {
|
|
1364
|
-
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;
|
|
1365
|
-
return;
|
|
1366
|
-
}
|
|
1367
|
-
if (filterItemType_enum.FilterItemType.CHECK_BOX_LIST === item.type) {
|
|
1368
|
-
countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
|
|
1369
|
-
.filter(([_, value]) => value === true)
|
|
1370
|
-
.map(([key, _]) => key).length;
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
if (item.groupedItems != undefined) {
|
|
1374
|
-
countInformedItens = item.groupedItems.filter(item => item.visible).length;
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
if (!!item.value) {
|
|
1378
|
-
countInformedItens++;
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
return countInformedItens;
|
|
1382
|
-
}
|
|
1383
|
-
renderCollapsibleFilterBox(label, listItems, isSingleItem, shouldRenderFooter = true) {
|
|
1384
|
-
if (!listItems.length)
|
|
1385
|
-
return null;
|
|
1386
|
-
const appliedFilters = this.getIformedFiltersCount(listItems);
|
|
1387
|
-
const lines = this.mountFiltersLines(listItems);
|
|
1388
|
-
return (index$1.h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (index$1.h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), index$1.h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (index$1.h("div", { class: "ez-flex ez-flex--justify-end grow" }, index$1.h("ez-button", { class: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
|
|
1389
|
-
}
|
|
1390
|
-
componentWillRender() {
|
|
1391
|
-
this._modalTitle = this.getCustomMessage('title');
|
|
1392
|
-
this._okButtonLabel = this.getCustomMessage('okButtonLabel');
|
|
1393
|
-
this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
|
|
1394
|
-
}
|
|
1395
|
-
componentDidLoad() {
|
|
1396
|
-
if (!this._originalFilterConfig)
|
|
1397
|
-
this._originalFilterConfig = this.filters;
|
|
1398
|
-
}
|
|
1399
|
-
render() {
|
|
1400
|
-
const customFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER);
|
|
1401
|
-
const quickFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.QUICK_FILTER);
|
|
1402
|
-
const otherFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.OTHER_FILTERS);
|
|
1403
|
-
return (index$1.h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, index$1.h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !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)))));
|
|
1404
|
-
}
|
|
1405
|
-
};
|
|
1406
|
-
SnkFilterModal.style = snkFilterModalCss;
|
|
1407
|
-
|
|
1408
726
|
exports.snk_filter_bar = SnkFilterBar;
|
|
1409
|
-
exports.snk_filter_item = SnkFilterItem;
|
|
1410
|
-
exports.snk_filter_list = SnkFilterList;
|
|
1411
|
-
exports.snk_filter_modal = SnkFilterModal;
|