@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
@@ -5,18 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index$1 = require('./index-1cf293c1.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-8b6def32.js');
|
9
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-7259cf65.js');
|
9
10
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
10
11
|
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
|
11
12
|
const index = require('./index-62760a9c.js');
|
12
13
|
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
13
|
-
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
14
|
-
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-7259cf65.js');
|
15
14
|
const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
|
16
|
-
const
|
15
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
17
16
|
const defaultFilters = require('./default-filters-a09bf82b.js');
|
18
|
-
require('./
|
19
|
-
require('./
|
17
|
+
const filterType_enum = require('./filter-type.enum-2bb46d2a.js');
|
18
|
+
const filterValidate = require('./filter-validate-6993f6f2.js');
|
19
|
+
require('./form-config-fetcher-dee08eb4.js');
|
20
|
+
require('./DataFetcher-2c37b6a1.js');
|
20
21
|
require('./PrintUtils-bcaeb82f.js');
|
21
22
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
22
23
|
|
@@ -210,51 +211,6 @@ function buildPersonalized(item) {
|
|
210
211
|
return { name: id, expression, params };
|
211
212
|
}
|
212
213
|
|
213
|
-
class SnkFilterModalFactory {
|
214
|
-
constructor({ filterConfig, configName, onComplete, getMessage, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
|
215
|
-
this._filterConfig = filterConfig;
|
216
|
-
this._configName = configName;
|
217
|
-
this._onComplete = onComplete;
|
218
|
-
this._getMessage = getMessage;
|
219
|
-
this._disablePersonalizedFilter = disablePersonalizedFilter;
|
220
|
-
this._addPersonalizedFilterFn = onAddPersonalizedFilter;
|
221
|
-
this._editPersonalizedFilterFn = onEditPersonalizedFilter;
|
222
|
-
this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
|
223
|
-
}
|
224
|
-
applyFilters(newFilterConfig) {
|
225
|
-
this._onComplete(newFilterConfig);
|
226
|
-
this._closeModal();
|
227
|
-
}
|
228
|
-
buildFilterModal() {
|
229
|
-
const filterModal = document.createElement("snk-filter-modal");
|
230
|
-
filterModal.className = "ez-size-height--full";
|
231
|
-
filterModal.filters = this._filterConfig;
|
232
|
-
filterModal.configName = this._configName;
|
233
|
-
filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
|
234
|
-
filterModal.getMessage = this._getMessage.bind(this);
|
235
|
-
filterModal.applyFilters = this.applyFilters.bind(this);
|
236
|
-
filterModal.closeModal = () => this._closeModal();
|
237
|
-
filterModal.addPersonalizedFilter = (isDefault) => this._addPersonalizedFilterFn(isDefault);
|
238
|
-
filterModal.editPersonalizedFilter = (id, isDefault) => this._editPersonalizedFilterFn(id, isDefault);
|
239
|
-
filterModal.deletePersonalizedFilter = (filter, configName, isDefault) => this._onDeletePersonalizedFilter(filter, configName, isDefault);
|
240
|
-
return filterModal;
|
241
|
-
}
|
242
|
-
async showModal() {
|
243
|
-
const filterModal = this.buildFilterModal();
|
244
|
-
const modalProps = {
|
245
|
-
content: filterModal,
|
246
|
-
position: 'right',
|
247
|
-
heightMode: 'full',
|
248
|
-
closeOutsideClick: false,
|
249
|
-
useScrimLight: true
|
250
|
-
};
|
251
|
-
this._closeModal = await utils.ApplicationUtils.showModal(modalProps);
|
252
|
-
}
|
253
|
-
async closeModal() {
|
254
|
-
this._closeModal();
|
255
|
-
}
|
256
|
-
}
|
257
|
-
|
258
214
|
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:12px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small);height:80%}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start;margin:var(--space--2, 2px) 0}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
|
259
215
|
|
260
216
|
const SnkFilterBar = class {
|
@@ -295,10 +251,13 @@ const SnkFilterBar = class {
|
|
295
251
|
this.filterBarLegacyConfigName = undefined;
|
296
252
|
this.autoLoad = undefined;
|
297
253
|
this.afterApplyConfig = undefined;
|
254
|
+
this.filterCustomConfig = undefined;
|
255
|
+
this.filterCustomConfigInterceptor = undefined;
|
298
256
|
this.allowDefault = undefined;
|
299
257
|
this.scrollerLocked = false;
|
300
258
|
this.showPersonalizedFilter = false;
|
301
259
|
this.personalizedFilterId = undefined;
|
260
|
+
this.isFilterModalOpen = false;
|
302
261
|
}
|
303
262
|
hasValidValue(item) {
|
304
263
|
if (item.value === undefined || item.value === null)
|
@@ -347,22 +306,28 @@ const SnkFilterBar = class {
|
|
347
306
|
this.processAfterUpdateConfig();
|
348
307
|
}
|
349
308
|
/**
|
350
|
-
* Faz o recarregamento da
|
309
|
+
* @description Faz o recarregamento da barra de filtros buscando o state no servidor.
|
310
|
+
* @async
|
311
|
+
* @return {Promise<void>} Retorna uma Promise que resolve quando o recarregamento for concluído.
|
351
312
|
*/
|
352
313
|
async reload() {
|
353
314
|
this.loadConfigFromStorage(true);
|
354
315
|
}
|
355
316
|
/**
|
356
|
-
* Retorna um item de filtro pelo ID.
|
317
|
+
* @description Retorna um item de filtro pelo ID.
|
318
|
+
* @async
|
319
|
+
* @param {string} id - ID do item de filtro.
|
320
|
+
* @returns {Promise<SnkFilterItemConfig | undefined>} O item de filtro correspondente ou undefined se não for encontrado.
|
357
321
|
*/
|
358
322
|
async getFilterItem(id) {
|
359
323
|
const item = this.filterConfig.find(item => item.id === id);
|
360
324
|
return Promise.resolve(core.ObjectUtils.copy(item));
|
361
325
|
}
|
362
326
|
/**
|
363
|
-
* Atualiza um item do filtro.
|
364
|
-
*
|
365
|
-
* @param
|
327
|
+
* @description Atualiza um item do filtro.
|
328
|
+
* @async
|
329
|
+
* @param {SnkFilterItemConfig} newFilterItem - Item com as informações atualizadas, caso o item não seja encontrado no array, ele não será modificado.
|
330
|
+
* @return {Promise<void>} Retorna uma Promise que resolve quando a atualização for concluída.
|
366
331
|
*/
|
367
332
|
async updateFilterItem(newFilterItem) {
|
368
333
|
const itemIndex = this.filterConfig.findIndex(item => item.id === newFilterItem.id);
|
@@ -375,9 +340,10 @@ const SnkFilterBar = class {
|
|
375
340
|
return Promise.resolve();
|
376
341
|
}
|
377
342
|
/**
|
378
|
-
* Adiciona um item de filtro.
|
379
|
-
*
|
380
|
-
* @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
|
343
|
+
* @description Adiciona um item de filtro.
|
344
|
+
* @async
|
345
|
+
* @param {SnkFilterItemConfig} filterItem - Item a ser adicionado, caso o item já exista com o ID, ele não será adicionado novamente.
|
346
|
+
* @return {Promise<void>} Retorna uma Promise que resolve quando o item for adicionado.
|
381
347
|
*/
|
382
348
|
async addFilterItem(filterItem) {
|
383
349
|
const itemIndex = this.filterConfig.findIndex(item => item.id === filterItem.id);
|
@@ -391,11 +357,10 @@ const SnkFilterBar = class {
|
|
391
357
|
return Promise.resolve();
|
392
358
|
}
|
393
359
|
/**
|
394
|
-
* Remove um item de filtro.
|
395
|
-
*
|
396
|
-
* @param filterID - ID do a ser
|
397
|
-
*
|
398
|
-
* @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
|
360
|
+
* @description Remove um item de filtro.
|
361
|
+
* @async
|
362
|
+
* @param {string} filterID - ID do item a ser removido.
|
363
|
+
* @returns {Promise<SnkFilterItemConfig|undefined>} Retorna o item de filtro removido, ou undefined caso não seja encontrado.
|
399
364
|
*/
|
400
365
|
async removeFilterItem(filterID) {
|
401
366
|
const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
|
@@ -440,7 +405,7 @@ const SnkFilterBar = class {
|
|
440
405
|
return;
|
441
406
|
}
|
442
407
|
this._loadingPending = false;
|
443
|
-
this.doLoadData(
|
408
|
+
this.doLoadData();
|
444
409
|
}
|
445
410
|
if (this._configUpdated) {
|
446
411
|
this._configUpdated = false;
|
@@ -467,7 +432,7 @@ const SnkFilterBar = class {
|
|
467
432
|
}
|
468
433
|
/**
|
469
434
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
470
|
-
* através de um pequeno
|
435
|
+
* através de um pequeno módulo na estrutura da aplicação:
|
471
436
|
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
472
437
|
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
|
473
438
|
*/
|
@@ -478,6 +443,9 @@ const SnkFilterBar = class {
|
|
478
443
|
}
|
479
444
|
return ((_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params)) || defaultValue;
|
480
445
|
}
|
446
|
+
async getFilters() {
|
447
|
+
return this.getFilter(null);
|
448
|
+
}
|
481
449
|
getFilter(_dataUnit) {
|
482
450
|
var _a;
|
483
451
|
const filters = [];
|
@@ -536,11 +504,11 @@ const SnkFilterBar = class {
|
|
536
504
|
const unpinnedItems = [];
|
537
505
|
this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
|
538
506
|
.filter(this.filterActiveFilter)
|
539
|
-
.forEach((item
|
507
|
+
.forEach((item) => {
|
540
508
|
item = core.ObjectUtils.copy(item);
|
541
509
|
const itemId = `filter-${item.id}`;
|
542
|
-
const filterItem = (index$1.h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class:
|
543
|
-
if (item.fixed || item.hardFixed) {
|
510
|
+
const filterItem = (index$1.h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: "ez-margin-horizontal--extra-small", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
511
|
+
if (item.fixed || item.hardFixed || item.required) {
|
544
512
|
pinnedItems.push(filterItem);
|
545
513
|
}
|
546
514
|
else {
|
@@ -549,9 +517,9 @@ const SnkFilterBar = class {
|
|
549
517
|
return filterItem;
|
550
518
|
});
|
551
519
|
const elements = [];
|
552
|
-
elements.push(...pinnedItems);
|
520
|
+
elements.push(...pinnedItems.reverse());
|
553
521
|
if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
|
554
|
-
elements.push(index$1.h("hr", { class: "ez-
|
522
|
+
elements.push(index$1.h("hr", { class: "ez-margin-horizontal--small ez-margin-vertical--auto ez-divider-vertical ez-divider--dark snk-filter-bar__divider" }));
|
555
523
|
}
|
556
524
|
elements.push(...unpinnedItems);
|
557
525
|
return elements;
|
@@ -576,7 +544,7 @@ const SnkFilterBar = class {
|
|
576
544
|
return normalized;
|
577
545
|
}
|
578
546
|
updateFilter(newItem) {
|
579
|
-
|
547
|
+
let config = this.filterConfig.map(item => {
|
580
548
|
newItem = this.normalizeItem(newItem);
|
581
549
|
if (item.id === newItem.id) {
|
582
550
|
if (core.ObjectUtils.objectToString(item) != core.ObjectUtils.objectToString(newItem)) {
|
@@ -586,6 +554,10 @@ const SnkFilterBar = class {
|
|
586
554
|
}
|
587
555
|
return item;
|
588
556
|
}).sort((a, b) => this._filtersComparator(a, b));
|
557
|
+
if (this.filterCustomConfigInterceptor) {
|
558
|
+
config = this.filterCustomConfigInterceptor(config);
|
559
|
+
}
|
560
|
+
this.filterConfig = config;
|
589
561
|
}
|
590
562
|
loadPermitions() {
|
591
563
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
@@ -607,6 +579,12 @@ const SnkFilterBar = class {
|
|
607
579
|
else {
|
608
580
|
config = await ConfigStorage.ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
|
609
581
|
}
|
582
|
+
if (this.filterCustomConfig) {
|
583
|
+
config = [...this.filterCustomConfig, ...config];
|
584
|
+
}
|
585
|
+
if (this.filterCustomConfigInterceptor) {
|
586
|
+
config = this.filterCustomConfigInterceptor(config);
|
587
|
+
}
|
610
588
|
this.filterConfig = config.map(item => this.normalizeItem(item));
|
611
589
|
this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
|
612
590
|
}
|
@@ -646,33 +624,17 @@ const SnkFilterBar = class {
|
|
646
624
|
this.updateFilter(evt.detail);
|
647
625
|
}
|
648
626
|
/**
|
649
|
-
* Abre o modal de filtros
|
627
|
+
* @description Abre o modal de filtros.
|
628
|
+
* @async
|
650
629
|
*/
|
651
630
|
async showFilterModal() {
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
};
|
657
|
-
let filtersConfigCopy = core.ObjectUtils.copy(this.filterConfig);
|
658
|
-
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
659
|
-
return itemA.originOrder - itemB.originOrder;
|
660
|
-
});
|
661
|
-
const factoryParams = {
|
662
|
-
filterConfig: filtersConfigCopy,
|
663
|
-
configName: this.configName,
|
664
|
-
onComplete: callbackOnApplyFilter,
|
665
|
-
disablePersonalizedFilter: this.disablePersonalizedFilter,
|
666
|
-
getMessage: (key, props) => this.getMessage(key, props),
|
667
|
-
onAddPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault),
|
668
|
-
onEditPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault),
|
669
|
-
onDeletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, filterItemType_enum.FilterItemType.PERSONALIZED, configName, isDefault),
|
670
|
-
};
|
671
|
-
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
672
|
-
await this._filterModalFactory.showModal();
|
631
|
+
if (this.isFilterModalOpen) {
|
632
|
+
return; // Evita abrir múltiplos modais
|
633
|
+
}
|
634
|
+
this.isFilterModalOpen = true;
|
673
635
|
}
|
674
636
|
addPersonalizedFilter(isDefault = false) {
|
675
|
-
this.
|
637
|
+
this.isFilterModalOpen = false;
|
676
638
|
this._isDefaultFilter = isDefault;
|
677
639
|
this.personalizedFilterId = undefined;
|
678
640
|
this.showPersonalizedFilter = true;
|
@@ -681,7 +643,7 @@ const SnkFilterBar = class {
|
|
681
643
|
});
|
682
644
|
}
|
683
645
|
editPersonalizedFilter(id, isDefault = false) {
|
684
|
-
this.
|
646
|
+
this.isFilterModalOpen = false;
|
685
647
|
this._isDefaultFilter = isDefault;
|
686
648
|
this.showPersonalizedFilter = true;
|
687
649
|
this.personalizedFilterId = id;
|
@@ -696,6 +658,15 @@ const SnkFilterBar = class {
|
|
696
658
|
ConfigStorage.ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
697
659
|
}
|
698
660
|
}
|
661
|
+
closeFilterModal() {
|
662
|
+
this.isFilterModalOpen = false;
|
663
|
+
}
|
664
|
+
applyFiltersFromModal(filters) {
|
665
|
+
var _a;
|
666
|
+
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
667
|
+
(_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
|
668
|
+
this.isFilterModalOpen = false;
|
669
|
+
}
|
699
670
|
handleHidePersonalizedFilter(reloadFilterBar) {
|
700
671
|
if (reloadFilterBar) {
|
701
672
|
this.loadConfigFromStorage().then(() => {
|
@@ -742,10 +713,14 @@ const SnkFilterBar = class {
|
|
742
713
|
if (this.showPersonalizedFilter) {
|
743
714
|
return index$1.h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, isDefaultFilter: this._isDefaultFilter, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
744
715
|
}
|
716
|
+
let filtersConfigCopy = core.ObjectUtils.copy(this.filterConfig);
|
717
|
+
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
718
|
+
return itemA.originOrder - itemB.originOrder;
|
719
|
+
});
|
745
720
|
if (this.mode !== "regular") {
|
746
|
-
return (index$1.h(index$1.Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (index$1.h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }))));
|
721
|
+
return (index$1.h(index$1.Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (index$1.h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) })), index$1.h("snk-filter-modal", { opened: this.isFilterModalOpen, filterConfig: this.filterConfig, configName: this.configName, disablePersonalizedFilter: this.disablePersonalizedFilter, getMessage: (key, props) => this.getMessage(key, props), applyFilters: (filters) => this.applyFiltersFromModal(filters), closeModal: () => this.closeFilterModal(), addPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault), editPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault), deletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, filterItemType_enum.FilterItemType.PERSONALIZED, configName, isDefault), filterCustomConfigInterceptor: this.filterCustomConfigInterceptor })));
|
747
722
|
}
|
748
|
-
return (index$1.h(index$1.Host, null, index$1.h("div", null, index$1.h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), index$1.h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, index$1.h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), index$1.h("ez-button", { class: "ez-padding-left--medium ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }, index$1.h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
723
|
+
return (index$1.h(index$1.Host, null, index$1.h("div", null, index$1.h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), index$1.h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, index$1.h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), index$1.h("ez-button", { class: "ez-padding-left--medium ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }, index$1.h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" })), index$1.h("snk-filter-modal", { opened: this.isFilterModalOpen, filterConfig: this.filterConfig, configName: this.configName, disablePersonalizedFilter: this.disablePersonalizedFilter, getMessage: (key, props) => this.getMessage(key, props), applyFilters: (filters) => this.applyFiltersFromModal(filters), closeModal: () => this.closeFilterModal(), addPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault), editPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault), deletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, filterItemType_enum.FilterItemType.PERSONALIZED, configName, isDefault), filterCustomConfigInterceptor: this.filterCustomConfigInterceptor })));
|
749
724
|
}
|
750
725
|
get _element() { return index$1.getElement(this); }
|
751
726
|
static get watchers() { return {
|
@@ -761,6 +736,7 @@ const SnkFilterItem = class {
|
|
761
736
|
index$1.registerInstance(this, hostRef);
|
762
737
|
this.visibleChanged = index$1.createEvent(this, "visibleChanged", 7);
|
763
738
|
this.filterChange = index$1.createEvent(this, "filterChange", 3);
|
739
|
+
this._keyboardManager = undefined;
|
764
740
|
this.detailIsVisible = undefined;
|
765
741
|
this.config = undefined;
|
766
742
|
this.getMessage = undefined;
|
@@ -784,13 +760,15 @@ const SnkFilterItem = class {
|
|
784
760
|
if (open) {
|
785
761
|
await ((_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.setBlur());
|
786
762
|
await this._popover.showUnder(this._chipElement);
|
763
|
+
await this._filterDetail.setFocusField();
|
787
764
|
}
|
788
765
|
}
|
789
766
|
/**
|
790
767
|
* Oculta os detalhes de um item da lista.
|
791
768
|
*/
|
792
769
|
async hideDetail() {
|
793
|
-
|
770
|
+
var _a;
|
771
|
+
await ((_a = this._popover) === null || _a === void 0 ? void 0 : _a.hide());
|
794
772
|
}
|
795
773
|
getConfigChanges() {
|
796
774
|
var _a;
|
@@ -810,12 +788,15 @@ const SnkFilterItem = class {
|
|
810
788
|
this.filterChange.emit(configChanged);
|
811
789
|
}
|
812
790
|
else {
|
813
|
-
this.togglePopover();
|
791
|
+
this.togglePopover(event);
|
814
792
|
}
|
815
793
|
}
|
816
794
|
async togglePopover(event) {
|
817
795
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
818
796
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
797
|
+
if (this.config.enabled === false) {
|
798
|
+
return;
|
799
|
+
}
|
819
800
|
if (this.detailIsVisible) {
|
820
801
|
await this.hideDetail();
|
821
802
|
}
|
@@ -964,8 +945,9 @@ const SnkFilterItem = class {
|
|
964
945
|
return undefined;
|
965
946
|
}
|
966
947
|
hasActiveElements(value) {
|
967
|
-
var _a
|
968
|
-
|
948
|
+
var _a;
|
949
|
+
const list = Array.isArray(value) ? value : value === null || value === void 0 ? void 0 : value.elements;
|
950
|
+
return ((_a = list === null || list === void 0 ? void 0 : list.filter((val) => val === null || val === void 0 ? void 0 : val.check)) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
969
951
|
}
|
970
952
|
hasActiveValue(config) {
|
971
953
|
return (config.type !== filterItemType_enum.FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
|
@@ -980,12 +962,67 @@ const SnkFilterItem = class {
|
|
980
962
|
}
|
981
963
|
return this.hasActiveValue(this.config);
|
982
964
|
}
|
983
|
-
handleVisibilityPopover(event) {
|
965
|
+
async handleVisibilityPopover(event) {
|
984
966
|
this.detailIsVisible = event.detail;
|
967
|
+
if (!this.detailIsVisible) {
|
968
|
+
await this._filterDetail.clearValue();
|
969
|
+
}
|
970
|
+
}
|
971
|
+
getCustomMessage(key, params) {
|
972
|
+
var _a;
|
973
|
+
return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
|
974
|
+
}
|
975
|
+
hasValue() {
|
976
|
+
if (this.config.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
977
|
+
return this.hasActiveElements(this.config.value);
|
978
|
+
}
|
979
|
+
return this.config.value !== undefined && this.config.value !== null;
|
980
|
+
}
|
981
|
+
getTooltipMessage() {
|
982
|
+
var _a, _b;
|
983
|
+
if (this.config.required && !this.hasValue()) {
|
984
|
+
return {
|
985
|
+
message: (_a = this.config.requiredMessage) !== null && _a !== void 0 ? _a : this.getCustomMessage('validations.requiredFilter'),
|
986
|
+
type: 'error'
|
987
|
+
};
|
988
|
+
}
|
989
|
+
if (this.config.enabled === false && this.config.disabledMessage) {
|
990
|
+
return { message: this.config.disabledMessage, type: 'warning' };
|
991
|
+
}
|
992
|
+
return {
|
993
|
+
message: (_b = this.config.defaultMessage) !== null && _b !== void 0 ? _b : this.getLabel(true),
|
994
|
+
type: 'default'
|
995
|
+
};
|
996
|
+
}
|
997
|
+
getTypeChip(type) {
|
998
|
+
switch (type) {
|
999
|
+
case 'default':
|
1000
|
+
return 'secondary';
|
1001
|
+
case 'warning':
|
1002
|
+
return 'warning-light';
|
1003
|
+
case 'error':
|
1004
|
+
return 'error-light';
|
1005
|
+
case 'success':
|
1006
|
+
return 'success-light';
|
1007
|
+
default:
|
1008
|
+
return type;
|
1009
|
+
}
|
1010
|
+
}
|
1011
|
+
initKeyboardManager() {
|
1012
|
+
this._keyboardManager = new core.KeyboardManager({ element: this._filterItemElement, propagate: true });
|
1013
|
+
this._keyboardManager
|
1014
|
+
.bind("Escape", () => this.hideDetail());
|
1015
|
+
}
|
1016
|
+
connectedCallback() {
|
1017
|
+
this.initKeyboardManager();
|
1018
|
+
}
|
1019
|
+
disconnectedCallback() {
|
1020
|
+
this._keyboardManager.unbindAllShortcutKeys();
|
985
1021
|
}
|
986
1022
|
render() {
|
987
1023
|
const leftIcon = this.getLeftIconName();
|
988
|
-
|
1024
|
+
const { type, message } = this.getTooltipMessage();
|
1025
|
+
return (index$1.h(index$1.Host, null, this.showChips && (index$1.h("ez-tooltip", { id: this.config.id, message: message, type: type, active: !this.detailIsVisible, strategy: "fixed" }, index$1.h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip(), onClick: (event) => this.togglePopover(event), disableAutoUpdateValue: true, type: this.getTypeChip(type), enabled: this.config.enabled }, leftIcon && (index$1.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, slot: "leftIcon" })), index$1.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), slot: "rightIcon", id: "removeFilter", onClick: (event) => this.clearFilter(event) })))), index$1.h("ez-popover-core", { ref: elem => this._popover = elem, onEzVisibilityChange: (event) => this.handleVisibilityPopover(event) }, index$1.h("snk-filter-detail", { ref: ref => this._filterDetail = ref, key: this.config.id, config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips && !this.config.required, removalBlocked: this.config.required }))));
|
989
1026
|
}
|
990
1027
|
get _filterItemElement() { return index$1.getElement(this); }
|
991
1028
|
static get watchers() { return {
|
@@ -1138,14 +1175,17 @@ const SnkFilterList = class {
|
|
1138
1175
|
get _element() { return index$1.getElement(this); }
|
1139
1176
|
};
|
1140
1177
|
|
1141
|
-
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{
|
1178
|
+
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{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}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
1142
1179
|
|
1143
1180
|
const SnkFilterModal = class {
|
1144
1181
|
constructor(hostRef) {
|
1145
1182
|
index$1.registerInstance(this, hostRef);
|
1183
|
+
this.filters = [];
|
1184
|
+
this.filtersWithError = [];
|
1146
1185
|
this.getMessage = undefined;
|
1147
1186
|
this.configName = undefined;
|
1148
|
-
this.
|
1187
|
+
this.filterConfig = undefined;
|
1188
|
+
this.opened = false;
|
1149
1189
|
this.applyFilters = undefined;
|
1150
1190
|
this.closeModal = undefined;
|
1151
1191
|
this.addPersonalizedFilter = undefined;
|
@@ -1154,6 +1194,11 @@ const SnkFilterModal = class {
|
|
1154
1194
|
this.filtersToDelete = [];
|
1155
1195
|
this.filterDefaultToDelete = undefined;
|
1156
1196
|
this.disablePersonalizedFilter = undefined;
|
1197
|
+
this.filterCustomConfigInterceptor = undefined;
|
1198
|
+
}
|
1199
|
+
filterConfigChangeHandler(newValue) {
|
1200
|
+
this.filters = core.ObjectUtils.copy(newValue);
|
1201
|
+
this.validateFilters();
|
1157
1202
|
}
|
1158
1203
|
/**
|
1159
1204
|
* Emitido quando um filtro personalizado é deletado.
|
@@ -1212,7 +1257,7 @@ const SnkFilterModal = class {
|
|
1212
1257
|
});
|
1213
1258
|
}
|
1214
1259
|
hasChangeToSave() {
|
1215
|
-
const hasChangesPersonalizedFilters = core.ObjectUtils.objectToString(this.filters) !== core.ObjectUtils.objectToString(this.
|
1260
|
+
const hasChangesPersonalizedFilters = core.ObjectUtils.objectToString(this.filters) !== core.ObjectUtils.objectToString(this.filters);
|
1216
1261
|
return hasChangesPersonalizedFilters;
|
1217
1262
|
}
|
1218
1263
|
handleClose() {
|
@@ -1227,6 +1272,9 @@ const SnkFilterModal = class {
|
|
1227
1272
|
});
|
1228
1273
|
}
|
1229
1274
|
handleApplyFilters() {
|
1275
|
+
if (!this.validateFilters()) {
|
1276
|
+
return;
|
1277
|
+
}
|
1230
1278
|
const filterPersonalized = this.filters.find(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER || filter.filterType === filterType_enum.FilterType.DEFAULT_FILTER);
|
1231
1279
|
if (this.isValidCustomFilter(filterPersonalized)) {
|
1232
1280
|
this.applyFilters(this.filters);
|
@@ -1265,8 +1313,14 @@ const SnkFilterModal = class {
|
|
1265
1313
|
break;
|
1266
1314
|
}
|
1267
1315
|
}
|
1268
|
-
handleFilterChange(
|
1269
|
-
|
1316
|
+
handleFilterChange(event) {
|
1317
|
+
event.stopPropagation();
|
1318
|
+
const filterConfig = event.detail;
|
1319
|
+
let config = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
|
1320
|
+
if (this.filterCustomConfigInterceptor) {
|
1321
|
+
config = this.filterCustomConfigInterceptor(config);
|
1322
|
+
}
|
1323
|
+
this.filters = core.ObjectUtils.copy(config);
|
1270
1324
|
}
|
1271
1325
|
handleClearFilterList(filterList) {
|
1272
1326
|
this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
@@ -1299,8 +1353,22 @@ const SnkFilterModal = class {
|
|
1299
1353
|
});
|
1300
1354
|
return valueList;
|
1301
1355
|
}
|
1356
|
+
validateFilters() {
|
1357
|
+
const notValidFilters = filterValidate.getInvalidFilters(this.filters);
|
1358
|
+
this.filtersWithError = notValidFilters.map(item => item.id);
|
1359
|
+
if (notValidFilters.length === 0) {
|
1360
|
+
return true;
|
1361
|
+
}
|
1362
|
+
notValidFilters.forEach(item => {
|
1363
|
+
const filterItem = this._element.querySelector(`#filter-item-${item.id}`);
|
1364
|
+
if (filterItem) {
|
1365
|
+
filterItem["errorMessage"] = item.requiredMessage || this.getCustomMessage('validations.requiredFilter');
|
1366
|
+
}
|
1367
|
+
});
|
1368
|
+
return false;
|
1369
|
+
}
|
1302
1370
|
renderFilterItem(filterItem, fullRow) {
|
1303
|
-
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
|
1371
|
+
return (index$1.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() }));
|
1304
1372
|
}
|
1305
1373
|
isDefaultFilterNumberVariation(filter) {
|
1306
1374
|
var _a;
|
@@ -1337,8 +1405,9 @@ const SnkFilterModal = class {
|
|
1337
1405
|
}
|
1338
1406
|
getIformedFiltersCount(listItems) {
|
1339
1407
|
let countInformedItens = 0;
|
1340
|
-
listItems.forEach(
|
1408
|
+
listItems.forEach(localItem => {
|
1341
1409
|
var _a, _b, _c, _d, _e, _f;
|
1410
|
+
const item = this.filterConfig.find(filter => filter.id === localItem.id);
|
1342
1411
|
if (filterItemType_enum.FilterItemType.MULTI_LIST === item.type) {
|
1343
1412
|
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;
|
1344
1413
|
return;
|
@@ -1364,7 +1433,8 @@ const SnkFilterModal = class {
|
|
1364
1433
|
return null;
|
1365
1434
|
const appliedFilters = this.getIformedFiltersCount(listItems);
|
1366
1435
|
const lines = this.mountFiltersLines(listItems);
|
1367
|
-
|
1436
|
+
const countFiltersWithError = this.filtersWithError.filter(item => listItems.some(filter => filter.id === item)).length;
|
1437
|
+
return (index$1.h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, index$1.h("div", { class: "ez-flex ez-flex--justify-end grow", slot: "rightSlot" }, !!appliedFilters && (index$1.h("ez-badge", { class: "ez-badge--primary-subtle", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), !!countFiltersWithError && (index$1.h("ez-badge", { class: "ez-badge--error-subtle", label: countFiltersWithError === null || countFiltersWithError === void 0 ? void 0 : countFiltersWithError.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: this.getCustomMessage("clearModal"), onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
|
1368
1438
|
}
|
1369
1439
|
handleDeleteFilter() {
|
1370
1440
|
this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.info.deleteDefaultFilterConfirm'), "alert-circle-inverted", "critical").then((actionConfirmed) => {
|
@@ -1398,6 +1468,7 @@ const SnkFilterModal = class {
|
|
1398
1468
|
}
|
1399
1469
|
componentWillLoad() {
|
1400
1470
|
this._application = core.ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
1471
|
+
this.filters = core.ObjectUtils.copy(this.filterConfig);
|
1401
1472
|
}
|
1402
1473
|
componentWillRender() {
|
1403
1474
|
this._modalTitle = this.getCustomMessage('title');
|
@@ -1405,16 +1476,19 @@ const SnkFilterModal = class {
|
|
1405
1476
|
this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
|
1406
1477
|
}
|
1407
1478
|
componentDidLoad() {
|
1408
|
-
|
1409
|
-
this._originalFilterConfig = this.filters;
|
1479
|
+
this.validateFilters();
|
1410
1480
|
}
|
1411
1481
|
render() {
|
1412
1482
|
this._defaultFilter = this.getDefaultFilter(this.filters);
|
1413
1483
|
const customFilters = this.getCustomFilter(this.filters);
|
1414
1484
|
const quickFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.QUICK_FILTER);
|
1415
1485
|
const otherFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.OTHER_FILTERS);
|
1416
|
-
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" }, index$1.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)))));
|
1486
|
+
return (index$1.h("ez-modal", { opened: this.opened, modalSize: "col--sd-3", align: "right", heightMode: "full", closeEsc: true }, 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" }, index$1.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))))));
|
1417
1487
|
}
|
1488
|
+
get _element() { return index$1.getElement(this); }
|
1489
|
+
static get watchers() { return {
|
1490
|
+
"filterConfig": ["filterConfigChangeHandler"]
|
1491
|
+
}; }
|
1418
1492
|
};
|
1419
1493
|
SnkFilterModal.style = snkFilterModalCss;
|
1420
1494
|
|