@sankhyalabs/sankhyablocks 8.15.0-dev.1 → 8.15.0-dev.11
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-0d507a8f.js → ConfigStorage-302bbbd4.js} +25 -15
- package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
- package/dist/cjs/{SnkFormConfigManager-467907f6.js → SnkFormConfigManager-71c4768e.js} +1 -1
- package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
- package/dist/cjs/{index-0e663819.js → index-0922807b.js} +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-bdaf9482.js → pesquisa-fetcher-7a08d110.js} +205 -12
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_2.cjs.entry.js +21 -5
- package/dist/cjs/snk-application.cjs.entry.js +65 -6
- package/dist/cjs/snk-attach.cjs.entry.js +395 -57
- package/dist/cjs/snk-crud.cjs.entry.js +5 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
- package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -9
- package/dist/cjs/snk-filter-bar.cjs.entry.js +33 -5
- package/dist/cjs/snk-filter-item.cjs.entry.js +47 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -2
- package/dist/cjs/snk-filter-modal.cjs.entry.js +14 -0
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +41 -18
- package/dist/cjs/{snk-guides-viewer-9342bca1.js → snk-guides-viewer-546509df.js} +6 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +6 -7
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-b8c428a9.js → taskbar-elements-01b85b99.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-application/snk-application.js +68 -5
- package/dist/collection/components/snk-attach/snk-attach.js +194 -38
- package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
- package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
- package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
- package/dist/collection/components/snk-attach/structure/index.js +6 -3
- package/dist/collection/components/snk-crud/snk-crud.js +2 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +2 -2
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +47 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +65 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +0 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +62 -3
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-grid/snk-grid.js +39 -16
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +1 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +24 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -1
- package/dist/collection/lib/@types/index.js +1 -0
- package/dist/collection/lib/configs/ConfigStorage.js +24 -14
- package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +16 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +28 -11
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +1 -1
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
- package/dist/components/ConfigStorage.js +25 -15
- package/dist/components/SnkMessageBuilder.js +13 -0
- package/dist/components/dataunit-fetcher.js +44 -13
- package/dist/components/index2.js +1 -0
- package/dist/components/snk-actions-button2.js +1 -0
- package/dist/components/snk-application2.js +62 -2
- package/dist/components/snk-attach2.js +400 -56
- package/dist/components/snk-crud.js +1 -1
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-detail-view2.js +1 -1
- package/dist/components/snk-filter-bar2.js +34 -5
- package/dist/components/snk-filter-item2.js +47 -1
- package/dist/components/snk-filter-modal-item2.js +0 -1
- package/dist/components/snk-filter-modal.js +18 -2
- package/dist/components/snk-grid2.js +38 -15
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/taskbar-actions-button2.js +19 -2
- package/dist/esm/{ConfigStorage-379a9cba.js → ConfigStorage-4151acc8.js} +25 -15
- package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
- package/dist/esm/{SnkFormConfigManager-587e9030.js → SnkFormConfigManager-5c7d3771.js} +1 -1
- package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
- package/dist/esm/{index-1564817d.js → index-0ece87a6.js} +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-cc1650eb.js → pesquisa-fetcher-d6ff9386.js} +206 -14
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_2.entry.js +21 -5
- package/dist/esm/snk-application.entry.js +65 -6
- package/dist/esm/snk-attach.entry.js +396 -58
- package/dist/esm/snk-crud.entry.js +5 -6
- package/dist/esm/snk-data-exporter.entry.js +4 -4
- package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +8 -9
- package/dist/esm/snk-filter-bar.entry.js +33 -5
- package/dist/esm/snk-filter-item.entry.js +47 -1
- package/dist/esm/snk-filter-modal-item.entry.js +1 -2
- package/dist/esm/snk-filter-modal.entry.js +14 -0
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/snk-grid-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +41 -18
- package/dist/esm/{snk-guides-viewer-9ce9588c.js → snk-guides-viewer-4e56a2e0.js} +6 -7
- package/dist/esm/snk-guides-viewer.entry.js +7 -8
- package/dist/esm/snk-personalized-filter.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +4 -5
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-26c981af.js → taskbar-elements-d4d0b424.js} +1 -1
- package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
- package/dist/sankhyablocks/{p-729f5f5b.entry.js → p-1d75d9f9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
- package/dist/sankhyablocks/p-32460e98.entry.js +11 -0
- package/dist/sankhyablocks/p-374d03f6.js +1 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/{p-35fe6e61.entry.js → p-40915359.entry.js} +1 -1
- package/dist/sankhyablocks/p-42af1bbf.js +65 -0
- package/dist/sankhyablocks/{p-2028633c.js → p-573a07c5.js} +1 -1
- package/dist/sankhyablocks/{p-953346b9.entry.js → p-69efa80d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6977a26c.entry.js → p-71439fd9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aaa1438e.entry.js → p-761ed32f.entry.js} +1 -1
- package/dist/sankhyablocks/p-7d8d7fe9.entry.js +1 -0
- package/dist/sankhyablocks/p-7f3c7b09.entry.js +1 -0
- package/dist/sankhyablocks/p-8c74258e.entry.js +1 -0
- package/dist/sankhyablocks/p-8f0488b8.entry.js +1 -0
- package/dist/sankhyablocks/p-9ebcfeb6.entry.js +1 -0
- package/dist/sankhyablocks/p-a9e5b094.entry.js +1 -0
- package/dist/sankhyablocks/p-aa95fb2c.js +56 -0
- package/dist/sankhyablocks/p-b05ab13d.entry.js +1 -0
- package/dist/sankhyablocks/p-c2137023.entry.js +1 -0
- package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
- package/dist/sankhyablocks/p-d82f6eda.entry.js +1 -0
- package/dist/sankhyablocks/p-dcb6aad1.entry.js +1 -0
- package/dist/sankhyablocks/p-e0fd9555.entry.js +1 -0
- package/dist/sankhyablocks/p-e8812d8a.js +1 -0
- package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +5 -2
- package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
- package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +28 -6
- package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
- package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
- package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +14 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +11 -0
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +5 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +2 -0
- package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +1 -0
- package/dist/types/components.d.ts +70 -13
- package/dist/types/lib/@types/index.d.ts +2 -1
- package/dist/types/lib/configs/ConfigStorage.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +8 -6
- package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
- package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
- package/dist/sankhyablocks/p-145c4434.js +0 -1
- package/dist/sankhyablocks/p-17dda7a2.entry.js +0 -1
- package/dist/sankhyablocks/p-19f51c6b.entry.js +0 -11
- package/dist/sankhyablocks/p-311c6173.entry.js +0 -1
- package/dist/sankhyablocks/p-4396d1a6.js +0 -56
- package/dist/sankhyablocks/p-44e894af.entry.js +0 -1
- package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
- package/dist/sankhyablocks/p-4b0ea83f.entry.js +0 -1
- package/dist/sankhyablocks/p-5534e08c.js +0 -1
- package/dist/sankhyablocks/p-78777ae0.entry.js +0 -1
- package/dist/sankhyablocks/p-9c3229fc.entry.js +0 -1
- package/dist/sankhyablocks/p-a037f5b4.entry.js +0 -1
- package/dist/sankhyablocks/p-a702a1a2.js +0 -60
- package/dist/sankhyablocks/p-c259545b.entry.js +0 -1
- package/dist/sankhyablocks/p-d1677df0.entry.js +0 -1
- package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
- package/dist/sankhyablocks/p-dd6a8377.js +0 -1
- package/dist/sankhyablocks/p-e138e7d4.entry.js +0 -1
- package/dist/sankhyablocks/p-e1b29d4c.entry.js +0 -1
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
- /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
import { Action, ApplicationContext, StringUtils } from "@sankhyalabs/core";
|
2
|
+
import { SaveErrorsEnum } from "../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces";
|
3
|
+
import { AutorizationType } from "../../../../../lib/http/data-fetcher/fetchers/auth-fetcher";
|
4
|
+
import { attachFetcherMetadataBuilder } from "../../builder/attach-crud-config.builder";
|
5
|
+
import { VIEW_MODE } from "../../../../../lib/utils/constants";
|
6
|
+
const SERVICE_LOAD = "Attach.load";
|
7
|
+
export class AttachFetcherDataUnitFactory {
|
8
|
+
constructor(getMessage) {
|
9
|
+
this.getMessage = getMessage;
|
10
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
11
|
+
}
|
12
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
13
|
+
dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
|
14
|
+
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
15
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
16
|
+
if (recordIds.length)
|
17
|
+
onSuccess();
|
18
|
+
return recordIds;
|
19
|
+
});
|
20
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
21
|
+
if (recordIds.length)
|
22
|
+
onSuccess();
|
23
|
+
return recordIds;
|
24
|
+
});
|
25
|
+
}
|
26
|
+
metadataLoader(_) {
|
27
|
+
return Promise.resolve(attachFetcherMetadataBuilder);
|
28
|
+
}
|
29
|
+
async dataLoader(_, request) {
|
30
|
+
if (!request.source) {
|
31
|
+
return Promise.resolve({ records: [] });
|
32
|
+
}
|
33
|
+
const criteria = {
|
34
|
+
criteria: {
|
35
|
+
codata: request.source,
|
36
|
+
tipoAnexo: "N"
|
37
|
+
}
|
38
|
+
};
|
39
|
+
const applicationDataFetcher = await this._application.getDataFetcher();
|
40
|
+
const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
|
41
|
+
const records = [];
|
42
|
+
anexo.forEach((param) => {
|
43
|
+
records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
|
44
|
+
name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
|
45
|
+
}] }, param));
|
46
|
+
});
|
47
|
+
return Promise.resolve({ records });
|
48
|
+
}
|
49
|
+
saveLoader(changes, fetcher) {
|
50
|
+
return new Promise((resolve) => {
|
51
|
+
const change = Array.isArray(changes) ? changes[0] : {};
|
52
|
+
fetcher.save(change)
|
53
|
+
.then(resolve)
|
54
|
+
.catch((error) => {
|
55
|
+
if (error.message === SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
|
56
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
|
57
|
+
return resolve([]);
|
58
|
+
}
|
59
|
+
if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
|
60
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
|
61
|
+
return resolve([]);
|
62
|
+
}
|
63
|
+
if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
|
64
|
+
this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
|
65
|
+
return resolve([]);
|
66
|
+
}
|
67
|
+
if (error.message) {
|
68
|
+
this._application.error((error.title || error.name), error.message);
|
69
|
+
return resolve([]);
|
70
|
+
}
|
71
|
+
resolve([]);
|
72
|
+
});
|
73
|
+
});
|
74
|
+
}
|
75
|
+
removeLoader(dataUnit, ids, fetcher) {
|
76
|
+
return new Promise((resolve) => {
|
77
|
+
dataUnit.getSelectionInfo().records.forEach(async (record) => {
|
78
|
+
this._application.hasAccess(AutorizationType.REMOVE)
|
79
|
+
.then(async (hasAccess) => {
|
80
|
+
if (hasAccess) {
|
81
|
+
await fetcher.delete(record);
|
82
|
+
resolve(ids);
|
83
|
+
}
|
84
|
+
});
|
85
|
+
});
|
86
|
+
});
|
87
|
+
}
|
88
|
+
getFilters() {
|
89
|
+
throw new Error('Method not implemented.');
|
90
|
+
}
|
91
|
+
getInterceptions(dataUnit, action, crudRef) {
|
92
|
+
return new Promise((resolve) => {
|
93
|
+
if (action.type === Action.EDITION_CANCELED) {
|
94
|
+
if (!dataUnit.isDirty())
|
95
|
+
return resolve(action);
|
96
|
+
return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
|
97
|
+
if (cancellationConfirmed) {
|
98
|
+
crudRef.goToView(VIEW_MODE.GRID);
|
99
|
+
return resolve(action);
|
100
|
+
}
|
101
|
+
return resolve(undefined);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
if (action.type === Action.DATA_SAVED) {
|
105
|
+
dataUnit.loadData();
|
106
|
+
return resolve(action);
|
107
|
+
}
|
108
|
+
resolve(action);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
}
|
@@ -1,3 +1,6 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './
|
3
|
-
export * from './
|
1
|
+
export * from './fetcher/facade/fetcher.facade';
|
2
|
+
export * from './fetcher/factory/anexo-sistema-data-unit.factory';
|
3
|
+
export * from './fetcher/factory/attach-fetcher-data-unit.factory';
|
4
|
+
export * from './builder/taskbar-builder';
|
5
|
+
export * from './builder/anexo-sistema-crud-config.builder';
|
6
|
+
export * from './builder/attach-crud-config.builder';
|
@@ -278,7 +278,7 @@ export class SnkCrud {
|
|
278
278
|
return;
|
279
279
|
}
|
280
280
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
281
|
-
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, "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, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, 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, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, 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" }))));
|
281
|
+
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, "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 }, 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 }, 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" }))));
|
282
282
|
}
|
283
283
|
static get is() { return "snk-crud"; }
|
284
284
|
static get encapsulation() { return "scoped"; }
|
@@ -459,7 +459,7 @@ export class SnkCrud {
|
|
459
459
|
"mutable": false,
|
460
460
|
"complexType": {
|
461
461
|
"original": "PresentationMode",
|
462
|
-
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY",
|
462
|
+
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY | PresentationMode.SINGLE_TASKBAR",
|
463
463
|
"references": {
|
464
464
|
"PresentationMode": {
|
465
465
|
"location": "import",
|
@@ -134,7 +134,7 @@ export class SnkGuidesViewer {
|
|
134
134
|
});
|
135
135
|
this._guides = this._guides.map(guide => {
|
136
136
|
if (guide.id === guideItem.id) {
|
137
|
-
return Object.assign(Object.assign({}, guide), guideItem);
|
137
|
+
return Object.assign(Object.assign(Object.assign({}, guide), guideItem), (guideItem.children !== undefined ? {} : { children: undefined }));
|
138
138
|
}
|
139
139
|
return guide;
|
140
140
|
});
|
@@ -690,7 +690,7 @@ export class SnkGuidesViewer {
|
|
690
690
|
"mutable": false,
|
691
691
|
"complexType": {
|
692
692
|
"original": "PresentationMode",
|
693
|
-
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY",
|
693
|
+
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY | PresentationMode.SINGLE_TASKBAR",
|
694
694
|
"references": {
|
695
695
|
"PresentationMode": {
|
696
696
|
"location": "import",
|
@@ -239,7 +239,7 @@ export class SnkDataExporter {
|
|
239
239
|
pkObject[`PK_${name}`] = { type: this.parseDataType(type), value };
|
240
240
|
pkObject['pks'] = [];
|
241
241
|
}
|
242
|
-
const dataFields = { nome: name, tipo: type, valor: value };
|
242
|
+
const dataFields = { nome: name, tipo: this.parseDataType(type), valor: value };
|
243
243
|
fields['fields'].push(dataFields);
|
244
244
|
pkObject['pks'].push(fields);
|
245
245
|
});
|
@@ -284,9 +284,14 @@ export class SnkFilterItem {
|
|
284
284
|
}
|
285
285
|
return this.hasActiveValue(this.config);
|
286
286
|
}
|
287
|
+
onEzClick() {
|
288
|
+
console.log("onEzClick");
|
289
|
+
}
|
287
290
|
render() {
|
288
291
|
const leftIcon = this.getLeftIconName();
|
289
|
-
return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("
|
292
|
+
return (h(Host, null, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("ez-split-button", { label: "Split Button", class: "ez-button--primary", mode: "label-icon", iconName: "acao", size: "small", onEzClick: this.onEzClick,
|
293
|
+
//onclick={this.onEzClick}
|
294
|
+
items: items }), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
|
290
295
|
}
|
291
296
|
static get is() { return "snk-filter-item"; }
|
292
297
|
static get properties() {
|
@@ -437,3 +442,44 @@ export class SnkFilterItem {
|
|
437
442
|
}];
|
438
443
|
}
|
439
444
|
}
|
445
|
+
const items = [
|
446
|
+
{
|
447
|
+
id: "1",
|
448
|
+
label: "Emitir NFe",
|
449
|
+
type: "item"
|
450
|
+
},
|
451
|
+
{
|
452
|
+
id: "2",
|
453
|
+
label: "Cancelar NFe",
|
454
|
+
type: "item"
|
455
|
+
},
|
456
|
+
{
|
457
|
+
id: "3",
|
458
|
+
label: "Exportar NFe",
|
459
|
+
type: "item",
|
460
|
+
children: [
|
461
|
+
{
|
462
|
+
id: "4",
|
463
|
+
label: "Danfe PDF",
|
464
|
+
type: "item",
|
465
|
+
children: [
|
466
|
+
{
|
467
|
+
id: "6",
|
468
|
+
label: "Modo retrato",
|
469
|
+
type: "item"
|
470
|
+
},
|
471
|
+
{
|
472
|
+
id: "7",
|
473
|
+
label: "Modo paisagem",
|
474
|
+
type: "item"
|
475
|
+
}
|
476
|
+
]
|
477
|
+
},
|
478
|
+
{
|
479
|
+
id: "5",
|
480
|
+
label: "XML",
|
481
|
+
type: "item"
|
482
|
+
}
|
483
|
+
]
|
484
|
+
}
|
485
|
+
];
|
@@ -15,6 +15,14 @@ export class SnkFilterModal {
|
|
15
15
|
this.closeModal = undefined;
|
16
16
|
this.addPersonalizedFilter = undefined;
|
17
17
|
this.editPersonalizedFilter = undefined;
|
18
|
+
this.deletePersonalizedFilter = undefined;
|
19
|
+
this.filtersToDelete = [];
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Emitido quando um filtro personalizado é deletado.
|
23
|
+
*/
|
24
|
+
deletePersonalizedFilterListener(event) {
|
25
|
+
this.filtersToDelete.push(event.detail);
|
18
26
|
}
|
19
27
|
getCustomMessage(key, params) {
|
20
28
|
var _a;
|
@@ -82,6 +90,12 @@ export class SnkFilterModal {
|
|
82
90
|
if (this.isValidCustomFilter(filterPersonalized)) {
|
83
91
|
this.applyFilters(this.filters);
|
84
92
|
}
|
93
|
+
if (this.filtersToDelete.length > 0) {
|
94
|
+
this.filtersToDelete.forEach(filter => {
|
95
|
+
this.deletePersonalizedFilter(filter, this.configName);
|
96
|
+
});
|
97
|
+
this.filtersToDelete = [];
|
98
|
+
}
|
85
99
|
}
|
86
100
|
isValidCustomFilter(filterPersonalized) {
|
87
101
|
const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
@@ -354,9 +368,59 @@ export class SnkFilterModal {
|
|
354
368
|
"optional": false,
|
355
369
|
"docs": {
|
356
370
|
"tags": [],
|
357
|
-
"text": "A\u00E7\u00E3o executada ao
|
371
|
+
"text": "A\u00E7\u00E3o executada ao editar um filtro personalizado"
|
372
|
+
}
|
373
|
+
},
|
374
|
+
"deletePersonalizedFilter": {
|
375
|
+
"type": "unknown",
|
376
|
+
"mutable": false,
|
377
|
+
"complexType": {
|
378
|
+
"original": "(filter: IPersonalizedFilter, configName: string) => void",
|
379
|
+
"resolved": "(filter: IPersonalizedFilter, configName: string) => void",
|
380
|
+
"references": {
|
381
|
+
"IPersonalizedFilter": {
|
382
|
+
"location": "import",
|
383
|
+
"path": "../../snk-personalized-filter/interfaces/IPersonalizedFilter"
|
384
|
+
}
|
385
|
+
}
|
386
|
+
},
|
387
|
+
"required": false,
|
388
|
+
"optional": false,
|
389
|
+
"docs": {
|
390
|
+
"tags": [],
|
391
|
+
"text": "A\u00E7\u00E3o executada ao deletar um filtro personalizado"
|
358
392
|
}
|
393
|
+
},
|
394
|
+
"filtersToDelete": {
|
395
|
+
"type": "unknown",
|
396
|
+
"mutable": false,
|
397
|
+
"complexType": {
|
398
|
+
"original": "IPersonalizedFilter[]",
|
399
|
+
"resolved": "IPersonalizedFilter[]",
|
400
|
+
"references": {
|
401
|
+
"IPersonalizedFilter": {
|
402
|
+
"location": "import",
|
403
|
+
"path": "../../snk-personalized-filter/interfaces/IPersonalizedFilter"
|
404
|
+
}
|
405
|
+
}
|
406
|
+
},
|
407
|
+
"required": false,
|
408
|
+
"optional": false,
|
409
|
+
"docs": {
|
410
|
+
"tags": [],
|
411
|
+
"text": "Guarda filtros a serem deletados no Apply do modal"
|
412
|
+
},
|
413
|
+
"defaultValue": "[]"
|
359
414
|
}
|
360
415
|
};
|
361
416
|
}
|
417
|
+
static get listeners() {
|
418
|
+
return [{
|
419
|
+
"name": "deleteFilter",
|
420
|
+
"method": "deletePersonalizedFilterListener",
|
421
|
+
"target": undefined,
|
422
|
+
"capture": false,
|
423
|
+
"passive": false
|
424
|
+
}];
|
425
|
+
}
|
362
426
|
}
|
@@ -41,7 +41,6 @@ export class SnkFilterModalItem {
|
|
41
41
|
buildSnkFilterPersonalizedProps() {
|
42
42
|
return {
|
43
43
|
tag: "snk-personalized-filter-editor", props: {
|
44
|
-
onDeleteFilter: (event) => this.handleDeleteFilter(event.detail, FilterItemType.PERSONALIZED),
|
45
44
|
onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
|
46
45
|
onAddFilter: () => this.addPersonalizedFilter.emit(),
|
47
46
|
}
|
@@ -74,7 +74,7 @@ export class SnkFilterBar {
|
|
74
74
|
* Faz o recarregamento da filterbar buscando o state no servidor.
|
75
75
|
*/
|
76
76
|
async reload() {
|
77
|
-
this.loadConfigFromStorage();
|
77
|
+
this.loadConfigFromStorage(true);
|
78
78
|
}
|
79
79
|
/**
|
80
80
|
* Retorna um item de filtro pelo ID.
|
@@ -114,6 +114,24 @@ export class SnkFilterBar {
|
|
114
114
|
this.updateFilter(filterItem);
|
115
115
|
return Promise.resolve();
|
116
116
|
}
|
117
|
+
/**
|
118
|
+
* Remove um item de filtro.
|
119
|
+
*
|
120
|
+
* @param filterID - ID do a ser adicionado
|
121
|
+
*
|
122
|
+
* @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
|
123
|
+
*/
|
124
|
+
async removeFilterItem(filterID) {
|
125
|
+
const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
|
126
|
+
if (itemIndex == -1) {
|
127
|
+
console.warn("[SnkFilterBar.removeFilterItem] FilterItem não encontrado");
|
128
|
+
return Promise.resolve(undefined);
|
129
|
+
}
|
130
|
+
const itemToRemove = this.filterConfig[itemIndex];
|
131
|
+
;
|
132
|
+
this.filterConfig = this.filterConfig.filter(item => item.id !== filterID);
|
133
|
+
return Promise.resolve(itemToRemove);
|
134
|
+
}
|
117
135
|
componentDidLoad() {
|
118
136
|
if (this._element) {
|
119
137
|
const dataInfo = { dataUnit: this.dataUnit };
|
@@ -264,7 +282,10 @@ export class SnkFilterBar {
|
|
264
282
|
loadPermitions() {
|
265
283
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
266
284
|
}
|
267
|
-
loadConfigFromStorage() {
|
285
|
+
async loadConfigFromStorage(clearCache) {
|
286
|
+
if (clearCache) {
|
287
|
+
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
288
|
+
}
|
268
289
|
return new Promise(accept => {
|
269
290
|
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
270
291
|
.then((filters) => {
|
@@ -321,7 +342,8 @@ export class SnkFilterBar {
|
|
321
342
|
onComplete: callbackOnApplyFilter,
|
322
343
|
getMessage: (key, props) => this.getMessage(key, props),
|
323
344
|
onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
|
324
|
-
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id)
|
345
|
+
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
|
346
|
+
onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
|
325
347
|
};
|
326
348
|
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
327
349
|
await this._filterModalFactory.showModal();
|
@@ -339,6 +361,11 @@ export class SnkFilterBar {
|
|
339
361
|
this.showPersonalizedFilter = true;
|
340
362
|
this.personalizedFilterId = id;
|
341
363
|
}
|
364
|
+
deletePersonalizedFilter(filter, filterItemType, configName) {
|
365
|
+
if (filterItemType === FilterItemType.PERSONALIZED) {
|
366
|
+
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
367
|
+
}
|
368
|
+
}
|
342
369
|
handleHidePersonalizedFilter(reloadFilterBar) {
|
343
370
|
if (reloadFilterBar) {
|
344
371
|
this.loadConfigFromStorage().then(() => {
|
@@ -612,6 +639,38 @@ export class SnkFilterBar {
|
|
612
639
|
"text": "filterItem - Item a ser adicionado, caso o item j\u00E1 exista com o ID ele n\u00E3o ser\u00E1 adicionado novamente"
|
613
640
|
}]
|
614
641
|
}
|
642
|
+
},
|
643
|
+
"removeFilterItem": {
|
644
|
+
"complexType": {
|
645
|
+
"signature": "(filterID: string) => Promise<SnkFilterItemConfig | undefined>",
|
646
|
+
"parameters": [{
|
647
|
+
"tags": [{
|
648
|
+
"name": "param",
|
649
|
+
"text": "filterID - ID do a ser adicionado"
|
650
|
+
}],
|
651
|
+
"text": "- ID do a ser adicionado"
|
652
|
+
}],
|
653
|
+
"references": {
|
654
|
+
"Promise": {
|
655
|
+
"location": "global"
|
656
|
+
},
|
657
|
+
"SnkFilterItemConfig": {
|
658
|
+
"location": "import",
|
659
|
+
"path": "./filter-item/snk-filter-item"
|
660
|
+
}
|
661
|
+
},
|
662
|
+
"return": "Promise<SnkFilterItemConfig>"
|
663
|
+
},
|
664
|
+
"docs": {
|
665
|
+
"text": "Remove um item de filtro.",
|
666
|
+
"tags": [{
|
667
|
+
"name": "param",
|
668
|
+
"text": "filterID - ID do a ser adicionado"
|
669
|
+
}, {
|
670
|
+
"name": "returns",
|
671
|
+
"text": "- Retorna o item de filtro removido, ou undefined caso n\u00E3o encontrado."
|
672
|
+
}]
|
673
|
+
}
|
615
674
|
}
|
616
675
|
};
|
617
676
|
}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
2
2
|
class SnkFilterModalFactory {
|
3
|
-
constructor({ filterConfig, configName, onComplete, getMessage, onAddPersonalizedFilter, onEditPersonalizedFilter }) {
|
3
|
+
constructor({ filterConfig, configName, onComplete, getMessage, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
|
4
4
|
this._filterConfig = filterConfig;
|
5
5
|
this._configName = configName;
|
6
6
|
this._onComplete = onComplete;
|
7
7
|
this._getMessage = getMessage;
|
8
8
|
this._addPersonalizedFilterFn = onAddPersonalizedFilter;
|
9
9
|
this._editPersonalizedFilterFn = onEditPersonalizedFilter;
|
10
|
+
this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
|
10
11
|
}
|
11
12
|
applyFilters(newFilterConfig) {
|
12
13
|
this._onComplete(newFilterConfig);
|
@@ -22,6 +23,7 @@ class SnkFilterModalFactory {
|
|
22
23
|
filterModal.closeModal = () => this._closeModal();
|
23
24
|
filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
|
24
25
|
filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
|
26
|
+
filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
|
25
27
|
return filterModal;
|
26
28
|
}
|
27
29
|
async showModal() {
|
@@ -14,14 +14,21 @@ export class SnkGrid {
|
|
14
14
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
15
15
|
"snkGridTopTaskbar.regular": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
16
16
|
"snkGridTopTaskbar.regular.secondary": ["FORM_MODE", "CONFIGURATOR", "INSERT"],
|
17
|
+
"snkGridTopTaskbar.regular.singleTaskbar": [],
|
17
18
|
"snkGridTopTaskbar.finish_edition": ["CANCEL", "SAVE"],
|
18
|
-
"snkGridTopTaskbar.finish_edition.secondary": []
|
19
|
+
"snkGridTopTaskbar.finish_edition.secondary": [],
|
20
|
+
"snkGridTopTaskbar.finish_edition.singleTaskbar": [],
|
19
21
|
});
|
20
22
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
21
23
|
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON", "MORE_OPTIONS"],
|
22
24
|
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
23
25
|
"snkGridHeaderTaskbar.detail.unselected": ["REFRESH", "MORE_OPTIONS"],
|
24
|
-
"snkGridHeaderTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
|
26
|
+
"snkGridHeaderTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"],
|
27
|
+
"snkGridHeaderTaskbar.singleTaskbar.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON", "MORE_OPTIONS"],
|
28
|
+
"snkGridHeaderTaskbar.singleTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "ATTACH", "FORM_MODE", "CONFIGURATOR", "REFRESH", "DATA_EXPORTER", "ACTIONS_BUTTON"],
|
29
|
+
"snkGridHeaderTaskbar.singleTaskbar.detail.unselected": ["INSERT", "FORM_MODE", "CONFIGURATOR", "REFRESH", "MORE_OPTIONS"],
|
30
|
+
"snkGridHeaderTaskbar.singleTaskbar.detail.selected": ["UPDATE", "ATTACH", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "FORM_MODE", "CONFIGURATOR", "REFRESH"],
|
31
|
+
"snkGridHeaderTaskbar.singleTaskbar.finish_edition": ["CANCEL", "SAVE"]
|
25
32
|
});
|
26
33
|
this._dataUnit = undefined;
|
27
34
|
this._dataState = undefined;
|
@@ -302,30 +309,46 @@ export class SnkGrid {
|
|
302
309
|
return invisibleButtons;
|
303
310
|
}
|
304
311
|
componentWillRender() {
|
305
|
-
var _a;
|
306
312
|
const invisibleButtons = this.getInvisibleButtons();
|
307
|
-
|
308
|
-
let headerTaskbarId;
|
309
|
-
if (hasSelectedRecord) {
|
310
|
-
headerTaskbarId = this.isDetail ? "snkGridHeaderTaskbar.detail.selected" : "snkGridHeaderTaskbar.selected";
|
311
|
-
}
|
312
|
-
else {
|
313
|
-
headerTaskbarId = this.isDetail ? "snkGridHeaderTaskbar.detail.unselected" : "snkGridHeaderTaskbar.unselected";
|
314
|
-
}
|
315
|
-
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState, this.getHeaderDisabledButtons(), invisibleButtons);
|
313
|
+
this._headerTaskbarProcessor.process(this.getHeaderTaskbarId(), this.taskbarManager, this._dataState, this.getHeaderDisabledButtons(), invisibleButtons);
|
316
314
|
this._topTaskbarProcessor.process(this.getTopTaskBarId(), this.taskbarManager, this._dataState, undefined, invisibleButtons);
|
317
315
|
this.dataExporterProviderStore();
|
318
316
|
}
|
317
|
+
getHeaderTaskbarId() {
|
318
|
+
var _a, _b;
|
319
|
+
const hasSelectedRecord = this._dataState && !!((_a = this._dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.length);
|
320
|
+
const taskbarIdPrefixLookup = {
|
321
|
+
primary: this.isDetail ? "snkGridHeaderTaskbar.detail" : "snkGridHeaderTaskbar",
|
322
|
+
secondary: this.isDetail ? "snkGridHeaderTaskbar.detail" : "snkGridHeaderTaskbar",
|
323
|
+
singleTaskbar: this.isDetail ? "snkGridHeaderTaskbar.singleTaskbar.detail" : "snkGridHeaderTaskbar.singleTaskbar"
|
324
|
+
};
|
325
|
+
const taskbarIdPrefix = taskbarIdPrefixLookup[this.presentationMode];
|
326
|
+
let headerTaskbarId = hasSelectedRecord ? `${taskbarIdPrefix}.selected` : `${taskbarIdPrefix}.unselected`;
|
327
|
+
if (((_b = this._dataState) === null || _b === void 0 ? void 0 : _b.isDirty) && this.presentationMode === PresentationMode.SINGLE_TASKBAR) {
|
328
|
+
headerTaskbarId = "snkGridHeaderTaskbar.singleTaskbar.finish_edition";
|
329
|
+
}
|
330
|
+
return headerTaskbarId;
|
331
|
+
}
|
319
332
|
getTopTaskBarId() {
|
320
333
|
var _a;
|
321
|
-
const
|
334
|
+
const suffixLookup = {
|
335
|
+
primary: "",
|
336
|
+
secondary: ".secondary",
|
337
|
+
singleTaskbar: ".singleTaskbar"
|
338
|
+
};
|
339
|
+
const sufix = suffixLookup[this.presentationMode];
|
322
340
|
if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
|
323
341
|
return `snkGridTopTaskbar.finish_edition${sufix}`;
|
324
342
|
}
|
325
343
|
return `snkGridTopTaskbar.regular${sufix}`;
|
326
344
|
}
|
327
345
|
getPrimaryButton() {
|
328
|
-
|
346
|
+
const primaryButtonLookup = {
|
347
|
+
primary: "INSERT",
|
348
|
+
secondary: "",
|
349
|
+
singleTaskbar: "INSERT"
|
350
|
+
};
|
351
|
+
return primaryButtonLookup[this.presentationMode];
|
329
352
|
}
|
330
353
|
getColumnSearch(actionButton, item) {
|
331
354
|
if (this._columnSearch != undefined) {
|
@@ -376,7 +399,7 @@ export class SnkGrid {
|
|
376
399
|
return undefined;
|
377
400
|
}
|
378
401
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, this._showSnkFilterBar &&
|
379
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail) }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
402
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail) }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, 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), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
380
403
|
}
|
381
404
|
static get is() { return "snk-grid"; }
|
382
405
|
static get encapsulation() { return "scoped"; }
|
@@ -573,7 +596,7 @@ export class SnkGrid {
|
|
573
596
|
"mutable": false,
|
574
597
|
"complexType": {
|
575
598
|
"original": "PresentationMode",
|
576
|
-
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY",
|
599
|
+
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY | PresentationMode.SINGLE_TASKBAR",
|
577
600
|
"references": {
|
578
601
|
"PresentationMode": {
|
579
602
|
"location": "import",
|
@@ -190,7 +190,7 @@ export class SnkPersonalizedFilter {
|
|
190
190
|
return personalizedFilter;
|
191
191
|
}
|
192
192
|
addFilterGroupCondition(personalizedFilter) {
|
193
|
-
if (!personalizedFilter.assistent.operand) {
|
193
|
+
if (personalizedFilter.assistent && !personalizedFilter.assistent.operand) {
|
194
194
|
personalizedFilter.assistent.operand = FilterGroupCondition.AND;
|
195
195
|
}
|
196
196
|
}
|
@@ -11,6 +11,9 @@ export class TaskbarActionsButton {
|
|
11
11
|
await this.hideActions();
|
12
12
|
}
|
13
13
|
}
|
14
|
+
async handleClose() {
|
15
|
+
await this.hideActions();
|
16
|
+
}
|
14
17
|
/**
|
15
18
|
* Exibe a lista de ações.
|
16
19
|
*/
|
@@ -56,12 +59,26 @@ export class TaskbarActionsButton {
|
|
56
59
|
return this._showDropdown && ((_a = this.actions) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
57
60
|
}
|
58
61
|
onSelectAction(iAction) {
|
59
|
-
const
|
62
|
+
const actions = this.actions.map(action => (Object.assign(Object.assign({}, action), { id: action.value })));
|
63
|
+
const selectedAction = this.getSelectedAction(iAction.id, actions);
|
60
64
|
this.taskbarActionSelected.emit(selectedAction);
|
61
65
|
if (!selectedAction.disableCloseOnSelect) {
|
62
66
|
this._showDropdown = false;
|
63
67
|
}
|
64
68
|
}
|
69
|
+
getSelectedAction(id, actions) {
|
70
|
+
let selectedItem;
|
71
|
+
for (const item of actions) {
|
72
|
+
if (item.id === id) {
|
73
|
+
selectedItem = item;
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
if (!(item === null || item === void 0 ? void 0 : item.children))
|
77
|
+
continue;
|
78
|
+
selectedItem = this.getSelectedAction(id, item.children);
|
79
|
+
}
|
80
|
+
return selectedItem;
|
81
|
+
}
|
65
82
|
dropdownItemBuilder(item, _level) {
|
66
83
|
const itemAction = this.actions.find(action => action.value === item.id);
|
67
84
|
if (!itemAction || !itemAction.itemBuilder) {
|
@@ -296,6 +313,12 @@ export class TaskbarActionsButton {
|
|
296
313
|
"target": "window",
|
297
314
|
"capture": false,
|
298
315
|
"passive": false
|
316
|
+
}, {
|
317
|
+
"name": "ezOpenModal",
|
318
|
+
"method": "handleClose",
|
319
|
+
"target": "window",
|
320
|
+
"capture": false,
|
321
|
+
"passive": false
|
299
322
|
}];
|
300
323
|
}
|
301
324
|
}
|
@@ -472,7 +472,7 @@ export class SnkTaskbar {
|
|
472
472
|
"mutable": true,
|
473
473
|
"complexType": {
|
474
474
|
"original": "PresentationMode",
|
475
|
-
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY",
|
475
|
+
"resolved": "PresentationMode.PRIMARY | PresentationMode.SECONDARY | PresentationMode.SINGLE_TASKBAR",
|
476
476
|
"references": {
|
477
477
|
"PresentationMode": {
|
478
478
|
"location": "import",
|