@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.10
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-1feabfc7.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-2284c850.entry.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-6988f4a6.entry.js +1 -0
- package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
- package/dist/sankhyablocks/p-7b4a4a50.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/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,6 +1,10 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
2
3
|
import FilterItemType from './filter-item-type.enum';
|
|
3
4
|
export class SnkFilterDetail {
|
|
5
|
+
async show() {
|
|
6
|
+
this._editor["show"]();
|
|
7
|
+
}
|
|
4
8
|
changeConfig(newConfig) {
|
|
5
9
|
this.filterChange.emit(newConfig);
|
|
6
10
|
}
|
|
@@ -16,6 +20,8 @@ export class SnkFilterDetail {
|
|
|
16
20
|
return "snk-filter-search";
|
|
17
21
|
case FilterItemType.NUMBER:
|
|
18
22
|
return "snk-filter-number";
|
|
23
|
+
case FilterItemType.PERSONALIZED:
|
|
24
|
+
return "snk-filter-personalized";
|
|
19
25
|
}
|
|
20
26
|
return "snk-filter-text";
|
|
21
27
|
}
|
|
@@ -27,13 +33,64 @@ export class SnkFilterDetail {
|
|
|
27
33
|
return undefined;
|
|
28
34
|
}
|
|
29
35
|
return ([
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
|
|
37
|
+
this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))
|
|
32
38
|
]);
|
|
33
39
|
}
|
|
40
|
+
buildIcon(title, iconName, action) {
|
|
41
|
+
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
|
|
42
|
+
}
|
|
43
|
+
apply() {
|
|
44
|
+
var _a;
|
|
45
|
+
let value = this._editor["value"];
|
|
46
|
+
let isValid = true;
|
|
47
|
+
if (this.config.type === FilterItemType.PERSONALIZED) {
|
|
48
|
+
const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
|
|
49
|
+
const paramsCount = params.length;
|
|
50
|
+
if (paramsCount === 0) {
|
|
51
|
+
//Valor do filtro personalizado sem parametros deve ser um array vazio
|
|
52
|
+
value = [];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
isValid = this.validateAllFilled(paramsCount, value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (isValid) {
|
|
59
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
|
|
63
|
+
validateAllFilled(paramsCount, value) {
|
|
64
|
+
let isValid = true;
|
|
65
|
+
if (value != undefined && paramsCount > 1) {
|
|
66
|
+
if (paramsCount > value.length) {
|
|
67
|
+
isValid = false;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
value.forEach(item => {
|
|
71
|
+
if (item == undefined) {
|
|
72
|
+
isValid = false;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!isValid) {
|
|
78
|
+
ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
|
|
79
|
+
}
|
|
80
|
+
return isValid;
|
|
81
|
+
}
|
|
82
|
+
/* WARNING: Temporário.*/
|
|
83
|
+
clear() {
|
|
84
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
85
|
+
}
|
|
86
|
+
onKeyDonwListener(event) {
|
|
87
|
+
if (event.key === "Enter") {
|
|
88
|
+
this._applyButton.setFocus().then(() => this.apply());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
34
91
|
render() {
|
|
35
92
|
const ContentEditor = this.getContentEditor();
|
|
36
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config,
|
|
93
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt) }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
37
94
|
}
|
|
38
95
|
static get is() { return "snk-filter-detail"; }
|
|
39
96
|
static get properties() {
|
|
@@ -58,23 +115,6 @@ export class SnkFilterDetail {
|
|
|
58
115
|
"text": ""
|
|
59
116
|
}
|
|
60
117
|
},
|
|
61
|
-
"keepOpened": {
|
|
62
|
-
"type": "boolean",
|
|
63
|
-
"mutable": true,
|
|
64
|
-
"complexType": {
|
|
65
|
-
"original": "boolean",
|
|
66
|
-
"resolved": "boolean",
|
|
67
|
-
"references": {}
|
|
68
|
-
},
|
|
69
|
-
"required": false,
|
|
70
|
-
"optional": false,
|
|
71
|
-
"docs": {
|
|
72
|
-
"tags": [],
|
|
73
|
-
"text": ""
|
|
74
|
-
},
|
|
75
|
-
"attribute": "keep-opened",
|
|
76
|
-
"reflect": false
|
|
77
|
-
},
|
|
78
118
|
"getMessage": {
|
|
79
119
|
"type": "unknown",
|
|
80
120
|
"mutable": false,
|
|
@@ -115,4 +155,24 @@ export class SnkFilterDetail {
|
|
|
115
155
|
}
|
|
116
156
|
}];
|
|
117
157
|
}
|
|
158
|
+
static get methods() {
|
|
159
|
+
return {
|
|
160
|
+
"show": {
|
|
161
|
+
"complexType": {
|
|
162
|
+
"signature": "() => Promise<void>",
|
|
163
|
+
"parameters": [],
|
|
164
|
+
"references": {
|
|
165
|
+
"Promise": {
|
|
166
|
+
"location": "global"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"return": "Promise<void>"
|
|
170
|
+
},
|
|
171
|
+
"docs": {
|
|
172
|
+
"text": "",
|
|
173
|
+
"tags": []
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
118
178
|
}
|
|
@@ -3,46 +3,52 @@ import { h, Host } from '@stencil/core';
|
|
|
3
3
|
import FilterItemType from './filter-item-type.enum';
|
|
4
4
|
export class SnkFilterItem {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.innerClickCheck = (
|
|
7
|
-
if (
|
|
6
|
+
this.innerClickCheck = (_floatingContainer, node) => {
|
|
7
|
+
if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
|
|
8
8
|
return true;
|
|
9
9
|
}
|
|
10
|
-
if (node && floatingContainer) {
|
|
11
|
-
if (!node.offsetParent) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
let current = node;
|
|
15
|
-
do {
|
|
16
|
-
if (current === floatingContainer) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
} while ((current = current.offsetParent) != null);
|
|
20
|
-
}
|
|
21
10
|
this.detailIsVisible = false;
|
|
22
11
|
return false;
|
|
23
12
|
};
|
|
24
13
|
}
|
|
25
14
|
async showUp(open = false) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
17
|
+
if (open) {
|
|
18
|
+
this._closeCallback = resolve;
|
|
19
|
+
window.requestAnimationFrame(() => {
|
|
20
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
21
|
+
autoClose: true,
|
|
22
|
+
innerClickTest: this.innerClickCheck,
|
|
23
|
+
backClickListener: () => this.onDetailCloseCallback(),
|
|
24
|
+
left: this.getScrollOffset(),
|
|
25
|
+
useOverlay: true
|
|
26
|
+
});
|
|
27
|
+
this._popover.show();
|
|
28
|
+
this.detailIsVisible = true;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
36
32
|
}
|
|
37
33
|
getScrollOffset() {
|
|
38
|
-
|
|
34
|
+
const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
|
|
35
|
+
const rect = this._filterItemElement.getBoundingClientRect();
|
|
36
|
+
return `calc(${rect.left}px + ${padding})`;
|
|
39
37
|
}
|
|
40
|
-
hideDetail() {
|
|
41
|
-
if (this.
|
|
42
|
-
|
|
38
|
+
async hideDetail() {
|
|
39
|
+
if (this.detailIsVisible) {
|
|
40
|
+
if (this._floatingID != undefined) {
|
|
41
|
+
FloatingManager.close(this._floatingID);
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
|
+
}
|
|
45
|
+
onDetailCloseCallback() {
|
|
44
46
|
this._floatingID = undefined;
|
|
45
47
|
this.detailIsVisible = false;
|
|
48
|
+
if (this._closeCallback) {
|
|
49
|
+
this._closeCallback();
|
|
50
|
+
this._closeCallback = undefined;
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
//---------------------------------------------
|
|
48
54
|
// Event handlers
|
|
@@ -57,7 +63,7 @@ export class SnkFilterItem {
|
|
|
57
63
|
this.hideDetail();
|
|
58
64
|
}
|
|
59
65
|
else {
|
|
60
|
-
this.
|
|
66
|
+
this.showUp(true);
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
evt.preventDefault();
|
|
@@ -117,6 +123,9 @@ export class SnkFilterItem {
|
|
|
117
123
|
if (type === FilterItemType.SEARCH) {
|
|
118
124
|
return `${label}: ${value.value} - ${value.label}`;
|
|
119
125
|
}
|
|
126
|
+
if (type === FilterItemType.PERSONALIZED) {
|
|
127
|
+
return label;
|
|
128
|
+
}
|
|
120
129
|
return `${label}: ${value}`;
|
|
121
130
|
}
|
|
122
131
|
return label;
|
|
@@ -131,15 +140,24 @@ export class SnkFilterItem {
|
|
|
131
140
|
filterChangeListener() {
|
|
132
141
|
this.hideDetail();
|
|
133
142
|
}
|
|
134
|
-
|
|
143
|
+
getRightIconName() {
|
|
135
144
|
if (this.config.value != undefined) {
|
|
136
145
|
return "close";
|
|
137
146
|
}
|
|
138
147
|
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
139
148
|
}
|
|
149
|
+
getLeftIconName() {
|
|
150
|
+
switch (this.config.type) {
|
|
151
|
+
case FilterItemType.PERIOD:
|
|
152
|
+
return "calendar";
|
|
153
|
+
case FilterItemType.PERSONALIZED:
|
|
154
|
+
return "tune";
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
140
158
|
render() {
|
|
141
|
-
const leftIcon = this.
|
|
142
|
-
return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.
|
|
159
|
+
const leftIcon = this.getLeftIconName();
|
|
160
|
+
return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
|
|
143
161
|
}
|
|
144
162
|
static get is() { return "snk-filter-item"; }
|
|
145
163
|
static get properties() {
|
|
@@ -227,6 +245,22 @@ export class SnkFilterItem {
|
|
|
227
245
|
"text": "",
|
|
228
246
|
"tags": []
|
|
229
247
|
}
|
|
248
|
+
},
|
|
249
|
+
"hideDetail": {
|
|
250
|
+
"complexType": {
|
|
251
|
+
"signature": "() => Promise<void>",
|
|
252
|
+
"parameters": [],
|
|
253
|
+
"references": {
|
|
254
|
+
"Promise": {
|
|
255
|
+
"location": "global"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"return": "Promise<void>"
|
|
259
|
+
},
|
|
260
|
+
"docs": {
|
|
261
|
+
"text": "",
|
|
262
|
+
"tags": []
|
|
263
|
+
}
|
|
230
264
|
}
|
|
231
265
|
};
|
|
232
266
|
}
|
|
@@ -4,41 +4,43 @@ const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
|
|
|
4
4
|
const MAX_FILTERS = 5;
|
|
5
5
|
export class SnkFilterList {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
let current = node;
|
|
13
|
-
do {
|
|
14
|
-
if (current === floatingContainer || current === this._element) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
} while ((current = current.offsetParent) != null);
|
|
7
|
+
this._preselection = -1;
|
|
8
|
+
this.innerClickCheck = (_floatingContainer, node) => {
|
|
9
|
+
if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
|
|
10
|
+
return true;
|
|
18
11
|
}
|
|
19
12
|
this._detailIsVisible = false;
|
|
20
13
|
return false;
|
|
21
14
|
};
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
this.
|
|
16
|
+
showDetail() {
|
|
17
|
+
this._preselection = -1;
|
|
18
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
19
|
+
autoClose: true,
|
|
20
|
+
innerClickTest: this.innerClickCheck,
|
|
21
|
+
backClickListener: () => this.onListCloseCallback(),
|
|
22
|
+
useOverlay: true
|
|
23
|
+
});
|
|
25
24
|
this._detailIsVisible = true;
|
|
26
25
|
this._showAll = false;
|
|
27
26
|
this._filterArgument = "";
|
|
27
|
+
this._filterInput.setFocus();
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
async hideDetail() {
|
|
30
30
|
if (this._floatingID != undefined) {
|
|
31
31
|
FloatingManager.close(this._floatingID);
|
|
32
32
|
}
|
|
33
|
+
}
|
|
34
|
+
onListCloseCallback() {
|
|
33
35
|
this._floatingID = undefined;
|
|
34
36
|
this._detailIsVisible = false;
|
|
35
37
|
}
|
|
36
38
|
buttonClick() {
|
|
37
39
|
if (this._detailIsVisible) {
|
|
38
|
-
this.
|
|
40
|
+
this.hideDetail();
|
|
39
41
|
}
|
|
40
42
|
else {
|
|
41
|
-
this.
|
|
43
|
+
this.showDetail();
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
componentDidRender() {
|
|
@@ -49,14 +51,15 @@ export class SnkFilterList {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
buildItemElement(item) {
|
|
52
|
-
|
|
54
|
+
const itemId = ++this._selectableItemsCount;
|
|
55
|
+
return (h("button", { id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
|
|
53
56
|
}
|
|
54
57
|
itemSelected(itemName) {
|
|
55
58
|
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
56
59
|
this._showAll = true;
|
|
57
60
|
}
|
|
58
61
|
else {
|
|
59
|
-
this.
|
|
62
|
+
this.hideDetail();
|
|
60
63
|
this.snkItemSelected.emit(itemName);
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -70,13 +73,47 @@ export class SnkFilterList {
|
|
|
70
73
|
items.splice(MAX_FILTERS);
|
|
71
74
|
items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
|
|
72
75
|
}
|
|
76
|
+
this._selectableItemsCount = 0;
|
|
73
77
|
return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
74
78
|
}
|
|
75
79
|
getFooterItems() {
|
|
76
80
|
return this.items.filter(item => item.kind === "FOOTER");
|
|
77
81
|
}
|
|
82
|
+
keyDownHandler(event) {
|
|
83
|
+
switch (event.key) {
|
|
84
|
+
case "ArrowDown":
|
|
85
|
+
this.changePreselection(this._preselection + 1);
|
|
86
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
87
|
+
event.stopImmediatePropagation();
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
break;
|
|
91
|
+
case "ArrowUp":
|
|
92
|
+
this.changePreselection(this._preselection - 1);
|
|
93
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
94
|
+
event.stopImmediatePropagation();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
changePreselection(newSelection) {
|
|
101
|
+
if (newSelection < 0) {
|
|
102
|
+
newSelection = this._selectableItemsCount;
|
|
103
|
+
}
|
|
104
|
+
this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
|
|
105
|
+
if (this._preselection === 0) {
|
|
106
|
+
this._filterInput.setFocus();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const item = this._element.querySelector(`#filter-item${this._preselection}`);
|
|
110
|
+
if (item) {
|
|
111
|
+
item.focus();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
78
115
|
render() {
|
|
79
|
-
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
116
|
+
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail, onFocus: () => this._preselection = 0 }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
80
117
|
}
|
|
81
118
|
static get is() { return "snk-filter-list"; }
|
|
82
119
|
static get properties() {
|
|
@@ -229,5 +266,34 @@ export class SnkFilterList {
|
|
|
229
266
|
}
|
|
230
267
|
}];
|
|
231
268
|
}
|
|
269
|
+
static get methods() {
|
|
270
|
+
return {
|
|
271
|
+
"hideDetail": {
|
|
272
|
+
"complexType": {
|
|
273
|
+
"signature": "() => Promise<void>",
|
|
274
|
+
"parameters": [],
|
|
275
|
+
"references": {
|
|
276
|
+
"Promise": {
|
|
277
|
+
"location": "global"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"return": "Promise<void>"
|
|
281
|
+
},
|
|
282
|
+
"docs": {
|
|
283
|
+
"text": "",
|
|
284
|
+
"tags": []
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
232
289
|
static get elementRef() { return "_element"; }
|
|
290
|
+
static get listeners() {
|
|
291
|
+
return [{
|
|
292
|
+
"name": "keydown",
|
|
293
|
+
"method": "keyDownHandler",
|
|
294
|
+
"target": undefined,
|
|
295
|
+
"capture": true,
|
|
296
|
+
"passive": false
|
|
297
|
+
}];
|
|
298
|
+
}
|
|
233
299
|
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { ModalAction, ModalButtonStatus } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
|
|
3
|
+
import { ArrayUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { CheckMode } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
5
|
+
export class SnkFilterModal {
|
|
6
|
+
updateValue(id, value = undefined) {
|
|
7
|
+
this.items = this.items.map(item => {
|
|
8
|
+
if (item.id === id && item.enabled) {
|
|
9
|
+
if (value == undefined) {
|
|
10
|
+
value = !item.active;
|
|
11
|
+
}
|
|
12
|
+
return Object.assign(Object.assign({}, item), { active: value });
|
|
13
|
+
}
|
|
14
|
+
return item;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
getActiveFiltersMsg() {
|
|
18
|
+
const activeFilters = this.items.filter(item => item.active).length;
|
|
19
|
+
if (activeFilters === 0) {
|
|
20
|
+
return this.getMessage("snkFilterBar.noActiveFilters");
|
|
21
|
+
}
|
|
22
|
+
return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
|
|
23
|
+
}
|
|
24
|
+
buildItems(list) {
|
|
25
|
+
return list.map(item => {
|
|
26
|
+
return (h("button", { onClick: () => this.updateValue(item.id), class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { id: `checkbox_${item.id}`, tabIndex: "-1", class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: CheckMode.SWITCH }), h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
itemKeyBoardSelect(event, item) {
|
|
30
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
31
|
+
this.updateValue(item.id);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
modalActionListener(evt) {
|
|
35
|
+
const modalAction = evt.detail;
|
|
36
|
+
if (modalAction === ModalAction.LOAD) {
|
|
37
|
+
if (this._filterInput) {
|
|
38
|
+
this._filterInput.setFocus();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.processModalAction(modalAction);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const allowCancel = this.items.filter(item => item.active).length > 0;
|
|
47
|
+
const items = (this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : []);
|
|
48
|
+
return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.modalActionListener(evt), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ?
|
|
49
|
+
h("ez-filter-input", { ref: ref => this._filterInput = ref, label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail })
|
|
50
|
+
:
|
|
51
|
+
undefined), items.length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.buildItems(items)), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
|
|
52
|
+
}
|
|
53
|
+
static get is() { return "snk-filter-modal"; }
|
|
54
|
+
static get properties() {
|
|
55
|
+
return {
|
|
56
|
+
"getMessage": {
|
|
57
|
+
"type": "unknown",
|
|
58
|
+
"mutable": false,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "(key: string, props?: any) => string",
|
|
61
|
+
"resolved": "(key: string, props?: any) => string",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": ""
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "unknown",
|
|
73
|
+
"mutable": true,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "Array<ModalItem>",
|
|
76
|
+
"resolved": "ModalItem[]",
|
|
77
|
+
"references": {
|
|
78
|
+
"Array": {
|
|
79
|
+
"location": "global"
|
|
80
|
+
},
|
|
81
|
+
"ModalItem": {
|
|
82
|
+
"location": "local"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"optional": false,
|
|
88
|
+
"docs": {
|
|
89
|
+
"tags": [],
|
|
90
|
+
"text": ""
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"modalTitle": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "string",
|
|
98
|
+
"resolved": "string",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": ""
|
|
106
|
+
},
|
|
107
|
+
"attribute": "modal-title",
|
|
108
|
+
"reflect": false
|
|
109
|
+
},
|
|
110
|
+
"modalSubTitle": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"mutable": false,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "string",
|
|
115
|
+
"resolved": "string",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": false,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": ""
|
|
123
|
+
},
|
|
124
|
+
"attribute": "modal-sub-title",
|
|
125
|
+
"reflect": false
|
|
126
|
+
},
|
|
127
|
+
"cancelButtonLabel": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "string",
|
|
132
|
+
"resolved": "string",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": ""
|
|
140
|
+
},
|
|
141
|
+
"attribute": "cancel-button-label",
|
|
142
|
+
"reflect": false
|
|
143
|
+
},
|
|
144
|
+
"okButtonLabel": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"mutable": false,
|
|
147
|
+
"complexType": {
|
|
148
|
+
"original": "string",
|
|
149
|
+
"resolved": "string",
|
|
150
|
+
"references": {}
|
|
151
|
+
},
|
|
152
|
+
"required": false,
|
|
153
|
+
"optional": false,
|
|
154
|
+
"docs": {
|
|
155
|
+
"tags": [],
|
|
156
|
+
"text": ""
|
|
157
|
+
},
|
|
158
|
+
"attribute": "ok-button-label",
|
|
159
|
+
"reflect": false
|
|
160
|
+
},
|
|
161
|
+
"infoText": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"mutable": false,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "string",
|
|
166
|
+
"resolved": "string",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": false,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": ""
|
|
174
|
+
},
|
|
175
|
+
"attribute": "info-text",
|
|
176
|
+
"reflect": false
|
|
177
|
+
},
|
|
178
|
+
"useSearch": {
|
|
179
|
+
"type": "boolean",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "boolean",
|
|
183
|
+
"resolved": "boolean",
|
|
184
|
+
"references": {}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": false,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": ""
|
|
191
|
+
},
|
|
192
|
+
"attribute": "use-search",
|
|
193
|
+
"reflect": false
|
|
194
|
+
},
|
|
195
|
+
"processModalAction": {
|
|
196
|
+
"type": "unknown",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "(action: ModalAction) => void",
|
|
200
|
+
"resolved": "(action: ModalAction) => void",
|
|
201
|
+
"references": {
|
|
202
|
+
"ModalAction": {
|
|
203
|
+
"location": "import",
|
|
204
|
+
"path": "@sankhyalabs/ezui/dist/collection/components/ez-modal-container"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"optional": false,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": ""
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
static get states() {
|
|
218
|
+
return {
|
|
219
|
+
"_filterArgument": {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|