@sankhyalabs/sankhyablocks 8.15.0-rc.2 → 8.15.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-302bbbd4.js → ConfigStorage-8d4e9d53.js} +70 -7
- package/dist/cjs/{DataFetcher-ba94ed5b.js → DataFetcher-99f0f6ed.js} +5 -3
- package/dist/cjs/{SnkFormConfigManager-71c4768e.js → SnkFormConfigManager-33995e92.js} +21 -13
- package/dist/cjs/{SnkMessageBuilder-e7dcf408.js → SnkMessageBuilder-66aa2557.js} +6 -1
- package/dist/cjs/SnkMultiSelectionListDataSource-d15f7aac.js +140 -0
- package/dist/cjs/{auth-fetcher-c8467c07.js → auth-fetcher-bb8e9ae4.js} +1 -1
- package/dist/cjs/{form-config-fetcher-df043d3d.js → form-config-fetcher-d73f4449.js} +13 -1
- package/dist/cjs/index-f9e81701.js +2 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-e4a7c4c3.js → pesquisa-fetcher-bdbbe9ac.js} +277 -61
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/{snk-actions-button_2.cjs.entry.js → snk-actions-button_4.cjs.entry.js} +520 -5
- package/dist/cjs/snk-application.cjs.entry.js +13 -8
- package/dist/cjs/snk-attach.cjs.entry.js +67 -47
- package/dist/cjs/snk-crud.cjs.entry.js +16 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +10 -6
- package/dist/cjs/{snk-data-unit-82c08a8c.js → snk-data-unit-41c29713.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
- package/dist/cjs/snk-entity-list.cjs.entry.js +5 -3
- package/dist/cjs/snk-filter-bar.cjs.entry.js +36 -5
- package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-item.cjs.entry.js +10 -6
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +47 -27
- package/dist/cjs/snk-form.cjs.entry.js +11 -4
- package/dist/cjs/snk-grid.cjs.entry.js +37 -22
- package/dist/cjs/{snk-guides-viewer-d32c096f.js → snk-guides-viewer-a8dd24a3.js} +15 -9
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +3 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +249 -23
- package/dist/cjs/snk-taskbar.cjs.entry.js +123 -15
- package/dist/cjs/{taskbar-elements-01b85b99.js → taskbar-elements-3ecd1278.js} +9 -9
- package/dist/collection/collection-manifest.json +6 -6
- package/dist/collection/components/snk-application/__mocks__/snk-application.js +7 -0
- package/dist/collection/components/snk-application/snk-application.js +51 -11
- package/dist/collection/components/snk-attach/snk-attach.js +39 -24
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
- package/dist/collection/components/snk-crud/snk-crud.js +95 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +11 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +27 -3
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +7 -3
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +5 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +3 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +28 -6
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +24 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +116 -2
- package/dist/collection/components/snk-form/snk-form.js +25 -1
- package/dist/collection/components/{snk-form → snk-form-config}/SnkFormConfigManager.js +20 -12
- package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.js +50 -30
- package/dist/collection/components/snk-grid/snk-grid.js +100 -16
- package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.js +130 -123
- package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.js +1 -1
- package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +10 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +414 -18
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +1 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -9
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +17 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +166 -14
- package/dist/collection/lib/configs/ConfigStorage.js +63 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +9 -40
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +5 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -11
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -1
- package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
- package/dist/collection/lib/utils/CrudUtils.js +13 -1
- package/dist/components/ConfigStorage.js +68 -5
- package/dist/components/DataFetcher.js +5 -3
- package/dist/components/SnkFormConfigManager.js +19 -11
- package/dist/components/SnkMessageBuilder.js +6 -1
- package/dist/components/dataunit-fetcher.js +45 -50
- package/dist/components/field-search.js +93 -3
- package/dist/components/form-config-fetcher.js +12 -0
- package/dist/components/index.d.ts +6 -6
- package/dist/components/snk-application2.js +9 -1
- package/dist/components/snk-attach2.js +115 -52
- package/dist/components/snk-crud.js +15 -3
- package/dist/components/snk-data-exporter2.js +7 -3
- package/dist/components/snk-detail-view2.js +40 -7
- package/dist/components/snk-entity-list.js +5 -3
- package/dist/components/snk-filter-bar2.js +38 -3
- package/dist/components/snk-filter-detail2.js +5 -1
- package/dist/components/snk-filter-item2.js +11 -6
- package/dist/components/snk-form-config2.js +46 -26
- package/dist/components/snk-form.js +8 -0
- package/dist/components/snk-grid-config2.js +128 -102
- package/dist/components/snk-grid2.js +38 -17
- package/dist/components/snk-personalized-filter-editor.js +3 -1
- package/dist/components/snk-simple-crud2.js +310 -30
- package/dist/components/snk-taskbar2.js +139 -25
- package/dist/components/taskbar-actions-button2.js +1 -1
- package/dist/esm/{ConfigStorage-4151acc8.js → ConfigStorage-6e241cd7.js} +70 -7
- package/dist/esm/{DataFetcher-aa159c5a.js → DataFetcher-a650ae58.js} +5 -3
- package/dist/esm/{SnkFormConfigManager-5c7d3771.js → SnkFormConfigManager-7a4e678f.js} +21 -13
- package/dist/esm/{SnkMessageBuilder-0fb796b9.js → SnkMessageBuilder-0a4becdd.js} +6 -1
- package/dist/esm/SnkMultiSelectionListDataSource-7084f3b3.js +133 -0
- package/dist/esm/{auth-fetcher-c05dc474.js → auth-fetcher-8ec448b0.js} +1 -1
- package/dist/esm/{form-config-fetcher-36219cd3.js → form-config-fetcher-765b8498.js} +13 -1
- package/dist/esm/index-a7d3d3f1.js +2 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-fa0c2540.js → pesquisa-fetcher-96d2f351.js} +266 -54
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/{snk-actions-button_2.entry.js → snk-actions-button_4.entry.js} +519 -6
- package/dist/esm/snk-application.entry.js +13 -8
- package/dist/esm/snk-attach.entry.js +66 -46
- package/dist/esm/snk-crud.entry.js +16 -10
- package/dist/esm/snk-data-exporter.entry.js +10 -6
- package/dist/esm/{snk-data-unit-5d201fb3.js → snk-data-unit-de1d140d.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +9 -10
- package/dist/esm/snk-entity-list.entry.js +5 -3
- package/dist/esm/snk-filter-bar.entry.js +36 -5
- package/dist/esm/snk-filter-detail.entry.js +4 -1
- package/dist/esm/snk-filter-item.entry.js +10 -6
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +48 -28
- package/dist/esm/snk-form.entry.js +11 -4
- package/dist/esm/snk-grid.entry.js +38 -23
- package/dist/esm/{snk-guides-viewer-f49613c6.js → snk-guides-viewer-131e9660.js} +15 -9
- package/dist/esm/snk-guides-viewer.entry.js +7 -8
- package/dist/esm/snk-personalized-filter-editor.entry.js +3 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +250 -24
- package/dist/esm/snk-taskbar.entry.js +124 -16
- package/dist/esm/{taskbar-elements-d4d0b424.js → taskbar-elements-2473c8ac.js} +9 -9
- package/dist/sankhyablocks/p-004c356e.js +26 -0
- package/dist/sankhyablocks/p-0624f62d.js +56 -0
- package/dist/sankhyablocks/p-075bba4c.entry.js +1 -0
- package/dist/sankhyablocks/p-07a61550.entry.js +1 -0
- package/dist/sankhyablocks/p-103c5956.entry.js +1 -0
- package/dist/sankhyablocks/p-1048bd26.entry.js +1 -0
- package/dist/sankhyablocks/{p-e6380c60.js → p-125bb902.js} +1 -1
- package/dist/sankhyablocks/p-13ae1a89.entry.js +1 -0
- package/dist/sankhyablocks/p-19a56978.entry.js +1 -0
- package/dist/sankhyablocks/{p-e0fd9555.entry.js → p-24ed6ad6.entry.js} +1 -1
- package/dist/sankhyablocks/p-32556aa6.js +1 -0
- package/dist/sankhyablocks/p-33718dfc.entry.js +1 -0
- package/dist/sankhyablocks/p-34a7f2ab.js +65 -0
- package/dist/sankhyablocks/{p-f3d1c48e.js → p-52c8e589.js} +1 -1
- package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
- package/dist/sankhyablocks/p-5833cff9.js +1 -0
- package/dist/sankhyablocks/p-5a2e016a.entry.js +1 -0
- package/dist/sankhyablocks/p-619c5f6f.entry.js +11 -0
- package/dist/sankhyablocks/p-6f560924.entry.js +1 -0
- package/dist/sankhyablocks/p-8967fa78.js +1 -0
- package/dist/sankhyablocks/p-a87149e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-7f3c7b09.entry.js → p-ac77949b.entry.js} +1 -1
- package/dist/sankhyablocks/p-ae4fc9a9.js +1 -0
- package/dist/sankhyablocks/p-b10b9934.entry.js +1 -0
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +1 -0
- package/dist/sankhyablocks/{p-9695f78b.js → p-be75153c.js} +1 -1
- package/dist/sankhyablocks/p-bf39bdb8.entry.js +1 -0
- package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
- package/dist/sankhyablocks/p-efeca7ba.js +1 -0
- package/dist/sankhyablocks/p-f7d0fab9.entry.js +1 -0
- package/dist/sankhyablocks/p-f7d9d148.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
- package/dist/types/components/snk-application/__mocks__/snk-application.d.ts +3 -0
- package/dist/types/components/snk-application/snk-application.d.ts +8 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
- package/dist/types/components/snk-crud/snk-crud.d.ts +21 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -1
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +6 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +20 -1
- package/dist/types/components/snk-form/snk-form.d.ts +6 -1
- package/dist/types/components/{snk-form → snk-form-config}/SnkFormConfigManager.d.ts +2 -1
- package/dist/types/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.d.ts +5 -3
- package/dist/types/components/snk-grid/snk-grid.d.ts +19 -1
- package/dist/types/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.d.ts +11 -6
- package/dist/types/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.d.ts +1 -1
- package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +75 -3
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +34 -1
- package/dist/types/components.d.ts +226 -12
- package/dist/types/lib/configs/ConfigStorage.d.ts +21 -1
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
- package/dist/types/lib/utils/CrudUtils.d.ts +3 -0
- package/package.json +9 -2
- package/dist/cjs/PreloadManager-84466da6.js +0 -224
- package/dist/cjs/SnkMultiSelectionListDataSource-ba5838c2.js +0 -49
- package/dist/cjs/snk-grid-config.cjs.entry.js +0 -483
- package/dist/cjs/snk-select-box.cjs.entry.js +0 -25
- package/dist/esm/PreloadManager-c1c2f2b4.js +0 -222
- package/dist/esm/SnkMultiSelectionListDataSource-44494b0e.js +0 -43
- package/dist/esm/snk-grid-config.entry.js +0 -479
- package/dist/esm/snk-select-box.entry.js +0 -21
- package/dist/sankhyablocks/p-02e3a45b.entry.js +0 -1
- package/dist/sankhyablocks/p-05243555.js +0 -1
- package/dist/sankhyablocks/p-094c30cb.js +0 -1
- package/dist/sankhyablocks/p-0d7863ed.js +0 -26
- package/dist/sankhyablocks/p-0ec5b2e5.js +0 -1
- package/dist/sankhyablocks/p-1d75d9f9.entry.js +0 -1
- package/dist/sankhyablocks/p-2582537c.entry.js +0 -1
- package/dist/sankhyablocks/p-282789a6.entry.js +0 -1
- package/dist/sankhyablocks/p-374d03f6.js +0 -1
- package/dist/sankhyablocks/p-3b0e4e08.js +0 -65
- package/dist/sankhyablocks/p-40915359.entry.js +0 -1
- package/dist/sankhyablocks/p-573a07c5.js +0 -1
- package/dist/sankhyablocks/p-69efa80d.entry.js +0 -1
- package/dist/sankhyablocks/p-761ed32f.entry.js +0 -1
- package/dist/sankhyablocks/p-86801b08.entry.js +0 -1
- package/dist/sankhyablocks/p-96ef14f9.entry.js +0 -1
- package/dist/sankhyablocks/p-98674137.entry.js +0 -1
- package/dist/sankhyablocks/p-9b5944a4.entry.js +0 -1
- package/dist/sankhyablocks/p-9bdbc7d8.entry.js +0 -1
- package/dist/sankhyablocks/p-a52b9254.entry.js +0 -11
- package/dist/sankhyablocks/p-aa95fb2c.js +0 -56
- package/dist/sankhyablocks/p-ac384baf.entry.js +0 -1
- package/dist/sankhyablocks/p-b05ab13d.entry.js +0 -1
- package/dist/sankhyablocks/p-c22c1d8e.js +0 -1
- package/dist/sankhyablocks/p-c4874327.entry.js +0 -1
- package/dist/sankhyablocks/p-c758265f.entry.js +0 -1
- package/dist/sankhyablocks/p-cb7419e0.entry.js +0 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
- package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
- /package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.js +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.js +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.css +0 -0
- /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.js +0 -0
- /package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.css +0 -0
- /package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.css +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.d.ts +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.d.ts +0 -0
- /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -0
@@ -1,25 +1,30 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import {
|
2
|
+
import { StringUtils, ApplicationContext, ObjectUtils, DataType, UserInterface, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
+
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
3
4
|
import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
|
4
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
5
|
-
import './DataFetcher-
|
6
|
-
import { I as InMemoryLoader } from './pesquisa-fetcher-
|
5
|
+
import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
|
6
|
+
import './DataFetcher-a650ae58.js';
|
7
|
+
import { I as InMemoryLoader } from './pesquisa-fetcher-96d2f351.js';
|
8
|
+
import { S as SnkMultiSelectionListDataSource, C as CrudUtils } from './SnkMultiSelectionListDataSource-7084f3b3.js';
|
7
9
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
8
10
|
import './ISave-d8c8bc59.js';
|
9
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
10
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
|
-
import './PreloadManager-c1c2f2b4.js';
|
12
13
|
import './filter-item-type.enum-d45e026f.js';
|
13
|
-
import './form-config-fetcher-
|
14
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-765b8498.js';
|
14
15
|
import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
|
15
|
-
import {
|
16
|
+
import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
|
17
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-7a4e678f.js';
|
16
18
|
import './index-bdf75557.js';
|
17
19
|
import './PrintUtils-3e4ff0f5.js';
|
18
|
-
import './ResourceIDUtils-a114189a.js';
|
19
20
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
21
|
+
import './ResourceIDUtils-a114189a.js';
|
20
22
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
21
23
|
|
22
|
-
const
|
24
|
+
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
25
|
+
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
26
|
+
|
27
|
+
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
|
23
28
|
|
24
29
|
const SnkSimpleCrud = class {
|
25
30
|
constructor(hostRef) {
|
@@ -28,20 +33,24 @@ const SnkSimpleCrud = class {
|
|
28
33
|
this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
|
29
34
|
this.actionClick = createEvent(this, "actionClick", 7);
|
30
35
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
31
|
-
this.
|
32
|
-
this.
|
36
|
+
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
37
|
+
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
33
38
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
34
39
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
40
|
+
this._formConfigFetcher = new FormConfigFetcher();
|
35
41
|
this._taskbarProcessor = new TaskbarProcessor({
|
36
|
-
"snkSimpleCrudTaskbar.form_regular": this.
|
37
|
-
"snkSimpleCrudTaskbar.grid_regular": this.
|
38
|
-
"snkSimpleCrudTaskbar.form_selected": this.
|
39
|
-
"snkSimpleCrudTaskbar.grid_selected": this.
|
42
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
43
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
44
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
|
45
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
|
40
46
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
41
47
|
});
|
48
|
+
this._showPopUpGridConfig = false;
|
49
|
+
this._showFormConfig = false;
|
42
50
|
this._currentViewMode = VIEW_MODE.GRID;
|
43
51
|
this._config = undefined;
|
44
52
|
this._fieldToGetFocus = undefined;
|
53
|
+
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
45
54
|
this.dataState = undefined;
|
46
55
|
this.dataUnit = undefined;
|
47
56
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
@@ -50,11 +59,39 @@ const SnkSimpleCrud = class {
|
|
50
59
|
this._formFields = [];
|
51
60
|
this.multipleSelection = undefined;
|
52
61
|
this.useCancelConfirm = true;
|
62
|
+
this.resourceID = undefined;
|
53
63
|
this.taskbarManager = undefined;
|
54
64
|
this.messagesBuilder = undefined;
|
55
65
|
this.useEnterLikeTab = false;
|
56
66
|
this.actionsList = undefined;
|
57
67
|
this.configName = undefined;
|
68
|
+
this.showConfiguratorButtons = undefined;
|
69
|
+
this.gridLegacyConfigName = undefined;
|
70
|
+
this.formLegacyConfigName = undefined;
|
71
|
+
this.ignoreReadOnlyFormFields = false;
|
72
|
+
}
|
73
|
+
handleResourceIDChanged(newValue, oldValue) {
|
74
|
+
if (StringUtils.isEmpty(newValue)) {
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
if (newValue === oldValue) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
this.loadFormConfig(true);
|
81
|
+
this.loadGridConfig(true);
|
82
|
+
}
|
83
|
+
getButtons(selected, changeModeBtn) {
|
84
|
+
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
85
|
+
.concat(changeModeBtn));
|
86
|
+
}
|
87
|
+
addConfigButton(buttons) {
|
88
|
+
if (this.configName === undefined) {
|
89
|
+
return buttons;
|
90
|
+
}
|
91
|
+
return buttons.concat(TaskbarElement.CONFIGURATOR);
|
92
|
+
}
|
93
|
+
get application() {
|
94
|
+
return ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
58
95
|
}
|
59
96
|
resolveInMemoryBtns(taskbarButtons) {
|
60
97
|
const newTaskBarConfig = [...taskbarButtons];
|
@@ -74,7 +111,10 @@ const SnkSimpleCrud = class {
|
|
74
111
|
}
|
75
112
|
actionClickListener(evt) {
|
76
113
|
const act = evt.detail;
|
77
|
-
if (act === TaskbarElement.
|
114
|
+
if (act === TaskbarElement.CONFIGURATOR) {
|
115
|
+
this._snkConfigurator.open();
|
116
|
+
}
|
117
|
+
else if (act === TaskbarElement.GRID_MODE) {
|
78
118
|
this.goToView(VIEW_MODE.GRID);
|
79
119
|
}
|
80
120
|
else if (act === TaskbarElement.FORM_MODE) {
|
@@ -92,17 +132,129 @@ const SnkSimpleCrud = class {
|
|
92
132
|
this.dataStateChange.emit(newValue);
|
93
133
|
}
|
94
134
|
}
|
95
|
-
|
135
|
+
async observeFormLegacy(newValue, oldValue) {
|
136
|
+
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
137
|
+
}
|
138
|
+
async observeGridLegacy(newValue, oldValue) {
|
139
|
+
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
140
|
+
}
|
141
|
+
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
142
|
+
if (newValue == undefined || newValue == oldValue) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
if (!this._gridConfigAlreadyLoaded) {
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
await this.loadGridConfig(true);
|
149
|
+
}
|
150
|
+
async handleUpdateFormLegacyConfig(newValue, oldValue) {
|
151
|
+
if (newValue == undefined || newValue == oldValue) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
if (!this._formConfigAlreadyLoaded) {
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
this.loadFormConfig(true);
|
158
|
+
}
|
159
|
+
openConfig(viewMode) {
|
160
|
+
this._snkConfigurator.close();
|
161
|
+
if (viewMode === VIEW_MODE.GRID) {
|
162
|
+
this.openGridConfig();
|
163
|
+
}
|
164
|
+
else if (viewMode === VIEW_MODE.FORM) {
|
165
|
+
this.openFormConfig();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
openGridConfig() {
|
169
|
+
this._grid.getColumnsState()
|
170
|
+
.then((gridColumns) => {
|
171
|
+
this._snkGridConfig.columns = gridColumns.filter(c => c.name);
|
172
|
+
this._snkGridConfig.selectedIndex = 0;
|
173
|
+
this._showPopUpGridConfig = true;
|
174
|
+
});
|
175
|
+
}
|
176
|
+
async openFormConfig() {
|
177
|
+
var _a, _b;
|
178
|
+
//No momento não daremos suporte para configuraçao de formulário quando houver legacy config
|
179
|
+
if (this.formLegacyConfigName) {
|
180
|
+
const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
|
181
|
+
const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
|
182
|
+
await this.application.alert(title, message);
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
this._showFormConfig = true;
|
186
|
+
}
|
187
|
+
addGridLegacyConfigName() {
|
188
|
+
if (this.gridLegacyConfigName && this.configName) {
|
189
|
+
ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
loadGridConfig(forceUpdate) {
|
193
|
+
if (this.configName === undefined) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
197
|
+
return;
|
198
|
+
}
|
199
|
+
this.addGridLegacyConfigName();
|
200
|
+
this._gridConfigAlreadyLoaded = true;
|
201
|
+
return new Promise((accept, reject) => {
|
202
|
+
ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
|
203
|
+
.then(config => {
|
204
|
+
this.setGridConfig(config);
|
205
|
+
accept();
|
206
|
+
})
|
207
|
+
.catch(reason => {
|
208
|
+
reject(reason);
|
209
|
+
});
|
210
|
+
});
|
211
|
+
}
|
212
|
+
formConfigIsLoaded() {
|
213
|
+
return this.formConfig != undefined || this._formConfigAlreadyLoaded;
|
214
|
+
}
|
215
|
+
async loadFormConfig(forceLoad = false) {
|
216
|
+
if (this.configName === undefined) {
|
217
|
+
return;
|
218
|
+
}
|
219
|
+
if (this._formConfigManager == undefined) {
|
220
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
221
|
+
this._formConfigManager.setConfig(this.formConfig);
|
222
|
+
}
|
223
|
+
if (this.formConfigIsLoaded() && !forceLoad) {
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
this._formConfigAlreadyLoaded = true;
|
227
|
+
let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
|
228
|
+
if (loadedLegacyConfig != undefined) {
|
229
|
+
this._formConfigManager.setConfig(loadedLegacyConfig);
|
230
|
+
this.setFormConfig(loadedLegacyConfig);
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
this.setFormConfig(await this._formConfigManager.loadConfig());
|
234
|
+
}
|
235
|
+
async componentWillRender() {
|
236
|
+
this._resourceID = await this.application.getResourceID();
|
96
237
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
238
|
+
if (this.configName === undefined) {
|
239
|
+
return;
|
240
|
+
}
|
241
|
+
if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
|
242
|
+
return;
|
243
|
+
}
|
244
|
+
await this.addGridLegacyConfigName();
|
245
|
+
this.loadGridConfig();
|
246
|
+
this.loadFormConfig();
|
97
247
|
}
|
98
248
|
componentWillLoad() {
|
99
249
|
this.processMetadata();
|
100
250
|
this.onModeChange();
|
101
251
|
this.configDatasource();
|
102
252
|
}
|
253
|
+
componentDidLoad() {
|
254
|
+
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
255
|
+
}
|
103
256
|
configDatasource() {
|
104
|
-
|
105
|
-
this._multiSelectionListDataSource.setApplication(application);
|
257
|
+
this._multiSelectionListDataSource.setApplication(this.application);
|
106
258
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
107
259
|
}
|
108
260
|
getTaskBarId() {
|
@@ -143,6 +295,27 @@ const SnkSimpleCrud = class {
|
|
143
295
|
getRecords() {
|
144
296
|
return Promise.resolve(this.dataUnit.records);
|
145
297
|
}
|
298
|
+
/**
|
299
|
+
* Usado para abrir o configurator do CRUD
|
300
|
+
*/
|
301
|
+
async openConfigurator() {
|
302
|
+
var _a;
|
303
|
+
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
|
304
|
+
}
|
305
|
+
/**
|
306
|
+
* Usado para fechar o configurator do CRUD
|
307
|
+
*/
|
308
|
+
async closeConfigurator() {
|
309
|
+
var _a;
|
310
|
+
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
311
|
+
}
|
312
|
+
updateConfig() {
|
313
|
+
if (this._formConfigManager == undefined) {
|
314
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
315
|
+
}
|
316
|
+
this._formConfigManager.setConfig(this.formConfig);
|
317
|
+
return;
|
318
|
+
}
|
146
319
|
processMetadata() {
|
147
320
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
148
321
|
const fieldMetadata = [];
|
@@ -197,6 +370,14 @@ const SnkSimpleCrud = class {
|
|
197
370
|
this.dataUnit.clearSelection();
|
198
371
|
}
|
199
372
|
}
|
373
|
+
handleConfiguratorEvent(evt, type) {
|
374
|
+
evt.stopImmediatePropagation();
|
375
|
+
if (type === 'SAVE') {
|
376
|
+
this.configuratorSave.emit();
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
this.configuratorCancel.emit();
|
380
|
+
}
|
200
381
|
getColumnSearch(actionButton, item) {
|
201
382
|
if (this._columnSearch != undefined) {
|
202
383
|
return this._columnSearch;
|
@@ -238,7 +419,9 @@ const SnkSimpleCrud = class {
|
|
238
419
|
return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
|
239
420
|
}
|
240
421
|
handleFormSetFields(fields) {
|
241
|
-
this._formFields
|
422
|
+
if (!ObjectUtils.equals(this._formFields, fields)) {
|
423
|
+
this._formFields = fields !== null && fields !== void 0 ? fields : [];
|
424
|
+
}
|
242
425
|
}
|
243
426
|
fieldsOptionLoader(argument) {
|
244
427
|
const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
|
@@ -310,16 +493,59 @@ const SnkSimpleCrud = class {
|
|
310
493
|
disconnectedCallback() {
|
311
494
|
window.removeEventListener("keydown", this._keyDownHandler);
|
312
495
|
}
|
496
|
+
gridConfigChangeHandler(evt) {
|
497
|
+
const config = evt.detail;
|
498
|
+
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
499
|
+
evt.stopPropagation();
|
500
|
+
}
|
501
|
+
modalConfigChangeHandler(evt) {
|
502
|
+
const config = evt.detail;
|
503
|
+
this._grid.setColumnsState(config.columns)
|
504
|
+
.then(() => {
|
505
|
+
this.setGridConfig(config);
|
506
|
+
this.closeGridConfig();
|
507
|
+
});
|
508
|
+
evt.stopPropagation();
|
509
|
+
}
|
510
|
+
setGridConfig(config) {
|
511
|
+
this.gridConfig = config;
|
512
|
+
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
513
|
+
}
|
514
|
+
setFormConfig(config, forceUpdate) {
|
515
|
+
if (this.formConfig && !forceUpdate)
|
516
|
+
return;
|
517
|
+
this.formConfig = config;
|
518
|
+
}
|
519
|
+
closeGridConfig() {
|
520
|
+
this._showPopUpGridConfig = false;
|
521
|
+
}
|
522
|
+
closeFormConfig() {
|
523
|
+
this._showFormConfig = false;
|
524
|
+
}
|
525
|
+
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
526
|
+
handleShowFormConfig() {
|
527
|
+
return this._showFormConfig && !this.formLegacyConfigName;
|
528
|
+
}
|
529
|
+
resolveResourceID() {
|
530
|
+
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
531
|
+
}
|
532
|
+
/* istanbul ignore next */
|
313
533
|
render() {
|
314
|
-
var _a;
|
315
|
-
|
534
|
+
var _a, _b, _c;
|
535
|
+
if (this.dataUnit == undefined) {
|
536
|
+
return;
|
537
|
+
}
|
538
|
+
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
316
539
|
? undefined
|
317
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.
|
540
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
318
541
|
}
|
319
542
|
get _element() { return getElement(this); }
|
320
543
|
static get watchers() { return {
|
544
|
+
"resourceID": ["handleResourceIDChanged"],
|
321
545
|
"mode": ["onModeChange"],
|
322
|
-
"dataState": ["observeDataState"]
|
546
|
+
"dataState": ["observeDataState"],
|
547
|
+
"formLegacyConfigName": ["observeFormLegacy"],
|
548
|
+
"gridLegacyConfigName": ["observeGridLegacy"]
|
323
549
|
}; }
|
324
550
|
};
|
325
551
|
SnkSimpleCrud.style = snkSimpleCrudCss;
|
@@ -1,17 +1,20 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
2
|
+
import { StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
|
4
|
-
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-
|
4
|
+
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-2473c8ac.js';
|
5
5
|
import { P as PresentationMode } from './index-0ece87a6.js';
|
6
6
|
import './index-bdf75557.js';
|
7
7
|
|
8
|
-
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
8
|
+
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";
|
9
9
|
|
10
10
|
const SnkTaskbar = class {
|
11
11
|
constructor(hostRef) {
|
12
12
|
registerInstance(this, hostRef);
|
13
13
|
this.actionClick = createEvent(this, "actionClick", 7);
|
14
14
|
this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
|
15
|
+
this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME = 'taskbar-custom-elements-container';
|
16
|
+
this.ACTIONS_BUTTON_TAG = 'TASKBAR-ACTIONS-BUTTON';
|
17
|
+
this.NOT_OVERFLOW_ELEMENTS = ["moreOptions", "dataExporter_snkDataExporter", "actionsButton_snkActionsButton"];
|
15
18
|
this._titleKeyByElement = {
|
16
19
|
[TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
|
17
20
|
[TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
|
@@ -29,11 +32,17 @@ const SnkTaskbar = class {
|
|
29
32
|
[TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
|
30
33
|
};
|
31
34
|
this._permissions = undefined;
|
35
|
+
this._overFlowedElements = [];
|
32
36
|
this._customElements = undefined;
|
33
37
|
this._customElementsId = undefined;
|
34
38
|
this._slotContainer = undefined;
|
39
|
+
this._hiddenActionsList = [];
|
40
|
+
this._lastWidth = undefined;
|
41
|
+
this._hasToUpdateOverFlow = false;
|
42
|
+
this.alignRigth = false;
|
35
43
|
this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
|
36
44
|
this.customContainerId = undefined;
|
45
|
+
this.overflowStrategy = 'hiddenItems';
|
37
46
|
this.configName = undefined;
|
38
47
|
this.resourceID = undefined;
|
39
48
|
this.buttons = undefined;
|
@@ -47,6 +56,18 @@ const SnkTaskbar = class {
|
|
47
56
|
}
|
48
57
|
observeButtons() {
|
49
58
|
this._definitions = undefined;
|
59
|
+
requestAnimationFrame(() => {
|
60
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
61
|
+
});
|
62
|
+
}
|
63
|
+
observeDisabledButtons() {
|
64
|
+
var _a;
|
65
|
+
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
66
|
+
}
|
67
|
+
observeLastWidth(newValue, oldValue) {
|
68
|
+
if (oldValue === 0 && newValue !== 0) {
|
69
|
+
this._hasToUpdateOverFlow = true;
|
70
|
+
}
|
50
71
|
}
|
51
72
|
// Internal methods
|
52
73
|
elementsFromString(strButtons) {
|
@@ -142,12 +163,19 @@ const SnkTaskbar = class {
|
|
142
163
|
}
|
143
164
|
const taskbarElement = TaskbarElement[def.toString()];
|
144
165
|
if (taskbarElement) {
|
145
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.
|
166
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), this.configName, this.presentationMode);
|
146
167
|
}
|
147
168
|
else {
|
148
169
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
149
170
|
}
|
150
171
|
}
|
172
|
+
buildDynamicActionsList() {
|
173
|
+
var _a;
|
174
|
+
if (this._hiddenActionsList.length) {
|
175
|
+
return [...((_a = this.actionsList) !== null && _a !== void 0 ? _a : []), { type: 'divider', label: "", value: "" }, ...this._hiddenActionsList];
|
176
|
+
}
|
177
|
+
return this.actionsList;
|
178
|
+
}
|
151
179
|
getIdElemBtnNative(taskbarElem) {
|
152
180
|
return StringUtils.toCamelCase(taskbarElem);
|
153
181
|
}
|
@@ -188,11 +216,13 @@ const SnkTaskbar = class {
|
|
188
216
|
});
|
189
217
|
}
|
190
218
|
addCustomElementContainer(elem) {
|
219
|
+
var _a;
|
191
220
|
const elementId = `${this.TASKBAR_ITEM_ID_PREFIX}${elem}`;
|
192
221
|
if (!this._customElementsId.includes(elementId)) {
|
193
222
|
this._customElementsId.push(elementId);
|
223
|
+
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.addNotOverFlowElement(elementId);
|
194
224
|
}
|
195
|
-
return h("span", { key: elementId, id: elementId });
|
225
|
+
return h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
|
196
226
|
}
|
197
227
|
getCustomElements() {
|
198
228
|
var _a, _b;
|
@@ -222,20 +252,95 @@ const SnkTaskbar = class {
|
|
222
252
|
this.getCustomElements();
|
223
253
|
}
|
224
254
|
componentWillRender() {
|
255
|
+
this.handleDefinitions();
|
256
|
+
this.validatePresentationMode();
|
257
|
+
this.updateOverFlowIfNeeded();
|
258
|
+
}
|
259
|
+
handleDefinitions() {
|
225
260
|
if (this._definitions == undefined && this._permissions) {
|
226
261
|
this._definitions = this.elementsFromString(this.buttons);
|
227
262
|
}
|
228
|
-
|
263
|
+
}
|
264
|
+
updateOverFlowIfNeeded() {
|
265
|
+
if (this._hasToUpdateOverFlow) {
|
266
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
267
|
+
this._hasToUpdateOverFlow = false;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
handleOverFlow(overFlowingElements) {
|
271
|
+
const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
|
272
|
+
this.resetOverFlowedElements();
|
273
|
+
this.doOverFlowElements(elementsToHandle);
|
274
|
+
}
|
275
|
+
resetOverFlowedElements() {
|
276
|
+
this._overFlowedElements.forEach(element => {
|
277
|
+
element.classList.remove(OVERFLOWED_CLASS_NAME);
|
278
|
+
});
|
279
|
+
this._hiddenActionsList = [];
|
280
|
+
this._overFlowedElements = [];
|
281
|
+
}
|
282
|
+
doOverFlowElements(overFlowedElements) {
|
283
|
+
overFlowedElements.forEach(element => {
|
284
|
+
element.classList.add(OVERFLOWED_CLASS_NAME);
|
285
|
+
this._overFlowedElements.push(element);
|
286
|
+
this.addItemToActionList(element);
|
287
|
+
});
|
288
|
+
}
|
289
|
+
addItemToActionList(element) {
|
290
|
+
const taskbarElement = this.getTaskbarElementName(element);
|
291
|
+
if (taskbarElement && this.isEnabled(taskbarElement) && this.isAllowed(taskbarElement)) {
|
292
|
+
const optionItem = {
|
293
|
+
value: taskbarElement,
|
294
|
+
label: this.getTaskbarElementLabel(element),
|
295
|
+
iconName: this.getTaskbarElementIcon(element)
|
296
|
+
};
|
297
|
+
this._hiddenActionsList.push(optionItem);
|
298
|
+
}
|
299
|
+
}
|
300
|
+
getTaskbarElementName(element) {
|
301
|
+
var _a;
|
302
|
+
return (_a = element.getAttribute('data-taskbar-element')) !== null && _a !== void 0 ? _a : "";
|
303
|
+
}
|
304
|
+
getTaskbarElementIcon(element) {
|
305
|
+
var _a;
|
306
|
+
return (_a = element.getAttribute('data-taskbar-icon')) !== null && _a !== void 0 ? _a : "";
|
307
|
+
}
|
308
|
+
getTaskbarElementLabel(element) {
|
309
|
+
var _a;
|
310
|
+
return (_a = element.getAttribute('data-taskbar-label')) !== null && _a !== void 0 ? _a : "";
|
311
|
+
}
|
312
|
+
hasToIgnoreOverFlow(element) {
|
313
|
+
return element.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME);
|
314
|
+
}
|
315
|
+
handleOverFlowStrategy() {
|
316
|
+
if (this.overflowStrategy === 'hiddenItems') {
|
317
|
+
this._overFlowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
|
318
|
+
}
|
319
|
+
}
|
320
|
+
buildOverFlowWatcherParams() {
|
321
|
+
return {
|
322
|
+
element: this._element,
|
323
|
+
callback: this.handleOverFlow.bind(this),
|
324
|
+
overFlowDirection: OverflowDirection.HORIZONTAL,
|
325
|
+
notOverFlow: this.NOT_OVERFLOW_ELEMENTS
|
326
|
+
};
|
229
327
|
}
|
230
328
|
componentDidLoad() {
|
231
329
|
const dataInfo = { dataUnit: this.dataUnit };
|
232
330
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
331
|
+
this.handleOverFlowStrategy();
|
233
332
|
}
|
234
333
|
componentDidRender() {
|
235
334
|
this.appendCustomElementsInTaskbar();
|
335
|
+
this.updateLastWidth();
|
336
|
+
}
|
337
|
+
updateLastWidth() {
|
338
|
+
this._lastWidth = this._element.getBoundingClientRect().width;
|
236
339
|
}
|
237
340
|
disconnectedCallback() {
|
341
|
+
var _a;
|
238
342
|
this.unlinkAllCustomElements();
|
343
|
+
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
|
239
344
|
}
|
240
345
|
unlinkAllCustomElements() {
|
241
346
|
var _a;
|
@@ -253,14 +358,9 @@ const SnkTaskbar = class {
|
|
253
358
|
return undefined;
|
254
359
|
}
|
255
360
|
let index = 0;
|
256
|
-
return (h(Host,
|
257
|
-
var _a;
|
258
|
-
|
259
|
-
index = 0;
|
260
|
-
}
|
261
|
-
else {
|
262
|
-
index++;
|
263
|
-
}
|
361
|
+
return (h(Host, { class: this.getHostClasses() }, this.removeEmpty(this._definitions.map((elem) => {
|
362
|
+
var _a, _b;
|
363
|
+
index++;
|
264
364
|
if (TaskbarElement[elem]) {
|
265
365
|
return this.getElement(index, TaskbarElement[elem]);
|
266
366
|
}
|
@@ -270,12 +370,20 @@ const SnkTaskbar = class {
|
|
270
370
|
if (this._customElements.has(elem)) {
|
271
371
|
return this.addCustomElementContainer(elem);
|
272
372
|
}
|
373
|
+
(_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.addNotOverFlowElement(elem);
|
273
374
|
return h("slot", { name: elem });
|
274
|
-
})), h("div", { class:
|
375
|
+
})), h("div", { class: this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME }, h("slot", { name: this.customSlotId }))));
|
376
|
+
}
|
377
|
+
getHostClasses() {
|
378
|
+
if (this.overflowStrategy !== 'hiddenItems')
|
379
|
+
return 'no-wrap';
|
380
|
+
return `full-width ${this.alignRigth ? 'align-right' : ""}`;
|
275
381
|
}
|
276
382
|
get _element() { return getElement(this); }
|
277
383
|
static get watchers() { return {
|
278
|
-
"buttons": ["observeButtons"]
|
384
|
+
"buttons": ["observeButtons"],
|
385
|
+
"disabledButtons": ["observeDisabledButtons"],
|
386
|
+
"_lastWidth": ["observeLastWidth"]
|
279
387
|
}; }
|
280
388
|
};
|
281
389
|
SnkTaskbar.style = snkTaskbarCss;
|
@@ -87,31 +87,31 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
87
87
|
case TaskbarElement.CONFIGURATOR:
|
88
88
|
return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
|
89
89
|
case TaskbarElement.MORE_OPTIONS:
|
90
|
-
return actionButton(element, dataElementId, title, isEnabled, actions, action);
|
90
|
+
return actionButton(element, className, dataElementId, title, isEnabled, actions, action);
|
91
91
|
case TaskbarElement.DIVIDER:
|
92
|
-
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-
|
92
|
+
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
93
93
|
case TaskbarElement.DATA_EXPORTER:
|
94
94
|
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
|
95
|
-
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId });
|
95
|
+
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
96
96
|
case TaskbarElement.ATTACH:
|
97
97
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
98
98
|
case TaskbarElement.ACTIONS_BUTTON:
|
99
|
-
return h("snk-actions-button", { "data-element-id": dataElementId });
|
99
|
+
return h("snk-actions-button", { "data-element-id": dataElementId, "data-taskbar-element": element });
|
100
100
|
}
|
101
101
|
};
|
102
102
|
function textButton(name, className, dataElementId, text, title, action, isEnabled) {
|
103
|
-
return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
|
103
|
+
return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-taskbar-label": text, "data-taskbar-element": name, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
|
104
104
|
}
|
105
105
|
function iconButton(iconName, name, className, dataElementId, title, action, isEnabled) {
|
106
|
-
return h("ez-button", { key: dataElementId, title: title, mode: "icon", size: "small", class: className, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
106
|
+
return h("ez-button", { key: dataElementId, title: title, mode: "icon", size: "small", class: className, "data-taskbar-label": title, "data-taskbar-element": name, "data-taskbar-icon": iconName, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
107
107
|
}
|
108
108
|
function iconTextButton(iconName, name, className, dataElementId, text, title, action, isEnabled) {
|
109
|
-
return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
|
109
|
+
return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-taskbar-label": text, "data-taskbar-icon": iconName, "data-taskbar-element": name, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
|
110
110
|
h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
111
111
|
}
|
112
|
-
function actionButton(element, dataElementId, title, isEnabled, actions, action) {
|
112
|
+
function actionButton(element, className, dataElementId, title, isEnabled, actions, action) {
|
113
113
|
return actions && actions.length > 0
|
114
|
-
? h("taskbar-actions-button", { key: dataElementId, title: title, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, onTaskbarActionSelected: (evt) => action(evt.detail.value) })
|
114
|
+
? h("taskbar-actions-button", { class: className, key: dataElementId, title: title, "data-taskbar-element": element, "data-element-id": dataElementId, enabled: isEnabled(element), actions: actions, onTaskbarActionSelected: (evt) => action(evt.detail.value) })
|
115
115
|
: undefined;
|
116
116
|
}
|
117
117
|
|