@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,387 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Stencil Client Platform v2.18.1 | MIT Licensed | https://stenciljs.com
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*
|
|
11
|
-
* This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
12
|
-
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
13
|
-
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
14
|
-
*/
|
|
15
|
-
const safeSelector = (selector) => {
|
|
16
|
-
const placeholders = [];
|
|
17
|
-
let index = 0;
|
|
18
|
-
// Replaces attribute selectors with placeholders.
|
|
19
|
-
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
|
|
20
|
-
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
21
|
-
const replaceBy = `__ph-${index}__`;
|
|
22
|
-
placeholders.push(keep);
|
|
23
|
-
index++;
|
|
24
|
-
return replaceBy;
|
|
25
|
-
});
|
|
26
|
-
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
27
|
-
// WS and "+" would otherwise be interpreted as selector separators.
|
|
28
|
-
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
29
|
-
const replaceBy = `__ph-${index}__`;
|
|
30
|
-
placeholders.push(exp);
|
|
31
|
-
index++;
|
|
32
|
-
return pseudo + replaceBy;
|
|
33
|
-
});
|
|
34
|
-
const ss = {
|
|
35
|
-
content,
|
|
36
|
-
placeholders,
|
|
37
|
-
};
|
|
38
|
-
return ss;
|
|
39
|
-
};
|
|
40
|
-
const restoreSafeSelector = (placeholders, content) => {
|
|
41
|
-
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
42
|
-
};
|
|
43
|
-
const _polyfillHost = '-shadowcsshost';
|
|
44
|
-
const _polyfillSlotted = '-shadowcssslotted';
|
|
45
|
-
// note: :host-context pre-processed to -shadowcsshostcontext.
|
|
46
|
-
const _polyfillHostContext = '-shadowcsscontext';
|
|
47
|
-
const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
|
|
48
|
-
const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
|
|
49
|
-
const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
|
|
50
|
-
const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
|
|
51
|
-
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
52
|
-
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
53
|
-
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
54
|
-
const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
|
|
55
|
-
const _polyfillHostRe = /-shadowcsshost/gim;
|
|
56
|
-
const _colonHostRe = /:host/gim;
|
|
57
|
-
const _colonSlottedRe = /::slotted/gim;
|
|
58
|
-
const _colonHostContextRe = /:host-context/gim;
|
|
59
|
-
const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
60
|
-
const stripComments = (input) => {
|
|
61
|
-
return input.replace(_commentRe, '');
|
|
62
|
-
};
|
|
63
|
-
const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
64
|
-
const extractCommentsWithHash = (input) => {
|
|
65
|
-
return input.match(_commentWithHashRe) || [];
|
|
66
|
-
};
|
|
67
|
-
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
68
|
-
const _curlyRe = /([{}])/g;
|
|
69
|
-
const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
70
|
-
const OPEN_CURLY = '{';
|
|
71
|
-
const CLOSE_CURLY = '}';
|
|
72
|
-
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
73
|
-
const processRules = (input, ruleCallback) => {
|
|
74
|
-
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
75
|
-
let nextBlockIndex = 0;
|
|
76
|
-
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
77
|
-
const selector = m[2];
|
|
78
|
-
let content = '';
|
|
79
|
-
let suffix = m[4];
|
|
80
|
-
let contentPrefix = '';
|
|
81
|
-
if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
|
|
82
|
-
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
83
|
-
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
84
|
-
contentPrefix = '{';
|
|
85
|
-
}
|
|
86
|
-
const cssRule = {
|
|
87
|
-
selector,
|
|
88
|
-
content,
|
|
89
|
-
};
|
|
90
|
-
const rule = ruleCallback(cssRule);
|
|
91
|
-
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
const escapeBlocks = (input) => {
|
|
95
|
-
const inputParts = input.split(_curlyRe);
|
|
96
|
-
const resultParts = [];
|
|
97
|
-
const escapedBlocks = [];
|
|
98
|
-
let bracketCount = 0;
|
|
99
|
-
let currentBlockParts = [];
|
|
100
|
-
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
101
|
-
const part = inputParts[partIndex];
|
|
102
|
-
if (part === CLOSE_CURLY) {
|
|
103
|
-
bracketCount--;
|
|
104
|
-
}
|
|
105
|
-
if (bracketCount > 0) {
|
|
106
|
-
currentBlockParts.push(part);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
if (currentBlockParts.length > 0) {
|
|
110
|
-
escapedBlocks.push(currentBlockParts.join(''));
|
|
111
|
-
resultParts.push(BLOCK_PLACEHOLDER);
|
|
112
|
-
currentBlockParts = [];
|
|
113
|
-
}
|
|
114
|
-
resultParts.push(part);
|
|
115
|
-
}
|
|
116
|
-
if (part === OPEN_CURLY) {
|
|
117
|
-
bracketCount++;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (currentBlockParts.length > 0) {
|
|
121
|
-
escapedBlocks.push(currentBlockParts.join(''));
|
|
122
|
-
resultParts.push(BLOCK_PLACEHOLDER);
|
|
123
|
-
}
|
|
124
|
-
const strEscapedBlocks = {
|
|
125
|
-
escapedString: resultParts.join(''),
|
|
126
|
-
blocks: escapedBlocks,
|
|
127
|
-
};
|
|
128
|
-
return strEscapedBlocks;
|
|
129
|
-
};
|
|
130
|
-
const insertPolyfillHostInCssText = (selector) => {
|
|
131
|
-
selector = selector
|
|
132
|
-
.replace(_colonHostContextRe, _polyfillHostContext)
|
|
133
|
-
.replace(_colonHostRe, _polyfillHost)
|
|
134
|
-
.replace(_colonSlottedRe, _polyfillSlotted);
|
|
135
|
-
return selector;
|
|
136
|
-
};
|
|
137
|
-
const convertColonRule = (cssText, regExp, partReplacer) => {
|
|
138
|
-
// m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
|
|
139
|
-
return cssText.replace(regExp, (...m) => {
|
|
140
|
-
if (m[2]) {
|
|
141
|
-
const parts = m[2].split(',');
|
|
142
|
-
const r = [];
|
|
143
|
-
for (let i = 0; i < parts.length; i++) {
|
|
144
|
-
const p = parts[i].trim();
|
|
145
|
-
if (!p)
|
|
146
|
-
break;
|
|
147
|
-
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
148
|
-
}
|
|
149
|
-
return r.join(',');
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
return _polyfillHostNoCombinator + m[3];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
const colonHostPartReplacer = (host, part, suffix) => {
|
|
157
|
-
return host + part.replace(_polyfillHost, '') + suffix;
|
|
158
|
-
};
|
|
159
|
-
const convertColonHost = (cssText) => {
|
|
160
|
-
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
161
|
-
};
|
|
162
|
-
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
163
|
-
if (part.indexOf(_polyfillHost) > -1) {
|
|
164
|
-
return colonHostPartReplacer(host, part, suffix);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
return host + part + suffix + ', ' + part + ' ' + host + suffix;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
171
|
-
const slotClass = '.' + slotScopeId + ' > ';
|
|
172
|
-
const selectors = [];
|
|
173
|
-
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
174
|
-
if (m[2]) {
|
|
175
|
-
const compound = m[2].trim();
|
|
176
|
-
const suffix = m[3];
|
|
177
|
-
const slottedSelector = slotClass + compound + suffix;
|
|
178
|
-
let prefixSelector = '';
|
|
179
|
-
for (let i = m[4] - 1; i >= 0; i--) {
|
|
180
|
-
const char = m[5][i];
|
|
181
|
-
if (char === '}' || char === ',') {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
prefixSelector = char + prefixSelector;
|
|
185
|
-
}
|
|
186
|
-
const orgSelector = prefixSelector + slottedSelector;
|
|
187
|
-
const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
|
|
188
|
-
if (orgSelector.trim() !== addedSelector.trim()) {
|
|
189
|
-
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
190
|
-
selectors.push({
|
|
191
|
-
orgSelector,
|
|
192
|
-
updatedSelector,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return slottedSelector;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
return _polyfillHostNoCombinator + m[3];
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
return {
|
|
202
|
-
selectors,
|
|
203
|
-
cssText,
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
const convertColonHostContext = (cssText) => {
|
|
207
|
-
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
208
|
-
};
|
|
209
|
-
const convertShadowDOMSelectors = (cssText) => {
|
|
210
|
-
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
|
|
211
|
-
};
|
|
212
|
-
const makeScopeMatcher = (scopeSelector) => {
|
|
213
|
-
const lre = /\[/g;
|
|
214
|
-
const rre = /\]/g;
|
|
215
|
-
scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
|
|
216
|
-
return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
|
|
217
|
-
};
|
|
218
|
-
const selectorNeedsScoping = (selector, scopeSelector) => {
|
|
219
|
-
const re = makeScopeMatcher(scopeSelector);
|
|
220
|
-
return !re.test(selector);
|
|
221
|
-
};
|
|
222
|
-
const injectScopingSelector = (selector, scopingSelector) => {
|
|
223
|
-
return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
|
|
224
|
-
return before + scopingSelector + colon + after;
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
228
|
-
// In Android browser, the lastIndex is not reset when the regex is used in String.replace()
|
|
229
|
-
_polyfillHostRe.lastIndex = 0;
|
|
230
|
-
if (_polyfillHostRe.test(selector)) {
|
|
231
|
-
const replaceBy = `.${hostSelector}`;
|
|
232
|
-
return selector
|
|
233
|
-
.replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
|
|
234
|
-
.replace(_polyfillHostRe, replaceBy + ' ');
|
|
235
|
-
}
|
|
236
|
-
return scopeSelector + ' ' + selector;
|
|
237
|
-
};
|
|
238
|
-
const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
239
|
-
const isRe = /\[is=([^\]]*)\]/g;
|
|
240
|
-
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
241
|
-
const className = '.' + scopeSelector;
|
|
242
|
-
const _scopeSelectorPart = (p) => {
|
|
243
|
-
let scopedP = p.trim();
|
|
244
|
-
if (!scopedP) {
|
|
245
|
-
return '';
|
|
246
|
-
}
|
|
247
|
-
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
248
|
-
scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
// remove :host since it should be unnecessary
|
|
252
|
-
const t = p.replace(_polyfillHostRe, '');
|
|
253
|
-
if (t.length > 0) {
|
|
254
|
-
scopedP = injectScopingSelector(t, className);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return scopedP;
|
|
258
|
-
};
|
|
259
|
-
const safeContent = safeSelector(selector);
|
|
260
|
-
selector = safeContent.content;
|
|
261
|
-
let scopedSelector = '';
|
|
262
|
-
let startIndex = 0;
|
|
263
|
-
let res;
|
|
264
|
-
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
265
|
-
// If a selector appears before :host it should not be shimmed as it
|
|
266
|
-
// matches on ancestor elements and not on elements in the host's shadow
|
|
267
|
-
// `:host-context(div)` is transformed to
|
|
268
|
-
// `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
|
|
269
|
-
// the `div` is not part of the component in the 2nd selectors and should not be scoped.
|
|
270
|
-
// Historically `component-tag:host` was matching the component so we also want to preserve
|
|
271
|
-
// this behavior to avoid breaking legacy apps (it should not match).
|
|
272
|
-
// The behavior should be:
|
|
273
|
-
// - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
|
|
274
|
-
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
|
|
275
|
-
// `:host-context(tag)`)
|
|
276
|
-
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
277
|
-
// Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
|
|
278
|
-
let shouldScope = !hasHost;
|
|
279
|
-
while ((res = sep.exec(selector)) !== null) {
|
|
280
|
-
const separator = res[1];
|
|
281
|
-
const part = selector.slice(startIndex, res.index).trim();
|
|
282
|
-
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
283
|
-
const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
|
|
284
|
-
scopedSelector += `${scopedPart} ${separator} `;
|
|
285
|
-
startIndex = sep.lastIndex;
|
|
286
|
-
}
|
|
287
|
-
const part = selector.substring(startIndex);
|
|
288
|
-
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
289
|
-
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
290
|
-
// replace the placeholders with their original values
|
|
291
|
-
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
292
|
-
};
|
|
293
|
-
const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
294
|
-
return selector
|
|
295
|
-
.split(',')
|
|
296
|
-
.map((shallowPart) => {
|
|
297
|
-
if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
|
|
298
|
-
return shallowPart.trim();
|
|
299
|
-
}
|
|
300
|
-
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
301
|
-
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
return shallowPart.trim();
|
|
305
|
-
}
|
|
306
|
-
})
|
|
307
|
-
.join(', ');
|
|
308
|
-
};
|
|
309
|
-
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
310
|
-
return processRules(cssText, (rule) => {
|
|
311
|
-
let selector = rule.selector;
|
|
312
|
-
let content = rule.content;
|
|
313
|
-
if (rule.selector[0] !== '@') {
|
|
314
|
-
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
315
|
-
}
|
|
316
|
-
else if (rule.selector.startsWith('@media') ||
|
|
317
|
-
rule.selector.startsWith('@supports') ||
|
|
318
|
-
rule.selector.startsWith('@page') ||
|
|
319
|
-
rule.selector.startsWith('@document')) {
|
|
320
|
-
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
|
|
321
|
-
}
|
|
322
|
-
const cssRule = {
|
|
323
|
-
selector: selector.replace(/\s{2,}/g, ' ').trim(),
|
|
324
|
-
content,
|
|
325
|
-
};
|
|
326
|
-
return cssRule;
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
330
|
-
cssText = insertPolyfillHostInCssText(cssText);
|
|
331
|
-
cssText = convertColonHost(cssText);
|
|
332
|
-
cssText = convertColonHostContext(cssText);
|
|
333
|
-
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
334
|
-
cssText = slotted.cssText;
|
|
335
|
-
cssText = convertShadowDOMSelectors(cssText);
|
|
336
|
-
if (scopeId) {
|
|
337
|
-
cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
|
|
338
|
-
}
|
|
339
|
-
cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
340
|
-
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
|
|
341
|
-
return {
|
|
342
|
-
cssText: cssText.trim(),
|
|
343
|
-
slottedSelectors: slotted.selectors,
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
347
|
-
const hostScopeId = scopeId + '-h';
|
|
348
|
-
const slotScopeId = scopeId + '-s';
|
|
349
|
-
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
350
|
-
cssText = stripComments(cssText);
|
|
351
|
-
const orgSelectors = [];
|
|
352
|
-
if (commentOriginalSelector) {
|
|
353
|
-
const processCommentedSelector = (rule) => {
|
|
354
|
-
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
355
|
-
const comment = `/*!@${rule.selector}*/`;
|
|
356
|
-
orgSelectors.push({ placeholder, comment });
|
|
357
|
-
rule.selector = placeholder + rule.selector;
|
|
358
|
-
return rule;
|
|
359
|
-
};
|
|
360
|
-
cssText = processRules(cssText, (rule) => {
|
|
361
|
-
if (rule.selector[0] !== '@') {
|
|
362
|
-
return processCommentedSelector(rule);
|
|
363
|
-
}
|
|
364
|
-
else if (rule.selector.startsWith('@media') ||
|
|
365
|
-
rule.selector.startsWith('@supports') ||
|
|
366
|
-
rule.selector.startsWith('@page') ||
|
|
367
|
-
rule.selector.startsWith('@document')) {
|
|
368
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
369
|
-
return rule;
|
|
370
|
-
}
|
|
371
|
-
return rule;
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
|
|
375
|
-
cssText = [scoped.cssText, ...commentsWithHash].join('\n');
|
|
376
|
-
if (commentOriginalSelector) {
|
|
377
|
-
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
378
|
-
cssText = cssText.replace(placeholder, comment);
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
382
|
-
cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
|
|
383
|
-
});
|
|
384
|
-
return cssText;
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
export { scopeCss };
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, f as Host, g as getElement } from './index-2b4d2d14.js';
|
|
2
|
-
import { b as DataType, t as toString, A as ApplicationContext, E as ErrorException, O as ObjectUtils } from './index-f1d3e4da.js';
|
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
|
|
4
|
-
|
|
5
|
-
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, 1);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;flex-grow:0}.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)}.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.preselected.sc-snk-filter-bar{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%}";
|
|
6
|
-
|
|
7
|
-
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
8
|
-
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
9
|
-
const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
|
|
10
|
-
const SnkFilterBar = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
registerInstance(this, hostRef);
|
|
13
|
-
this._updateSequence = [];
|
|
14
|
-
this._calculateSortIndex = (item) => {
|
|
15
|
-
let index = item.hardFixed ? 1000000 : 0;
|
|
16
|
-
//campos Hard Fixed não variam a ordem
|
|
17
|
-
if (!item.hardFixed) {
|
|
18
|
-
index += item.fixed ? 100000 : 0;
|
|
19
|
-
index += item.value == undefined ? 0 : 10000;
|
|
20
|
-
index += this._updateSequence.lastIndexOf(item.id) + 1;
|
|
21
|
-
}
|
|
22
|
-
return index;
|
|
23
|
-
};
|
|
24
|
-
this._filtersComparator = (a, b) => {
|
|
25
|
-
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
30
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
|
31
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
32
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
|
|
33
|
-
*/
|
|
34
|
-
getMessage(key, params) {
|
|
35
|
-
return this._application.messagesBuilder.getMessage(key, params);
|
|
36
|
-
}
|
|
37
|
-
getFilter(_dataUnit) {
|
|
38
|
-
var _a;
|
|
39
|
-
const filters = [];
|
|
40
|
-
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => item.value).forEach(item => {
|
|
41
|
-
const filter = this.buildDUFilter(item);
|
|
42
|
-
if (filter) {
|
|
43
|
-
filters.push(filter);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return filters;
|
|
47
|
-
}
|
|
48
|
-
buildDUFilter(item) {
|
|
49
|
-
const { id, value, type, props, visible } = item;
|
|
50
|
-
if (value && visible) {
|
|
51
|
-
if (type === FilterItemType.BINARY_SELECT) {
|
|
52
|
-
const options = props.options;
|
|
53
|
-
const selectedOption = options.find(opt => opt.name === value);
|
|
54
|
-
//FIXME: ajustar o backend para não exigir parametros
|
|
55
|
-
return { name: id, expression: selectedOption.expression, params: [] };
|
|
56
|
-
}
|
|
57
|
-
if (type === FilterItemType.MULTI_SELECT) {
|
|
58
|
-
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
|
59
|
-
}
|
|
60
|
-
if (type === FilterItemType.PERIOD) {
|
|
61
|
-
let { end, start } = value;
|
|
62
|
-
if (typeof end === "string") {
|
|
63
|
-
end = new Date(end);
|
|
64
|
-
}
|
|
65
|
-
if (typeof start === "string") {
|
|
66
|
-
start = new Date(start);
|
|
67
|
-
}
|
|
68
|
-
const params = [];
|
|
69
|
-
let expression;
|
|
70
|
-
if (end && start) {
|
|
71
|
-
expression = props.expression.fullfill;
|
|
72
|
-
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (start) {
|
|
76
|
-
expression = props.expression.onlystart;
|
|
77
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
expression = props.expression.onlyend;
|
|
81
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return { name: id, expression, params };
|
|
85
|
-
}
|
|
86
|
-
if (type === FilterItemType.SEARCH) {
|
|
87
|
-
const expression = props.expression;
|
|
88
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
|
89
|
-
}
|
|
90
|
-
if (type === FilterItemType.TEXT) {
|
|
91
|
-
const expression = props.expression;
|
|
92
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
|
93
|
-
}
|
|
94
|
-
if (type === FilterItemType.NUMBER) {
|
|
95
|
-
const expression = props.expression;
|
|
96
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
|
97
|
-
}
|
|
98
|
-
//No mapeamento dos outros tipos precisamos saber o tipo de dado.
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
componentWillLoad() {
|
|
103
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
104
|
-
if (this._application) {
|
|
105
|
-
this._application.getFilterBarConfig(this.configName)
|
|
106
|
-
.then((filters) => {
|
|
107
|
-
this.filterConfig = filters;
|
|
108
|
-
})
|
|
109
|
-
.catch(reason => {
|
|
110
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (this.dataUnit == undefined) {
|
|
114
|
-
let parent = this._element.parentElement;
|
|
115
|
-
while (parent) {
|
|
116
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
117
|
-
const snkDataUnit = parent;
|
|
118
|
-
this.dataUnit = snkDataUnit.dataUnit;
|
|
119
|
-
if (this.dataUnit) {
|
|
120
|
-
this.dataUnit.addFilterProvider(this);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
124
|
-
this.dataUnit = evt.detail;
|
|
125
|
-
this.dataUnit.addFilterProvider(this);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
parent = parent.parentElement;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.dataUnit.addFilterProvider(this);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
getFilterItems() {
|
|
138
|
-
const pinnedItems = [];
|
|
139
|
-
const unpinnedItems = [];
|
|
140
|
-
this.filterConfig
|
|
141
|
-
.filter(item => item.visible)
|
|
142
|
-
.sort((a, b) => this._filtersComparator(a, b))
|
|
143
|
-
.forEach((item, index) => {
|
|
144
|
-
const filterItem = (h("snk-filter-item", { id: `filter-${item.id}`, config: this.normalizeItem(item), class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
145
|
-
if (item.fixed || item.hardFixed) {
|
|
146
|
-
pinnedItems.push(filterItem);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
unpinnedItems.push(filterItem);
|
|
150
|
-
}
|
|
151
|
-
return filterItem;
|
|
152
|
-
});
|
|
153
|
-
const elements = [];
|
|
154
|
-
elements.push(...pinnedItems);
|
|
155
|
-
if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
|
|
156
|
-
elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
|
|
157
|
-
}
|
|
158
|
-
elements.push(...unpinnedItems);
|
|
159
|
-
return elements;
|
|
160
|
-
}
|
|
161
|
-
calculateUpdateSequence(item) {
|
|
162
|
-
if (item) {
|
|
163
|
-
this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
|
|
164
|
-
this._updateSequence.push(item.id);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
filterChangeListener(evt) {
|
|
168
|
-
this.updateFilter(evt.detail);
|
|
169
|
-
}
|
|
170
|
-
normalizeItem(item) {
|
|
171
|
-
const normalized = Object.assign({}, item);
|
|
172
|
-
const optionals = ["props", "value", "hardFixed", "fixed"];
|
|
173
|
-
optionals.forEach(prop => {
|
|
174
|
-
if (normalized[prop] == undefined) {
|
|
175
|
-
delete normalized[prop];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
if (item.value === "") {
|
|
179
|
-
delete item.value;
|
|
180
|
-
}
|
|
181
|
-
return normalized;
|
|
182
|
-
}
|
|
183
|
-
updateFilter(newItem, clear = false) {
|
|
184
|
-
let needLoad = false;
|
|
185
|
-
let updated = false;
|
|
186
|
-
this.filterConfig = this.filterConfig.map(item => {
|
|
187
|
-
if (clear) {
|
|
188
|
-
if (item.value != undefined) {
|
|
189
|
-
updated = true;
|
|
190
|
-
needLoad = true;
|
|
191
|
-
}
|
|
192
|
-
return Object.assign(Object.assign({}, item), { value: undefined });
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
if (item.id === newItem.id) {
|
|
196
|
-
const normalizedOne = this.normalizeItem(item);
|
|
197
|
-
const normalizedTwo = this.normalizeItem(newItem);
|
|
198
|
-
updated = ObjectUtils.objectToString(normalizedOne) != ObjectUtils.objectToString(normalizedTwo);
|
|
199
|
-
needLoad = ObjectUtils.objectToString(normalizedOne.value) !== ObjectUtils.objectToString(normalizedTwo.value);
|
|
200
|
-
return newItem;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return item;
|
|
204
|
-
});
|
|
205
|
-
if (needLoad) {
|
|
206
|
-
this.dataUnit.loadData();
|
|
207
|
-
}
|
|
208
|
-
if (updated) {
|
|
209
|
-
this.calculateUpdateSequence(newItem);
|
|
210
|
-
this._application.saveFilterBarConfig(this.filterConfig, this.configName);
|
|
211
|
-
}
|
|
212
|
-
return needLoad;
|
|
213
|
-
}
|
|
214
|
-
getAddListItems() {
|
|
215
|
-
const hiddenItems = this.filterConfig
|
|
216
|
-
.filter(item => !item.visible)
|
|
217
|
-
.sort(this._filtersComparator);
|
|
218
|
-
return hiddenItems.map(filter => {
|
|
219
|
-
return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
|
|
220
|
-
}).concat([
|
|
221
|
-
{ name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" },
|
|
222
|
-
{ name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
|
|
223
|
-
]);
|
|
224
|
-
}
|
|
225
|
-
getActiveClass() {
|
|
226
|
-
const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
|
|
227
|
-
return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
|
|
228
|
-
}
|
|
229
|
-
getAppliedListItems() {
|
|
230
|
-
const appliedItems = this.filterConfig
|
|
231
|
-
.filter(item => item.value != undefined)
|
|
232
|
-
.sort(this._filtersComparator);
|
|
233
|
-
return appliedItems.map(filter => {
|
|
234
|
-
return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
|
|
235
|
-
}).concat([
|
|
236
|
-
{ name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
|
|
237
|
-
]);
|
|
238
|
-
}
|
|
239
|
-
addFilterHandler(itemName) {
|
|
240
|
-
const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
|
|
241
|
-
if (filterItem) {
|
|
242
|
-
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
243
|
-
window.requestAnimationFrame(() => {
|
|
244
|
-
const itemElement = this._element.querySelector("#filter-" + itemName);
|
|
245
|
-
if (itemElement) {
|
|
246
|
-
itemElement.showUp();
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
appliedFilterHandler(itemName) {
|
|
252
|
-
if (itemName === CLEAR_ALL_FILTERS) {
|
|
253
|
-
if (this.updateFilter(null, true)) {
|
|
254
|
-
this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
const itemElement = this._element.querySelector("#filter-" + itemName);
|
|
259
|
-
if (itemElement) {
|
|
260
|
-
itemElement.showUp(true);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
render() {
|
|
265
|
-
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
266
|
-
return undefined;
|
|
267
|
-
}
|
|
268
|
-
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" }))));
|
|
269
|
-
}
|
|
270
|
-
get _element() { return getElement(this); }
|
|
271
|
-
};
|
|
272
|
-
SnkFilterBar.style = snkFilterBarCss;
|
|
273
|
-
|
|
274
|
-
export { SnkFilterBar as snk_filter_bar };
|