@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.11
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/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-6c2f7bcd.js} +107 -131
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
- package/dist/cjs/constants-9056ca9e.js +84 -0
- package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
- package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
- package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
- package/dist/cjs/{index-b0b676c5.js → index-20e8b68a.js} +165 -1473
- package/dist/cjs/loader.cjs.js +2 -18
- package/dist/cjs/sankhyablocks.cjs.js +4 -116
- package/dist/cjs/snk-application.cjs.entry.js +330 -7196
- package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +230 -0
- package/dist/cjs/snk-configurator_6.cjs.entry.js +1156 -0
- package/dist/cjs/snk-crud.cjs.entry.js +21 -13
- package/dist/cjs/snk-data-unit.cjs.entry.js +24 -32
- package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +5 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +62 -5
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +6 -3
- package/dist/cjs/snk-filter-number.cjs.entry.js +6 -3
- package/dist/cjs/snk-filter-period.cjs.entry.js +5 -2
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +7 -13
- package/dist/cjs/snk-filter-text.cjs.entry.js +2 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
- package/dist/cjs/snk-form.cjs.entry.js +41 -28
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
- package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-9a4b1e19.js} +10 -6
- package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +29 -1
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +236 -37
- package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
- package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
- package/dist/collection/components/snk-crud/snk-crud.js +46 -17
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +1 -28
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +180 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +22 -38
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +80 -20
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +65 -31
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +85 -19
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +222 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +39 -4
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +250 -141
- package/dist/collection/components/snk-form/snk-form.css +4 -0
- package/dist/collection/components/snk-form/snk-form.js +108 -30
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
- package/dist/collection/components/snk-grid/snk-grid.js +94 -26
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +35 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +15 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
- package/dist/collection/lib/index.js +1 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
- package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
- package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
- package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
- package/dist/collection/lib/utils/CrudUtils.js +73 -0
- package/dist/collection/lib/utils/constants.js +72 -0
- package/dist/components/SnkMessageBuilder.js +108 -131
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/constants.js +74 -0
- package/dist/components/filter-item-type.enum.js +2 -0
- package/dist/{sankhyablocks/snk-application.entry.js → components/form-config-fetcher.js} +88 -1347
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +8 -4
- package/dist/components/snk-application2.js +313 -7173
- package/dist/components/snk-config-modal.d.ts +11 -0
- package/dist/components/snk-config-modal.js +6 -0
- package/dist/components/snk-config-modal2.js +91 -0
- package/dist/components/snk-config-options.d.ts +11 -0
- package/dist/components/snk-config-options.js +6 -0
- package/dist/components/snk-config-options2.js +245 -0
- package/dist/components/snk-configurator.d.ts +11 -0
- package/dist/components/snk-configurator.js +6 -0
- package/dist/components/snk-configurator2.js +212 -0
- package/dist/components/snk-crud.js +76 -26
- package/dist/components/snk-data-unit.js +4 -13
- package/dist/components/snk-field-config.d.ts +11 -0
- package/dist/components/snk-field-config.js +6 -0
- package/dist/components/snk-field-config2.js +70 -0
- package/dist/components/snk-filter-bar2.js +354 -148
- package/dist/components/snk-filter-binary-select.js +5 -1
- package/dist/components/snk-filter-detail2.js +62 -5
- package/dist/components/snk-filter-item2.js +52 -33
- package/dist/components/snk-filter-list2.js +60 -22
- package/dist/components/snk-filter-modal.d.ts +11 -0
- package/dist/components/snk-filter-modal.js +6 -0
- package/dist/components/snk-filter-modal2.js +84 -0
- package/dist/components/snk-filter-multi-select.js +6 -2
- package/dist/components/snk-filter-number.js +6 -2
- package/dist/components/snk-filter-period.js +5 -1
- package/dist/components/snk-filter-personalized.d.ts +11 -0
- package/dist/components/snk-filter-personalized.js +108 -0
- package/dist/components/snk-filter-search.js +5 -12
- package/dist/components/snk-filter-text.js +1 -1
- package/dist/components/snk-form-config.d.ts +11 -0
- package/dist/components/snk-form-config.js +6 -0
- package/dist/components/snk-form-config2.js +996 -0
- package/dist/components/snk-form2.js +79 -29
- package/dist/components/snk-grid2.js +57 -32
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-tab-config.d.ts +11 -0
- package/dist/components/snk-tab-config.js +6 -0
- package/dist/components/snk-tab-config2.js +7220 -0
- package/dist/components/snk-taskbar2.js +28 -10
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-5792c260.js} +108 -131
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
- package/dist/esm/constants-c6039d3d.js +74 -0
- package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
- package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
- package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
- package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-e4121713.js} +165 -1466
- package/dist/esm/loader.js +2 -18
- package/dist/esm/sankhyablocks.js +4 -116
- package/dist/esm/snk-application.entry.js +308 -7174
- package/dist/esm/snk-config-modal.entry.js +58 -0
- package/dist/esm/snk-config-options.entry.js +226 -0
- package/dist/esm/snk-configurator_6.entry.js +1147 -0
- package/dist/esm/snk-crud.entry.js +20 -12
- package/dist/esm/snk-data-unit.entry.js +5 -13
- package/dist/esm/snk-field-config_2.entry.js +130 -0
- package/dist/esm/snk-filter-binary-select.entry.js +5 -2
- package/dist/esm/snk-filter-detail.entry.js +62 -5
- package/dist/esm/snk-filter-multi-select.entry.js +6 -3
- package/dist/esm/snk-filter-number.entry.js +6 -3
- package/dist/esm/snk-filter-period.entry.js +5 -2
- package/dist/esm/snk-filter-personalized.entry.js +85 -0
- package/dist/esm/snk-filter-search.entry.js +6 -12
- package/dist/esm/snk-filter-text.entry.js +2 -2
- package/dist/esm/snk-form-config.entry.js +953 -0
- package/dist/esm/snk-form.entry.js +40 -27
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/snk-tab-config.entry.js +317 -0
- package/dist/{sankhyablocks/taskbar-elements-35d64ff9.js → esm/taskbar-elements-e2ed0536.js} +10 -6
- package/dist/esm/teste-pesquisa.entry.js +2 -2
- package/dist/sankhyablocks/index.esm.js +0 -1
- package/dist/sankhyablocks/p-029ae4e4.entry.js +1 -0
- package/dist/sankhyablocks/p-03f9c407.js +1 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
- package/dist/sankhyablocks/p-2dc76d79.entry.js +1 -0
- package/dist/sankhyablocks/p-361299e8.js +26 -0
- package/dist/sankhyablocks/p-3a276f3d.entry.js +1 -0
- package/dist/sankhyablocks/p-400cc777.entry.js +1 -0
- package/dist/sankhyablocks/p-44ce5b90.entry.js +1 -0
- package/dist/sankhyablocks/p-521c96f0.entry.js +1 -0
- package/dist/sankhyablocks/p-60eef7cd.entry.js +1 -0
- package/dist/sankhyablocks/p-6988f4a6.entry.js +1 -0
- package/dist/sankhyablocks/p-6a4162bd.entry.js +1 -0
- package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
- package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
- package/dist/sankhyablocks/p-9dc4426d.entry.js +1 -0
- package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
- package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
- package/dist/sankhyablocks/p-a5b26df2.js +1 -0
- package/dist/sankhyablocks/p-b6d6b172.js +1 -0
- package/dist/sankhyablocks/p-cc4bef9f.entry.js +1 -0
- package/dist/sankhyablocks/p-d50651a3.js +1 -0
- package/dist/sankhyablocks/p-d690b6b5.entry.js +75 -0
- package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
- package/dist/sankhyablocks/p-deb1f523.entry.js +1 -0
- package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
- package/dist/sankhyablocks/p-e9beab79.entry.js +1 -0
- package/dist/sankhyablocks/p-f37cdeb5.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
- package/dist/types/components/snk-application/snk-application.d.ts +38 -16
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
- package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
- package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
- package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +24 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +4 -5
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +7 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +8 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +26 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +31 -17
- package/dist/types/components/snk-form/snk-form.d.ts +71 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
- package/dist/types/components.d.ts +424 -24
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +7 -7
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
- package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
- package/dist/types/lib/utils/constants.d.ts +76 -0
- package/dist/types/lib/utils/pesquisa.d.ts +2 -1
- package/package.json +4 -3
- package/react/components.d.ts +25 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -5
- package/dist/cjs/css-shim-b8158822.js +0 -6
- package/dist/cjs/dom-36862b77.js +0 -75
- package/dist/cjs/index-02201bc9.js +0 -2397
- package/dist/cjs/shadow-css-346c0795.js +0 -389
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -278
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -154
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
- package/dist/cjs/snk-grid.cjs.entry.js +0 -79
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
- package/dist/components/index2.js +0 -2384
- package/dist/esm/SnkMessageBuilder-a7da466b.js +0 -303
- package/dist/esm/app-globals-0f993ce5.js +0 -3
- package/dist/esm/css-shim-b3f2ee8d.js +0 -4
- package/dist/esm/dom-665d6011.js +0 -73
- package/dist/esm/index-2b4d2d14.js +0 -3262
- package/dist/esm/index-f1d3e4da.js +0 -2384
- package/dist/esm/shadow-css-b18e99d7.js +0 -387
- package/dist/esm/snk-filter-bar.entry.js +0 -274
- package/dist/esm/snk-filter-item.entry.js +0 -150
- package/dist/esm/snk-filter-list.entry.js +0 -87
- package/dist/esm/snk-grid.entry.js +0 -75
- package/dist/esm/snk-taskbar.entry.js +0 -156
- package/dist/esm/taskbar-elements-35d64ff9.js +0 -90
- package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
- package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
- package/dist/sankhyablocks/dom-665d6011.js +0 -73
- package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +0 -12
- package/dist/sankhyablocks/index-f1d3e4da.js +0 -2384
- package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
- package/dist/sankhyablocks/snk-crud.entry.js +0 -66
- package/dist/sankhyablocks/snk-data-unit.entry.js +0 -276
- package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -274
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
- package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -45
- package/dist/sankhyablocks/snk-filter-item.entry.js +0 -150
- package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
- package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
- package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
- package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
- package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
- package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
- package/dist/sankhyablocks/snk-form.entry.js +0 -129
- package/dist/sankhyablocks/snk-grid.entry.js +0 -75
- package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
- package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
- package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
- package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
|
@@ -1,20 +1,125 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { DataType, ObjectUtils, StringUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
|
5
|
+
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
6
|
+
import { d as defineCustomElement$4 } from './snk-filter-detail2.js';
|
|
7
|
+
import { d as defineCustomElement$3 } from './snk-filter-item2.js';
|
|
8
|
+
import { d as defineCustomElement$2 } from './snk-filter-list2.js';
|
|
9
|
+
import { d as defineCustomElement$1 } from './snk-filter-modal2.js';
|
|
7
10
|
|
|
8
|
-
const
|
|
11
|
+
const buildFilter = (item) => {
|
|
12
|
+
switch (item.type) {
|
|
13
|
+
case FilterItemType.DEFAULT_FILTER:
|
|
14
|
+
return buildDefault(item);
|
|
15
|
+
case FilterItemType.BINARY_SELECT:
|
|
16
|
+
return buildBinary(item);
|
|
17
|
+
case FilterItemType.MULTI_SELECT:
|
|
18
|
+
return buildMultSelect(item);
|
|
19
|
+
case FilterItemType.PERIOD:
|
|
20
|
+
return buildPeriod(item);
|
|
21
|
+
case FilterItemType.SEARCH:
|
|
22
|
+
return buildSearch(item);
|
|
23
|
+
case FilterItemType.TEXT:
|
|
24
|
+
return buildText(item);
|
|
25
|
+
case FilterItemType.NUMBER:
|
|
26
|
+
return buildNumber(item);
|
|
27
|
+
case FilterItemType.PERSONALIZED:
|
|
28
|
+
return buildPersonalized(item);
|
|
29
|
+
default:
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function buildDefault(item) {
|
|
34
|
+
return { name: item.id, expression: item.props.expression, params: [] };
|
|
35
|
+
}
|
|
36
|
+
function buildBinary(item) {
|
|
37
|
+
const { id, value, props } = item;
|
|
38
|
+
const options = props.options;
|
|
39
|
+
const selectedOption = options.find(opt => opt.name === value);
|
|
40
|
+
return { name: id, expression: selectedOption.expression, params: [] };
|
|
41
|
+
}
|
|
42
|
+
function buildMultSelect(item) {
|
|
43
|
+
const { id, value, props } = item;
|
|
44
|
+
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
|
45
|
+
}
|
|
46
|
+
function buildPeriod(item) {
|
|
47
|
+
const { id, value, props } = item;
|
|
48
|
+
let { end, start } = value;
|
|
49
|
+
if (typeof end === "string") {
|
|
50
|
+
end = new Date(end);
|
|
51
|
+
}
|
|
52
|
+
if (typeof start === "string") {
|
|
53
|
+
start = new Date(start);
|
|
54
|
+
}
|
|
55
|
+
const params = [];
|
|
56
|
+
let expression;
|
|
57
|
+
if (end && start) {
|
|
58
|
+
expression = props.expression.fullfill;
|
|
59
|
+
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (start) {
|
|
63
|
+
expression = props.expression.onlystart;
|
|
64
|
+
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
expression = props.expression.onlyend;
|
|
68
|
+
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return { name: id, expression, params };
|
|
72
|
+
}
|
|
73
|
+
function buildSearch(item) {
|
|
74
|
+
const { id, value, props } = item;
|
|
75
|
+
const expression = props.expression;
|
|
76
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
|
77
|
+
}
|
|
78
|
+
function buildText(item) {
|
|
79
|
+
const { id, value, props } = item;
|
|
80
|
+
const expression = props.expression;
|
|
81
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
|
82
|
+
}
|
|
83
|
+
function buildNumber(item) {
|
|
84
|
+
const { id, value, props } = item;
|
|
85
|
+
const expression = props.expression;
|
|
86
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
|
87
|
+
}
|
|
88
|
+
function buildPersonalized(item) {
|
|
89
|
+
var _a;
|
|
90
|
+
const { id, value, props } = item;
|
|
91
|
+
const expression = props.expression;
|
|
92
|
+
return {
|
|
93
|
+
name: id, expression, params: (((_a = props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
|
|
94
|
+
const valuesArray = Array.from(value);
|
|
95
|
+
const dataType = param.dataType;
|
|
96
|
+
let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
|
|
97
|
+
if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
|
|
98
|
+
paramValue = paramValue["value"];
|
|
99
|
+
}
|
|
100
|
+
if (paramValue == undefined && dataType === DataType.BOOLEAN) {
|
|
101
|
+
paramValue = false;
|
|
102
|
+
}
|
|
103
|
+
return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);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__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:100%;height:100%}";
|
|
9
109
|
|
|
10
110
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
11
111
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
12
112
|
const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
|
|
113
|
+
const ADD_FILTER = "ADD_FILTER";
|
|
114
|
+
const APPLIED_FILTERS = "APPLIED_FILTERS";
|
|
13
115
|
const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
116
|
constructor() {
|
|
15
117
|
super();
|
|
16
118
|
this.__registerHost();
|
|
17
119
|
this._updateSequence = [];
|
|
120
|
+
this._loadingPending = false;
|
|
121
|
+
this._configUpdated = false;
|
|
122
|
+
this._pendingFilters = [];
|
|
18
123
|
this._calculateSortIndex = (item) => {
|
|
19
124
|
let index = item.hardFixed ? 1000000 : 0;
|
|
20
125
|
//campos Hard Fixed não variam a ordem
|
|
@@ -29,6 +134,54 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
29
134
|
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
|
30
135
|
};
|
|
31
136
|
}
|
|
137
|
+
observeFilterConfig(newValue, oldValue) {
|
|
138
|
+
if (oldValue != undefined && newValue == undefined) {
|
|
139
|
+
this._loadingPending = true;
|
|
140
|
+
this._configUpdated = true;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
|
|
144
|
+
newValue.forEach(newItem => {
|
|
145
|
+
const oldItem = oldItems.get(newItem.id);
|
|
146
|
+
if (oldItem != undefined) {
|
|
147
|
+
this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
|
|
148
|
+
this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this._configUpdated = true;
|
|
152
|
+
this._loadingPending = this._loadingPending || newItem.value != undefined;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
this.processAfterUpdateConfig();
|
|
157
|
+
}
|
|
158
|
+
processPendingFilter() {
|
|
159
|
+
if (this._pendingFilters.length > 0 && this._currentPendingFilter == undefined) {
|
|
160
|
+
this._currentPendingFilter = this._element.querySelector("#filter-" + this._pendingFilters.pop());
|
|
161
|
+
if (this._currentPendingFilter) {
|
|
162
|
+
this._currentPendingFilter.showUp(true).then(() => {
|
|
163
|
+
this._currentPendingFilter = undefined;
|
|
164
|
+
this.processPendingFilter();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (this._currentPendingFilter == undefined) {
|
|
169
|
+
this.processAfterUpdateConfig();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
processAfterUpdateConfig() {
|
|
173
|
+
if (this._pendingFilters.length > 0) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (this._loadingPending) {
|
|
177
|
+
this._loadingPending = false;
|
|
178
|
+
this.dataUnit.loadData();
|
|
179
|
+
}
|
|
180
|
+
if (this._configUpdated) {
|
|
181
|
+
this._configUpdated = false;
|
|
182
|
+
this._application.saveFilterBarConfig(this.filterConfig, this.configName);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
32
185
|
/**
|
|
33
186
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
34
187
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -41,111 +194,43 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
41
194
|
getFilter(_dataUnit) {
|
|
42
195
|
var _a;
|
|
43
196
|
const filters = [];
|
|
44
|
-
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => item
|
|
45
|
-
const filter =
|
|
197
|
+
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => this.isActiveFilter(item)).forEach(item => {
|
|
198
|
+
const filter = buildFilter(item);
|
|
46
199
|
if (filter) {
|
|
47
200
|
filters.push(filter);
|
|
48
201
|
}
|
|
49
202
|
});
|
|
50
203
|
return filters;
|
|
51
204
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (value && visible) {
|
|
55
|
-
if (type === FilterItemType.BINARY_SELECT) {
|
|
56
|
-
const options = props.options;
|
|
57
|
-
const selectedOption = options.find(opt => opt.name === value);
|
|
58
|
-
//FIXME: ajustar o backend para não exigir parametros
|
|
59
|
-
return { name: id, expression: selectedOption.expression, params: [] };
|
|
60
|
-
}
|
|
61
|
-
if (type === FilterItemType.MULTI_SELECT) {
|
|
62
|
-
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
|
63
|
-
}
|
|
64
|
-
if (type === FilterItemType.PERIOD) {
|
|
65
|
-
let { end, start } = value;
|
|
66
|
-
if (typeof end === "string") {
|
|
67
|
-
end = new Date(end);
|
|
68
|
-
}
|
|
69
|
-
if (typeof start === "string") {
|
|
70
|
-
start = new Date(start);
|
|
71
|
-
}
|
|
72
|
-
const params = [];
|
|
73
|
-
let expression;
|
|
74
|
-
if (end && start) {
|
|
75
|
-
expression = props.expression.fullfill;
|
|
76
|
-
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
if (start) {
|
|
80
|
-
expression = props.expression.onlystart;
|
|
81
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
expression = props.expression.onlyend;
|
|
85
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { name: id, expression, params };
|
|
89
|
-
}
|
|
90
|
-
if (type === FilterItemType.SEARCH) {
|
|
91
|
-
const expression = props.expression;
|
|
92
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
|
93
|
-
}
|
|
94
|
-
if (type === FilterItemType.TEXT) {
|
|
95
|
-
const expression = props.expression;
|
|
96
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
|
97
|
-
}
|
|
98
|
-
if (type === FilterItemType.NUMBER) {
|
|
99
|
-
const expression = props.expression;
|
|
100
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
|
101
|
-
}
|
|
102
|
-
//No mapeamento dos outros tipos precisamos saber o tipo de dado.
|
|
103
|
-
}
|
|
104
|
-
return undefined;
|
|
205
|
+
isActiveFilter(item) {
|
|
206
|
+
return (item.visible && item.value != undefined) || item.type === FilterItemType.DEFAULT_FILTER;
|
|
105
207
|
}
|
|
106
|
-
|
|
107
|
-
this.
|
|
108
|
-
if (this.
|
|
109
|
-
this.
|
|
110
|
-
.then((filters) => {
|
|
111
|
-
this.filterConfig = filters;
|
|
112
|
-
})
|
|
113
|
-
.catch(reason => {
|
|
114
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
115
|
-
});
|
|
208
|
+
registryFilterProvider() {
|
|
209
|
+
this.dataUnit.addFilterProvider(this);
|
|
210
|
+
if (this.filterConfig) {
|
|
211
|
+
this.dataUnit.loadData();
|
|
116
212
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (this.dataUnit) {
|
|
124
|
-
this.dataUnit.addFilterProvider(this);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
128
|
-
this.dataUnit = evt.detail;
|
|
129
|
-
this.dataUnit.addFilterProvider(this);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
break;
|
|
213
|
+
}
|
|
214
|
+
itemFocused(selectedItem) {
|
|
215
|
+
this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
|
|
216
|
+
if (item.id === selectedItem) {
|
|
217
|
+
if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
|
|
218
|
+
item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
|
|
133
219
|
}
|
|
134
220
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
221
|
+
else {
|
|
222
|
+
item["hideDetail"]();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
140
225
|
}
|
|
141
226
|
getFilterItems() {
|
|
142
227
|
const pinnedItems = [];
|
|
143
228
|
const unpinnedItems = [];
|
|
144
229
|
this.filterConfig
|
|
145
230
|
.filter(item => item.visible)
|
|
146
|
-
.sort((a, b) => this._filtersComparator(a, b))
|
|
147
231
|
.forEach((item, index) => {
|
|
148
|
-
const
|
|
232
|
+
const itemId = `filter-${item.id}`;
|
|
233
|
+
const filterItem = (h("snk-filter-item", { 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 }));
|
|
149
234
|
if (item.fixed || item.hardFixed) {
|
|
150
235
|
pinnedItems.push(filterItem);
|
|
151
236
|
}
|
|
@@ -168,9 +253,6 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
168
253
|
this._updateSequence.push(item.id);
|
|
169
254
|
}
|
|
170
255
|
}
|
|
171
|
-
filterChangeListener(evt) {
|
|
172
|
-
this.updateFilter(evt.detail);
|
|
173
|
-
}
|
|
174
256
|
normalizeItem(item) {
|
|
175
257
|
const normalized = Object.assign({}, item);
|
|
176
258
|
const optionals = ["props", "value", "hardFixed", "fixed"];
|
|
@@ -184,105 +266,224 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
184
266
|
}
|
|
185
267
|
return normalized;
|
|
186
268
|
}
|
|
187
|
-
updateFilter(newItem
|
|
188
|
-
let needLoad = false;
|
|
189
|
-
let updated = false;
|
|
269
|
+
updateFilter(newItem) {
|
|
190
270
|
this.filterConfig = this.filterConfig.map(item => {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
return Object.assign(Object.assign({}, item), { value: undefined });
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
if (item.id === newItem.id) {
|
|
200
|
-
const normalizedOne = this.normalizeItem(item);
|
|
201
|
-
const normalizedTwo = this.normalizeItem(newItem);
|
|
202
|
-
updated = ObjectUtils.objectToString(normalizedOne) != ObjectUtils.objectToString(normalizedTwo);
|
|
203
|
-
needLoad = ObjectUtils.objectToString(normalizedOne.value) !== ObjectUtils.objectToString(normalizedTwo.value);
|
|
204
|
-
return newItem;
|
|
271
|
+
newItem = this.normalizeItem(newItem);
|
|
272
|
+
if (item.id === newItem.id) {
|
|
273
|
+
if (ObjectUtils.objectToString(item) != ObjectUtils.objectToString(newItem)) {
|
|
274
|
+
this.calculateUpdateSequence(newItem);
|
|
205
275
|
}
|
|
276
|
+
return newItem;
|
|
206
277
|
}
|
|
207
278
|
return item;
|
|
208
|
-
});
|
|
209
|
-
if (needLoad) {
|
|
210
|
-
this.dataUnit.loadData();
|
|
211
|
-
}
|
|
212
|
-
if (updated) {
|
|
213
|
-
this.calculateUpdateSequence(newItem);
|
|
214
|
-
this._application.saveFilterBarConfig(this.filterConfig, this.configName);
|
|
215
|
-
}
|
|
216
|
-
return needLoad;
|
|
279
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
217
280
|
}
|
|
218
281
|
getAddListItems() {
|
|
219
282
|
const hiddenItems = this.filterConfig
|
|
220
|
-
.filter(item => !item.visible)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
]);
|
|
283
|
+
.filter(item => !item.visible && this.isListable(item));
|
|
284
|
+
const footerItems = [{ name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" }];
|
|
285
|
+
if (this.allowDefault) {
|
|
286
|
+
footerItems.push({ name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" });
|
|
287
|
+
}
|
|
288
|
+
return hiddenItems.map(filter => { return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null }; })
|
|
289
|
+
.concat(footerItems);
|
|
228
290
|
}
|
|
229
291
|
getActiveClass() {
|
|
230
292
|
const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
|
|
231
293
|
return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
|
|
232
294
|
}
|
|
295
|
+
isListable(item, allowPersonalized = false) {
|
|
296
|
+
return item.type !== FilterItemType.DEFAULT_FILTER && (allowPersonalized || item.type !== FilterItemType.PERSONALIZED);
|
|
297
|
+
}
|
|
233
298
|
getAppliedListItems() {
|
|
234
299
|
const appliedItems = this.filterConfig
|
|
235
|
-
.filter(item => item.
|
|
236
|
-
.sort(this._filtersComparator);
|
|
300
|
+
.filter(item => this.isActiveFilter(item) && this.isListable(item, true));
|
|
237
301
|
return appliedItems.map(filter => {
|
|
238
302
|
return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
|
|
239
303
|
}).concat([
|
|
240
304
|
{ name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
|
|
241
305
|
]);
|
|
242
306
|
}
|
|
307
|
+
addPersonalizedFilters(personalizedItems) {
|
|
308
|
+
const activeFilters = {};
|
|
309
|
+
personalizedItems.forEach(item => {
|
|
310
|
+
if (item.active) {
|
|
311
|
+
activeFilters[item.id] = true;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
this.filterConfig = this.filterConfig.map(item => {
|
|
315
|
+
var _a, _b;
|
|
316
|
+
if (item.type === FilterItemType.PERSONALIZED) {
|
|
317
|
+
const visible = activeFilters[item.id];
|
|
318
|
+
if (!item.visible && visible) {
|
|
319
|
+
this.calculateUpdateSequence(item);
|
|
320
|
+
if (((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) != undefined) {
|
|
321
|
+
this._pendingFilters.push(item.id);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return this.normalizeItem(visible ? Object.assign(Object.assign({}, item), { visible }) : Object.assign(Object.assign({}, item), { visible, value: undefined, fixed: undefined }));
|
|
325
|
+
}
|
|
326
|
+
return item;
|
|
327
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
328
|
+
}
|
|
329
|
+
openDefaultFilterModal() {
|
|
330
|
+
const filterModal = document.createElement("snk-filter-modal");
|
|
331
|
+
const defaultFilter = this.filterConfig.filter(item => item.type === FilterItemType.DEFAULT_FILTER);
|
|
332
|
+
filterModal.getMessage = (key, props) => this.getMessage(key, props);
|
|
333
|
+
filterModal.modalTitle = this.getMessage("snkFilterBar.modalDefaultFilterTitle");
|
|
334
|
+
filterModal.infoText = this.getMessage(defaultFilter.length == 0 ? "snkFilterBar.modalInfoTextCreateDefault" : "snkFilterBar.modalInfoTextEditDefault");
|
|
335
|
+
filterModal.items = defaultFilter.map(item => {
|
|
336
|
+
return { id: item.id, active: true, enabled: false, label: item.label };
|
|
337
|
+
});
|
|
338
|
+
filterModal.processModalAction = (_action) => {
|
|
339
|
+
this._application.closeModal();
|
|
340
|
+
};
|
|
341
|
+
this._application.showModal(filterModal);
|
|
342
|
+
}
|
|
343
|
+
openPersonalizedModal() {
|
|
344
|
+
const filterModal = document.createElement("snk-filter-modal");
|
|
345
|
+
const personalizedFilter = this.filterConfig
|
|
346
|
+
.filter(item => item.type === FilterItemType.PERSONALIZED)
|
|
347
|
+
.sort((itemA, itemB) => StringUtils.compare(itemA.label, itemB.label));
|
|
348
|
+
filterModal.getMessage = (key, props) => this.getMessage(key, props);
|
|
349
|
+
filterModal.modalTitle = this.getMessage("snkFilterBar.modalPersonalizedFilterTitle");
|
|
350
|
+
filterModal.modalSubTitle = this.getMessage("snkFilterBar.modalPersonalizedFilterSubTitle");
|
|
351
|
+
filterModal.okButtonLabel = this.getMessage("snkFilterBar.modalOkButtonLabel");
|
|
352
|
+
filterModal.cancelButtonLabel = this.getMessage("snkFilterBar.modalCancelButtonLabel");
|
|
353
|
+
filterModal.infoText = this.getMessage("snkFilterBar.modalInfoTextCreateEditPersonalized");
|
|
354
|
+
filterModal.useSearch = true;
|
|
355
|
+
filterModal.items = personalizedFilter.map(item => {
|
|
356
|
+
return { id: item.id, active: item.visible, enabled: true, label: item.label };
|
|
357
|
+
});
|
|
358
|
+
filterModal.processModalAction = (action) => {
|
|
359
|
+
if (action === ModalAction.CANCEL) {
|
|
360
|
+
// O Botão de cancelar, tem efeito específico:
|
|
361
|
+
// - Desmarcar todos os filtros personalizados.
|
|
362
|
+
filterModal.items = filterModal.items.map(item => {
|
|
363
|
+
return Object.assign(Object.assign({}, item), { active: false });
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
if (action === ModalAction.OK) {
|
|
368
|
+
this.addPersonalizedFilters(filterModal.items);
|
|
369
|
+
}
|
|
370
|
+
this._application.closeModal();
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
this._application.showModal(filterModal);
|
|
374
|
+
}
|
|
375
|
+
clearFilters() {
|
|
376
|
+
let changed = false;
|
|
377
|
+
this.filterConfig = this.filterConfig.map(item => {
|
|
378
|
+
if (item.value != undefined) {
|
|
379
|
+
changed = true;
|
|
380
|
+
}
|
|
381
|
+
return Object.assign(Object.assign({}, item), { value: undefined });
|
|
382
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
383
|
+
return changed;
|
|
384
|
+
}
|
|
385
|
+
loadPermitions() {
|
|
386
|
+
this._application.isUserSup().then(value => this.allowDefault = value);
|
|
387
|
+
}
|
|
388
|
+
loadConfigFromApplication() {
|
|
389
|
+
this._application.getFilterBarConfig(this.configName)
|
|
390
|
+
.then((filters) => {
|
|
391
|
+
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
|
392
|
+
if (this.dataUnit) {
|
|
393
|
+
this.dataUnit.loadData();
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
.catch(reason => {
|
|
397
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
attachDataUnit() {
|
|
401
|
+
if (this.dataUnit == undefined) {
|
|
402
|
+
let parent = this._element.parentElement;
|
|
403
|
+
while (parent) {
|
|
404
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
405
|
+
const snkDataUnit = parent;
|
|
406
|
+
this.dataUnit = snkDataUnit.dataUnit;
|
|
407
|
+
if (this.dataUnit) {
|
|
408
|
+
this.registryFilterProvider();
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
412
|
+
this.dataUnit = evt.detail;
|
|
413
|
+
this.registryFilterProvider();
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
parent = parent.parentElement;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
this.registryFilterProvider();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
filterChangeListener(evt) {
|
|
426
|
+
this.updateFilter(evt.detail);
|
|
427
|
+
}
|
|
243
428
|
addFilterHandler(itemName) {
|
|
244
429
|
const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
|
|
245
|
-
if (
|
|
430
|
+
if (itemName === PERSONALIZED_FILTER) {
|
|
431
|
+
this.openPersonalizedModal();
|
|
432
|
+
}
|
|
433
|
+
else if (itemName === DEFAULT_FILTER) {
|
|
434
|
+
this.openDefaultFilterModal();
|
|
435
|
+
}
|
|
436
|
+
else if (filterItem) {
|
|
437
|
+
this._pendingFilters.push(itemName);
|
|
246
438
|
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
247
|
-
window.requestAnimationFrame(() => {
|
|
248
|
-
const itemElement = this._element.querySelector("#filter-" + itemName);
|
|
249
|
-
if (itemElement) {
|
|
250
|
-
itemElement.showUp();
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
439
|
}
|
|
254
440
|
}
|
|
255
441
|
appliedFilterHandler(itemName) {
|
|
256
442
|
if (itemName === CLEAR_ALL_FILTERS) {
|
|
257
|
-
if (this.
|
|
443
|
+
if (this.clearFilters()) {
|
|
258
444
|
this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
|
|
259
445
|
}
|
|
260
446
|
}
|
|
261
447
|
else {
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
|
|
448
|
+
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
449
|
+
if (filterItemElement) {
|
|
450
|
+
filterItemElement.showUp(true);
|
|
265
451
|
}
|
|
266
452
|
}
|
|
267
453
|
}
|
|
454
|
+
componentWillLoad() {
|
|
455
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
456
|
+
if (this._application) {
|
|
457
|
+
this.loadPermitions();
|
|
458
|
+
this.loadConfigFromApplication();
|
|
459
|
+
}
|
|
460
|
+
this.attachDataUnit();
|
|
461
|
+
}
|
|
462
|
+
componentDidRender() {
|
|
463
|
+
this.processPendingFilter();
|
|
464
|
+
}
|
|
268
465
|
render() {
|
|
269
466
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
270
467
|
return undefined;
|
|
271
468
|
}
|
|
272
|
-
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
469
|
+
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { id: APPLIED_FILTERS, onFocusin: () => this.itemFocused(APPLIED_FILTERS), items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { id: ADD_FILTER, onFocusin: () => this.itemFocused(ADD_FILTER), items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
273
470
|
}
|
|
274
471
|
get _element() { return this; }
|
|
472
|
+
static get watchers() { return {
|
|
473
|
+
"filterConfig": ["observeFilterConfig"]
|
|
474
|
+
}; }
|
|
275
475
|
static get style() { return snkFilterBarCss; }
|
|
276
476
|
}, [2, "snk-filter-bar", {
|
|
277
477
|
"dataUnit": [1040],
|
|
278
478
|
"configName": [1, "config-name"],
|
|
279
|
-
"filterConfig": [1040]
|
|
479
|
+
"filterConfig": [1040],
|
|
480
|
+
"allowDefault": [32]
|
|
280
481
|
}, [[0, "filterChange", "filterChangeListener"]]]);
|
|
281
482
|
function defineCustomElement() {
|
|
282
483
|
if (typeof customElements === "undefined") {
|
|
283
484
|
return;
|
|
284
485
|
}
|
|
285
|
-
const components = ["snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list"];
|
|
486
|
+
const components = ["snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal"];
|
|
286
487
|
components.forEach(tagName => { switch (tagName) {
|
|
287
488
|
case "snk-filter-bar":
|
|
288
489
|
if (!customElements.get(tagName)) {
|
|
@@ -291,15 +492,20 @@ function defineCustomElement() {
|
|
|
291
492
|
break;
|
|
292
493
|
case "snk-filter-detail":
|
|
293
494
|
if (!customElements.get(tagName)) {
|
|
294
|
-
defineCustomElement$
|
|
495
|
+
defineCustomElement$4();
|
|
295
496
|
}
|
|
296
497
|
break;
|
|
297
498
|
case "snk-filter-item":
|
|
298
499
|
if (!customElements.get(tagName)) {
|
|
299
|
-
defineCustomElement$
|
|
500
|
+
defineCustomElement$3();
|
|
300
501
|
}
|
|
301
502
|
break;
|
|
302
503
|
case "snk-filter-list":
|
|
504
|
+
if (!customElements.get(tagName)) {
|
|
505
|
+
defineCustomElement$2();
|
|
506
|
+
}
|
|
507
|
+
break;
|
|
508
|
+
case "snk-filter-modal":
|
|
303
509
|
if (!customElements.get(tagName)) {
|
|
304
510
|
defineCustomElement$1();
|
|
305
511
|
}
|
|
@@ -32,6 +32,9 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
32
32
|
this.value = undefined;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
async show() {
|
|
36
|
+
this._checkOne.setFocus();
|
|
37
|
+
}
|
|
35
38
|
render() {
|
|
36
39
|
if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
|
|
37
40
|
return undefined;
|
|
@@ -41,7 +44,8 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
41
44
|
}
|
|
42
45
|
}, [0, "snk-filter-binary-select", {
|
|
43
46
|
"value": [1544],
|
|
44
|
-
"config": [16]
|
|
47
|
+
"config": [16],
|
|
48
|
+
"show": [64]
|
|
45
49
|
}, [[0, "ezChange", "ezChangeListener"]]]);
|
|
46
50
|
function defineCustomElement$1() {
|
|
47
51
|
if (typeof customElements === "undefined") {
|