@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,6 +1,18 @@
|
|
1
1
|
import { DataFetcher } from '../';
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
2
|
+
import { ApplicationContext, SortMode } from '@sankhyalabs/core';
|
3
3
|
export class CrudUtils {
|
4
|
+
static assertDefaultSorting(gridConfig, dataUnit) {
|
5
|
+
if (gridConfig && dataUnit) {
|
6
|
+
dataUnit.defaultSorting = gridConfig
|
7
|
+
.columns
|
8
|
+
.filter(col => col.ascending != undefined)
|
9
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
10
|
+
.map(({ name: field, ascending }) => {
|
11
|
+
const { dataType } = dataUnit.getField(field);
|
12
|
+
return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
|
13
|
+
});
|
14
|
+
}
|
15
|
+
}
|
4
16
|
static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
|
5
17
|
const SERVICE_CRUD_FIND = "mge@crud.find";
|
6
18
|
let parsedFields = [];
|
@@ -232,7 +232,7 @@ class PersonalizedFilterFetcher {
|
|
232
232
|
assistent
|
233
233
|
}
|
234
234
|
}`);
|
235
|
-
this.templateByQuery.set("savePersonalizedFilter", dist.gql `
|
235
|
+
this.templateByQuery.set("savePersonalizedFilter", dist.gql `
|
236
236
|
mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
|
237
237
|
$queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
|
238
238
|
id
|
@@ -254,11 +254,11 @@ class PersonalizedFilterFetcher {
|
|
254
254
|
}
|
255
255
|
}`);
|
256
256
|
}
|
257
|
-
async loadPersonalizedFilter(resourceID, filterID, configName) {
|
257
|
+
async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName) {
|
258
258
|
return new Promise((resolve, reject) => {
|
259
259
|
DataFetcher.get()
|
260
260
|
.callGraphQL({
|
261
|
-
values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
|
261
|
+
values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
|
262
262
|
query: this.templateByQuery.get("fetchFilterAssistent"),
|
263
263
|
})
|
264
264
|
.then((resp) => {
|
@@ -270,6 +270,9 @@ class PersonalizedFilterFetcher {
|
|
270
270
|
});
|
271
271
|
});
|
272
272
|
}
|
273
|
+
resolveLegacyConfigName(legacyConfigName) {
|
274
|
+
return legacyConfigName ? `?legacyResourceID=${legacyConfigName}` : '';
|
275
|
+
}
|
273
276
|
async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
274
277
|
if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
|
275
278
|
return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
|
@@ -358,11 +361,30 @@ var CONFIG_SOURCE;
|
|
358
361
|
CONFIG_SOURCE["filterBar"] = "filterBar";
|
359
362
|
})(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
|
360
363
|
class ConfigStorage {
|
361
|
-
static
|
364
|
+
static addFilterBarLegacyConfig(configName, legacyConfigName) {
|
365
|
+
this.validateConfigName(configName, legacyConfigName);
|
366
|
+
this.filterBarLegacyConfig.set(configName, legacyConfigName);
|
367
|
+
}
|
368
|
+
static addFormLegacyConfig(configName, legacyConfigName) {
|
369
|
+
this.validateConfigName(configName, legacyConfigName);
|
370
|
+
this.formLegacyConfig.set(configName, legacyConfigName);
|
371
|
+
}
|
372
|
+
static addGridLegacyConfig(configName, legacyConfigName) {
|
373
|
+
this.validateConfigName(configName, legacyConfigName);
|
374
|
+
this.gridLegacyConfig.set(configName, legacyConfigName);
|
375
|
+
}
|
376
|
+
static preload(resourceID, configName, legacyConfigs) {
|
377
|
+
if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.gridLegacyConfig)) {
|
378
|
+
ConfigStorage.addGridLegacyConfig(configName, legacyConfigs.gridLegacyConfig);
|
379
|
+
}
|
380
|
+
if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.formLegacyConfig)) {
|
381
|
+
ConfigStorage.addFormLegacyConfig(configName, legacyConfigs.formLegacyConfig);
|
382
|
+
}
|
362
383
|
ConfigStorage.loadFormConfig(configName, resourceID);
|
363
384
|
ConfigStorage.loadGridConfig(configName, resourceID);
|
364
385
|
}
|
365
386
|
static async loadFilterBarConfig(name, resourceID, urlParams) {
|
387
|
+
urlParams = this.handleLegacyConfig(name, CONFIG_SOURCE.filterBar, urlParams);
|
366
388
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
367
389
|
if (!ConfigStorage.configById.has(cacheID)) {
|
368
390
|
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
@@ -370,6 +392,7 @@ class ConfigStorage {
|
|
370
392
|
return ConfigStorage.configById.get(cacheID);
|
371
393
|
}
|
372
394
|
static async loadFormConfig(name, resourceID) {
|
395
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
|
373
396
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
374
397
|
if (!ConfigStorage.configById.has(cacheID)) {
|
375
398
|
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
@@ -377,6 +400,7 @@ class ConfigStorage {
|
|
377
400
|
return ConfigStorage.configById.get(cacheID);
|
378
401
|
}
|
379
402
|
static async loadGridConfig(name, resourceID) {
|
403
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
380
404
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
381
405
|
if (!ConfigStorage.configById.has(cacheID)) {
|
382
406
|
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
@@ -388,6 +412,7 @@ class ConfigStorage {
|
|
388
412
|
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
389
413
|
}
|
390
414
|
static async saveFormConfig(config, name, resourceID) {
|
415
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
|
391
416
|
await this.deleteFormConfigCache(name, resourceID);
|
392
417
|
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
393
418
|
}
|
@@ -402,7 +427,8 @@ class ConfigStorage {
|
|
402
427
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
403
428
|
}
|
404
429
|
static async loadPersonalizedFilter(filterId, resourceID, configName) {
|
405
|
-
|
430
|
+
const legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
431
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
|
406
432
|
}
|
407
433
|
static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
408
434
|
//Ao criar ou alterar um filtro personalizado,
|
@@ -425,6 +451,38 @@ class ConfigStorage {
|
|
425
451
|
static async deleteFilterBarConfigCache(name, resourceID) {
|
426
452
|
await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
|
427
453
|
}
|
454
|
+
static validateConfigName(configName, legacyConfigName) {
|
455
|
+
if (!configName)
|
456
|
+
throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
|
457
|
+
if (!legacyConfigName)
|
458
|
+
throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
|
459
|
+
}
|
460
|
+
static handleLegacyConfig(configName, configSource, urlParams) {
|
461
|
+
let legacyConfigName;
|
462
|
+
switch (configSource) {
|
463
|
+
case CONFIG_SOURCE.filterBar:
|
464
|
+
legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
465
|
+
break;
|
466
|
+
case CONFIG_SOURCE.grid:
|
467
|
+
legacyConfigName = this.gridLegacyConfig.get(configName);
|
468
|
+
break;
|
469
|
+
case CONFIG_SOURCE.form:
|
470
|
+
legacyConfigName = this.formLegacyConfig.get(configName);
|
471
|
+
}
|
472
|
+
const params = urlParams ? Object.assign({}, urlParams) : {};
|
473
|
+
if (legacyConfigName) {
|
474
|
+
params['legacyResourceID'] = legacyConfigName;
|
475
|
+
}
|
476
|
+
return params;
|
477
|
+
}
|
478
|
+
static handleLegacyConfigAsString(name, source) {
|
479
|
+
const params = this.handleLegacyConfig(name, source);
|
480
|
+
const legacyResourceID = params['legacyResourceID'];
|
481
|
+
if (legacyResourceID) {
|
482
|
+
name = name + `?legacyResourceID=${legacyResourceID}`;
|
483
|
+
}
|
484
|
+
return name;
|
485
|
+
}
|
428
486
|
static async deleteConfigCache(name, resourceID, source) {
|
429
487
|
const cacheID = ConfigStorage.buildCacheID(name, source, resourceID);
|
430
488
|
this.configById.delete(cacheID);
|
@@ -436,6 +494,11 @@ class ConfigStorage {
|
|
436
494
|
return `req_${source}_${name}_${resourceID}`;
|
437
495
|
}
|
438
496
|
}
|
497
|
+
ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
|
498
|
+
ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
|
499
|
+
ConfigStorage.filterBarLegacyConfig = new Map();
|
500
|
+
ConfigStorage.formLegacyConfig = new Map();
|
501
|
+
ConfigStorage.gridLegacyConfig = new Map();
|
439
502
|
ConfigStorage.configById = new Map();
|
440
503
|
ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
|
441
504
|
ConfigStorage.formConfigFetcher = new FormConfigFetcher();
|
@@ -6786,7 +6786,6 @@ class DataFetcher {
|
|
6786
6786
|
if (http.readyState == 4 && http.status == 200) {
|
6787
6787
|
try {
|
6788
6788
|
const jsonResp = JSON.parse(http.responseText);
|
6789
|
-
await this.processServiceBrokerClientEvents({ clientEvents: jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject });
|
6790
6789
|
/**
|
6791
6790
|
* Este trecho difere do projeto HTML5 devido à decisão de adotar uma abordagem síncrona para esta chamada. Isso é justificado pelo fato de que, no cenário em questão, a abordagem assíncrona teria impactos negativos.
|
6792
6791
|
*
|
@@ -6797,8 +6796,10 @@ class DataFetcher {
|
|
6797
6796
|
if (this.isServiceBrokerError(jsonResp)) {
|
6798
6797
|
reject(this.processServiceBrokerErrorInfo(jsonResp));
|
6799
6798
|
}
|
6800
|
-
else if (jsonResp.status == DataFetcher.SERVICE_BROKER_STATUS.SERVICE_CANCELED
|
6801
|
-
|
6799
|
+
else if (jsonResp.status == DataFetcher.SERVICE_BROKER_STATUS.SERVICE_CANCELED) {
|
6800
|
+
if (jsonResp.statusMessage) {
|
6801
|
+
console.debug(`[DataFetcher] ${jsonResp.statusMessage}`);
|
6802
|
+
}
|
6802
6803
|
}
|
6803
6804
|
else {
|
6804
6805
|
accept(jsonResp.responseBody);
|
@@ -6806,6 +6807,7 @@ class DataFetcher {
|
|
6806
6807
|
(_a = this.application) === null || _a === void 0 ? void 0 : _a.info(jsonResp.statusMessage);
|
6807
6808
|
}
|
6808
6809
|
}
|
6810
|
+
this.processServiceBrokerClientEvents({ clientEvents: jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject });
|
6809
6811
|
}
|
6810
6812
|
catch (err) {
|
6811
6813
|
console.warn(`Erro ao executar serviço: ${err}`);
|
@@ -8,6 +8,11 @@ class SnkFormConfigManager {
|
|
8
8
|
this._configName = configName;
|
9
9
|
this._onConfigChange = onConfigChange;
|
10
10
|
}
|
11
|
+
addFormLegacyConfig(legacyConfigName) {
|
12
|
+
if (this._configName) {
|
13
|
+
ConfigStorage.addFormLegacyConfig(this._configName, legacyConfigName);
|
14
|
+
}
|
15
|
+
}
|
11
16
|
async loadConfig() {
|
12
17
|
return new Promise(resolve => {
|
13
18
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
@@ -93,16 +98,19 @@ class SnkFormConfigManager {
|
|
93
98
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
|
94
99
|
return normalizedText.includes(normalizedFilter);
|
95
100
|
}
|
96
|
-
getInsertionConfig(dataUnit) {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
if (
|
101
|
-
|
101
|
+
getInsertionConfig(dataUnit, ignoreReadOnlyFormFields) {
|
102
|
+
let fields = this.getFieldsList(dataUnit);
|
103
|
+
if (ignoreReadOnlyFormFields) {
|
104
|
+
fields = fields.filter(field => {
|
105
|
+
if (dataUnit) {
|
106
|
+
const def = dataUnit.getField(field.name);
|
107
|
+
if (def && def.readOnly) {
|
108
|
+
return false;
|
109
|
+
}
|
102
110
|
}
|
103
|
-
|
104
|
-
|
105
|
-
}
|
111
|
+
return !field.readOnly;
|
112
|
+
});
|
113
|
+
}
|
106
114
|
return Object.assign(Object.assign({}, this._config), { fields });
|
107
115
|
}
|
108
116
|
setConfig(config) {
|
@@ -122,8 +130,8 @@ class SnkFormConfigManager {
|
|
122
130
|
this._onConfigChange(Object.assign({}, this._config));
|
123
131
|
}
|
124
132
|
}
|
125
|
-
getConfig(insertionMode, dataUnit) {
|
126
|
-
return insertionMode ? this.getInsertionConfig(dataUnit) : Object.assign({}, this._config);
|
133
|
+
getConfig(insertionMode, dataUnit, ignoreReadOnlyFormFields) {
|
134
|
+
return insertionMode ? this.getInsertionConfig(dataUnit, ignoreReadOnlyFormFields !== null && ignoreReadOnlyFormFields !== void 0 ? ignoreReadOnlyFormFields : true) : Object.assign({}, this._config);
|
127
135
|
}
|
128
136
|
getFormConfigFetcher() {
|
129
137
|
if (this._formConfigFetcher == undefined) {
|
@@ -146,6 +146,10 @@ const snkCrudMessages = {
|
|
146
146
|
|
147
147
|
const snkSimpleCrudMessages = {
|
148
148
|
findColumn: "Busca de colunas",
|
149
|
+
formConfigUnavaliable: {
|
150
|
+
title: "Aviso",
|
151
|
+
message: 'A opção "Configurar formulário" será disponibilizada em breve. Enquanto isso, acesse a configuração do fomulário através dos layouts anteriores, HTML5 ou Flex.'
|
152
|
+
}
|
149
153
|
};
|
150
154
|
|
151
155
|
const fileViewerMessages = {
|
@@ -286,7 +290,8 @@ const snkDataExporterMessages = {
|
|
286
290
|
},
|
287
291
|
message: {
|
288
292
|
emailSuccess: "E-mail enviado com sucesso",
|
289
|
-
exportError: "
|
293
|
+
exportError: "Falha ao exportar dados",
|
294
|
+
unknownFailure: "O motivo da falha não pode ser identificado.",
|
290
295
|
exportPermission: "O usuário não possui permissão para exportar o arquivo.",
|
291
296
|
},
|
292
297
|
title: {
|
@@ -54,7 +54,7 @@ class PesquisaFetcher {
|
|
54
54
|
});
|
55
55
|
}
|
56
56
|
loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
|
57
|
-
var _a, _b, _c;
|
57
|
+
var _a, _b, _c, _d;
|
58
58
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
59
59
|
const values = {
|
60
60
|
argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
|
@@ -67,7 +67,7 @@ class PesquisaFetcher {
|
|
67
67
|
$: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
|
68
68
|
}
|
69
69
|
};
|
70
|
-
if (((_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params.length) > 0) {
|
70
|
+
if (((_c = (_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
71
71
|
externalCriteria.params = {
|
72
72
|
param: values.criteria.params.map(param => {
|
73
73
|
let value = param.value;
|
@@ -90,18 +90,11 @@ class PesquisaFetcher {
|
|
90
90
|
};
|
91
91
|
}
|
92
92
|
const options = searchOptions != undefined
|
93
|
-
? {
|
94
|
-
"pkFieldName": searchOptions.codeFieldName,
|
95
|
-
"label": searchOptions.descriptionFieldName,
|
96
|
-
"fieldName": searchOptions.codeFieldName,
|
97
|
-
"useDescriptionOptions": false,
|
98
|
-
"enableRowsCounter": true
|
99
|
-
}
|
100
|
-
: undefined;
|
93
|
+
? Object.assign(Object.assign({}, searchOptions), { "pkFieldName": searchOptions.codeFieldName, "label": searchOptions.descriptionFieldName, "fieldName": searchOptions.codeFieldName, "useDescriptionOptions": false, "enableRowsCounter": true }) : undefined;
|
101
94
|
const reqBody = {
|
102
95
|
"serviceName": serviceName,
|
103
96
|
"requestBody": {
|
104
|
-
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (
|
97
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_d = values.searchOptions) === null || _d === void 0 ? void 0 : _d.rootEntity }, { options }),
|
105
98
|
"clientEventList": {
|
106
99
|
"clientEvent": []
|
107
100
|
}
|
@@ -390,6 +383,38 @@ class PreloadManager {
|
|
390
383
|
PreloadManager._repositories = new Map();
|
391
384
|
PreloadManager._loadingStatus = new Map();
|
392
385
|
|
386
|
+
function applyFilter(records, dataUnit, filters) {
|
387
|
+
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
388
|
+
if (!(columnFilters === null || columnFilters === void 0 ? void 0 : columnFilters.size)) {
|
389
|
+
return records;
|
390
|
+
}
|
391
|
+
const filterFunction = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
392
|
+
if (filterFunction == undefined) {
|
393
|
+
return records;
|
394
|
+
}
|
395
|
+
return records.filter(filterFunction);
|
396
|
+
}
|
397
|
+
function applySorting(records, dataUnit, sorting) {
|
398
|
+
if (sorting == undefined || sorting.length == 0) {
|
399
|
+
return records;
|
400
|
+
}
|
401
|
+
const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
|
402
|
+
if (sortingFunction == undefined) {
|
403
|
+
return records;
|
404
|
+
}
|
405
|
+
return records.sort(sortingFunction);
|
406
|
+
}
|
407
|
+
function buildPaginationInfo(records, offset = 0, limit = 0) {
|
408
|
+
const lastRecord = Math.min(offset + limit, records === null || records === void 0 ? void 0 : records.length);
|
409
|
+
return {
|
410
|
+
currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
|
411
|
+
firstRecord: offset,
|
412
|
+
lastRecord: lastRecord,
|
413
|
+
total: records === null || records === void 0 ? void 0 : records.length,
|
414
|
+
hasMore: !!((records === null || records === void 0 ? void 0 : records.length) - lastRecord),
|
415
|
+
};
|
416
|
+
}
|
417
|
+
|
393
418
|
class InMemoryLoader {
|
394
419
|
constructor(metadata, records) {
|
395
420
|
this.metadata = metadata;
|
@@ -402,9 +427,13 @@ class InMemoryLoader {
|
|
402
427
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
403
428
|
}
|
404
429
|
getRecordsToLoad() {
|
405
|
-
if (this._initialRecords == undefined
|
430
|
+
if (this._initialRecords == undefined && this.dataUnit.records.length > 0) {
|
406
431
|
this._initialRecords = this.dataUnit.records;
|
407
432
|
}
|
433
|
+
const addedRecords = this.dataUnit.getAddedRecords();
|
434
|
+
if (addedRecords) {
|
435
|
+
return [...this._initialRecords, ...addedRecords];
|
436
|
+
}
|
408
437
|
return this._initialRecords;
|
409
438
|
}
|
410
439
|
get dataUnit() {
|
@@ -463,30 +492,9 @@ class InMemoryLoader {
|
|
463
492
|
return StringUtils.generateUUID();
|
464
493
|
}
|
465
494
|
inMemoryLoader(dataUnit, request, recordsIn) {
|
466
|
-
let records =
|
467
|
-
records =
|
468
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(request,
|
469
|
-
}
|
470
|
-
applyFilter(records, dataUnit, filters) {
|
471
|
-
const columnFilters = ColumnFilterManager.getColumnFilters(filters, "");
|
472
|
-
if (columnFilters == undefined || columnFilters.size == 0) {
|
473
|
-
return records;
|
474
|
-
}
|
475
|
-
const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, Array.from(columnFilters.values()));
|
476
|
-
if (filterFunciton == undefined) {
|
477
|
-
return records;
|
478
|
-
}
|
479
|
-
return records.filter(filterFunciton);
|
480
|
-
}
|
481
|
-
applySorting(records, dataUnit, sorting) {
|
482
|
-
if (sorting == undefined || sorting.length == 0) {
|
483
|
-
return records;
|
484
|
-
}
|
485
|
-
const sortingFunction = PreloadManager.getSortingFunction(dataUnit, sorting);
|
486
|
-
if (sortingFunction == undefined) {
|
487
|
-
return records;
|
488
|
-
}
|
489
|
-
return records.sort(sortingFunction);
|
495
|
+
let records = applyFilter(recordsIn, dataUnit, request.filters);
|
496
|
+
records = applySorting(records, dataUnit, request.sort);
|
497
|
+
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
490
498
|
}
|
491
499
|
metadaLoader() {
|
492
500
|
return Promise.resolve(this._metadata);
|
@@ -519,19 +527,6 @@ class InMemoryLoader {
|
|
519
527
|
}
|
520
528
|
}
|
521
529
|
InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME = "InMemoryDataUnit";
|
522
|
-
function buildPaginationInfo({ offset, limit }, records) {
|
523
|
-
if (offset === undefined || limit === undefined) {
|
524
|
-
return undefined;
|
525
|
-
}
|
526
|
-
const lastRecord = Math.min(offset + limit, records.length);
|
527
|
-
return {
|
528
|
-
currentPage: Math.ceil(offset / limit),
|
529
|
-
firstRecord: offset,
|
530
|
-
lastRecord: lastRecord,
|
531
|
-
total: records.length,
|
532
|
-
hasMore: !!(records.length - lastRecord),
|
533
|
-
};
|
534
|
-
}
|
535
530
|
|
536
531
|
class DatasetStrategy {
|
537
532
|
canSlice() {
|
@@ -1150,4 +1145,4 @@ class DataUnitFetcher {
|
|
1150
1145
|
}
|
1151
1146
|
}
|
1152
1147
|
|
1153
|
-
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a };
|
1148
|
+
export { DataUnitFetcher as D, InMemoryLoader as I, PesquisaFetcher as P, PreloadManager as a, applyFilter as b, applySorting as c, buildPaginationInfo as d };
|
@@ -1,8 +1,98 @@
|
|
1
|
-
import {
|
2
|
-
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
1
|
+
import { D as DataFetcher } from './DataFetcher.js';
|
3
2
|
import { a as PreloadManager } from './dataunit-fetcher.js';
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils } from '@sankhyalabs/core';
|
4
|
+
import './index2.js';
|
5
|
+
import './snk-actions-button2.js';
|
6
|
+
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
|
+
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
|
+
import './filter-item-type.enum.js';
|
9
|
+
import './form-config-fetcher.js';
|
10
|
+
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
4
11
|
import { h } from '@stencil/core/internal/client';
|
5
12
|
|
13
|
+
class CrudUtils {
|
14
|
+
static assertDefaultSorting(gridConfig, dataUnit) {
|
15
|
+
if (gridConfig && dataUnit) {
|
16
|
+
dataUnit.defaultSorting = gridConfig
|
17
|
+
.columns
|
18
|
+
.filter(col => col.ascending != undefined)
|
19
|
+
.sort((colA, colB) => colA.orderIndex - colB.orderIndex)
|
20
|
+
.map(({ name: field, ascending }) => {
|
21
|
+
const { dataType } = dataUnit.getField(field);
|
22
|
+
return { field, dataType, mode: ascending ? SortMode.ASC : SortMode.DESC };
|
23
|
+
});
|
24
|
+
}
|
25
|
+
}
|
26
|
+
static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
|
27
|
+
const SERVICE_CRUD_FIND = "mge@crud.find";
|
28
|
+
let parsedFields = [];
|
29
|
+
let parsedCriteria = [];
|
30
|
+
let literalCriteria = {};
|
31
|
+
let application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
32
|
+
if (fields) {
|
33
|
+
if (!Array.isArray(fields)) {
|
34
|
+
throw new Error(application.messagesBuilder.getMessage("crudUtils.errorArray", null));
|
35
|
+
}
|
36
|
+
fields.forEach((fieldName) => {
|
37
|
+
parsedFields.push({
|
38
|
+
name: fieldName
|
39
|
+
});
|
40
|
+
});
|
41
|
+
}
|
42
|
+
if (criteria) {
|
43
|
+
for (const key in criteria) {
|
44
|
+
if (criteria.hasOwnProperty(key)) {
|
45
|
+
parsedCriteria.push({ nome: key, valor: criteria[key] });
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
if (criteriaExpression) {
|
50
|
+
literalCriteria = {
|
51
|
+
expression: {
|
52
|
+
$: criteriaExpression
|
53
|
+
}
|
54
|
+
};
|
55
|
+
}
|
56
|
+
let request = {
|
57
|
+
requestBody: {
|
58
|
+
entity: {
|
59
|
+
name: entityName,
|
60
|
+
criterio: parsedCriteria,
|
61
|
+
fields: {
|
62
|
+
field: parsedFields
|
63
|
+
},
|
64
|
+
literalCriteria: literalCriteria,
|
65
|
+
orderby: orderBy
|
66
|
+
}
|
67
|
+
}
|
68
|
+
};
|
69
|
+
return new Promise((resolve) => {
|
70
|
+
DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
|
71
|
+
var _a;
|
72
|
+
let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
|
73
|
+
if (entities != undefined) {
|
74
|
+
let crudFindResult = {
|
75
|
+
fields: new Map()
|
76
|
+
};
|
77
|
+
for (let key in entities) {
|
78
|
+
let fieldValue = entities[key];
|
79
|
+
if (fieldValue.hasOwnProperty('$')) {
|
80
|
+
crudFindResult.fields.set(key, fieldValue.$);
|
81
|
+
}
|
82
|
+
if (onlyFirst) {
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
resolve(crudFindResult);
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
resolve(null);
|
90
|
+
}
|
91
|
+
});
|
92
|
+
});
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
6
96
|
class TaskbarProcessor {
|
7
97
|
constructor(defaultButtons) {
|
8
98
|
this._defaultButtons = defaultButtons;
|
@@ -118,4 +208,4 @@ const openFieldSearch = async (moreOptions, field) => {
|
|
118
208
|
await moreOptions.showActions();
|
119
209
|
};
|
120
210
|
|
121
|
-
export { SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, buildFieldSearch as b, openFieldSearch as o };
|
211
|
+
export { CrudUtils as C, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, buildFieldSearch as b, openFieldSearch as o };
|
@@ -230,6 +230,18 @@ class FormConfigFetcher extends ResourceFetcher {
|
|
230
230
|
}
|
231
231
|
return `cfg://${authority}/${resourceID}`;
|
232
232
|
}
|
233
|
+
async fetchLegacyConfigurableForm(configName) {
|
234
|
+
const payload = { 'requestBody': { 'config': { 'chave': configName, 'tipo': 'T' } } };
|
235
|
+
const response = await DataFetcher.get().callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
236
|
+
if (ObjectUtils.isEmpty(response))
|
237
|
+
return undefined;
|
238
|
+
return this.buildLegacyConfigurableForm(response);
|
239
|
+
}
|
240
|
+
buildLegacyConfigurableForm(config) {
|
241
|
+
var _a, _b, _c;
|
242
|
+
const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
243
|
+
return { emptyConfig: false, fields: Array.isArray(rawFields) ? rawFields : [rawFields] };
|
244
|
+
}
|
233
245
|
}
|
234
246
|
var UserConfigType;
|
235
247
|
(function (UserConfigType) {
|
@@ -4,7 +4,7 @@ export { SnkActionsForm as SnkActionsForm } from '../types/components/snk-action
|
|
4
4
|
export { SnkApplication as SnkApplication } from '../types/components/snk-application/snk-application';
|
5
5
|
export { SnkAttach as SnkAttach } from '../types/components/snk-attach/snk-attach';
|
6
6
|
export { SnkActionsForm as SnkClientConfirm } from '../types/components/snk-actions-button/subcomponents/snk-client-confirm';
|
7
|
-
export { SnkConfigOptions as SnkConfigOptions } from '../types/components/snk-form/subcomponents/snk-config-options/snk-config-options';
|
7
|
+
export { SnkConfigOptions as SnkConfigOptions } from '../types/components/snk-form-config/subcomponents/snk-config-options/snk-config-options';
|
8
8
|
export { SnkConfigurator as SnkConfigurator } from '../types/components/snk-configurator/snk-configurator';
|
9
9
|
export { SnkCrud as SnkCrud } from '../types/components/snk-crud/snk-crud';
|
10
10
|
export { SnkCustomSlotElements as SnkCustomSlotElements } from '../types/components/snk-custom-slot-elements/snk-custom-slot-elements';
|
@@ -15,7 +15,7 @@ export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-l
|
|
15
15
|
export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
|
16
16
|
export { SnkExpressionGroup as SnkExpressionGroup } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group';
|
17
17
|
export { SnkExpressionItem as SnkExpressionItem } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item';
|
18
|
-
export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/subcomponents/snk-field-config/snk-field-config';
|
18
|
+
export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form-config/subcomponents/snk-field-config/snk-field-config';
|
19
19
|
export { SnkFilterAdvancedMode as SnkFilterAdvancedMode } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode';
|
20
20
|
export { SnkFilterAssistentMode as SnkFilterAssistentMode } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode';
|
21
21
|
export { SnkFilterBar as SnkFilterBar } from '../types/components/snk-filter-bar/snk-filter-bar';
|
@@ -34,20 +34,20 @@ export { SnkFilterPeriod as SnkFilterPeriod } from '../types/components/snk-filt
|
|
34
34
|
export { SnkFilterSearch as SnkFilterSearch } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-search';
|
35
35
|
export { SnkFilterText as SnkFilterText } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-text';
|
36
36
|
export { SnkForm as SnkForm } from '../types/components/snk-form/snk-form';
|
37
|
-
export { SnkFormConfig as SnkFormConfig } from '../types/components/snk-form
|
37
|
+
export { SnkFormConfig as SnkFormConfig } from '../types/components/snk-form-config/snk-form-config';
|
38
38
|
export { SnkFormSummary as SnkFormSummary } from '../types/components/snk-crud/subcomponents/snk-form-summary';
|
39
39
|
export { SnkFormView as SnkFormView } from '../types/components/snk-crud/subcomponents/snk-form-view';
|
40
40
|
export { SnkGrid as SnkGrid } from '../types/components/snk-grid/snk-grid';
|
41
|
-
export { SnkGridConfig as SnkGridConfig } from '../types/components/snk-grid
|
41
|
+
export { SnkGridConfig as SnkGridConfig } from '../types/components/snk-grid-config/snk-grid-config';
|
42
42
|
export { SnkGuidesViewer as SnkGuidesViewer } from '../types/components/snk-crud/subcomponents/snk-guides-viewer';
|
43
43
|
export { SnkPersonalizedFilter as SnkPersonalizedFilter } from '../types/components/snk-personalized-filter/snk-personalized-filter';
|
44
44
|
export { SnkFilterPersonalized as SnkPersonalizedFilterEditor } from '../types/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor';
|
45
45
|
export { SnkPesquisa as SnkPesquisa } from '../types/components/snk-pesquisa/snk-pesquisa';
|
46
46
|
export { SnkPrintSelector as SnkPrintSelector } from '../types/components/snk-print-selector/snk-print-selector';
|
47
|
-
export { SelectBox as SnkSelectBox } from '../types/components/snk-grid/
|
47
|
+
export { SelectBox as SnkSelectBox } from '../types/components/snk-grid-config/snk-select-box/snk-select-box';
|
48
48
|
export { SnkSimpleBar as SnkSimpleBar } from '../types/components/snk-simple-bar/snk-simple-bar';
|
49
49
|
export { SnkSimpleCrud as SnkSimpleCrud } from '../types/components/snk-simple-crud/snk-simple-crud';
|
50
|
-
export { SnkTabConfig as SnkTabConfig } from '../types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config';
|
50
|
+
export { SnkTabConfig as SnkTabConfig } from '../types/components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config';
|
51
51
|
export { SnkTaskbar as SnkTaskbar } from '../types/components/snk-taskbar/snk-taskbar';
|
52
52
|
export { TaskbarActionsButton as TaskbarActionsButton } from '../types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button';
|
53
53
|
export { TestePesquisa as TestePesquisa } from '../types/components/teste-pesquisa/teste-pesquisa';
|
@@ -292,6 +292,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
292
292
|
this._isLoadedByPk = false;
|
293
293
|
this.messagesBuilder = undefined;
|
294
294
|
this.configName = undefined;
|
295
|
+
this.gridLegacyConfigName = undefined;
|
296
|
+
this.formLegacyConfigName = undefined;
|
295
297
|
this.loadByPK = undefined;
|
296
298
|
}
|
297
299
|
async processPendingActions(actionsLocker) {
|
@@ -1198,7 +1200,11 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1198
1200
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
1199
1201
|
this.registerPkChangeListener();
|
1200
1202
|
ErrorTracking.init();
|
1201
|
-
|
1203
|
+
let legacyConfig = {
|
1204
|
+
gridLegacyConfig: this.gridLegacyConfigName,
|
1205
|
+
formLegacyConfig: this.formLegacyConfigName
|
1206
|
+
};
|
1207
|
+
ConfigStorage.preload(this.applicationResourceID, this.configName, legacyConfig);
|
1202
1208
|
document.addEventListener("click", () => Workspace.applicationClick());
|
1203
1209
|
this._waitingAppReady.forEach(resolve => resolve());
|
1204
1210
|
}
|
@@ -1241,6 +1247,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1241
1247
|
}, [2, "snk-application", {
|
1242
1248
|
"messagesBuilder": [1040],
|
1243
1249
|
"configName": [1, "config-name"],
|
1250
|
+
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
1251
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
1244
1252
|
"loadByPK": [16],
|
1245
1253
|
"getKeyboardManager": [64],
|
1246
1254
|
"isUserSup": [64],
|