@sankhyalabs/sankhyablocks 8.15.1 → 8.16.0-dev.2
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/{SnkMultiSelectionListDataSource-303e85d1.js → IExporterProvider-9479f618.js} +94 -4
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-1b13bacd.js} +6 -3
- package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-722b104e.js} +8 -12
- package/dist/cjs/{pesquisa-fetcher-213797ec.js → dataunit-fetcher-0c7106a0.js} +88 -180
- package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +4 -2
- package/dist/cjs/snk-application.cjs.entry.js +34 -11
- package/dist/cjs/snk-attach.cjs.entry.js +71 -46
- package/dist/cjs/snk-crud.cjs.entry.js +96 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
- package/dist/cjs/snk-data-unit-16791a2f.js +679 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
- package/dist/cjs/snk-form.cjs.entry.js +51 -6
- package/dist/cjs/snk-grid.cjs.entry.js +164 -107
- package/dist/cjs/{snk-guides-viewer-4b6ecda8.js → snk-guides-viewer-d82746e8.js} +36 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
- package/dist/cjs/snk-simple-crud.cjs.entry.js +264 -37
- package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +35 -11
- package/dist/collection/components/snk-attach/snk-attach.js +67 -44
- package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
- package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +249 -7
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +507 -214
- package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
- package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
- package/dist/collection/components/snk-form/snk-form.js +102 -5
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -3
- package/dist/collection/components/snk-grid/snk-grid.js +240 -101
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +386 -18
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
- package/dist/collection/lib/@types/index.js +5 -0
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +8 -3
- package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
- package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
- package/dist/components/ISave.js +47 -0
- package/dist/components/SnkFormConfigManager.js +6 -3
- package/dist/components/SnkMessageBuilder.js +8 -12
- package/dist/components/dataunit-fetcher.js +85 -182
- package/dist/components/index2.js +198 -33
- package/dist/components/pesquisa-fetcher.js +164 -0
- package/dist/components/snk-actions-button2.js +4 -11
- package/dist/components/snk-application2.js +31 -9
- package/dist/components/snk-attach2.js +65 -41
- package/dist/components/snk-crud.js +103 -11
- package/dist/components/snk-data-exporter2.js +309 -85
- package/dist/components/snk-data-unit2.js +470 -212
- package/dist/components/snk-detail-view2.js +87 -10
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-filter-bar2.js +6 -1
- package/dist/components/snk-form-view2.js +72 -1
- package/dist/components/snk-form.js +53 -6
- package/dist/components/snk-grid2.js +168 -106
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +259 -23
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{SnkMultiSelectionListDataSource-36918dbf.js → IExporterProvider-5a858363.js} +93 -5
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-d4554df9.js} +6 -3
- package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-89925609.js} +8 -12
- package/dist/esm/{pesquisa-fetcher-fe6f3826.js → dataunit-fetcher-f7e0ffc0.js} +84 -181
- package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +4 -2
- package/dist/esm/snk-application.entry.js +33 -10
- package/dist/esm/snk-attach.entry.js +66 -41
- package/dist/esm/snk-crud.entry.js +96 -10
- package/dist/esm/snk-data-exporter.entry.js +316 -86
- package/dist/esm/snk-data-unit-a327d22c.js +677 -0
- package/dist/esm/snk-data-unit.entry.js +12 -2
- package/dist/esm/snk-detail-view.entry.js +48 -7
- package/dist/esm/snk-filter-bar.entry.js +5 -1
- package/dist/esm/snk-form-view.entry.js +67 -0
- package/dist/esm/snk-form.entry.js +51 -6
- package/dist/esm/snk-grid.entry.js +162 -105
- package/dist/esm/{snk-guides-viewer-113be3fd.js → snk-guides-viewer-874da66f.js} +36 -8
- package/dist/esm/snk-guides-viewer.entry.js +8 -6
- package/dist/esm/snk-simple-crud.entry.js +252 -25
- package/dist/esm/snk-taskbar.entry.js +4 -3
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
- package/dist/sankhyablocks/p-0046959e.entry.js +1 -0
- package/dist/sankhyablocks/p-0e11ee18.entry.js +1 -0
- package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
- package/dist/sankhyablocks/p-30cf616e.js +1 -0
- package/dist/sankhyablocks/p-47b60deb.entry.js +1 -0
- package/dist/sankhyablocks/p-60e46675.entry.js +11 -0
- package/dist/sankhyablocks/p-6d4f4614.js +60 -0
- package/dist/sankhyablocks/p-6ded2076.entry.js +1 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/p-7d9baaf4.entry.js +1 -0
- package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
- package/dist/sankhyablocks/p-829d4045.js +1 -0
- package/dist/sankhyablocks/p-8c6b44ea.entry.js +1 -0
- package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/p-a4b1f1eb.js +1 -0
- package/dist/sankhyablocks/p-af8efd95.js +6 -0
- package/dist/sankhyablocks/p-b7c4feeb.entry.js +1 -0
- package/dist/sankhyablocks/p-b8cde0d8.entry.js +1 -0
- package/dist/sankhyablocks/p-c7cbad38.js +1 -0
- package/dist/sankhyablocks/p-e0b9f59a.entry.js +1 -0
- package/dist/sankhyablocks/p-e6210aec.js +1 -0
- package/dist/sankhyablocks/p-e9bbc3d5.entry.js +1 -0
- package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -3
- package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
- package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
- package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +36 -1
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +19 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -1
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +61 -2
- package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
- package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/snk-form.d.ts +14 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +58 -4
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +220 -4
- package/dist/types/lib/@types/index.d.ts +5 -0
- package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
- package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
- package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/snk-data-unit-41c29713.js +0 -462
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/index3.js +0 -199
- package/dist/esm/snk-data-unit-de1d140d.js +0 -460
- package/dist/sankhyablocks/p-032fe52e.js +0 -1
- package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-0899e0b5.entry.js +0 -1
- package/dist/sankhyablocks/p-154a7f33.entry.js +0 -1
- package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
- package/dist/sankhyablocks/p-164666b1.js +0 -65
- package/dist/sankhyablocks/p-32556aa6.js +0 -1
- package/dist/sankhyablocks/p-328585d0.entry.js +0 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5cb07080.js +0 -1
- package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
- package/dist/sankhyablocks/p-7fe120b8.entry.js +0 -11
- package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
- package/dist/sankhyablocks/p-af1ac81f.entry.js +0 -1
- package/dist/sankhyablocks/p-b4525fc0.entry.js +0 -1
- package/dist/sankhyablocks/p-cce0865d.js +0 -1
- package/dist/sankhyablocks/p-dec65f6c.entry.js +0 -1
- package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
- package/dist/sankhyablocks/p-f13f7616.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -1,29 +1,87 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
|
2
|
-
import { StringUtils, ApplicationContext, ObjectUtils, DataType,
|
2
|
+
import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
|
5
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
5
|
+
import { T as TaskbarElement } from './taskbar-elements-d59867f1.js';
|
6
6
|
import './DataFetcher-c1baf61d.js';
|
7
|
-
import
|
8
|
-
import { S as SnkMultiSelectionListDataSource,
|
9
|
-
import { P as PresentationMode } from './index-
|
7
|
+
import './pesquisa-fetcher-03c8f919.js';
|
8
|
+
import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, a as CrudUtils } from './IExporterProvider-5a858363.js';
|
9
|
+
import { D as DataExporterOption, P as PresentationMode } from './index-3aa4977a.js';
|
10
10
|
import './ISave-d8c8bc59.js';
|
11
11
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
12
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
13
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-f7e0ffc0.js';
|
13
14
|
import './filter-item-type.enum-d45e026f.js';
|
14
15
|
import { F as FormConfigFetcher } from './form-config-fetcher-30fb808f.js';
|
15
16
|
import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
|
16
17
|
import { C as ConfigStorage } from './ConfigStorage-86187da3.js';
|
17
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
18
|
-
import './
|
18
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-d4554df9.js';
|
19
|
+
import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
|
20
|
+
import { s as store } from './index-bdf75557.js';
|
19
21
|
import './PrintUtils-3e4ff0f5.js';
|
22
|
+
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
20
23
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
24
|
+
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
21
25
|
import './ResourceIDUtils-a114189a.js';
|
22
|
-
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
23
26
|
|
24
27
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
25
28
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
26
29
|
|
30
|
+
class ClientSideExporterProvider extends CommonsExporter {
|
31
|
+
getSelectedNumber() {
|
32
|
+
return this.dataUnit.getSelectionInfo().length;
|
33
|
+
}
|
34
|
+
getTotalRecords() {
|
35
|
+
var _a, _b, _c;
|
36
|
+
const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
37
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
38
|
+
}
|
39
|
+
getSelectedIDs() {
|
40
|
+
return getSelectedIDs(this.dataUnit);
|
41
|
+
}
|
42
|
+
getRecordID() {
|
43
|
+
var _a, _b, _c;
|
44
|
+
return (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
45
|
+
}
|
46
|
+
async getRecords() {
|
47
|
+
if (this.dataUnit.records.length === 0) {
|
48
|
+
return Promise.resolve([]);
|
49
|
+
}
|
50
|
+
const selectionInfo = this.dataUnit.getSelectionInfo();
|
51
|
+
const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
|
52
|
+
return Promise.resolve(records == undefined ? [] : records);
|
53
|
+
}
|
54
|
+
getHiddenOptions() {
|
55
|
+
return [
|
56
|
+
DataExporterOption.EXPORT_BY_EMAIL,
|
57
|
+
DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
58
|
+
DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
59
|
+
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
60
|
+
DataExporterOption.EXPORT_PAGE_TO_XLS
|
61
|
+
];
|
62
|
+
}
|
63
|
+
formatValue(record, column) {
|
64
|
+
const { id, descriptionFrom } = column;
|
65
|
+
const value = record[descriptionFrom || id];
|
66
|
+
if (value == undefined) {
|
67
|
+
return "";
|
68
|
+
}
|
69
|
+
if (descriptionFrom != undefined) {
|
70
|
+
return value.label;
|
71
|
+
}
|
72
|
+
const fieldDescriptor = this.dataUnit.getField(id);
|
73
|
+
if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
|
74
|
+
return value.value;
|
75
|
+
}
|
76
|
+
if (column.customFormatter) {
|
77
|
+
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
78
|
+
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
79
|
+
return formattedValue;
|
80
|
+
}
|
81
|
+
return this.dataUnit.getFormattedValue(id, value);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
27
85
|
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}";
|
28
86
|
|
29
87
|
const SnkSimpleCrud = class {
|
@@ -38,11 +96,13 @@ const SnkSimpleCrud = class {
|
|
38
96
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
39
97
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
40
98
|
this._formConfigFetcher = new FormConfigFetcher();
|
99
|
+
this._customEditors = new Map();
|
100
|
+
this._customRenders = new Map();
|
41
101
|
this._taskbarProcessor = new TaskbarProcessor({
|
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),
|
102
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
103
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
104
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
105
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
46
106
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
47
107
|
});
|
48
108
|
this._showPopUpGridConfig = false;
|
@@ -53,12 +113,15 @@ const SnkSimpleCrud = class {
|
|
53
113
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
54
114
|
this.dataState = undefined;
|
55
115
|
this.dataUnit = undefined;
|
116
|
+
this.entityName = undefined;
|
56
117
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
57
118
|
this.gridConfig = undefined;
|
58
119
|
this.formConfig = undefined;
|
59
120
|
this._formFields = [];
|
121
|
+
this._fieldsProps = new Map();
|
60
122
|
this.multipleSelection = undefined;
|
61
123
|
this.useCancelConfirm = true;
|
124
|
+
this.pageSize = 150;
|
62
125
|
this.resourceID = undefined;
|
63
126
|
this.taskbarManager = undefined;
|
64
127
|
this.messagesBuilder = undefined;
|
@@ -69,6 +132,33 @@ const SnkSimpleCrud = class {
|
|
69
132
|
this.gridLegacyConfigName = undefined;
|
70
133
|
this.formLegacyConfigName = undefined;
|
71
134
|
this.ignoreReadOnlyFormFields = false;
|
135
|
+
this.autoFocus = true;
|
136
|
+
this.autoLoad = undefined;
|
137
|
+
}
|
138
|
+
/**
|
139
|
+
* Registra um editor customizado para campos da grade e formulário.
|
140
|
+
*/
|
141
|
+
async addCustomEditor(fieldName, customEditor) {
|
142
|
+
if (this._grid && this._form) {
|
143
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
144
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
const newCustomEditors = new Map(this._customEditors);
|
148
|
+
newCustomEditors.set(fieldName, customEditor);
|
149
|
+
this._customEditors = newCustomEditors;
|
150
|
+
}
|
151
|
+
/**
|
152
|
+
* Registra um render customizado para colunas da grid.
|
153
|
+
*/
|
154
|
+
async addGridCustomRender(fieldName, customRender) {
|
155
|
+
if (this._grid) {
|
156
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
const newCustomRenders = new Map(this._customRenders);
|
160
|
+
newCustomRenders.set(fieldName, customRender);
|
161
|
+
this._customRenders = newCustomRenders;
|
72
162
|
}
|
73
163
|
handleResourceIDChanged(newValue, oldValue) {
|
74
164
|
if (StringUtils.isEmpty(newValue)) {
|
@@ -80,9 +170,30 @@ const SnkSimpleCrud = class {
|
|
80
170
|
this.loadFormConfig(true);
|
81
171
|
this.loadGridConfig(true);
|
82
172
|
}
|
83
|
-
|
173
|
+
/**
|
174
|
+
* Registra um formatador de valores para uma coluna da grid.
|
175
|
+
*/
|
176
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
177
|
+
this._grid.addCustomValueFormatter(columnName, customFormatter);
|
178
|
+
}
|
179
|
+
/**
|
180
|
+
* Remove o formatador de valores de uma coluna da grid.
|
181
|
+
*/
|
182
|
+
async removeCustomValueFormatter(columnName) {
|
183
|
+
this._grid.removeCustomValueFormatter(columnName);
|
184
|
+
}
|
185
|
+
/**
|
186
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
187
|
+
*/
|
188
|
+
async setFieldProp(fieldName, propName, value) {
|
189
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
190
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
191
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
192
|
+
this._fieldsProps = newCustomFieldProps;
|
193
|
+
}
|
194
|
+
getButtons(selected, extraButtons) {
|
84
195
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
85
|
-
.concat(
|
196
|
+
.concat(extraButtons));
|
86
197
|
}
|
87
198
|
addConfigButton(buttons) {
|
88
199
|
if (this.configName === undefined) {
|
@@ -122,15 +233,19 @@ const SnkSimpleCrud = class {
|
|
122
233
|
}
|
123
234
|
evt.stopPropagation();
|
124
235
|
}
|
236
|
+
async onChangeEntityName(newValue) {
|
237
|
+
if (this.dataUnit)
|
238
|
+
return;
|
239
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
240
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
241
|
+
}
|
125
242
|
onModeChange() {
|
126
243
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
127
244
|
this.initInMemoryDataUnit();
|
128
245
|
}
|
129
246
|
}
|
130
247
|
observeDataState(newValue, oldValue) {
|
131
|
-
|
132
|
-
this.dataStateChange.emit(newValue);
|
133
|
-
}
|
248
|
+
this.handleDataStateChange(newValue, oldValue);
|
134
249
|
}
|
135
250
|
async observeFormLegacy(newValue, oldValue) {
|
136
251
|
await this.handleUpdateFormLegacyConfig(newValue, oldValue);
|
@@ -138,6 +253,28 @@ const SnkSimpleCrud = class {
|
|
138
253
|
async observeGridLegacy(newValue, oldValue) {
|
139
254
|
await this.handleUpdateGridLegacyConfig(newValue, oldValue);
|
140
255
|
}
|
256
|
+
async handleDataStateChange(newValue, oldValue) {
|
257
|
+
if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
|
258
|
+
this.dataStateChange.emit(newValue);
|
259
|
+
}
|
260
|
+
await this.processRmPrecision();
|
261
|
+
}
|
262
|
+
async processRmPrecision() {
|
263
|
+
var _a, _b;
|
264
|
+
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
265
|
+
for (const field of fieldsWithRmPrecision || []) {
|
266
|
+
if (!field) {
|
267
|
+
continue;
|
268
|
+
}
|
269
|
+
const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
|
270
|
+
if (!rmPrecision && rmPrecision !== 0) {
|
271
|
+
continue;
|
272
|
+
}
|
273
|
+
await this.setFieldProp(field, 'precision', rmPrecision);
|
274
|
+
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
275
|
+
}
|
276
|
+
this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
|
277
|
+
}
|
141
278
|
async handleUpdateGridLegacyConfig(newValue, oldValue) {
|
142
279
|
if (newValue == undefined || newValue == oldValue) {
|
143
280
|
return;
|
@@ -234,6 +371,7 @@ const SnkSimpleCrud = class {
|
|
234
371
|
}
|
235
372
|
async componentWillRender() {
|
236
373
|
this._resourceID = await this.application.getResourceID();
|
374
|
+
this.dataExporterProviderStore();
|
237
375
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
238
376
|
if (this.configName === undefined) {
|
239
377
|
return;
|
@@ -245,32 +383,70 @@ const SnkSimpleCrud = class {
|
|
245
383
|
this.loadGridConfig();
|
246
384
|
this.loadFormConfig();
|
247
385
|
}
|
386
|
+
componentDidRender() {
|
387
|
+
this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
|
388
|
+
this.addGridCustomValueFormattters();
|
389
|
+
this.setFieldsProps();
|
390
|
+
this.setCustomRenders();
|
391
|
+
this.setCustomEditors();
|
392
|
+
}
|
248
393
|
componentWillLoad() {
|
249
394
|
this.processMetadata();
|
250
395
|
this.onModeChange();
|
251
396
|
this.configDatasource();
|
397
|
+
this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
|
252
398
|
}
|
253
399
|
componentDidLoad() {
|
254
400
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
255
401
|
}
|
402
|
+
setCustomRenders() {
|
403
|
+
if (!this._grid) {
|
404
|
+
return;
|
405
|
+
}
|
406
|
+
for (const [fieldName, customRender] of this._customRenders) {
|
407
|
+
this._grid.addGridCustomRender(fieldName, customRender);
|
408
|
+
this._customRenders.delete(fieldName);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
setCustomEditors() {
|
412
|
+
if (!this._grid || !this._form) {
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
for (const [fieldName, customEditor] of this._customEditors) {
|
416
|
+
this._grid.addCustomEditor(fieldName, customEditor);
|
417
|
+
this._form.addCustomEditor(fieldName, customEditor);
|
418
|
+
this._customEditors.delete(fieldName);
|
419
|
+
}
|
420
|
+
}
|
256
421
|
configDatasource() {
|
257
422
|
this._multiSelectionListDataSource.setApplication(this.application);
|
258
423
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
259
424
|
}
|
425
|
+
setFieldsProps() {
|
426
|
+
if (!this._form) {
|
427
|
+
return;
|
428
|
+
}
|
429
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
430
|
+
for (const prop in props) {
|
431
|
+
this._form.setFieldProp(fieldName, prop, props[prop]);
|
432
|
+
}
|
433
|
+
this._fieldsProps.delete(fieldName);
|
434
|
+
}
|
435
|
+
}
|
260
436
|
getTaskBarId() {
|
261
|
-
var _a, _b
|
437
|
+
var _a, _b;
|
262
438
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
263
439
|
return "snkSimpleCrudTaskbar.finish_edition";
|
264
440
|
}
|
265
441
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
266
442
|
!this.dataState.selectionInfo.isAllRecords() &&
|
267
|
-
|
443
|
+
this.dataState.selectionInfo.length > 0) {
|
268
444
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
269
445
|
}
|
270
446
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
271
447
|
}
|
272
448
|
initInMemoryDataUnit() {
|
273
|
-
this._inMemoryLoader = new InMemoryLoader(this._metadata);
|
449
|
+
this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
|
274
450
|
this.dataUnit = this._inMemoryLoader.dataUnit;
|
275
451
|
this.dataUnitReady.emit(this.dataUnit);
|
276
452
|
}
|
@@ -309,12 +485,11 @@ const SnkSimpleCrud = class {
|
|
309
485
|
var _a;
|
310
486
|
(_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
|
311
487
|
}
|
312
|
-
updateConfig() {
|
488
|
+
async updateConfig() {
|
313
489
|
if (this._formConfigManager == undefined) {
|
314
490
|
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
315
491
|
}
|
316
492
|
this._formConfigManager.setConfig(this.formConfig);
|
317
|
-
return;
|
318
493
|
}
|
319
494
|
processMetadata() {
|
320
495
|
const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
|
@@ -346,11 +521,28 @@ const SnkSimpleCrud = class {
|
|
346
521
|
};
|
347
522
|
}
|
348
523
|
}
|
524
|
+
addGridCustomValueFormattters() {
|
525
|
+
var _a, _b, _c;
|
526
|
+
const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
|
527
|
+
if (!metadataFields) {
|
528
|
+
return;
|
529
|
+
}
|
530
|
+
const fieldsWithRmPrecision = [];
|
531
|
+
metadataFields.forEach((field) => {
|
532
|
+
var _a;
|
533
|
+
if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
|
534
|
+
fieldsWithRmPrecision.push(field.name);
|
535
|
+
}
|
536
|
+
});
|
537
|
+
fieldsWithRmPrecision.forEach(field => {
|
538
|
+
this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
|
539
|
+
});
|
540
|
+
}
|
349
541
|
onDataStateChange(evt) {
|
350
542
|
this.dataState = Object.assign({}, evt.detail);
|
351
543
|
}
|
352
544
|
getTaskBarDisabledButtons() {
|
353
|
-
var _a, _b, _c, _d;
|
545
|
+
var _a, _b, _c, _d, _e, _f;
|
354
546
|
const disabledButtons = [];
|
355
547
|
if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
|
356
548
|
disabledButtons.push(TaskbarElement.NEXT);
|
@@ -361,6 +553,9 @@ const SnkSimpleCrud = class {
|
|
361
553
|
if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
|
362
554
|
disabledButtons.push(TaskbarElement.FORM_MODE);
|
363
555
|
}
|
556
|
+
if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
|
557
|
+
disabledButtons.push(TaskbarElement.CLONE);
|
558
|
+
}
|
364
559
|
return disabledButtons;
|
365
560
|
}
|
366
561
|
handleCancelEdit() {
|
@@ -504,9 +699,23 @@ const SnkSimpleCrud = class {
|
|
504
699
|
.then(() => {
|
505
700
|
this.setGridConfig(config);
|
506
701
|
this.closeGridConfig();
|
702
|
+
this.dataExporterProviderStore();
|
507
703
|
});
|
508
704
|
evt.stopPropagation();
|
509
705
|
}
|
706
|
+
async dataExporterProviderStore() {
|
707
|
+
if (this.dataUnit == undefined) {
|
708
|
+
return;
|
709
|
+
}
|
710
|
+
if (this._grid == undefined) {
|
711
|
+
return;
|
712
|
+
}
|
713
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
714
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
715
|
+
}
|
716
|
+
getDataExporterStoreKey() {
|
717
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
718
|
+
}
|
510
719
|
setGridConfig(config) {
|
511
720
|
this.gridConfig = config;
|
512
721
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
@@ -522,6 +731,15 @@ const SnkSimpleCrud = class {
|
|
522
731
|
closeFormConfig() {
|
523
732
|
this._showFormConfig = false;
|
524
733
|
}
|
734
|
+
getPageSize() {
|
735
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
736
|
+
return 0;
|
737
|
+
}
|
738
|
+
if (this.pageSize == undefined) {
|
739
|
+
return 150;
|
740
|
+
}
|
741
|
+
return this.pageSize;
|
742
|
+
}
|
525
743
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
526
744
|
handleShowFormConfig() {
|
527
745
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -537,19 +755,28 @@ const SnkSimpleCrud = class {
|
|
537
755
|
}
|
538
756
|
return configFromManager;
|
539
757
|
}
|
758
|
+
updateFormConfig() {
|
759
|
+
const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
|
760
|
+
this.setFormConfig(newConfig, true);
|
761
|
+
if (this._formConfigManager == undefined) {
|
762
|
+
this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
|
763
|
+
}
|
764
|
+
this._formConfigManager.setConfig(this.formConfig);
|
765
|
+
}
|
540
766
|
/* istanbul ignore next */
|
541
767
|
render() {
|
542
768
|
var _a;
|
543
769
|
if (this.dataUnit == undefined) {
|
544
770
|
return;
|
545
771
|
}
|
546
|
-
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)
|
772
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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, "data-exporter-store-key": this.getDataExporterStoreKey(), 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)
|
547
773
|
? undefined
|
548
|
-
: 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: this.getFormConfig(), 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() }))));
|
774
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), 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() }))));
|
549
775
|
}
|
550
776
|
get _element() { return getElement(this); }
|
551
777
|
static get watchers() { return {
|
552
778
|
"resourceID": ["handleResourceIDChanged"],
|
779
|
+
"entityName": ["onChangeEntityName"],
|
553
780
|
"mode": ["onModeChange"],
|
554
781
|
"dataState": ["observeDataState"],
|
555
782
|
"formLegacyConfigName": ["observeFormLegacy"],
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { Action, 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-
|
5
|
-
import { P as PresentationMode } from './index-
|
4
|
+
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-d59867f1.js';
|
5
|
+
import { P as PresentationMode } from './index-3aa4977a.js';
|
6
6
|
import './index-bdf75557.js';
|
7
7
|
|
8
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}";
|
@@ -189,8 +189,9 @@ const SnkTaskbar = class {
|
|
189
189
|
className += "ez-padding-left--medium";
|
190
190
|
}
|
191
191
|
const taskbarElement = TaskbarElement[def.toString()];
|
192
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
192
193
|
if (taskbarElement) {
|
193
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
194
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
194
195
|
}
|
195
196
|
else {
|
196
197
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { h } from './index-a7d3d3f1.js';
|
2
|
-
import { P as PresentationMode } from './index-
|
2
|
+
import { P as PresentationMode } from './index-3aa4977a.js';
|
3
3
|
import { s as store } from './index-bdf75557.js';
|
4
4
|
|
5
5
|
var TaskbarElement;
|
@@ -48,7 +48,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
|
|
48
48
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
49
49
|
}
|
50
50
|
};
|
51
|
-
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions,
|
51
|
+
const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
|
52
52
|
var _a;
|
53
53
|
const title = getTitle(element);
|
54
54
|
switch (element) {
|
@@ -91,7 +91,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
91
91
|
case TaskbarElement.DIVIDER:
|
92
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
|
-
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[
|
94
|
+
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
|
95
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);
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as i,f as s,h as e,H as a}from"./p-d2d301a6.js";import{Action as o}from"@sankhyalabs/core";import{S as h}from"./p-829d4045.js";import{FormMetadata as n,buildFormMetadata as r}from"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-dc7c9047.js";import"./p-af8efd95.js";import{P as d}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import{T as l}from"./p-7e7a7473.js";import{d as c}from"./p-b0ef4383.js";import{S as m}from"./p-a4b1f1eb.js";import{S as u}from"./p-7a337364.js";import"./p-aff76a53.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-6dc031de.js";import"./p-c2495304.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";class v{constructor(t,i,s){this._parentGuide=t,this._formMetadata=i,this._dataUnit=s}get id(){return this._parentGuide.id}buildGuideItem(t){const i=Object.assign({},this._parentGuide);delete i.expanded,delete i.children;const s=this._dataUnit.getSelectedRecord();if(!s)return i;const e=this._dataUnit.isNewRecord(s.__record__id__),a=Array.from(this._formMetadata.getAllSheets().values()).map((i=>{const{name:s,label:a}=i,o=null!=n.getDetailName(s.split("::").pop()),h=o&&e,r=this._parentGuide.id,d=o?`${r}::${s}`:`${r}__FORM:${s}`;return o&&t.has(d)&&!h?t.get(d).buildGuideItem(t):{id:d,label:a,disabled:h,tooltip:h?"Finalize o cadastro para ter acesso a esta guia.":void 0}})),o=a.shift();return o.label=e?"Novo Registro":s.__record__label__,o.children=a,i.children=[o],i}}const p=class{constructor(s){t(this,s),this.snkDetailGuidesChange=i(this,"snkDetailGuidesChange",7),this.snkSwitchGuide=i(this,"snkSwitchGuide",7),this.formItemsReady=i(this,"formItemsReady",7),this._disabledButtons=void 0,this._currentView=void 0,this.attachmentRegisterKey=void 0,this.formConfigManager=void 0,this.dataUnitName=void 0,this.resourceID=void 0,this.guideItemPath=void 0,this.entityName=void 0,this.label=void 0,this.dataUnit=void 0,this.selectedForm=void 0,this.dataState=void 0,this.messagesBuilder=void 0,this.branchGuide=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.customEditors=void 0,this.customRenders=void 0}observeDataUnit(t,i){null==t||t.subscribe(this.dataUnitActionHandler.bind(this)),null==i||i.unsubscribe(this.dataUnitActionHandler)}observerDataState(t,i){const s=!(null==i?void 0:i.insertionMode)&&(null==t?void 0:t.insertionMode),e=(null==i?void 0:i.insertionMode)&&!(null==t?void 0:t.insertionMode);if((s||e)&&this.loadMetadata(),null==this._formMetadata)return;const a=null==t?void 0:t.selectedRecord,o=null==i?void 0:i.selectedRecord;(null==a?void 0:a.__record__id__)!==(null==o?void 0:o.__record__id__)&&this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit)),s&&setTimeout((()=>{this.changeViewMode(c.FORM)}),0),e&&this.changeViewMode(c.GRID);const h=[];this.dataState.hasPrevious||h.push(l.PREVIOUS),this.dataState.hasNext||h.push(l.NEXT),this.dataState.insertionMode&&h.push(l.INSERT),this._disabledButtons=h}async changeViewMode(t){this.emitSwitchEvent(t)}async configGrid(){this._snkGrid&&this._snkGrid.showConfig()}async showUp(){this._snkFormView&&this._snkFormView.showUp(),this._snkGrid&&this._snkGrid.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);this._snkGrid.addCustomEditor(t,i,e),this._snkFormView.addCustomEditor(t,i,e)}async observerPropsCustomEditor(t){for(const i in t)await this.addCustomEditor(i,t[i])}async addGridCustomRender(t,i){var s;const e=this.normalizeBranchGuideId(null===(s=this.branchGuide)||void 0===s?void 0:s.id);await this._snkGrid.addGridCustomRender(t,i,e)}onContentCardChanged(t){m.updateContentCard(t.detail.formName,t.detail.cardConfig,t.detail.propertyChanged,this.formConfigManager).then((()=>s(this))),t.stopPropagation()}async observeCustomRenders(t){for(const i in t){const s=t[i];await this.addGridCustomRender(i,s)}}updateLabel(){const t=this.guideItemPath?this.guideItemPath.length:0;if(t>0){const i=t>0?this.guideItemPath.map((t=>t.label)):void 0;this.label=i.pop(),this._levelPath=i.length>0?i.join(" / "):void 0}else this.label="",this._levelPath=void 0}getFormGuideId(t){var i;if(!t){if(null==(null===(i=this.dataState)||void 0===i?void 0:i.selectedRecord))return;const s=Array.from(this._formMetadata.getAllSheets().keys());if(!s||0==s.length)return;t=s[0]}return`${this.stripFormPattern(this.branchGuide.id)}__FORM:${t}`}stripFormPattern(t){return t.replace(p.REGEX_FORM_ID,"")}loadMetadata(){var t;if(!this.dataUnit)return;if(!this.formConfigManager.isLoaded)return;const i=this.formConfigManager.getConfig(null===(t=this.dataState)||void 0===t?void 0:t.insertionMode,this.dataUnit);this._formMetadata=r(null==i||0===i.fields.length?void 0:i,this.dataUnit,!0)}dataUnitReadyHandler(t){this.dataUnit=t.detail,this.loadMetadata()}updateViewStack(t){var i,s;this._viewStack=t,this._currentView=this.selectedForm?1:0,null===(s=null===(i=this._viewStack)||void 0===i?void 0:i.show)||void 0===s||s.call(i,this._currentView)}getFormFields(){return this.selectedForm&&this._formMetadata?this._formMetadata.getSheet(this.selectedForm).fields:[]}emitSwitchEvent(t){const i=t===c.GRID?this.stripFormPattern(this.branchGuide.id):this.getFormGuideId();i&&this.snkSwitchGuide.emit(i)}handleAttachBack(){this._viewStack.show(c.GRID)}executeActionHandler(t){t.detail===l.GRID_MODE&&(this.emitSwitchEvent(c.GRID),t.stopPropagation()),t.detail===l.FORM_MODE&&(this.emitSwitchEvent(c.FORM),t.stopPropagation()),t.detail===l.ATTACH&&(this._viewStack.show(c.ATTACHMENT),t.stopPropagation())}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}async handleDataStateChange({detail:t}){this.dataState=t,void 0!==t.selectedRecord&&this._snkDataUnit&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}componentWillLoad(){this._configName=`dynaform.${this.entityName}`,this.formConfigManager=new h(this._configName,this.resourceID,(()=>this.loadMetadata())),this.formConfigManager.loadConfig(),null==this.messagesBuilder&&(this.messagesBuilder=new u(this.entityName))}async componentDidLoad(){await this.observerPropsCustomEditor(this.customEditors),await this.observeCustomRenders(this.customRenders)}async dataUnitActionHandler(t){t.type===o.FIELD_INVALIDATED&&this.addErrorBadgeToBranchGuide()}addErrorBadgeToBranchGuide(){this.branchGuide=Object.assign(Object.assign({},this.branchGuide),{badge:"error"}),this.snkDetailGuidesChange.emit(new v(this.branchGuide,this._formMetadata,this.dataUnit))}normalizeBranchGuideId(t){return null==t?void 0:t.replace(/child\[(.*?)\]/g,"$1").replace(/::/g,">")}render(){return this.updateLabel(),e(a,null,e("snk-data-unit",{ref:t=>this._snkDataUnit=t,dataUnitName:`${this.dataUnitName}`,onDataUnitReady:t=>this.dataUnitReadyHandler(t),entityName:this.entityName,onDataStateChange:this.handleDataStateChange.bind(this),ignoreSaveMessage:this._currentView===c.GRID,messagesBuilder:this.messagesBuilder,configName:this._configName},e("ez-view-stack",{ref:t=>this.updateViewStack(t)},e("stack-item",null,e("div",{class:"ez-box ez-box--shadow grid-container"},e("div",{class:"ez-flex ez-title--primary ez-size-width--full ez-padding--large detail-header"},e("div",{class:"ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center"},this._levelPath?e("span",{class:"level-path"},this._levelPath+" /"):void 0,this.label)),e("snk-grid",{class:"ez-size-width--full ez-size-height--full",ref:t=>this._snkGrid=t,configName:this._configName,messagesBuilder:this.messagesBuilder,onGridDoubleClick:()=>this.emitSwitchEvent(c.FORM),onActionClick:t=>this.executeActionHandler(t),presentationMode:d.SECONDARY,canEdit:this.canEdit,isDetail:!0,taskbarCustomContainerId:this.taskbarCustomContainerId,gridHeaderCustomSlotId:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS",topTaskbarCustomSlotId:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}))),e("stack-item",null,e("snk-form-view",{ref:t=>this._snkFormView=t,canExpand:!1,canFix:!1,name:this.selectedForm,formMetadata:this._formMetadata,dataUnit:this.dataUnit,fields:this.getFormFields(),label:this.label,levelPath:this._levelPath,onFormItemsReady:({detail:t})=>this.formItemsReady.emit(t)},e("snk-taskbar",{key:"guideViewerTaskbar",class:"form-taskbar","data-element-id":"guideViewer",configName:this._configName,messagesBuilder:this.messagesBuilder,disabledButtons:this._disabledButtons,buttons:"INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR",primaryButton:"INSERT",presentationMode:d.SECONDARY,onActionClick:t=>this.executeActionHandler(t),dataUnit:this.dataUnit,resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"},e("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))),e("stack-item",null,e("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this.entityName,onBack:this.handleAttachBack.bind(this)})))))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observerDataState"],customEditors:["observerPropsCustomEditor"],customRenders:["observeCustomRenders"]}}};p.REGEX_FORM_ID=/__FORM:[^:]+/g,p.style=".sc-snk-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%}.level-path.sc-snk-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.form-taskbar.sc-snk-detail-view{padding-bottom:var(--space--medium)}.grid-container.sc-snk-detail-view{background-color:#FFF;min-height:100px}.detail-header.sc-snk-detail-view{padding-bottom:0}";export{p as snk_detail_view}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ApplicationContext as o,ObjectUtils as r,UserInterface as n,DataType as l,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as h}from"@sankhyalabs/ezui/dist/collection/utils";import{D as c,a as p,b as u}from"./p-30cf616e.js";import{R as m}from"./p-b0ef4383.js";import{D as v}from"./p-dc7c9047.js";import{S as x}from"./p-c7cbad38.js";import"./p-af8efd95.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import"./p-8d884fab.js";import"./p-7a337364.js";import"./p-9863d682.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class f{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===c.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===c.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this._selectedNumber>0&&this.setExportAllRecords(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];if(t===c.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===c.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===c.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportAllRecords(t,e){var i;const s=[c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS];if(t===c.EXPORT_ALL_RECORDS&&e.push(this.getAllRecords()),s.includes(t)){let s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS));null==s&&(e.push(this.getAllRecords()),s=e.find((t=>t.id===c.EXPORT_ALL_RECORDS))),(null===(i=s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===c.EXPORT_ALL_RECORDS_TO_PDF&&s.children.push(this.getExportAllRecordsToPDF()),t===c.EXPORT_ALL_RECORDS_TO_XLS&&s.children.push(this.getExportAllRecordsToXLS())}}setExportByEmail(t,e){t===c.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:c.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:c.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:c.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getAllRecords(){return{id:c.EXPORT_ALL_RECORDS,label:this._getMessage("snkDataExporter.label.allRecords"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:c.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:c.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportAllRecordsToPDF(){return{id:c.EXPORT_ALL_RECORDS_TO_PDF,label:"PDF (.pdf)"}}getExportAllRecordsToXLS(){return{id:c.EXPORT_ALL_RECORDS_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:c.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function g(t){const e=[];let i=0;for(const s of t){if(i+=s.width,i>=800)break;e.push(s)}return e}function b(t){return Object.keys(c).find((e=>c[e]===t))}class E{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async getParams(t){var e,i,s,o,r,n;const l=null===(i=(e=this._provider).getFilters)||void 0===i?void 0:i.call(e),a=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(b(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),d=null===(o=(s=this._provider).getOrders)||void 0===o?void 0:o.call(s),h=null===(n=(r=this._provider).getResourceURI)||void 0===n?void 0:n.call(r),u=this._provider.getSelectedIDs(),m=t.exportOption,v=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS];delete t.exportOption;let x=Object.assign({filters:l,columns:a,sort:d,resourceURI:h,selectedIDs:u.slice(0,this._provider.getExportLimit())},t);if(v.includes(m)||"page"==t.type){const t=this._provider.getOffset(),e=this._provider.getPageSize();x=Object.assign(Object.assign({},x),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(x=Object.assign(Object.assign({},x),{offset:0,limit:this._provider.getExportLimit(),selectedIDs:[]}));return Promise.resolve(x)}async executeExport(t){const e=await this.getParams(t),{methodName:i}=e,s=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(e,["methodName"]),n=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.${i}`,l={serviceName:n,requestBody:s};return new Promise(((t,e)=>{v.get().callServiceBroker(n,r.objectToString(l)).then((e=>t(this.getFormatResponse(e)))).catch((t=>e(t)))}))}getFormatResponse(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}}class w{constructor(t){this._provider=t}async getParsedColumns(){return g(await this._provider.getColumnsMetadata())}async executeExport(t){const{methodName:e,titleGrid:i}=t,s=await this._provider.getRecords(),o=[p.EXPORT_TO_PDF,p.EXPORT_PAGE_TO_PDF,p.EXPORT_PDF_TO_EMAIL,p.EXPORT_ALL_RECORDS_TO_PDF].includes(b(null==t?void 0:t.exportOption))?await this.getParsedColumns():await this._provider.getColumnsMetadata(),[r,n]=this.getExecutor(e),l={serviceName:r,requestBody:{grid:{titleGrid:i,columns:this.buildColumnsObject(o),rows:this.buildRowsObject(o,s),customOptions:{xlsxExtension:!1}}}};return new Promise(((t,e)=>{v.get().callServiceBroker(r,l).then((e=>t(n(e)))).catch((t=>e(t)))}))}getExecutor(t){return"exportToPDF"===t?["GridPDFBuilderSP.buildPDFFromJson",t=>({fileSessionKey:t.chavePDF.valor,canPrint:"S"===t.permiteImprimir.valor,canExport:"S"===t.permiteExportar.valor,canSendEmail:"S"===t.canSendEmail.valor,useAppPrint:!0})]:["GridXLSBuilderSP.buildXLSFromJson",t=>({fileSessionKey:t.chaveXLS.valor,canPrint:!1,canExport:!1,useAppPrint:!1,canSendEmail:!1})]}buildColumnsObject(t){return{column:t.map(((t,e)=>{const{label:i,id:s,width:o,userInterface:r}=t;return Object.assign({index:e+1,id:s,label:i,width:o,presentationType:"P"},k[r]||{type:"S",align:"left"})}))}}buildRowsObject(t,e){return{row:e.map((e=>{const i={};return t.forEach(((t,s)=>i["c"+(s+1)]={$:this.formatValue(e,t)})),i}))}}formatValue(t,e){return null!=this._provider.formatValue?this._provider.formatValue(t,e):t[e.id]||""}}const k={[n.DATE]:{type:"D",align:"center"},[n.DATETIME]:{type:"H",align:"center"},[n.TIME]:{type:"I",align:"right"},[n.ELAPSEDTIME]:{type:"I",align:"right"},[n.DECIMALNUMBER]:{type:"F",align:"right"},[n.INTEGERNUMBER]:{type:"I",align:"right"},[n.SEARCH]:{type:"S",align:"right"}},D=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._releasedToExport=[c.EXPORT_TO_PDF,c.EXPORT_TO_XLS,c.EXPORT_BY_EMAIL,c.EXPORT_PDF_TO_EMAIL,c.EXPORT_XLS_TO_EMAIL,c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS,c.EXPORT_ALL_RECORDS_TO_PDF,c.EXPORT_ALL_RECORDS_TO_XLS],this._items=[],this._showDropdown=!1,this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=u[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:u.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),d.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){null!=this.provider&&null!=t&&null!=e&&this.getExporterStrategy().executeExport(t).then((t=>e(t))).catch((t=>{console.error(t);let{title:e,message:i,statusMessage:s}=t||{};d.error(e||this.getMessage("snkDataExporter.message.exportError"),s||i||this.getMessage("snkDataExporter.message.unknownFailure"))}))}getExporterStrategy(){return null==this.provider.getRecords?new E(this.provider):new w(this.provider)}getOptionKey(t){return Object.keys(c).find((e=>c[e]===t))}getExportType(t){return t===c.EXPORT_ALL_RECORDS_TO_PDF||t===c.EXPORT_ALL_RECORDS_TO_XLS?"all":t===c.EXPORT_PAGE_TO_PDF||t===c.EXPORT_PAGE_TO_XLS?"page":"selection"}async dispatchExporter(t){var e,i,s;const r=this.getOptionKey(t),n=null!==(e=p[r])&&void 0!==e?e:p.EXPORT_TO_PDF,l=p[r]===p.EXPORT_TO_XLS,a={methodName:c[`EXPORT_TO_${n}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:null===(s=null===(i=this.provider)||void 0===i?void 0:i.getExportLimit)||void 0===s?void 0:s.call(i),type:this.getExportType(t)};await this.resolveExporter(a,(t=>{t.canExport||n===p.EXPORT_TO_PDF?function({fileSessionKey:t,isDownload:e}){const i=o.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),d.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:n,isDownload:l})):d.error(this.getMessage("snkDataExporter.title.permission"),this.getMessage("snkDataExporter.message.exportPermission"))}))}async processExporter(t){var e,i,s,o,r,n,l;const a=null==t?void 0:t.detail,p=[c.EXPORT_PAGE_TO_PDF,c.EXPORT_PAGE_TO_XLS],u=null===(e=null==a?void 0:a.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==a?void 0:a.id)===c.EXPORT_CURRENT_PAGE)return;const m=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),v=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),x=null===(r=null===(o=this.provider)||void 0===o?void 0:o.getPageSize)||void 0===r?void 0:r.call(o),f=null===(l=null===(n=this.provider)||void 0===n?void 0:n.getExportLimit)||void 0===l?void 0:l.call(n);let g=!1;if(p.includes(null==a?void 0:a.id)&&x<=f||u?g=!1:(null==m?void 0:m.length)?g=m.length>f:v>f&&(g=!0),g){const t=f.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await d.confirm(e.title,e.description,null,h.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(u)return this.openPersonalizedReports(a.id),void(this._showDropdown=!1);this.getFilteredReleasedToExport().includes(null==a?void 0:a.id)&&(a.id===c.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(a.id),this._showDropdown=!1)}getFilteredReleasedToExport(){var t,e;if(null==this.provider)return this._releasedToExport;const i=null===(e=(t=this.provider).getHiddenOptions)||void 0===e?void 0:e.call(t);return null==i?this._releasedToExport:this._releasedToExport.filter((t=>!i.includes(t)))}loadItems(){const t=[];this.getFilteredReleasedToExport().forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e,i;const s=null===(i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID)||void 0===i?void 0:i.call(e);if(null==s)return void(this._items=t);const n=await function(t){const e=`${o.getContextValue("__SNK__APPLICATION__").getModuleName()}@DataExporterSPBean.getPersonalizedReports`,i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,r.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return r.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:s});null==n||n.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e,i;const s=[],o=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(i=null===(e=this.provider)||void 0===e?void 0:e.getSelectedIDs)||void 0===i||i.call(e).forEach((({name:t,type:e,value:i},o)=>{const r={fields:[]};0===o&&(s[`PK_${t}`]={type:this.parseDataType(e),value:i},s.pks=[]);const n={nome:`PK_${t}`,tipo:this.parseDataType(e),valor:i};r.fields.push(n),s.pks.push(r)})),this._application.openApp(`${m}${o}`,s)}parseDataType(t){switch(t){case l.NUMBER:return"I";case l.DATE:return"D";default:return"S"}}loadDropdown(){var t;this._selectedNumber=(null===(t=this.provider)||void 0===t?void 0:t.getSelectedNumber())||0,this._itemBuilder=new f(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=o.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" ez-elevation--16":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};D.style=".sc-snk-data-exporter-h{display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{D as snk_data_exporter}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as i,h as s,H as e}from"./p-d2d301a6.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{DataBinder as r}from"@sankhyalabs/ezui/dist/collection/utils/form";const a=class{constructor(s){t(this,s),this.snkContentCardChanged=i(this,"snkContentCardChanged",7),this.snkRequestClearFieldToFocus=i(this,"snkRequestClearFieldToFocus",7),this.formItemsReady=i(this,"formItemsReady",7),this._customEditors=new Map,this._fieldProps=new Map,this.levelPath=void 0,this.label=void 0,this.name=void 0,this.fields=void 0,this.formMetadata=void 0,this.dataUnit=void 0,this.contracted=void 0,this.fixed=!1,this.summaryFields=void 0,this.canExpand=!0,this.canFix=!0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.customEditors=void 0,this.fieldsProps=void 0}async showUp(){this._formView&&this._formView.showUp()}async addCustomEditor(t,i,s){if(this._formView)return void this._formView.addCustomEditor(t,i,s);const e=new Map(this._customEditors);e.set(t,{customEditor:i,detailContext:s}),this._customEditors=e}observePropsCustomEditor(t){for(const i in t)this.addCustomEditor(i,t[i])}async setFieldProp(t,i,s){const e=this._fieldProps.get(t)||[];this._fieldProps.set(t,[...e,{propName:i,value:s}])}async observeFieldsProps(t){for(const i in t){const s=t[i],e=Object.keys(s);for(const t of e)await this.setFieldProp(i,t,s[t])}}changeFix(){this.fixed=!this.fixed,this.emitEvent("fixed")}changeContracted(){this.contracted=!this.contracted,this.emitEvent("presentation")}emitEvent(t){this.snkContentCardChanged.emit({formName:this.name,cardConfig:{fixed:this.fixed,presentation:this.contracted?"CONTRACTED":"EXPANDED"},propertyChanged:t})}getCardSummary(){const t={};return this.getSummaryFields().forEach((({field:i,label:s})=>{var e;const o=this.dataUnit.getFormattedValue(i);""!==o&&(null==s&&(s=null===(e=this.dataUnit.getField(i))||void 0===e?void 0:e.label),t[s]=o)})),t}getSummaryFields(){return null==this.summaryFields?this.fields.map((t=>{const i=this.dataUnit.getField(t.name);return{field:t.name,label:t.label||(null==i?void 0:i.label)}})):this.summaryFields}bindFields(t){null==this._dataBinder&&null!=this.dataUnit&&(this._dataBinder=new r(this.dataUnit)),this._dataBinder&&this._dataBinder.bind(t,this.dataUnit.dataUnitId,this.formMetadata,this.recordsValidator)}handleFormItemsReady(t){t.stopPropagation(),this.formItemsReady.emit(Object.assign(Object.assign({},t.detail),{formId:this.name}))}disconnectedCallback(){null!=this._dataBinder&&this._dataBinder.onDisconnectedCallback()}componentDidLoad(){this.observePropsCustomEditor(this.customEditors),this.observeFieldsProps(this.fieldsProps)}componentDidRender(){this.setCustomEditors(),this.setFieldProps(),null!=this.fieldToFocus&&this.fields.some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.snkRequestClearFieldToFocus.emit()}))}setCustomEditors(){if(this._formView)for(const[t,i]of this._customEditors)this._formView.addCustomEditor(t,i.customEditor,i.detailContext),this._customEditors.delete(t)}setFieldProps(){if(this._formView)for(const[t,i]of this._fieldProps)i.forEach((i=>{this._formView.setFieldProp(t,i.propName,i.value),this._fieldProps.delete(t)}))}render(){return s(e,{class:"ez-box__container"},s("div",{class:"summary-header ez-flex ez-size-width--full"},s("div",{class:"ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9"},this.levelPath?s("span",{class:"level-path"},this.levelPath+" /"):void 0,this.label),s("div",{class:"ez-flex ez-flex--justify-end ez-col--sd-3"},this.canFix&&s("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.fixed?"un-pin":"push-pin","data-element-id":o.getInternalIDInfo("toggleFixed_ezFormCard"),onClick:()=>this.changeFix(),title:this.fixed?"Desafixar":"Fixar"}),this.canExpand&&s("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.contracted?"chevron-down":"chevron-up","data-element-id":o.getInternalIDInfo("toggleExpand_ezFormCard"),onClick:()=>this.changeContracted(),title:this.contracted?"Expandir":"Resumir"}))),s("slot",null),this.contracted?s("snk-form-summary",{summary:this.getCardSummary()}):s("ez-form-view",{ref:t=>this._formView=t,fields:this.fields,onEzContentReady:t=>this.bindFields(t.detail),onFormItemsReady:t=>this.handleFormItemsReady(t)}))}static get watchers(){return{customEditors:["observePropsCustomEditor"],fieldsProps:["observeFieldsProps"]}}};a.style=".sc-snk-form-view-h{display:flex;width:100%;--ez-form-card-summary-field-content-weight:700}.level-path.sc-snk-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";export{a as snk_form_view}
|
@@ -0,0 +1 @@
|
|
1
|
+
var o,r,e,t;!function(o){o.PRIMARY="primary",o.SECONDARY="secondary",o.SINGLE_TASKBAR="singleTaskbar"}(o||(o={})),function(o){o.EXPORT_TO_PDF="exportToPDF",o.EXPORT_TO_XLS="exportToXLS",o.EXPORT_CURRENT_PAGE="exportCurrentPage",o.EXPORT_ALL_RECORDS="exportAllRecords",o.EXPORT_PAGE_TO_PDF="exportPageToPDF",o.EXPORT_PAGE_TO_XLS="exportPageToXLS",o.EXPORT_ALL_RECORDS_TO_PDF="exportAllRecordsToPDF",o.EXPORT_ALL_RECORDS_TO_XLS="exportAllRecordsToXLS",o.EXPORT_BY_EMAIL="exportToEmail",o.EXPORT_PDF_TO_EMAIL="exportPDFToEmail",o.EXPORT_XLS_TO_EMAIL="exportXLSToEmail"}(r||(r={})),function(o){o.PDF="exportPDFToEmail",o.XLS="exportXLSToEmail",o.XLSX="exportXLSToEmail"}(e||(e={})),function(o){o.EXPORT_TO_PDF="PDF",o.EXPORT_TO_XLS="XLS",o.EXPORT_PAGE_TO_PDF="PDF",o.EXPORT_PAGE_TO_XLS="XLS",o.EXPORT_ALL_RECORDS_TO_PDF="PDF",o.EXPORT_ALL_RECORDS_TO_XLS="XLS",o.EXPORT_PDF_TO_EMAIL="PDF",o.EXPORT_XLS_TO_EMAIL="XLS"}(t||(t={}));export{r as D,o as P,t as a,e as b}
|