@sankhyalabs/sankhyablocks 8.16.0-dev.4 → 8.16.0-dev.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-ecc0ed20.js} +3 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-37c7cbcf.js} +64 -22
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-bae64d0d.js} +7 -3
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-a36ae041.js} +48 -20
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/index-f9e81701.js +8 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-490a86c3.js} +7 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +38 -29
- package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +381 -7
- package/dist/cjs/snk-crud.cjs.entry.js +16 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +19 -18
- package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-b460f1da.js} +42 -22
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +12 -13
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1411 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +58 -21
- package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-de0a5c57.js} +27 -14
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +66 -27
- package/dist/cjs/snk-taskbar.cjs.entry.js +24 -1
- package/dist/collection/collection-manifest.json +11 -31
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-attach/snk-attach.js +25 -16
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +97 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -4
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +70 -7
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +4 -4
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +5 -5
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +57 -20
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +59 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +72 -18
- package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
- package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +74 -8
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +91 -16
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +65 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/collection/lib/utils/CrudUtils.js +25 -16
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/collection/sw.js +46 -0
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +65 -21
- package/dist/components/DataFetcher.js +22 -16
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +72 -18
- package/dist/components/SnkMessageBuilder.js +7 -3
- package/dist/components/dataunit-fetcher.js +47 -17
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/pesquisa-fetcher.js +6 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-attach2.js +34 -25
- package/dist/components/snk-crud.js +15 -2
- package/dist/components/snk-data-exporter2.js +12 -11
- package/dist/components/snk-data-unit2.js +44 -60
- package/dist/components/snk-detail-view2.js +28 -13
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +35 -22
- package/dist/components/snk-filter-binary-select.js +1 -1
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +17 -4
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +51 -12
- package/dist/components/snk-personalized-filter-editor.js +1 -1
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +59 -16
- package/dist/components/snk-taskbar2.js +25 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-881c41a9.js} +65 -24
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-f1a0fc92.js} +74 -20
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-6fff4a4c.js} +7 -3
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-fd58c640.js} +48 -18
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/index-a7d3d3f1.js +8 -28
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-50fc7e6b.js} +7 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +18 -15
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +39 -30
- package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +382 -10
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +17 -8
- package/dist/esm/snk-data-exporter.entry.js +20 -19
- package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-590225b5.js} +42 -22
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +13 -14
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +1404 -0
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +53 -16
- package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-2f4dcdc5.js} +28 -15
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +63 -24
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +24 -1
- package/dist/sankhyablocks/p-052213ba.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-0b6cd238.entry.js +1 -0
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-242d010e.entry.js +1 -0
- package/dist/sankhyablocks/p-275de842.entry.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
- package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
- package/dist/sankhyablocks/p-47bce500.js +60 -0
- package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
- package/dist/sankhyablocks/p-583517ba.entry.js +1 -0
- package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
- package/dist/sankhyablocks/p-5e51e833.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/p-6114ee36.entry.js +1 -0
- package/dist/sankhyablocks/p-72c10005.entry.js +1 -0
- package/dist/sankhyablocks/p-7bd9683d.js +1 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-8a9638ae.js} +2 -2
- package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
- package/dist/sankhyablocks/p-ab1645fb.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-cefb0ee1.entry.js +1 -0
- package/dist/sankhyablocks/p-cfa1b199.js +1 -0
- package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-dbe6174a.entry.js} +2 -2
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/p-fa6c5826.entry.js +1 -0
- package/dist/sankhyablocks/p-fadc8339.js +1 -0
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd13b4d2.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +13 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +113 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -1
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +4 -3
- package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -714
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
- package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
- package/dist/cjs/snk-form.cjs.entry.js +0 -143
- package/dist/esm/snk-config-options.entry.js +0 -235
- package/dist/esm/snk-filter-bar.entry.js +0 -710
- package/dist/esm/snk-filter-item.entry.js +0 -308
- package/dist/esm/snk-filter-list.entry.js +0 -148
- package/dist/esm/snk-filter-modal.entry.js +0 -245
- package/dist/esm/snk-form.entry.js +0 -139
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-3a216b81.entry.js +0 -1
- package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
- package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
- package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
- package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
- package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
- package/dist/sankhyablocks/p-cefba299.js +0 -1
- package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fcac4dfc.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -1,710 +0,0 @@
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
3
|
-
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
4
|
-
import { C as ConfigStorage } from './ConfigStorage-86187da3.js';
|
5
|
-
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
6
|
-
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
7
|
-
import { F as FilterOperand } from './index-ae591a44.js';
|
8
|
-
import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
|
9
|
-
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
10
|
-
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
|
11
|
-
import './form-config-fetcher-30fb808f.js';
|
12
|
-
import './DataFetcher-c1baf61d.js';
|
13
|
-
import './PrintUtils-3e4ff0f5.js';
|
14
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
15
|
-
|
16
|
-
const buildFilter = (item) => {
|
17
|
-
switch (item.type) {
|
18
|
-
case FilterItemType.DEFAULT_FILTER:
|
19
|
-
return buildDefault(item);
|
20
|
-
case FilterItemType.BINARY_SELECT:
|
21
|
-
return buildBinary(item);
|
22
|
-
case FilterItemType.MULTI_SELECT:
|
23
|
-
return buildMultSelect(item);
|
24
|
-
case FilterItemType.MULTI_LIST:
|
25
|
-
return buildMultiList(item);
|
26
|
-
case FilterItemType.PERIOD:
|
27
|
-
return buildPeriod(item);
|
28
|
-
case FilterItemType.SEARCH:
|
29
|
-
return buildSearch(item);
|
30
|
-
case FilterItemType.TEXT:
|
31
|
-
return buildText(item);
|
32
|
-
case FilterItemType.NUMBER:
|
33
|
-
return buildNumber(item);
|
34
|
-
case FilterItemType.PERSONALIZED:
|
35
|
-
return buildPersonalized(item);
|
36
|
-
case FilterItemType.CHECK_BOX_LIST:
|
37
|
-
return buildCheckboxList(item);
|
38
|
-
default:
|
39
|
-
return undefined;
|
40
|
-
}
|
41
|
-
};
|
42
|
-
function buildDefault(item) {
|
43
|
-
return { name: item.id, expression: item.props.expression, params: [] };
|
44
|
-
}
|
45
|
-
function buildBinary(item) {
|
46
|
-
const { id, value, props } = item;
|
47
|
-
const options = props.options;
|
48
|
-
const selectedOption = options.find(opt => opt.name === value);
|
49
|
-
return { name: id, expression: selectedOption.expression, params: [] };
|
50
|
-
}
|
51
|
-
function buildMultSelect(item) {
|
52
|
-
const { id, value, props } = item;
|
53
|
-
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
54
|
-
}
|
55
|
-
function buildMultiList(item) {
|
56
|
-
const { id, value, props } = item;
|
57
|
-
const parsedValues = parseMultiListValues(value);
|
58
|
-
if (parsedValues.length > 0) {
|
59
|
-
return {
|
60
|
-
name: id,
|
61
|
-
expression: props.expression,
|
62
|
-
params: [{
|
63
|
-
name: id,
|
64
|
-
dataType: DataType.TEXT,
|
65
|
-
value: JSON.stringify(parsedValues)
|
66
|
-
}]
|
67
|
-
};
|
68
|
-
}
|
69
|
-
}
|
70
|
-
function buildCheckboxList(item) {
|
71
|
-
var _a;
|
72
|
-
const { id, value, props } = item;
|
73
|
-
const selectedOptionNames = Object.entries(value !== null && value !== void 0 ? value : {})
|
74
|
-
.filter(([_, valueChecked]) => valueChecked === true)
|
75
|
-
.map(([key, _]) => key);
|
76
|
-
const selectedOptionsObject = (_a = props.options) === null || _a === void 0 ? void 0 : _a.filter(option => selectedOptionNames.includes(option.name));
|
77
|
-
return { name: id, expression: buildCheckboxListExpression(selectedOptionsObject), params: [] };
|
78
|
-
}
|
79
|
-
function buildCheckboxListExpression(options) {
|
80
|
-
let expression = "";
|
81
|
-
options.forEach((option, index) => {
|
82
|
-
var _a;
|
83
|
-
expression += ` ${index > 0 ? ((_a = option.operand) !== null && _a !== void 0 ? _a : 'OR') : ''} ${option.expression}`;
|
84
|
-
});
|
85
|
-
return expression.trim();
|
86
|
-
}
|
87
|
-
function parseMultiListValues(multiListValue) {
|
88
|
-
var _a, _b;
|
89
|
-
const value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
|
90
|
-
return value.filter(item => item === null || item === void 0 ? void 0 : item.check).map(({ id }) => Number.isNaN(+id) ? String(id) : Number(id));
|
91
|
-
}
|
92
|
-
function buildPeriod(item) {
|
93
|
-
const { id, value, props } = item;
|
94
|
-
let { end, start } = value;
|
95
|
-
if (typeof end === "string") {
|
96
|
-
end = new Date(end);
|
97
|
-
}
|
98
|
-
if (typeof start === "string") {
|
99
|
-
start = new Date(start);
|
100
|
-
}
|
101
|
-
const params = [];
|
102
|
-
let expression;
|
103
|
-
if (end && start) {
|
104
|
-
expression = props.expression.fullfill;
|
105
|
-
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
106
|
-
}
|
107
|
-
else {
|
108
|
-
if (start) {
|
109
|
-
expression = props.expression.onlystart;
|
110
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
111
|
-
}
|
112
|
-
else {
|
113
|
-
expression = props.expression.onlyend;
|
114
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
115
|
-
}
|
116
|
-
}
|
117
|
-
return { name: id, expression, params };
|
118
|
-
}
|
119
|
-
function buildSearch(item) {
|
120
|
-
const { id, value, props } = item;
|
121
|
-
const expression = props.expression;
|
122
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
123
|
-
}
|
124
|
-
function buildText(item) {
|
125
|
-
let { id, value, props } = item;
|
126
|
-
const expression = props.expression;
|
127
|
-
if (!StringUtils.isEmpty(props.likeAs)) {
|
128
|
-
value = buildLikeValue(value, props.likeAs);
|
129
|
-
}
|
130
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
131
|
-
}
|
132
|
-
function buildNumber(item) {
|
133
|
-
const { id, value, props } = item;
|
134
|
-
const variation = props.variation;
|
135
|
-
if (variation === FilterNumberVariation.INTERVAL) {
|
136
|
-
const { start, end } = value !== null && value !== void 0 ? value : { start: 0, end: 0 };
|
137
|
-
if (start && end) {
|
138
|
-
return {
|
139
|
-
name: id,
|
140
|
-
expression: props.intervalExpression.fullfill,
|
141
|
-
params: [
|
142
|
-
{ name: `${id}.START`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) },
|
143
|
-
{ name: `${id}.END`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
|
144
|
-
]
|
145
|
-
};
|
146
|
-
}
|
147
|
-
if (start) {
|
148
|
-
return {
|
149
|
-
name: id,
|
150
|
-
expression: props.intervalExpression.onlystart,
|
151
|
-
params: [
|
152
|
-
{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) }
|
153
|
-
]
|
154
|
-
};
|
155
|
-
}
|
156
|
-
if (end) {
|
157
|
-
return {
|
158
|
-
name: id,
|
159
|
-
expression: props.intervalExpression.onlyend,
|
160
|
-
params: [
|
161
|
-
{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
|
162
|
-
]
|
163
|
-
};
|
164
|
-
}
|
165
|
-
}
|
166
|
-
const expression = props.expression;
|
167
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
168
|
-
}
|
169
|
-
function buildLikeValue(valueAsString, likeAs) {
|
170
|
-
if (likeAs === "CONTANIS") {
|
171
|
-
return `%${valueAsString}%`;
|
172
|
-
}
|
173
|
-
else if (likeAs === "STARTS_WITH") {
|
174
|
-
return `${valueAsString}%`;
|
175
|
-
}
|
176
|
-
else if (likeAs === "ENDS_WITH") {
|
177
|
-
return `%${valueAsString}`;
|
178
|
-
}
|
179
|
-
return valueAsString;
|
180
|
-
}
|
181
|
-
function buildPersonalized(item) {
|
182
|
-
const { id, groupedItems = [] } = item;
|
183
|
-
const activeFilters = groupedItems.filter(groupItem => !!groupItem.visible);
|
184
|
-
const filters = activeFilters.map(item => {
|
185
|
-
var _a;
|
186
|
-
const expression = item.props.expression;
|
187
|
-
const params = (((_a = item.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
|
188
|
-
const valuesArray = Array.from(item.value || 0);
|
189
|
-
const dataType = param.dataType;
|
190
|
-
let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
|
191
|
-
if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
|
192
|
-
paramValue = paramValue["value"];
|
193
|
-
}
|
194
|
-
if (paramValue == undefined && dataType === DataType.BOOLEAN) {
|
195
|
-
paramValue = false;
|
196
|
-
}
|
197
|
-
return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
|
198
|
-
});
|
199
|
-
return { expression, name: item.id, params };
|
200
|
-
});
|
201
|
-
const expression = filters.map(filter => `(${filter.expression})`).join(` ${FilterOperand.AND} `);
|
202
|
-
const params = filters.flatMap(filter => filter.params);
|
203
|
-
return { name: id, expression, params };
|
204
|
-
}
|
205
|
-
|
206
|
-
class SnkFilterModalFactory {
|
207
|
-
constructor({ filterConfig, configName, onComplete, getMessage, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
|
208
|
-
this._filterConfig = filterConfig;
|
209
|
-
this._configName = configName;
|
210
|
-
this._onComplete = onComplete;
|
211
|
-
this._getMessage = getMessage;
|
212
|
-
this._disablePersonalizedFilter = disablePersonalizedFilter;
|
213
|
-
this._addPersonalizedFilterFn = onAddPersonalizedFilter;
|
214
|
-
this._editPersonalizedFilterFn = onEditPersonalizedFilter;
|
215
|
-
this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
|
216
|
-
}
|
217
|
-
applyFilters(newFilterConfig) {
|
218
|
-
this._onComplete(newFilterConfig);
|
219
|
-
this._closeModal();
|
220
|
-
}
|
221
|
-
buildFilterModal() {
|
222
|
-
const filterModal = document.createElement("snk-filter-modal");
|
223
|
-
filterModal.className = "ez-size-height--full";
|
224
|
-
filterModal.filters = this._filterConfig;
|
225
|
-
filterModal.configName = this._configName;
|
226
|
-
filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
|
227
|
-
filterModal.getMessage = this._getMessage.bind(this);
|
228
|
-
filterModal.applyFilters = this.applyFilters.bind(this);
|
229
|
-
filterModal.closeModal = () => this._closeModal();
|
230
|
-
filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
|
231
|
-
filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
|
232
|
-
filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
|
233
|
-
return filterModal;
|
234
|
-
}
|
235
|
-
async showModal() {
|
236
|
-
const filterModal = this.buildFilterModal();
|
237
|
-
const modalProps = {
|
238
|
-
content: filterModal,
|
239
|
-
position: 'left',
|
240
|
-
heightMode: 'full',
|
241
|
-
closeOutsideClick: false,
|
242
|
-
useScrimLight: true
|
243
|
-
};
|
244
|
-
this._closeModal = await ApplicationUtils.showModal(modalProps);
|
245
|
-
}
|
246
|
-
async closeModal() {
|
247
|
-
this._closeModal();
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
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:8px}[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)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.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%}";
|
252
|
-
|
253
|
-
const SnkFilterBar = class {
|
254
|
-
constructor(hostRef) {
|
255
|
-
registerInstance(this, hostRef);
|
256
|
-
this.configUpdated = createEvent(this, "configUpdated", 7);
|
257
|
-
this._updateSequence = [];
|
258
|
-
this._loadingPending = false;
|
259
|
-
this._configUpdated = false;
|
260
|
-
this._firstLoad = true;
|
261
|
-
this._pendingVariables = false;
|
262
|
-
this._customfiltersToBeUpdated = [];
|
263
|
-
this._calculateSortIndex = (item) => {
|
264
|
-
let index = item.hardFixed ? 1000000 : 0;
|
265
|
-
//campos Hard Fixed não variam a ordem
|
266
|
-
if (!item.hardFixed) {
|
267
|
-
index += item.fixed ? 100000 : 0;
|
268
|
-
index += item.value == undefined ? 0 : 10000;
|
269
|
-
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
270
|
-
}
|
271
|
-
return index;
|
272
|
-
};
|
273
|
-
this._filtersComparator = (a, b) => {
|
274
|
-
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
275
|
-
};
|
276
|
-
this.dataUnit = undefined;
|
277
|
-
this.title = undefined;
|
278
|
-
this.configName = undefined;
|
279
|
-
this.resourceID = undefined;
|
280
|
-
this.mode = "regular";
|
281
|
-
this.filterConfig = undefined;
|
282
|
-
this.messagesBuilder = undefined;
|
283
|
-
this.disablePersonalizedFilter = undefined;
|
284
|
-
this.filterBarLegacyConfigName = undefined;
|
285
|
-
this.autoLoad = undefined;
|
286
|
-
this.allowDefault = undefined;
|
287
|
-
this.scrollerLocked = false;
|
288
|
-
this.showPersonalizedFilter = false;
|
289
|
-
this.personalizedFilterId = undefined;
|
290
|
-
}
|
291
|
-
observeFilterConfig(newValue, oldValue) {
|
292
|
-
if (ObjectUtils.equals(newValue, oldValue))
|
293
|
-
return;
|
294
|
-
this.handleFilterConfigsChanged(oldValue, newValue);
|
295
|
-
}
|
296
|
-
handleFilterConfigsChanged(oldValue, newValue) {
|
297
|
-
if (oldValue != undefined && newValue == undefined) {
|
298
|
-
this._loadingPending = true;
|
299
|
-
this._configUpdated = true;
|
300
|
-
}
|
301
|
-
else {
|
302
|
-
const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
|
303
|
-
if (oldItems.size === 0 && newValue.length > 0) {
|
304
|
-
this._loadingPending = true;
|
305
|
-
this._configUpdated = false;
|
306
|
-
}
|
307
|
-
else {
|
308
|
-
newValue.forEach(newItem => {
|
309
|
-
const oldItem = oldItems.get(newItem.id);
|
310
|
-
if (oldItem != undefined) {
|
311
|
-
this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
|
312
|
-
this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
|
313
|
-
if (!this._loadingPending) {
|
314
|
-
const groupedChanged = ObjectUtils.objectToString(oldItem.groupedItems) != ObjectUtils.objectToString(newItem.groupedItems);
|
315
|
-
this._configUpdated = this._configUpdated || groupedChanged;
|
316
|
-
this._loadingPending = this._loadingPending || groupedChanged;
|
317
|
-
}
|
318
|
-
}
|
319
|
-
else {
|
320
|
-
this._configUpdated = true;
|
321
|
-
this._loadingPending = this._loadingPending || newItem.value != undefined;
|
322
|
-
}
|
323
|
-
});
|
324
|
-
}
|
325
|
-
}
|
326
|
-
if (this._loadingPending || this._configUpdated)
|
327
|
-
this.configUpdated.emit(newValue);
|
328
|
-
this.processAfterUpdateConfig();
|
329
|
-
}
|
330
|
-
/**
|
331
|
-
* Faz o recarregamento da filterbar buscando o state no servidor.
|
332
|
-
*/
|
333
|
-
async reload() {
|
334
|
-
this.loadConfigFromStorage(true);
|
335
|
-
}
|
336
|
-
/**
|
337
|
-
* Retorna um item de filtro pelo ID.
|
338
|
-
*/
|
339
|
-
async getFilterItem(id) {
|
340
|
-
const item = this.filterConfig.find(item => item.id === id);
|
341
|
-
return Promise.resolve(ObjectUtils.copy(item));
|
342
|
-
}
|
343
|
-
/**
|
344
|
-
* Atualiza um item do filtro.
|
345
|
-
*
|
346
|
-
* @param filterItem - Item com as informações atualizadas, caso o item não seja encontrado no array ele mão será modificado
|
347
|
-
*/
|
348
|
-
async updateFilterItem(newFilterItem) {
|
349
|
-
const itemIndex = this.filterConfig.findIndex(item => item.id === newFilterItem.id);
|
350
|
-
if (itemIndex == -1) {
|
351
|
-
console.warn("[SnkFilterBar.updateFilterItem] FilterItem não encontrado, o mesmo não será atualizado.");
|
352
|
-
return Promise.resolve();
|
353
|
-
}
|
354
|
-
this._loadingPending = true;
|
355
|
-
this.updateFilter(newFilterItem);
|
356
|
-
return Promise.resolve();
|
357
|
-
}
|
358
|
-
/**
|
359
|
-
* Adiciona um item de filtro.
|
360
|
-
*
|
361
|
-
* @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
|
362
|
-
*/
|
363
|
-
async addFilterItem(filterItem) {
|
364
|
-
const itemIndex = this.filterConfig.findIndex(item => item.id === filterItem.id);
|
365
|
-
if (itemIndex > -1) {
|
366
|
-
console.warn("[SnkFilterBar.addFilterItem] FilterItem já existe , o mesmo não será adicionado novamente.");
|
367
|
-
return Promise.resolve();
|
368
|
-
}
|
369
|
-
this.filterConfig.push(filterItem);
|
370
|
-
this._loadingPending = true;
|
371
|
-
this.updateFilter(filterItem);
|
372
|
-
return Promise.resolve();
|
373
|
-
}
|
374
|
-
/**
|
375
|
-
* Remove um item de filtro.
|
376
|
-
*
|
377
|
-
* @param filterID - ID do a ser adicionado
|
378
|
-
*
|
379
|
-
* @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
|
380
|
-
*/
|
381
|
-
async removeFilterItem(filterID) {
|
382
|
-
const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
|
383
|
-
if (itemIndex == -1) {
|
384
|
-
console.warn("[SnkFilterBar.removeFilterItem] FilterItem não encontrado");
|
385
|
-
return Promise.resolve(undefined);
|
386
|
-
}
|
387
|
-
const itemToRemove = this.filterConfig[itemIndex];
|
388
|
-
this.filterConfig = this.filterConfig.filter(item => item.id !== filterID);
|
389
|
-
return Promise.resolve(itemToRemove);
|
390
|
-
}
|
391
|
-
componentDidLoad() {
|
392
|
-
if (this._element) {
|
393
|
-
const dataInfo = { dataUnit: this.dataUnit };
|
394
|
-
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
395
|
-
}
|
396
|
-
}
|
397
|
-
processPendingFilter() {
|
398
|
-
if (this._pendingVariables) {
|
399
|
-
const popUp = this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");
|
400
|
-
if (popUp) {
|
401
|
-
popUp.showUp(true).then(() => {
|
402
|
-
this.processAfterUpdateConfig();
|
403
|
-
});
|
404
|
-
}
|
405
|
-
}
|
406
|
-
else {
|
407
|
-
this.processAfterUpdateConfig();
|
408
|
-
}
|
409
|
-
}
|
410
|
-
getPersonalizedFilterItem() {
|
411
|
-
return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
|
412
|
-
}
|
413
|
-
async processAfterUpdateConfig() {
|
414
|
-
if (this._loadingPending) {
|
415
|
-
if (await this._application.isLoadedByPk() && !this._configUpdated)
|
416
|
-
return;
|
417
|
-
const personalizedFilter = this.getPersonalizedFilterItem();
|
418
|
-
this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
|
419
|
-
if (this._pendingVariables) {
|
420
|
-
return;
|
421
|
-
}
|
422
|
-
this._loadingPending = false;
|
423
|
-
this.doLoadData(this.dataUnit.getLastLoadRequest() != undefined);
|
424
|
-
}
|
425
|
-
if (this._configUpdated) {
|
426
|
-
this._configUpdated = false;
|
427
|
-
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
|
428
|
-
}
|
429
|
-
}
|
430
|
-
async doLoadData(forceReload = false) {
|
431
|
-
try {
|
432
|
-
if (this._firstLoad && this.autoLoad === false) {
|
433
|
-
return;
|
434
|
-
}
|
435
|
-
if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
|
436
|
-
let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
|
437
|
-
if (!autoLoad) {
|
438
|
-
return;
|
439
|
-
}
|
440
|
-
}
|
441
|
-
this.dataUnit.loadData(undefined, undefined, true);
|
442
|
-
}
|
443
|
-
finally {
|
444
|
-
this._firstLoad = false;
|
445
|
-
}
|
446
|
-
}
|
447
|
-
/**
|
448
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
449
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
450
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
451
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
|
452
|
-
*/
|
453
|
-
getMessage(key, params, defaultValue) {
|
454
|
-
var _a;
|
455
|
-
if (this.messagesBuilder == undefined && this._application) {
|
456
|
-
this.messagesBuilder = this._application.messagesBuilder;
|
457
|
-
}
|
458
|
-
return ((_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params)) || defaultValue;
|
459
|
-
}
|
460
|
-
getFilter(_dataUnit) {
|
461
|
-
var _a;
|
462
|
-
const filters = [];
|
463
|
-
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => this.isActiveFilter(item)).forEach(item => {
|
464
|
-
const filter = buildFilter(item);
|
465
|
-
if (filter) {
|
466
|
-
filters.push(filter);
|
467
|
-
}
|
468
|
-
});
|
469
|
-
return filters;
|
470
|
-
}
|
471
|
-
isActiveFilter(item) {
|
472
|
-
/*
|
473
|
-
- O filtro padrão também deve sempre ser condiderado ativo, pois, sempre deve
|
474
|
-
ser aplicado.
|
475
|
-
*/
|
476
|
-
if (item.type === FilterItemType.DEFAULT_FILTER) {
|
477
|
-
return true;
|
478
|
-
}
|
479
|
-
return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
|
480
|
-
}
|
481
|
-
registryFilterProvider() {
|
482
|
-
this.dataUnit.addFilterProvider(this);
|
483
|
-
if (this.filterConfig) {
|
484
|
-
this.doLoadData();
|
485
|
-
}
|
486
|
-
}
|
487
|
-
itemFocused(selectedItem) {
|
488
|
-
this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
|
489
|
-
if (item.id === selectedItem) {
|
490
|
-
if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
|
491
|
-
item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
|
492
|
-
}
|
493
|
-
}
|
494
|
-
else {
|
495
|
-
item["hideDetail"]();
|
496
|
-
}
|
497
|
-
});
|
498
|
-
}
|
499
|
-
filterActiveFilter(item) {
|
500
|
-
return item.visible || item.removalBlocked;
|
501
|
-
}
|
502
|
-
filterPersonalizedItems(item) {
|
503
|
-
return item.type === FilterItemType.PERSONALIZED;
|
504
|
-
}
|
505
|
-
getPersonalizedFilterVariableItems() {
|
506
|
-
return this.filterConfig
|
507
|
-
.filter(this.filterPersonalizedItems)
|
508
|
-
.map(item => {
|
509
|
-
const itemId = `filter-${item.id}`;
|
510
|
-
return (h("snk-filter-item", { key: item.id, id: itemId, config: Object.assign({}, item), onFocusin: () => this.itemFocused(itemId), onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), getMessage: (key, props) => this.getMessage(key, props), showChips: false }));
|
511
|
-
});
|
512
|
-
}
|
513
|
-
getFilterItems() {
|
514
|
-
const pinnedItems = [];
|
515
|
-
const unpinnedItems = [];
|
516
|
-
this.filterConfig
|
517
|
-
.filter(this.filterActiveFilter)
|
518
|
-
.forEach((item, index) => {
|
519
|
-
item = ObjectUtils.copy(item);
|
520
|
-
const itemId = `filter-${item.id}`;
|
521
|
-
const filterItem = (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: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
522
|
-
if (item.fixed || item.hardFixed) {
|
523
|
-
pinnedItems.push(filterItem);
|
524
|
-
}
|
525
|
-
else {
|
526
|
-
unpinnedItems.push(filterItem);
|
527
|
-
}
|
528
|
-
return filterItem;
|
529
|
-
});
|
530
|
-
const elements = [];
|
531
|
-
elements.push(...pinnedItems);
|
532
|
-
if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
|
533
|
-
elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
|
534
|
-
}
|
535
|
-
elements.push(...unpinnedItems);
|
536
|
-
return elements;
|
537
|
-
}
|
538
|
-
calculateUpdateSequence(item) {
|
539
|
-
if (item) {
|
540
|
-
this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
|
541
|
-
this._updateSequence.push(item.id);
|
542
|
-
}
|
543
|
-
}
|
544
|
-
normalizeItem(item) {
|
545
|
-
const normalized = Object.assign({}, item);
|
546
|
-
const optionals = ["props", "value", "hardFixed", "fixed"];
|
547
|
-
optionals.forEach(prop => {
|
548
|
-
if (normalized[prop] == undefined) {
|
549
|
-
delete normalized[prop];
|
550
|
-
}
|
551
|
-
});
|
552
|
-
if (item.value === "") {
|
553
|
-
delete item.value;
|
554
|
-
}
|
555
|
-
return normalized;
|
556
|
-
}
|
557
|
-
updateFilter(newItem) {
|
558
|
-
this.filterConfig = this.filterConfig.map(item => {
|
559
|
-
newItem = this.normalizeItem(newItem);
|
560
|
-
if (item.id === newItem.id) {
|
561
|
-
if (ObjectUtils.objectToString(item) != ObjectUtils.objectToString(newItem)) {
|
562
|
-
this.calculateUpdateSequence(newItem);
|
563
|
-
}
|
564
|
-
return newItem;
|
565
|
-
}
|
566
|
-
return item;
|
567
|
-
}).sort((a, b) => this._filtersComparator(a, b));
|
568
|
-
}
|
569
|
-
loadPermitions() {
|
570
|
-
this._application.isUserSup().then(value => this.allowDefault = value);
|
571
|
-
}
|
572
|
-
addFilterBarLegacyConfigName() {
|
573
|
-
if (this.filterBarLegacyConfigName && this.configName) {
|
574
|
-
ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
|
575
|
-
}
|
576
|
-
}
|
577
|
-
async loadConfigFromStorage(clearCache) {
|
578
|
-
if (clearCache) {
|
579
|
-
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
580
|
-
}
|
581
|
-
return new Promise(accept => {
|
582
|
-
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
583
|
-
.then((filters) => {
|
584
|
-
accept();
|
585
|
-
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
586
|
-
})
|
587
|
-
.catch(reason => {
|
588
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
589
|
-
});
|
590
|
-
});
|
591
|
-
}
|
592
|
-
attachDataUnit() {
|
593
|
-
if (this.dataUnit == undefined) {
|
594
|
-
let parent = this._element.parentElement;
|
595
|
-
while (parent) {
|
596
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
597
|
-
const snkDataUnit = parent;
|
598
|
-
this.dataUnit = snkDataUnit.dataUnit;
|
599
|
-
if (this.dataUnit) {
|
600
|
-
this.registryFilterProvider();
|
601
|
-
}
|
602
|
-
else {
|
603
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
604
|
-
this.dataUnit = evt.detail;
|
605
|
-
this.registryFilterProvider();
|
606
|
-
});
|
607
|
-
}
|
608
|
-
break;
|
609
|
-
}
|
610
|
-
}
|
611
|
-
parent = parent.parentElement;
|
612
|
-
}
|
613
|
-
else {
|
614
|
-
this.registryFilterProvider();
|
615
|
-
}
|
616
|
-
}
|
617
|
-
/**
|
618
|
-
* Emitido quando acontece a alteração do estado do filtro.
|
619
|
-
*/
|
620
|
-
filterChangeListener(evt) {
|
621
|
-
this.updateFilter(evt.detail);
|
622
|
-
}
|
623
|
-
/**
|
624
|
-
* Abre o modal de filtros
|
625
|
-
*/
|
626
|
-
async showFilterModal() {
|
627
|
-
const callbackOnApplyFilter = (filters) => {
|
628
|
-
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
629
|
-
};
|
630
|
-
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
631
|
-
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
632
|
-
return itemA.originOrder - itemB.originOrder;
|
633
|
-
});
|
634
|
-
const factoryParams = {
|
635
|
-
filterConfig: filtersConfigCopy,
|
636
|
-
configName: this.configName,
|
637
|
-
onComplete: callbackOnApplyFilter,
|
638
|
-
disablePersonalizedFilter: this.disablePersonalizedFilter,
|
639
|
-
getMessage: (key, props) => this.getMessage(key, props),
|
640
|
-
onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
|
641
|
-
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
|
642
|
-
onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
|
643
|
-
};
|
644
|
-
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
645
|
-
await this._filterModalFactory.showModal();
|
646
|
-
}
|
647
|
-
addPersonalizedFilter() {
|
648
|
-
this._filterModalFactory.closeModal();
|
649
|
-
this.personalizedFilterId = undefined;
|
650
|
-
this.showPersonalizedFilter = true;
|
651
|
-
window.requestAnimationFrame(() => {
|
652
|
-
this._elPersonalizedFilter.createPersonalizedFilter();
|
653
|
-
});
|
654
|
-
}
|
655
|
-
editPersonalizedFilter(id) {
|
656
|
-
this._filterModalFactory.closeModal();
|
657
|
-
this.showPersonalizedFilter = true;
|
658
|
-
this.personalizedFilterId = id;
|
659
|
-
}
|
660
|
-
deletePersonalizedFilter(filter, filterItemType, configName) {
|
661
|
-
if (filterItemType === FilterItemType.PERSONALIZED) {
|
662
|
-
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
663
|
-
}
|
664
|
-
}
|
665
|
-
handleHidePersonalizedFilter(reloadFilterBar) {
|
666
|
-
if (reloadFilterBar) {
|
667
|
-
this.loadConfigFromStorage().then(() => {
|
668
|
-
this.hidePersonalizedFilter();
|
669
|
-
});
|
670
|
-
}
|
671
|
-
else {
|
672
|
-
this.hidePersonalizedFilter();
|
673
|
-
}
|
674
|
-
}
|
675
|
-
hidePersonalizedFilter() {
|
676
|
-
this.personalizedFilterId = undefined;
|
677
|
-
this.showPersonalizedFilter = false;
|
678
|
-
}
|
679
|
-
componentWillLoad() {
|
680
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
681
|
-
if (this._application) {
|
682
|
-
this.loadPermitions();
|
683
|
-
this.addFilterBarLegacyConfigName();
|
684
|
-
this.loadConfigFromStorage();
|
685
|
-
}
|
686
|
-
this.attachDataUnit();
|
687
|
-
}
|
688
|
-
componentDidRender() {
|
689
|
-
this.processPendingFilter();
|
690
|
-
}
|
691
|
-
render() {
|
692
|
-
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
693
|
-
return undefined;
|
694
|
-
}
|
695
|
-
if (this.showPersonalizedFilter) {
|
696
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
697
|
-
}
|
698
|
-
if (this.mode !== "regular") {
|
699
|
-
return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
|
700
|
-
}
|
701
|
-
return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
702
|
-
}
|
703
|
-
get _element() { return getElement(this); }
|
704
|
-
static get watchers() { return {
|
705
|
-
"filterConfig": ["observeFilterConfig"]
|
706
|
-
}; }
|
707
|
-
};
|
708
|
-
SnkFilterBar.style = snkFilterBarCss;
|
709
|
-
|
710
|
-
export { SnkFilterBar as snk_filter_bar };
|