@sankhyalabs/sankhyablocks 8.16.0-rc.2 → 8.16.0-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-ecc0ed20.js} +2 -2
- package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-29b65619.js} +39 -6
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
- package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
- package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-f1c92f79.js} +72 -16
- package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-bae64d0d.js} +6 -2
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-f89461c1.js} +46 -18
- package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-ca89181c.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
- package/dist/cjs/snk-application.cjs.entry.js +17 -7
- package/dist/cjs/snk-attach.cjs.entry.js +38 -29
- package/dist/cjs/snk-crud.cjs.entry.js +21 -8
- package/dist/cjs/snk-data-exporter.cjs.entry.js +9 -9
- package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-d8279f5f.js} +43 -22
- package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
- package/dist/cjs/snk-detail-view.cjs.entry.js +11 -11
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +40 -25
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +17 -5
- package/dist/cjs/snk-form.cjs.entry.js +7 -6
- package/dist/cjs/snk-grid.cjs.entry.js +66 -21
- package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-b9920385.js} +29 -13
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +56 -21
- package/dist/cjs/snk-taskbar.cjs.entry.js +61 -36
- package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
- package/dist/collection/components/snk-application/snk-application.js +41 -1
- package/dist/collection/components/snk-attach/snk-attach.js +25 -16
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
- package/dist/collection/components/snk-crud/snk-crud.js +103 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +72 -6
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +41 -20
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +77 -21
- package/dist/collection/components/snk-form/snk-form.js +2 -2
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +70 -14
- package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +100 -8
- package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +82 -10
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +103 -36
- package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
- package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
- package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
- package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
- package/dist/components/DataFetcher.js +22 -16
- package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
- package/dist/components/SnkFormConfigManager.js +70 -14
- package/dist/components/SnkMessageBuilder.js +6 -2
- package/dist/components/dataunit-fetcher.js +45 -15
- package/dist/components/form-config-fetcher.js +4 -1
- package/dist/components/snk-actions-button2.js +12 -9
- package/dist/components/snk-application2.js +12 -1
- package/dist/components/snk-attach2.js +34 -25
- package/dist/components/snk-crud.js +20 -3
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +44 -60
- package/dist/components/snk-detail-view2.js +29 -10
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +39 -22
- package/dist/components/snk-filter-binary-select.js +1 -1
- package/dist/components/snk-filter-checkbox-list.js +1 -1
- package/dist/components/snk-form-config2.js +16 -3
- package/dist/components/snk-form.js +2 -2
- package/dist/components/snk-grid2.js +60 -12
- package/dist/components/snk-personalized-filter-editor.js +1 -1
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-bar2.js +1 -1
- package/dist/components/snk-simple-crud2.js +49 -10
- package/dist/components/snk-taskbar2.js +63 -38
- package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-7b36d041.js} +2 -2
- package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-30caa626.js} +40 -8
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
- package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
- package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-139f09fa.js} +72 -16
- package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-6fff4a4c.js} +6 -2
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-c24c76c6.js} +46 -16
- package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-8edaa8cd.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +17 -14
- package/dist/esm/snk-application.entry.js +17 -7
- package/dist/esm/snk-attach.entry.js +38 -29
- package/dist/esm/snk-crud.entry.js +21 -8
- package/dist/esm/snk-data-exporter.entry.js +9 -9
- package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-d10910d9.js} +43 -22
- package/dist/esm/snk-data-unit.entry.js +5 -5
- package/dist/esm/snk-detail-view.entry.js +11 -11
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +40 -25
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +17 -5
- package/dist/esm/snk-form.entry.js +7 -6
- package/dist/esm/snk-grid.entry.js +61 -16
- package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-beb6baef.js} +29 -13
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +52 -17
- package/dist/esm/snk-taskbar.entry.js +62 -37
- package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-47db7e88.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-23736d75.js +1 -0
- package/dist/sankhyablocks/p-2923c1b5.js +1 -0
- package/dist/sankhyablocks/{p-871aa14e.entry.js → p-31e74634.entry.js} +1 -1
- package/dist/sankhyablocks/p-38b85e5a.entry.js +1 -0
- package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
- package/dist/sankhyablocks/p-43acd479.entry.js +11 -0
- package/dist/sankhyablocks/{p-52920496.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/p-50a3623b.entry.js +1 -0
- package/dist/sankhyablocks/p-520c7c38.entry.js +1 -0
- package/dist/sankhyablocks/p-52816250.entry.js +1 -0
- package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/p-62f5f14b.entry.js +1 -0
- package/dist/sankhyablocks/p-7ac7932c.js +60 -0
- package/dist/sankhyablocks/p-7dd49d15.js +1 -0
- package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
- package/dist/sankhyablocks/p-93592aae.js +1 -0
- package/dist/sankhyablocks/p-afbb070d.js +1 -0
- package/dist/sankhyablocks/p-bd1a1ca6.entry.js +1 -0
- package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
- package/dist/sankhyablocks/p-c5546f92.js +1 -0
- package/dist/sankhyablocks/p-c6db5eeb.entry.js +1 -0
- package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
- package/dist/sankhyablocks/p-d0a6fc0f.entry.js +1 -0
- package/dist/sankhyablocks/p-dcead955.entry.js +1 -0
- package/dist/sankhyablocks/p-eb9f0407.entry.js +1 -0
- package/dist/sankhyablocks/p-f3434fc4.js +1 -0
- package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-fbb1b675.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
- package/dist/types/components/snk-application/snk-application.d.ts +6 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +9 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +15 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +119 -0
- package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
- package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
- package/package.json +2 -2
- package/dist/sankhyablocks/p-17def7cd.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-2a408684.js +0 -1
- package/dist/sankhyablocks/p-3a212712.js +0 -1
- package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
- package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
- package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
- package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
- package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
- package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
- package/dist/sankhyablocks/p-7619bdb1.entry.js +0 -11
- package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
- package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
- package/dist/sankhyablocks/p-80042dc6.entry.js +0 -1
- package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
- package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
- package/dist/sankhyablocks/p-9863d682.js +0 -1
- package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
- package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
- package/dist/sankhyablocks/p-c2495304.js +0 -1
- package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
- package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
- package/dist/sankhyablocks/p-fe79f83a.js +0 -60
- package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
|
7
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
7
|
+
import { P as PreloadManager, D as DataUnitFetcher } from './dataunit-fetcher.js';
|
8
8
|
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
10
10
|
import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
|
@@ -776,6 +776,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
776
776
|
async isLoadedByPk() {
|
777
777
|
return Promise.resolve(this._isLoadedByPk);
|
778
778
|
}
|
779
|
+
/**
|
780
|
+
* Remove registro do cache do PreLoader do dataunit.
|
781
|
+
* Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
|
782
|
+
*/
|
783
|
+
async preloadMangerRemoveRecord(dataUnit, recordsIDs) {
|
784
|
+
const records = recordsIDs.map(id => {
|
785
|
+
return { "__record__id__": id };
|
786
|
+
});
|
787
|
+
PreloadManager.removeRecords(dataUnit, records);
|
788
|
+
}
|
779
789
|
async getAuthList(auth) {
|
780
790
|
return await (new MGEAuthorization()).parseFromJSON(auth);
|
781
791
|
}
|
@@ -1314,6 +1324,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1314
1324
|
"info": [64],
|
1315
1325
|
"loadTotals": [64],
|
1316
1326
|
"isLoadedByPk": [64],
|
1327
|
+
"preloadMangerRemoveRecord": [64],
|
1317
1328
|
"executeSearch": [64],
|
1318
1329
|
"executePreparedSearch": [64],
|
1319
1330
|
"isDebugMode": [64],
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataU
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher.js';
|
4
4
|
import './pesquisa-fetcher.js';
|
5
5
|
import { S as SaveErrorsEnum } from './ISave.js';
|
6
|
-
import { P as PreloadManager,
|
6
|
+
import { P as PreloadManager, b as buildLoadDataResponse, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher.js';
|
7
7
|
import './filter-item-type.enum.js';
|
8
8
|
import './form-config-fetcher.js';
|
9
9
|
import { V as VIEW_MODE } from './constants.js';
|
@@ -119,21 +119,23 @@ const SERVICE = {
|
|
119
119
|
download: "AnexoSistemaSP.baixar",
|
120
120
|
};
|
121
121
|
class AnexoSistemaFetcher {
|
122
|
-
constructor(entityName,
|
122
|
+
constructor(entityName, dataUnitName) {
|
123
123
|
var _a;
|
124
124
|
this.entityName = entityName;
|
125
|
-
this.registerKey = registerKey;
|
126
125
|
this.dataUnitName = dataUnitName;
|
127
126
|
this.validateFields = (fields) => {
|
128
127
|
if (!!fields.LINK && !!fields.NOMEARQUIVO)
|
129
128
|
throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
|
130
129
|
if (!fields.LINK && !fields.NOMEARQUIVO)
|
131
130
|
throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
|
132
|
-
if (!this.
|
131
|
+
if (!this._registerKey)
|
133
132
|
throw new Error('Register key can not be null');
|
134
133
|
};
|
135
134
|
this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
|
136
135
|
}
|
136
|
+
set registerKey(registerKey) {
|
137
|
+
this._registerKey = registerKey;
|
138
|
+
}
|
137
139
|
async save(change) {
|
138
140
|
var _a, _b;
|
139
141
|
let { updatingFields: fields } = change;
|
@@ -152,7 +154,7 @@ class AnexoSistemaFetcher {
|
|
152
154
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
153
155
|
link: fields.LINK,
|
154
156
|
nameEntity: this.entityName,
|
155
|
-
pkEntity: this.
|
157
|
+
pkEntity: this._registerKey,
|
156
158
|
typeAcess: fields.TIPOACESSO,
|
157
159
|
typeApres: fields.TIPOAPRES,
|
158
160
|
}
|
@@ -192,7 +194,7 @@ class AnexoSistemaFetcher {
|
|
192
194
|
nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
|
193
195
|
link: fields.LINK,
|
194
196
|
nameEntity: this.entityName,
|
195
|
-
pkEntity: this.
|
197
|
+
pkEntity: this._registerKey,
|
196
198
|
typeAcess: fields.TIPOACESSO,
|
197
199
|
typeApres: fields.TIPOAPRES,
|
198
200
|
}
|
@@ -464,9 +466,7 @@ class AttachFetcherDataUnitFactory {
|
|
464
466
|
});
|
465
467
|
this._records = records;
|
466
468
|
}
|
467
|
-
|
468
|
-
records = applySorting(records, dataUnit, request.sort);
|
469
|
-
return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
|
469
|
+
return buildLoadDataResponse(this._records, dataUnit, request);
|
470
470
|
}
|
471
471
|
saveLoader(changes, fetcher) {
|
472
472
|
return new Promise((resolve) => {
|
@@ -663,11 +663,20 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
663
663
|
this.loadAttachmentDataUnit();
|
664
664
|
}
|
665
665
|
if (oldRegisterKey !== newRegisterKey) {
|
666
|
+
if (this._currentFetcher instanceof AnexoSistemaFetcher) {
|
667
|
+
this._currentFetcher.registerKey = newRegisterKey;
|
668
|
+
}
|
666
669
|
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
|
667
670
|
}
|
668
671
|
}
|
672
|
+
getAnexoSistemaFetcherInstance() {
|
673
|
+
var _a;
|
674
|
+
const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
|
675
|
+
anexoSistemaFetcher.registerKey = this.registerKey;
|
676
|
+
return anexoSistemaFetcher;
|
677
|
+
}
|
669
678
|
async initAttach() {
|
670
|
-
var _a, _b, _c, _d, _e
|
679
|
+
var _a, _b, _c, _d, _e;
|
671
680
|
if (!this.fetcherType && !this.registerKey)
|
672
681
|
return;
|
673
682
|
if (!this.fetcherType) {
|
@@ -675,18 +684,18 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
675
684
|
}
|
676
685
|
this.returnToGridMode();
|
677
686
|
if (this.fetcherType === "AnexoSistema") {
|
678
|
-
this._currentFetcher =
|
679
|
-
(
|
680
|
-
await ((
|
687
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
688
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
689
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
681
690
|
return;
|
682
691
|
}
|
683
692
|
if (this.fetcherType === "Attach") {
|
684
|
-
const hasMoreOneItem = ((
|
693
|
+
const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
|
685
694
|
if (hasMoreOneItem)
|
686
695
|
return;
|
687
696
|
}
|
688
|
-
await ((
|
689
|
-
await ((
|
697
|
+
await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
|
698
|
+
await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
|
690
699
|
}
|
691
700
|
/**
|
692
701
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
@@ -745,11 +754,11 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
745
754
|
}
|
746
755
|
}
|
747
756
|
async loadAnexoSistema() {
|
748
|
-
var _a, _b
|
757
|
+
var _a, _b;
|
749
758
|
this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
|
750
|
-
this._currentFetcher =
|
759
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
751
760
|
if (!this._currentDataUnit.metadata) {
|
752
|
-
await ((
|
761
|
+
await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
|
753
762
|
this.crudConfig = Object.assign({}, anexoSistemaCrudConfig);
|
754
763
|
}
|
755
764
|
this.initDataUnitLoaders();
|
@@ -759,7 +768,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
759
768
|
this._currentDataUnit.addInterceptor({
|
760
769
|
interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
|
761
770
|
});
|
762
|
-
await ((
|
771
|
+
await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
|
763
772
|
this.disableEditFieldsNotInForm();
|
764
773
|
}
|
765
774
|
async loadAttach() {
|
@@ -785,16 +794,16 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
785
794
|
}
|
786
795
|
}
|
787
796
|
initDataUnitLoaders() {
|
788
|
-
var _a, _b
|
797
|
+
var _a, _b;
|
789
798
|
if (this.fetcherType === "AnexoSistema") {
|
790
|
-
this._currentFetcher =
|
799
|
+
this._currentFetcher = this.getAnexoSistemaFetcherInstance();
|
791
800
|
this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
|
792
|
-
(
|
801
|
+
(_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
|
793
802
|
}
|
794
803
|
if (this.fetcherType === "Attach") {
|
795
804
|
this._currentFetcher = new AttachFetcher();
|
796
805
|
this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
|
797
|
-
(
|
806
|
+
(_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
|
798
807
|
this.returnToGridMode();
|
799
808
|
await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
|
800
809
|
});
|
@@ -838,7 +847,7 @@ const SnkAttach = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
838
847
|
var _a, _b;
|
839
848
|
if (!this._currentDataUnit)
|
840
849
|
return null;
|
841
|
-
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
|
850
|
+
return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary ez-padding-bottom--medium" }, this.getMessage("snkAttach.description")))))))));
|
842
851
|
}
|
843
852
|
static get watchers() { return {
|
844
853
|
"registerKey": ["registerKeyWatcher"]
|
@@ -51,6 +51,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
51
|
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
52
52
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
53
53
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
54
|
+
this.viewModeChanged = createEvent(this, "viewModeChanged", 7);
|
54
55
|
this._keyDownHandler = async (event) => this.keyDownListener(event);
|
55
56
|
this._viewHistory = [];
|
56
57
|
this._customEditors = new Map();
|
@@ -79,7 +80,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
79
80
|
this.disablePersonalizedFilter = undefined;
|
80
81
|
this.autoLoad = undefined;
|
81
82
|
this.autoFocus = true;
|
83
|
+
this.enableGridInsert = false;
|
82
84
|
this.domainMessagesBuilder = undefined;
|
85
|
+
this.ignoreReadOnlyFormFields = undefined;
|
86
|
+
this.enableLockManger = false;
|
87
|
+
this.setCustomFormTitle = undefined;
|
83
88
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
84
89
|
}
|
85
90
|
/**
|
@@ -188,6 +193,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
188
193
|
else if (viewMode === VIEW_MODE.FORM) {
|
189
194
|
this._guidesViewer.setFocus();
|
190
195
|
}
|
196
|
+
this.viewModeChanged.emit(viewMode);
|
191
197
|
}
|
192
198
|
openConfig(viewMode) {
|
193
199
|
this._snkConfigurator.close();
|
@@ -203,6 +209,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
203
209
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
204
210
|
}
|
205
211
|
insertionModeHandler() {
|
212
|
+
if (this.enableGridInsert)
|
213
|
+
return;
|
206
214
|
this.gridToForm();
|
207
215
|
}
|
208
216
|
cancelHandler() {
|
@@ -316,11 +324,16 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
316
324
|
if (!isDocumentBody)
|
317
325
|
element.focus();
|
318
326
|
}
|
327
|
+
async function handleAddRecord() {
|
328
|
+
if (!dataUnit.hasNewRecord()) {
|
329
|
+
dataUnit.addRecord();
|
330
|
+
}
|
331
|
+
}
|
319
332
|
keyboardManager
|
320
333
|
.bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
|
321
334
|
.bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
322
335
|
.bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
323
|
-
.bind("F8",
|
336
|
+
.bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
|
324
337
|
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
325
338
|
.bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
326
339
|
.bind("ctrl + .", () => {
|
@@ -416,8 +429,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
416
429
|
if (this._resourceID == undefined) {
|
417
430
|
return;
|
418
431
|
}
|
419
|
-
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
420
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
432
|
+
this._snkDataUnit.ignoreSaveMessage = (this._currentViewMode === VIEW_MODE.GRID && !this.enableGridInsert);
|
433
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableLockManger: this.enableLockManger }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName, enableGridInsert: this.enableGridInsert, getCustomTitle: this.setCustomFormTitle, ignoreReadOnlyFormFields: this.ignoreReadOnlyFormFields }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
421
434
|
}
|
422
435
|
get _element() { return this; }
|
423
436
|
static get watchers() { return {
|
@@ -443,7 +456,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
443
456
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
444
457
|
"autoLoad": [4, "auto-load"],
|
445
458
|
"autoFocus": [4, "auto-focus"],
|
459
|
+
"enableGridInsert": [4, "enable-grid-insert"],
|
446
460
|
"domainMessagesBuilder": [1, "domain-messages-builder"],
|
461
|
+
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
462
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
463
|
+
"setCustomFormTitle": [16],
|
447
464
|
"_dataUnit": [32],
|
448
465
|
"_dataState": [32],
|
449
466
|
"attachmentRegisterKey": [32],
|
@@ -124,7 +124,7 @@ class ItemBuilder {
|
|
124
124
|
getExportToXLS(groupName) {
|
125
125
|
return {
|
126
126
|
id: DataExporterOption.EXPORT_TO_XLS,
|
127
|
-
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.
|
127
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`,
|
128
128
|
group: groupName
|
129
129
|
};
|
130
130
|
}
|
@@ -167,7 +167,7 @@ class ItemBuilder {
|
|
167
167
|
getExportPageToXLS() {
|
168
168
|
return {
|
169
169
|
id: DataExporterOption.EXPORT_PAGE_TO_XLS,
|
170
|
-
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.
|
170
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xls)`
|
171
171
|
};
|
172
172
|
}
|
173
173
|
/**
|
@@ -1,47 +1,10 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import {
|
2
|
+
import { Action, ObjectUtils, DataUnitAction, StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
5
|
-
import { g as getRecordValue,
|
5
|
+
import { g as getRecordValue, a as DatasetStrategy } from './dataunit-fetcher.js';
|
6
6
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
7
|
-
|
8
|
-
const getSelectedIDs = (dataUnit) => {
|
9
|
-
const selectionInfo = dataUnit.getSelectionInfo();
|
10
|
-
if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
|
11
|
-
return [];
|
12
|
-
}
|
13
|
-
const selectedRecordsIDsInfo = [];
|
14
|
-
const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
|
15
|
-
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
16
|
-
selectedRecords.forEach(recordId => {
|
17
|
-
if (!dataUnit.isNewRecord(recordId)) {
|
18
|
-
/*
|
19
|
-
Esse if foi necessário para tratar corretamente o ID
|
20
|
-
do record quando está sendo utilizado no modo standAlone
|
21
|
-
isso não faz a exportação da grid funcionar no modo standAlone
|
22
|
-
mas deixa de causar erro nas oprações de CRUD.
|
23
|
-
*/
|
24
|
-
if (!JSUtils.isBase64(recordId)) {
|
25
|
-
selectedRecordsIDsInfo.push({
|
26
|
-
name: "__record__id__",
|
27
|
-
type: DataType.TEXT,
|
28
|
-
value: recordId
|
29
|
-
});
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
const revertBase64ToObject = JSON.parse(window.atob(recordId));
|
33
|
-
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
34
|
-
const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
|
35
|
-
if (metadataField == undefined) {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
39
|
-
});
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
return selectedRecordsIDsInfo;
|
44
|
-
};
|
7
|
+
import { g as getSelectedRecordsIDsInfo } from './GetSelectedRecordsIDsInfo.js';
|
45
8
|
|
46
9
|
const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
47
10
|
constructor() {
|
@@ -61,7 +24,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
61
24
|
this._rowMetadataCache = new Map();
|
62
25
|
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
63
26
|
this._dataUnitObserver = async (action) => {
|
64
|
-
const duState = this.buildDataState(action.type);
|
27
|
+
const duState = await this.buildDataState(action.type);
|
65
28
|
this.dataState = duState;
|
66
29
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
67
30
|
switch (action.type) {
|
@@ -153,7 +116,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
153
116
|
* @returns Retorna a lista de IDs dos registros selecionados.
|
154
117
|
*/
|
155
118
|
async getSelectedRecordsIDsInfo() {
|
156
|
-
return
|
119
|
+
return getSelectedRecordsIDsInfo(this.dataUnit);
|
157
120
|
}
|
158
121
|
/**
|
159
122
|
* Retorna os campos que possuem a propriedade "rmp" (Row Metadata Provider).
|
@@ -173,14 +136,22 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
173
136
|
async getRowMetadata(record) {
|
174
137
|
return this.doGetRowMetadata(record);
|
175
138
|
}
|
176
|
-
doGetRowMetadata(record) {
|
139
|
+
async doGetRowMetadata(record) {
|
177
140
|
const selectedRecord = this.dataUnit.getSelectedRecord();
|
178
141
|
if (!record && !selectedRecord) {
|
179
142
|
return;
|
180
143
|
}
|
181
144
|
const currentRecord = record || selectedRecord;
|
182
145
|
const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
|
183
|
-
|
146
|
+
let rowMetadata = this._metadataByRow.get(recordId);
|
147
|
+
/*
|
148
|
+
Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
|
149
|
+
muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
|
150
|
+
corretos nao confiando apenas no _metadataByRow
|
151
|
+
*/
|
152
|
+
if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
|
153
|
+
rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
|
154
|
+
}
|
184
155
|
if (!rowMetadata) {
|
185
156
|
return;
|
186
157
|
}
|
@@ -374,7 +345,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
374
345
|
case Action.RECORDS_COPIED:
|
375
346
|
return this.interceptRecordsCopied(action);
|
376
347
|
case Action.DATA_CHANGED:
|
377
|
-
await this.handleLoadRowMetadata(action);
|
348
|
+
await this.handleLoadRowMetadata(action.payload);
|
378
349
|
return await this.interceptDataChange(action);
|
379
350
|
case Action.CHANGING_DATA:
|
380
351
|
return await this.interceptDataChange(action);
|
@@ -394,8 +365,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
394
365
|
return action;
|
395
366
|
}
|
396
367
|
}
|
397
|
-
async handleLoadRowMetadata(
|
398
|
-
|
368
|
+
async handleLoadRowMetadata(record) {
|
369
|
+
if (!record)
|
370
|
+
return;
|
399
371
|
const keysPayload = Object.keys(record);
|
400
372
|
const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
|
401
373
|
if (rmpField) {
|
@@ -474,7 +446,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
474
446
|
isAllowed(flag) {
|
475
447
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
476
448
|
}
|
477
|
-
buildDataState(actionType) {
|
449
|
+
async buildDataState(actionType) {
|
478
450
|
var _a;
|
479
451
|
const selectionInfo = this.dataUnit.getSelectionInfo();
|
480
452
|
const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
|
@@ -482,7 +454,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
482
454
|
let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
|
483
455
|
const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
|
484
456
|
if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
|
485
|
-
rowMetadata = this.doGetRowMetadata(selectedRecord);
|
457
|
+
rowMetadata = await this.doGetRowMetadata(selectedRecord);
|
486
458
|
}
|
487
459
|
else if (rowMetadata) {
|
488
460
|
rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
|
@@ -504,17 +476,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
504
476
|
});
|
505
477
|
}
|
506
478
|
async handleDataSaved(action) {
|
507
|
-
|
479
|
+
var _a, _b, _c;
|
480
|
+
const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
|
508
481
|
if (newRowMetadata) {
|
509
482
|
newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
|
510
483
|
}
|
511
484
|
const recordId = action.payload.records[0].__record__id__;
|
512
485
|
this._metadataByRow.set(recordId, newRowMetadata);
|
513
|
-
this.dataState = this.buildDataState();
|
514
|
-
|
486
|
+
this.dataState = await this.buildDataState();
|
487
|
+
let saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
488
|
+
if (saveOperation == 'copy')
|
489
|
+
saveOperation = OperationMap.CLONE;
|
490
|
+
if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
|
515
491
|
return;
|
516
492
|
}
|
517
|
-
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
518
493
|
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
519
494
|
if (msg != undefined) {
|
520
495
|
this.showSuccessMessage(msg);
|
@@ -583,21 +558,30 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
583
558
|
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
584
559
|
}
|
585
560
|
}
|
561
|
+
updateMetadataWithRMP() {
|
562
|
+
this.fillFieldsWithRmp(this.dataUnit.metadata);
|
563
|
+
this.fillFieldsWithRmPrecision(this.dataUnit.metadata);
|
564
|
+
const dataUnitUpdatedMetadata = this.handleDULinksOnMetadataLoaded(this.dataUnit.metadata);
|
565
|
+
this.dataUnit.metadata = dataUnitUpdatedMetadata;
|
566
|
+
}
|
586
567
|
async loadDataUnit() {
|
587
|
-
var _a;
|
568
|
+
var _a, _b;
|
588
569
|
if (this.dataUnit == null && this._application && this.entityName) {
|
589
570
|
this.dataUnit = await this.getDataUnitParentOrChild();
|
590
571
|
}
|
591
572
|
if (this.dataUnit) {
|
592
573
|
this.dataUnit.pageSize = this.pageSize;
|
593
574
|
this.dataUnit.unsubscribe(this._dataUnitObserver);
|
594
|
-
this.dataUnit.addInterceptor(this);
|
595
575
|
this.dataUnit.subscribe(this._dataUnitObserver);
|
596
|
-
|
597
|
-
|
598
|
-
|
576
|
+
if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) {
|
577
|
+
this.updateMetadataWithRMP();
|
578
|
+
}
|
579
|
+
this.dataUnit.addInterceptor(this);
|
580
|
+
if ((_b = this.dataUnit.records) === null || _b === void 0 ? void 0 : _b.length) {
|
581
|
+
const { records } = this.getMetadataByRow(this.dataUnit);
|
582
|
+
this.dataUnit.records = records;
|
599
583
|
}
|
600
|
-
this.dataState = this.buildDataState();
|
584
|
+
this.dataState = await this.buildDataState();
|
601
585
|
let resolver;
|
602
586
|
while (resolver = this._onDataUnitResolve.pop()) {
|
603
587
|
resolver(this.dataUnit);
|
@@ -755,4 +739,4 @@ function defineCustomElement() {
|
|
755
739
|
} });
|
756
740
|
}
|
757
741
|
|
758
|
-
export { SnkDataUnit as S, defineCustomElement as d
|
742
|
+
export { SnkDataUnit as S, defineCustomElement as d };
|