@sankhyalabs/sankhyablocks 8.15.0-dev.52 → 8.15.0-dev.54
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-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
- package/dist/cjs/{SnkMultiSelectionListDataSource-d15f7aac.js → IExporterProvider-955812ad.js} +52 -5
- package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
- package/dist/cjs/{SnkFormConfigManager-33995e92.js → SnkFormConfigManager-8986431f.js} +2 -2
- package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
- package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-bdbbe9ac.js → pesquisa-fetcher-6e934fb5.js} +30 -16
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +8 -9
- package/dist/cjs/snk-application.cjs.entry.js +22 -23
- package/dist/cjs/snk-attach.cjs.entry.js +12 -13
- package/dist/cjs/snk-crud.cjs.entry.js +4 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +195 -78
- package/dist/cjs/{snk-data-unit-41c29713.js → snk-data-unit-abd2113f.js} +2 -37
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +6 -7
- package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
- package/dist/cjs/snk-form.cjs.entry.js +3 -4
- package/dist/cjs/snk-grid.cjs.entry.js +65 -102
- package/dist/cjs/{snk-guides-viewer-a8dd24a3.js → snk-guides-viewer-4e8b517b.js} +4 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +124 -33
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -2
- package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +35 -45
- package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
- package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
- package/dist/collection/components/snk-grid/snk-grid.js +3 -94
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +91 -11
- 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/dataUnit/InMemoryLoader.js +1 -1
- 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 +8 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
- package/dist/components/ConfigStorage.js +1 -2
- package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
- package/dist/components/ISave.js +42 -0
- package/dist/components/dataunit-fetcher.js +18 -4
- package/dist/components/form-config-fetcher.js +7022 -3
- package/dist/components/index2.js +198 -33
- package/dist/components/snk-actions-button2.js +3 -12
- package/dist/components/snk-application2.js +1 -1
- package/dist/components/snk-attach2.js +3 -4
- package/dist/components/snk-crud.js +3 -4
- package/dist/components/snk-data-exporter2.js +192 -79
- package/dist/components/snk-data-unit2.js +41 -39
- package/dist/components/snk-detail-view2.js +4 -5
- package/dist/components/snk-expression-item2.js +1 -1
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +63 -100
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-simple-crud2.js +111 -18
- package/dist/components/snk-taskbar2.js +6 -5
- package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-7084f3b3.js → IExporterProvider-6ebf47ab.js} +52 -6
- package/dist/esm/RecordIDUtils-87d02110.js +41 -0
- package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
- package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
- package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-96d2f351.js → pesquisa-fetcher-4eed47c6.js} +18 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +3 -4
- package/dist/esm/snk-application.entry.js +4 -5
- package/dist/esm/snk-attach.entry.js +4 -5
- package/dist/esm/snk-crud.entry.js +4 -5
- package/dist/esm/snk-data-exporter.entry.js +195 -78
- package/dist/esm/{snk-data-unit-de1d140d.js → snk-data-unit-29eba11a.js} +3 -38
- package/dist/esm/snk-data-unit.entry.js +2 -1
- package/dist/esm/snk-detail-view.entry.js +6 -7
- package/dist/esm/snk-filter-bar.entry.js +2 -3
- package/dist/esm/snk-filter-modal-item.entry.js +2 -3
- package/dist/esm/snk-form-config.entry.js +1 -2
- package/dist/esm/snk-form.entry.js +3 -4
- package/dist/esm/snk-grid.entry.js +63 -100
- package/dist/esm/{snk-guides-viewer-131e9660.js → snk-guides-viewer-2742a9db.js} +4 -5
- package/dist/esm/snk-guides-viewer.entry.js +6 -7
- package/dist/esm/snk-personalized-filter.entry.js +2 -3
- package/dist/esm/snk-simple-crud.entry.js +112 -21
- package/dist/esm/snk-taskbar.entry.js +3 -2
- package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
- package/dist/sankhyablocks/p-07825198.js +1 -0
- package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
- package/dist/sankhyablocks/p-201e5588.entry.js +1 -0
- package/dist/sankhyablocks/p-33a6728e.js +26 -0
- package/dist/sankhyablocks/p-37afb96a.js +1 -0
- package/dist/sankhyablocks/p-411fe937.entry.js +1 -0
- package/dist/sankhyablocks/p-44d52fc6.js +1 -0
- package/dist/sankhyablocks/p-4ddf7add.entry.js +1 -0
- package/dist/sankhyablocks/p-7b797d8f.entry.js +1 -0
- package/dist/sankhyablocks/p-87cb937d.js +65 -0
- package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
- package/dist/sankhyablocks/p-9863d682.js +1 -0
- package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
- package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
- package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
- package/dist/sankhyablocks/p-bf209f48.entry.js +1 -0
- package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
- package/dist/sankhyablocks/p-c3c0ad0b.entry.js +1 -0
- package/dist/sankhyablocks/{p-619c5f6f.entry.js → p-c801a38a.entry.js} +2 -2
- package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
- package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
- package/dist/sankhyablocks/p-e4225e8b.entry.js +1 -0
- package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
- package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
- package/dist/sankhyablocks/p-fd44c905.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -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 +3 -1
- package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +15 -2
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
- package/dist/types/components.d.ts +16 -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/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
- package/dist/components/DataFetcher.js +0 -7023
- package/dist/components/index3.js +0 -199
- package/dist/esm/form-config-fetcher-765b8498.js +0 -253
- package/dist/sankhyablocks/p-004c356e.js +0 -26
- package/dist/sankhyablocks/p-075bba4c.entry.js +0 -1
- package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
- package/dist/sankhyablocks/p-103c5956.entry.js +0 -1
- package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
- package/dist/sankhyablocks/p-13ae1a89.entry.js +0 -1
- package/dist/sankhyablocks/p-19a56978.entry.js +0 -1
- package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
- package/dist/sankhyablocks/p-34a7f2ab.js +0 -65
- package/dist/sankhyablocks/p-52c8e589.js +0 -1
- package/dist/sankhyablocks/p-5833cff9.js +0 -1
- package/dist/sankhyablocks/p-5a2e016a.entry.js +0 -1
- package/dist/sankhyablocks/p-6f560924.entry.js +0 -1
- package/dist/sankhyablocks/p-8967fa78.js +0 -1
- package/dist/sankhyablocks/p-a87149e4.entry.js +0 -1
- package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
- package/dist/sankhyablocks/p-b10b9934.entry.js +0 -1
- package/dist/sankhyablocks/p-be75153c.js +0 -1
- package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
- package/dist/sankhyablocks/p-f7d0fab9.entry.js +0 -1
- package/dist/sankhyablocks/p-f7d9d148.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
- /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
2
|
-
import { Action, ApplicationContext, DataUnitAction, ObjectUtils
|
2
|
+
import { Action, ApplicationContext, DataUnitAction, ObjectUtils } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
|
5
|
+
import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
|
5
6
|
export class SnkDataUnit {
|
6
7
|
constructor() {
|
7
8
|
this._onDataUnitResolve = [];
|
@@ -117,43 +118,7 @@ export class SnkDataUnit {
|
|
117
118
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
118
119
|
*/
|
119
120
|
async getSelectedRecordsIDsInfo() {
|
120
|
-
|
121
|
-
const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
|
122
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
123
|
-
return [];
|
124
|
-
}
|
125
|
-
const selectedRecordsIDsInfo = [];
|
126
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
|
127
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
128
|
-
selectedRecords.forEach(({ __record__id__ }) => {
|
129
|
-
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
130
|
-
/*
|
131
|
-
Esse if foi necessário para tratar corretamente o ID
|
132
|
-
do record quando está sendo utilizado no modo standAlone
|
133
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
134
|
-
mas deixa de causar erro nas oprações de CRUD.
|
135
|
-
*/
|
136
|
-
if (!JSUtils.isBase64(__record__id__)) {
|
137
|
-
selectedRecordsIDsInfo.push({
|
138
|
-
name: "__record__id__",
|
139
|
-
type: DataType.TEXT,
|
140
|
-
value: __record__id__
|
141
|
-
});
|
142
|
-
return;
|
143
|
-
}
|
144
|
-
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
145
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
146
|
-
var _a;
|
147
|
-
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
148
|
-
if (metadataField == undefined) {
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
152
|
-
});
|
153
|
-
}
|
154
|
-
});
|
155
|
-
}
|
156
|
-
return selectedRecordsIDsInfo;
|
121
|
+
return Promise.resolve(getSelectedIDs(this.dataUnit));
|
157
122
|
}
|
158
123
|
getCleanOnCopyFields() {
|
159
124
|
var _a;
|
@@ -774,10 +739,6 @@ export class SnkDataUnit {
|
|
774
739
|
},
|
775
740
|
"Array": {
|
776
741
|
"location": "global"
|
777
|
-
},
|
778
|
-
"Record": {
|
779
|
-
"location": "import",
|
780
|
-
"path": "@sankhyalabs/core"
|
781
742
|
}
|
782
743
|
},
|
783
744
|
"return": "Promise<IRecordID[]>"
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { h, Fragment } from '@stencil/core';
|
2
|
-
import { ApplicationContext,
|
3
|
-
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
2
|
+
import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
4
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
5
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
6
5
|
import { PresentationMode } from '../../lib/@types';
|
@@ -10,6 +9,7 @@ import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionLis
|
|
10
9
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
11
10
|
import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/field-search';
|
12
11
|
import { CrudUtils } from '../../lib';
|
12
|
+
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
13
13
|
export class SnkGrid {
|
14
14
|
constructor() {
|
15
15
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
@@ -155,99 +155,8 @@ export class SnkGrid {
|
|
155
155
|
});
|
156
156
|
evt.stopPropagation();
|
157
157
|
}
|
158
|
-
buildColumnsMetadata(gridColumns) {
|
159
|
-
const columnsMetadata = [];
|
160
|
-
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
161
|
-
var _a, _b;
|
162
|
-
/**
|
163
|
-
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
164
|
-
*/
|
165
|
-
if (column.hidden && column.name !== "RECDESP") {
|
166
|
-
return;
|
167
|
-
}
|
168
|
-
const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
169
|
-
const columnData = {
|
170
|
-
label: column.label,
|
171
|
-
id: column.name,
|
172
|
-
width: column.width,
|
173
|
-
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
174
|
-
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
175
|
-
};
|
176
|
-
columnsMetadata.push(columnData);
|
177
|
-
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
178
|
-
const mergedFrom = fieldData.properties.mergedFrom;
|
179
|
-
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
180
|
-
const descriptionColumn = {
|
181
|
-
label: fieldData.properties.DESCRIPTIONENTITY,
|
182
|
-
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
183
|
-
width: 200,
|
184
|
-
type: DataType.TEXT,
|
185
|
-
userInterface: UserInterface.LONGTEXT
|
186
|
-
};
|
187
|
-
columnsMetadata.push(descriptionColumn);
|
188
|
-
}
|
189
|
-
});
|
190
|
-
return columnsMetadata || [];
|
191
|
-
}
|
192
|
-
getPaginationInfo() {
|
193
|
-
var _a;
|
194
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
|
195
|
-
}
|
196
|
-
getExporterOffset(paginationInfo) {
|
197
|
-
if (paginationInfo == undefined) {
|
198
|
-
return;
|
199
|
-
}
|
200
|
-
const offset = paginationInfo.firstRecord;
|
201
|
-
if (offset > 0) {
|
202
|
-
return (offset - 1);
|
203
|
-
}
|
204
|
-
return offset;
|
205
|
-
}
|
206
158
|
async dataExporterProviderStore() {
|
207
|
-
|
208
|
-
const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
|
209
|
-
const dataExporterProvider = {
|
210
|
-
getFilters: () => {
|
211
|
-
var _a;
|
212
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
|
213
|
-
},
|
214
|
-
getColumnsMetadata: async () => {
|
215
|
-
var _a;
|
216
|
-
const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
217
|
-
return this.buildColumnsMetadata(columnsState);
|
218
|
-
},
|
219
|
-
getOrders: () => {
|
220
|
-
var _a;
|
221
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
|
222
|
-
},
|
223
|
-
getResourceURI: () => {
|
224
|
-
var _a;
|
225
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
226
|
-
},
|
227
|
-
getSelectedNumber: () => {
|
228
|
-
var _a, _b;
|
229
|
-
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
|
230
|
-
},
|
231
|
-
getTotalRecords: () => {
|
232
|
-
var _a, _b, _c;
|
233
|
-
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
234
|
-
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;
|
235
|
-
},
|
236
|
-
getSelectedIDs: () => {
|
237
|
-
return selectedIDs || [];
|
238
|
-
},
|
239
|
-
getOffset: () => {
|
240
|
-
return this.getExporterOffset(this.getPaginationInfo());
|
241
|
-
},
|
242
|
-
getLimit: () => {
|
243
|
-
var _a;
|
244
|
-
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
|
245
|
-
},
|
246
|
-
getRecordID: () => {
|
247
|
-
var _a, _b, _c;
|
248
|
-
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__;
|
249
|
-
}
|
250
|
-
};
|
159
|
+
const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
|
251
160
|
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
|
252
161
|
}
|
253
162
|
addElementID() {
|
@@ -11,16 +11,18 @@ import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/
|
|
11
11
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
12
12
|
import { SnkFormConfigManager } from '../snk-form-config/SnkFormConfigManager';
|
13
13
|
import { REGULAR_DEFAULT_BTNS, REGULAR_SELECTED_BTNS } from './regular-buttons';
|
14
|
+
import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
|
15
|
+
import store from "../../lib/store";
|
14
16
|
export class SnkSimpleCrud {
|
15
17
|
constructor() {
|
16
18
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
17
19
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
18
20
|
this._formConfigFetcher = new FormConfigFetcher();
|
19
21
|
this._taskbarProcessor = new TaskbarProcessor({
|
20
|
-
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
|
21
|
-
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
|
22
|
-
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
|
23
|
-
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
|
22
|
+
"snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
|
23
|
+
"snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
24
|
+
"snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
|
25
|
+
"snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
|
24
26
|
"snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
25
27
|
});
|
26
28
|
this._showPopUpGridConfig = false;
|
@@ -31,12 +33,14 @@ export class SnkSimpleCrud {
|
|
31
33
|
this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
32
34
|
this.dataState = undefined;
|
33
35
|
this.dataUnit = undefined;
|
36
|
+
this.entityName = undefined;
|
34
37
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
35
38
|
this.gridConfig = undefined;
|
36
39
|
this.formConfig = undefined;
|
37
40
|
this._formFields = [];
|
38
41
|
this.multipleSelection = undefined;
|
39
42
|
this.useCancelConfirm = true;
|
43
|
+
this.pageSize = 150;
|
40
44
|
this.resourceID = undefined;
|
41
45
|
this.taskbarManager = undefined;
|
42
46
|
this.messagesBuilder = undefined;
|
@@ -58,9 +62,9 @@ export class SnkSimpleCrud {
|
|
58
62
|
this.loadFormConfig(true);
|
59
63
|
this.loadGridConfig(true);
|
60
64
|
}
|
61
|
-
getButtons(selected,
|
65
|
+
getButtons(selected, extraButtons) {
|
62
66
|
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
63
|
-
.concat(
|
67
|
+
.concat(extraButtons));
|
64
68
|
}
|
65
69
|
addConfigButton(buttons) {
|
66
70
|
if (this.configName === undefined) {
|
@@ -100,6 +104,12 @@ export class SnkSimpleCrud {
|
|
100
104
|
}
|
101
105
|
evt.stopPropagation();
|
102
106
|
}
|
107
|
+
async onChangeEntityName(newValue) {
|
108
|
+
if (this.dataUnit)
|
109
|
+
return;
|
110
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
111
|
+
this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
|
112
|
+
}
|
103
113
|
onModeChange() {
|
104
114
|
if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
|
105
115
|
this.initInMemoryDataUnit();
|
@@ -212,6 +222,7 @@ export class SnkSimpleCrud {
|
|
212
222
|
}
|
213
223
|
async componentWillRender() {
|
214
224
|
this._resourceID = await this.application.getResourceID();
|
225
|
+
this.dataExporterProviderStore();
|
215
226
|
this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
|
216
227
|
if (this.configName === undefined) {
|
217
228
|
return;
|
@@ -236,13 +247,13 @@ export class SnkSimpleCrud {
|
|
236
247
|
this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
|
237
248
|
}
|
238
249
|
getTaskBarId() {
|
239
|
-
var _a, _b
|
250
|
+
var _a, _b;
|
240
251
|
if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
241
252
|
return "snkSimpleCrudTaskbar.finish_edition";
|
242
253
|
}
|
243
254
|
if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
|
244
255
|
!this.dataState.selectionInfo.isAllRecords() &&
|
245
|
-
|
256
|
+
this.dataState.selectionInfo.length > 0) {
|
246
257
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
|
247
258
|
}
|
248
259
|
return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
|
@@ -482,9 +493,23 @@ export class SnkSimpleCrud {
|
|
482
493
|
.then(() => {
|
483
494
|
this.setGridConfig(config);
|
484
495
|
this.closeGridConfig();
|
496
|
+
this.dataExporterProviderStore();
|
485
497
|
});
|
486
498
|
evt.stopPropagation();
|
487
499
|
}
|
500
|
+
async dataExporterProviderStore() {
|
501
|
+
if (this.dataUnit == undefined) {
|
502
|
+
return;
|
503
|
+
}
|
504
|
+
if (this._grid == undefined) {
|
505
|
+
return;
|
506
|
+
}
|
507
|
+
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
508
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
509
|
+
}
|
510
|
+
getDataExporterStoreKey() {
|
511
|
+
return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
|
512
|
+
}
|
488
513
|
setGridConfig(config) {
|
489
514
|
this.gridConfig = config;
|
490
515
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
@@ -500,6 +525,15 @@ export class SnkSimpleCrud {
|
|
500
525
|
closeFormConfig() {
|
501
526
|
this._showFormConfig = false;
|
502
527
|
}
|
528
|
+
getPageSize() {
|
529
|
+
if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
|
530
|
+
return 0;
|
531
|
+
}
|
532
|
+
if (this.pageSize == undefined) {
|
533
|
+
return 150;
|
534
|
+
}
|
535
|
+
return this.pageSize;
|
536
|
+
}
|
503
537
|
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
504
538
|
handleShowFormConfig() {
|
505
539
|
return this._showFormConfig && !this.formLegacyConfigName;
|
@@ -507,15 +541,23 @@ export class SnkSimpleCrud {
|
|
507
541
|
resolveResourceID() {
|
508
542
|
return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
|
509
543
|
}
|
544
|
+
getFormConfig() {
|
545
|
+
var _a, _b;
|
546
|
+
const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields);
|
547
|
+
if (!this.configName && !configFromManager) {
|
548
|
+
return this.formConfig;
|
549
|
+
}
|
550
|
+
return configFromManager;
|
551
|
+
}
|
510
552
|
/* istanbul ignore next */
|
511
553
|
render() {
|
512
|
-
var _a
|
554
|
+
var _a;
|
513
555
|
if (this.dataUnit == undefined) {
|
514
556
|
return;
|
515
557
|
}
|
516
|
-
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)
|
558
|
+
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), 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 }, 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)
|
517
559
|
? undefined
|
518
|
-
: 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:
|
560
|
+
: 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() }))));
|
519
561
|
}
|
520
562
|
static get is() { return "snk-simple-crud"; }
|
521
563
|
static get encapsulation() { return "scoped"; }
|
@@ -571,6 +613,23 @@ export class SnkSimpleCrud {
|
|
571
613
|
"text": ""
|
572
614
|
}
|
573
615
|
},
|
616
|
+
"entityName": {
|
617
|
+
"type": "string",
|
618
|
+
"mutable": false,
|
619
|
+
"complexType": {
|
620
|
+
"original": "string",
|
621
|
+
"resolved": "string",
|
622
|
+
"references": {}
|
623
|
+
},
|
624
|
+
"required": false,
|
625
|
+
"optional": false,
|
626
|
+
"docs": {
|
627
|
+
"tags": [],
|
628
|
+
"text": "Define o nome da entidade que o componente vai utilizar para fazer as opera\u00E7\u00F5es de CRUD"
|
629
|
+
},
|
630
|
+
"attribute": "entity-name",
|
631
|
+
"reflect": false
|
632
|
+
},
|
574
633
|
"mode": {
|
575
634
|
"type": "number",
|
576
635
|
"mutable": false,
|
@@ -669,6 +728,24 @@ export class SnkSimpleCrud {
|
|
669
728
|
"reflect": false,
|
670
729
|
"defaultValue": "true"
|
671
730
|
},
|
731
|
+
"pageSize": {
|
732
|
+
"type": "number",
|
733
|
+
"mutable": false,
|
734
|
+
"complexType": {
|
735
|
+
"original": "number",
|
736
|
+
"resolved": "number",
|
737
|
+
"references": {}
|
738
|
+
},
|
739
|
+
"required": false,
|
740
|
+
"optional": false,
|
741
|
+
"docs": {
|
742
|
+
"tags": [],
|
743
|
+
"text": "Determina quantas linhas s\u00E3o retornadas por p\u00E1gina."
|
744
|
+
},
|
745
|
+
"attribute": "page-size",
|
746
|
+
"reflect": false,
|
747
|
+
"defaultValue": "150"
|
748
|
+
},
|
672
749
|
"resourceID": {
|
673
750
|
"type": "string",
|
674
751
|
"mutable": false,
|
@@ -1128,6 +1205,9 @@ export class SnkSimpleCrud {
|
|
1128
1205
|
return [{
|
1129
1206
|
"propName": "resourceID",
|
1130
1207
|
"methodName": "handleResourceIDChanged"
|
1208
|
+
}, {
|
1209
|
+
"propName": "entityName",
|
1210
|
+
"methodName": "onChangeEntityName"
|
1131
1211
|
}, {
|
1132
1212
|
"propName": "mode",
|
1133
1213
|
"methodName": "onModeChange"
|
@@ -47,7 +47,7 @@ export const buildCustomButton = (def, className, dataElementId, action, isEnabl
|
|
47
47
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
48
48
|
}
|
49
49
|
};
|
50
|
-
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions,
|
50
|
+
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
|
51
51
|
var _a;
|
52
52
|
const title = getTitle(element);
|
53
53
|
switch (element) {
|
@@ -90,7 +90,7 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
|
|
90
90
|
case TaskbarElement.DIVIDER:
|
91
91
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
92
92
|
case TaskbarElement.DATA_EXPORTER:
|
93
|
-
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[
|
93
|
+
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
|
94
94
|
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
95
95
|
case TaskbarElement.ATTACH:
|
96
96
|
return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
|
@@ -156,8 +156,9 @@ export class SnkTaskbar {
|
|
156
156
|
className += "ez-padding-left--medium";
|
157
157
|
}
|
158
158
|
const taskbarElement = TaskbarElement[def.toString()];
|
159
|
+
const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
|
159
160
|
if (taskbarElement) {
|
160
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(),
|
161
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
|
161
162
|
}
|
162
163
|
else {
|
163
164
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
@@ -21,6 +21,9 @@ export default class DataUnitDataLoader {
|
|
21
21
|
});
|
22
22
|
});
|
23
23
|
}
|
24
|
+
static getCachedRecords(dataUnit) {
|
25
|
+
return PreloadManager.getCachedRecords(dataUnit);
|
26
|
+
}
|
24
27
|
static async loadFromServer(dataUnit, request, loadingInfo) {
|
25
28
|
try {
|
26
29
|
//Registramos a request com as informações de carga para determinarmos a última.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ObjectUtils } from "@sankhyalabs/core";
|
1
2
|
export class ArrayRepository {
|
2
3
|
constructor(equalsFunction) {
|
3
4
|
this._list = [];
|
@@ -77,4 +78,7 @@ export class ArrayRepository {
|
|
77
78
|
async count() {
|
78
79
|
return Promise.resolve(this._list.length);
|
79
80
|
}
|
81
|
+
getFromCache() {
|
82
|
+
return ObjectUtils.copy(this._list);
|
83
|
+
}
|
80
84
|
}
|
@@ -67,7 +67,11 @@ export default class PreloadManager {
|
|
67
67
|
static async loadData(dataUnit, request, loadFromServer) {
|
68
68
|
try {
|
69
69
|
if (PreloadManager.isCacheEnabled(dataUnit)) {
|
70
|
-
|
70
|
+
const useCache = [
|
71
|
+
"EZ_GRID_LOADING_SOURCE",
|
72
|
+
DataUnit.CHANGING_PAGE_LOADING_SOURCE,
|
73
|
+
DataUnit.ALL_RECORDS_SELECTION_SOURCE
|
74
|
+
].includes(request.source);
|
71
75
|
if (useCache) {
|
72
76
|
const isCacheEmpty = await PreloadManager.getRepository(dataUnit).isEmpty();
|
73
77
|
if (!isCacheEmpty) {
|
@@ -134,6 +138,9 @@ export default class PreloadManager {
|
|
134
138
|
.catch(reason => reject(reason));
|
135
139
|
});
|
136
140
|
}
|
141
|
+
static getCachedRecords(dataUnit) {
|
142
|
+
return PreloadManager.getRepository(dataUnit).getFromCache();
|
143
|
+
}
|
137
144
|
}
|
138
145
|
PreloadManager._repositories = new Map();
|
139
146
|
PreloadManager._loadingStatus = new Map();
|
@@ -111,6 +111,7 @@ export default class DataUnitFetcher {
|
|
111
111
|
dataUnit.saveLoader = (_dataUnit, changes) => this.saveData(dataUnit, changes);
|
112
112
|
dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
|
113
113
|
dataUnit.recordLoader = (dataUnit, recordIds) => this.loadRecord(dataUnit, recordIds);
|
114
|
+
dataUnit.allRecordsLoader = (dataUnit) => DataUnitDataLoader.getCachedRecords(dataUnit);
|
114
115
|
return dataUnit;
|
115
116
|
}
|
116
117
|
loadMetadata(dataUnit) {
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher.js';
|
1
|
+
import { R as ResourceFetcher, d as dist, D as DataFetcher, F as FormConfigFetcher } from './form-config-fetcher.js';
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
5
4
|
|
6
5
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
7
6
|
var t = {};
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import { D as DataFetcher } from './
|
1
|
+
import { D as DataFetcher } from './form-config-fetcher.js';
|
2
2
|
import { a as PreloadManager } from './dataunit-fetcher.js';
|
3
|
-
import { SortMode, ApplicationContext, UserInterface, DateUtils } from '@sankhyalabs/core';
|
4
|
-
import './
|
5
|
-
import './snk-actions-button2.js';
|
3
|
+
import { SortMode, ApplicationContext, UserInterface, DateUtils, DataType } from '@sankhyalabs/core';
|
4
|
+
import './ISave.js';
|
6
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
|
-
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
6
|
+
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
7
|
import './filter-item-type.enum.js';
|
9
|
-
import './form-config-fetcher.js';
|
10
8
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
11
9
|
import { h } from '@stencil/core/internal/client';
|
12
10
|
|
@@ -208,4 +206,51 @@ const openFieldSearch = async (moreOptions, field) => {
|
|
208
206
|
await moreOptions.showActions();
|
209
207
|
};
|
210
208
|
|
211
|
-
|
209
|
+
class CommonsExporter {
|
210
|
+
constructor(dataUnit, grid) {
|
211
|
+
this.dataUnit = dataUnit;
|
212
|
+
this.grid = grid;
|
213
|
+
}
|
214
|
+
async getColumnsMetadata() {
|
215
|
+
var _a;
|
216
|
+
const columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
|
217
|
+
return this.buildColumnsMetadata(columnsState);
|
218
|
+
}
|
219
|
+
buildColumnsMetadata(gridColumns) {
|
220
|
+
const columnsMetadata = [];
|
221
|
+
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
222
|
+
var _a, _b;
|
223
|
+
/**
|
224
|
+
* TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
|
225
|
+
*/
|
226
|
+
if (column.hidden && column.name !== "RECDESP") {
|
227
|
+
return;
|
228
|
+
}
|
229
|
+
const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
|
230
|
+
const columnData = {
|
231
|
+
label: column.label,
|
232
|
+
id: column.name,
|
233
|
+
width: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.width,
|
234
|
+
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
235
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
236
|
+
};
|
237
|
+
columnsMetadata.push(columnData);
|
238
|
+
if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
|
239
|
+
const mergedFrom = fieldData.properties.mergedFrom;
|
240
|
+
const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
|
241
|
+
const descriptionColumn = {
|
242
|
+
label: fieldData.properties.DESCRIPTIONENTITY,
|
243
|
+
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
244
|
+
width: 200,
|
245
|
+
type: DataType.TEXT,
|
246
|
+
userInterface: UserInterface$1.LONGTEXT,
|
247
|
+
descriptionFrom: fieldData.name
|
248
|
+
};
|
249
|
+
columnsMetadata.push(descriptionColumn);
|
250
|
+
}
|
251
|
+
});
|
252
|
+
return columnsMetadata || [];
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
export { CommonsExporter as C, SnkMultiSelectionListDataSource as S, TaskbarProcessor as T, CrudUtils as a, buildFieldSearch as b, openFieldSearch as o };
|
@@ -0,0 +1,42 @@
|
|
1
|
+
var PresentationMode;
|
2
|
+
(function (PresentationMode) {
|
3
|
+
PresentationMode["PRIMARY"] = "primary";
|
4
|
+
PresentationMode["SECONDARY"] = "secondary";
|
5
|
+
PresentationMode["SINGLE_TASKBAR"] = "singleTaskbar";
|
6
|
+
})(PresentationMode || (PresentationMode = {}));
|
7
|
+
var DataExporterOption;
|
8
|
+
(function (DataExporterOption) {
|
9
|
+
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
10
|
+
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
11
|
+
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
12
|
+
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
13
|
+
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
14
|
+
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
15
|
+
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
16
|
+
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
17
|
+
})(DataExporterOption || (DataExporterOption = {}));
|
18
|
+
var DataExporterFormat;
|
19
|
+
(function (DataExporterFormat) {
|
20
|
+
DataExporterFormat["PDF"] = "exportPDFToEmail";
|
21
|
+
DataExporterFormat["XLS"] = "exportXLSToEmail";
|
22
|
+
DataExporterFormat["XLSX"] = "exportXLSToEmail";
|
23
|
+
})(DataExporterFormat || (DataExporterFormat = {}));
|
24
|
+
var DataExporterType;
|
25
|
+
(function (DataExporterType) {
|
26
|
+
DataExporterType["EXPORT_TO_PDF"] = "PDF";
|
27
|
+
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
28
|
+
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
29
|
+
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
30
|
+
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
31
|
+
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
32
|
+
})(DataExporterType || (DataExporterType = {}));
|
33
|
+
|
34
|
+
var SaveErrorsEnum;
|
35
|
+
(function (SaveErrorsEnum) {
|
36
|
+
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
37
|
+
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
38
|
+
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
39
|
+
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
40
|
+
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
41
|
+
|
42
|
+
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, DataExporterFormat as a, DataExporterType as b };
|