@sankhyalabs/sankhyablocks 8.15.0-dev.2 → 8.15.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-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-e4a7c4c3.js} +254 -34
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_2.cjs.entry.js +23 -5
- package/dist/cjs/snk-application.cjs.entry.js +74 -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 +40 -5
- package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -2
- package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
- 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-d32c096f.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-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +19 -8
- 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 +119 -13
- 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/editors/snk-filter-multi-select.js +2 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +84 -2
- 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 +84 -3
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +5 -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-pesquisa/snk-pesquisa.css +2 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +26 -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/dataUnit/InMemoryLoader.js +1 -1
- 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 +31 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +55 -31
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +7 -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 +93 -35
- package/dist/components/index2.js +1 -0
- package/dist/components/snk-actions-button2.js +1 -0
- package/dist/components/snk-application2.js +73 -3
- 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 +42 -5
- package/dist/components/snk-filter-item2.js +3 -0
- package/dist/components/snk-filter-modal-item2.js +0 -1
- package/dist/components/snk-filter-modal.js +21 -3
- package/dist/components/snk-filter-multi-select.js +2 -1
- package/dist/components/snk-grid2.js +38 -15
- package/dist/components/snk-personalized-filter2.js +1 -1
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-simple-crud2.js +15 -1
- package/dist/components/taskbar-actions-button2.js +21 -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-fa0c2540.js} +255 -36
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_2.entry.js +23 -5
- package/dist/esm/snk-application.entry.js +74 -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 +40 -5
- package/dist/esm/snk-filter-item.entry.js +3 -0
- package/dist/esm/snk-filter-modal-item.entry.js +1 -2
- package/dist/esm/snk-filter-modal.entry.js +16 -1
- package/dist/esm/snk-filter-multi-select.entry.js +2 -1
- 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-f49613c6.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-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +17 -6
- 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-02e3a45b.entry.js +1 -0
- package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
- package/dist/sankhyablocks/p-0ec5b2e5.js +1 -0
- 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-2582537c.entry.js +1 -0
- package/dist/sankhyablocks/p-282789a6.entry.js +1 -0
- package/dist/sankhyablocks/p-374d03f6.js +1 -0
- package/dist/sankhyablocks/p-38289a55.js +1 -0
- package/dist/sankhyablocks/p-3b0e4e08.js +65 -0
- package/dist/sankhyablocks/{p-35fe6e61.entry.js → p-40915359.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2028633c.js → p-573a07c5.js} +1 -1
- package/dist/sankhyablocks/p-62896624.entry.js +1 -0
- package/dist/sankhyablocks/{p-953346b9.entry.js → p-69efa80d.entry.js} +1 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/{p-aaa1438e.entry.js → p-761ed32f.entry.js} +1 -1
- package/dist/sankhyablocks/p-7f3c7b09.entry.js +1 -0
- package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
- package/dist/sankhyablocks/p-9b5944a4.entry.js +1 -0
- package/dist/sankhyablocks/p-9bdbc7d8.entry.js +1 -0
- package/dist/sankhyablocks/p-aa95fb2c.js +56 -0
- package/dist/sankhyablocks/p-ac384baf.entry.js +1 -0
- package/dist/sankhyablocks/p-b05ab13d.entry.js +1 -0
- package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
- package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
- package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
- package/dist/sankhyablocks/p-e0fd9555.entry.js +1 -0
- package/dist/sankhyablocks/p-e817f254.entry.js +11 -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 +12 -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 -1
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +19 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +16 -0
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +7 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
- 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 +108 -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 +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +4 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +15 -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-20726710.entry.js +0 -1
- 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,62 @@
|
|
1
|
+
import { ApplicationContext, DataType, UserInterface } from "@sankhyalabs/core";
|
2
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
3
|
+
const getMessage = (key) => {
|
4
|
+
var _a, _b;
|
5
|
+
return (_b = (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
|
6
|
+
};
|
7
|
+
export const attachCrudConfig = {
|
8
|
+
grid: {
|
9
|
+
columns: [
|
10
|
+
{ name: "CODATA", orderIndex: 0, width: 0 },
|
11
|
+
{ name: "DESCRICAO", orderIndex: 1, width: 0 },
|
12
|
+
{ name: "ARQUIVO", orderIndex: 2, width: 0 },
|
13
|
+
{ name: "DTALTER", orderIndex: 3, width: 0 },
|
14
|
+
{ name: "USUARIO", orderIndex: 4, width: 0 },
|
15
|
+
],
|
16
|
+
},
|
17
|
+
form: {
|
18
|
+
emptyConfig: false,
|
19
|
+
fields: [
|
20
|
+
{
|
21
|
+
name: "DESCRICAO",
|
22
|
+
label: getMessage("snkAttach.attachMetadata.lblDescription"),
|
23
|
+
visible: true,
|
24
|
+
readOnly: false,
|
25
|
+
required: true,
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: "CAMINHO_ARQUIVO",
|
29
|
+
label: getMessage("snkAttach.attachMetadata.lblFile"),
|
30
|
+
visible: true,
|
31
|
+
readOnly: false,
|
32
|
+
required: true,
|
33
|
+
},
|
34
|
+
],
|
35
|
+
},
|
36
|
+
};
|
37
|
+
export const attachFetcherMetadataBuilder = {
|
38
|
+
name: "Attach",
|
39
|
+
label: "Attach List",
|
40
|
+
fields: [
|
41
|
+
{ name: "CODATA", label: getMessage("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
|
42
|
+
{ name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT },
|
43
|
+
{ name: "ARQUIVO", label: getMessage("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
|
44
|
+
{ name: "USUARIO", label: getMessage("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
|
45
|
+
{ name: "DTALTER", label: getMessage("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
|
46
|
+
{
|
47
|
+
name: "CAMINHO_ARQUIVO",
|
48
|
+
label: getMessage("snkAttach.attachMetadata.lblFileUpload"),
|
49
|
+
dataType: DataType.OBJECT,
|
50
|
+
userInterface: UserInterface.FILE,
|
51
|
+
readOnly: false,
|
52
|
+
required: true,
|
53
|
+
visible: true,
|
54
|
+
properties: {
|
55
|
+
subTitle: getMessage("snkAttach.attachMetadata.lblSubTitle"),
|
56
|
+
MAX_FILES: 1,
|
57
|
+
STORAGESTRATEGY: "SESSION",
|
58
|
+
INTERNAL_FILENAME: "Attach.upload",
|
59
|
+
}
|
60
|
+
},
|
61
|
+
],
|
62
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TaskbarElement } from "
|
1
|
+
import { TaskbarElement } from "../../../snk-taskbar/elements/taskbar-elements";
|
2
2
|
import { ApplicationContext } from "@sankhyalabs/core";
|
3
3
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
4
4
|
const getMessage = (key) => {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,28 +1,31 @@
|
|
1
1
|
import { Action, ApplicationContext, DataType } from "@sankhyalabs/core";
|
2
|
-
import { SaveErrorsEnum } from "
|
3
|
-
import { VIEW_MODE } from "
|
4
|
-
import PreloadManager from '
|
5
|
-
export class
|
2
|
+
import { SaveErrorsEnum } from "../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces";
|
3
|
+
import { VIEW_MODE } from "../../../../../lib/utils/constants";
|
4
|
+
import PreloadManager from '../../../../../lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager';
|
5
|
+
export class AnexoSistemaDataUnitFactory {
|
6
6
|
constructor(entityName, getMessage) {
|
7
7
|
this.entityName = entityName;
|
8
8
|
this.getMessage = getMessage;
|
9
9
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
10
10
|
}
|
11
|
-
initLoaders(dataUnit,
|
11
|
+
initLoaders(dataUnit, fetcher, onSuccess) {
|
12
12
|
if (!this.loader)
|
13
13
|
this.loader = dataUnit.dataLoader;
|
14
14
|
dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
15
|
-
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes,
|
15
|
+
dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
|
16
16
|
if (recordIds.length)
|
17
17
|
onSuccess();
|
18
18
|
return recordIds;
|
19
19
|
});
|
20
|
-
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids,
|
20
|
+
dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
|
21
21
|
if (recordIds.length)
|
22
22
|
onSuccess();
|
23
23
|
return recordIds;
|
24
24
|
});
|
25
25
|
}
|
26
|
+
metadataLoader(dataUnit) {
|
27
|
+
throw new Error("Method not implemented.");
|
28
|
+
}
|
26
29
|
dataLoader(dataUnit, request) {
|
27
30
|
return new Promise(resolve => {
|
28
31
|
this.loader(dataUnit, request).then(response => {
|
@@ -38,11 +41,11 @@ export class AttachmentDataUnitBuilder {
|
|
38
41
|
});
|
39
42
|
});
|
40
43
|
}
|
41
|
-
saveLoader(changes,
|
44
|
+
saveLoader(changes, fetcher) {
|
42
45
|
return new Promise((resolve) => {
|
43
46
|
var _a;
|
44
47
|
const change = Array.isArray(changes) ? changes[0] : {};
|
45
|
-
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ?
|
48
|
+
const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
|
46
49
|
savePromise(change).then((records) => {
|
47
50
|
resolve(records);
|
48
51
|
}).catch((error) => {
|
@@ -62,11 +65,11 @@ export class AttachmentDataUnitBuilder {
|
|
62
65
|
});
|
63
66
|
});
|
64
67
|
}
|
65
|
-
removeLoader(dataUnit, ids,
|
68
|
+
removeLoader(dataUnit, ids, fetcher) {
|
66
69
|
return new Promise((resolve) => {
|
67
70
|
const { records } = dataUnit.getSelectionInfo();
|
68
71
|
const recordToDelete = records[0];
|
69
|
-
|
72
|
+
fetcher.delete(recordToDelete).then(() => {
|
70
73
|
PreloadManager.removeRecords(dataUnit, [recordToDelete]);
|
71
74
|
return resolve(ids);
|
72
75
|
});
|
@@ -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
|
});
|
package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js
CHANGED
@@ -10,7 +10,8 @@ export class SnkFilterMultiSelect {
|
|
10
10
|
* Emitido quando acontece a alteração de valor do componente snk-filter-multi-select
|
11
11
|
*/
|
12
12
|
ezChangeListener(evt) {
|
13
|
-
|
13
|
+
var _a;
|
14
|
+
this.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value;
|
14
15
|
this.valueChanged.emit(this.value);
|
15
16
|
}
|
16
17
|
/**
|
@@ -254,6 +254,9 @@ export class SnkFilterItem {
|
|
254
254
|
}
|
255
255
|
canClearFilter() {
|
256
256
|
const { value, groupedItems = [] } = this.config;
|
257
|
+
if (value != undefined && this.config.type === FilterItemType.MULTI_LIST) {
|
258
|
+
return value.some((item) => item.check);
|
259
|
+
}
|
257
260
|
return value !== undefined || groupedItems.some(item => item.visible);
|
258
261
|
}
|
259
262
|
getRightIconName() {
|
@@ -15,6 +15,15 @@ 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
|
+
this.disablePersonalizedFilter = undefined;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Emitido quando um filtro personalizado é deletado.
|
24
|
+
*/
|
25
|
+
deletePersonalizedFilterListener(event) {
|
26
|
+
this.filtersToDelete.push(event.detail);
|
18
27
|
}
|
19
28
|
getCustomMessage(key, params) {
|
20
29
|
var _a;
|
@@ -82,6 +91,12 @@ export class SnkFilterModal {
|
|
82
91
|
if (this.isValidCustomFilter(filterPersonalized)) {
|
83
92
|
this.applyFilters(this.filters);
|
84
93
|
}
|
94
|
+
if (this.filtersToDelete.length > 0) {
|
95
|
+
this.filtersToDelete.forEach(filter => {
|
96
|
+
this.deletePersonalizedFilter(filter, this.configName);
|
97
|
+
});
|
98
|
+
this.filtersToDelete = [];
|
99
|
+
}
|
85
100
|
}
|
86
101
|
isValidCustomFilter(filterPersonalized) {
|
87
102
|
const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
@@ -219,7 +234,7 @@ export class SnkFilterModal {
|
|
219
234
|
const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
|
220
235
|
const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
|
221
236
|
const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
|
222
|
-
return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
237
|
+
return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
223
238
|
}
|
224
239
|
static get is() { return "snk-filter-modal"; }
|
225
240
|
static get originalStyleUrls() {
|
@@ -354,9 +369,76 @@ export class SnkFilterModal {
|
|
354
369
|
"optional": false,
|
355
370
|
"docs": {
|
356
371
|
"tags": [],
|
357
|
-
"text": "A\u00E7\u00E3o executada ao
|
372
|
+
"text": "A\u00E7\u00E3o executada ao editar um filtro personalizado"
|
358
373
|
}
|
374
|
+
},
|
375
|
+
"deletePersonalizedFilter": {
|
376
|
+
"type": "unknown",
|
377
|
+
"mutable": false,
|
378
|
+
"complexType": {
|
379
|
+
"original": "(filter: IPersonalizedFilter, configName: string) => void",
|
380
|
+
"resolved": "(filter: IPersonalizedFilter, configName: string) => void",
|
381
|
+
"references": {
|
382
|
+
"IPersonalizedFilter": {
|
383
|
+
"location": "import",
|
384
|
+
"path": "../../snk-personalized-filter/interfaces/IPersonalizedFilter"
|
385
|
+
}
|
386
|
+
}
|
387
|
+
},
|
388
|
+
"required": false,
|
389
|
+
"optional": false,
|
390
|
+
"docs": {
|
391
|
+
"tags": [],
|
392
|
+
"text": "A\u00E7\u00E3o executada ao deletar um filtro personalizado"
|
393
|
+
}
|
394
|
+
},
|
395
|
+
"filtersToDelete": {
|
396
|
+
"type": "unknown",
|
397
|
+
"mutable": false,
|
398
|
+
"complexType": {
|
399
|
+
"original": "IPersonalizedFilter[]",
|
400
|
+
"resolved": "IPersonalizedFilter[]",
|
401
|
+
"references": {
|
402
|
+
"IPersonalizedFilter": {
|
403
|
+
"location": "import",
|
404
|
+
"path": "../../snk-personalized-filter/interfaces/IPersonalizedFilter"
|
405
|
+
}
|
406
|
+
}
|
407
|
+
},
|
408
|
+
"required": false,
|
409
|
+
"optional": false,
|
410
|
+
"docs": {
|
411
|
+
"tags": [],
|
412
|
+
"text": "Guarda filtros a serem deletados no Apply do modal"
|
413
|
+
},
|
414
|
+
"defaultValue": "[]"
|
415
|
+
},
|
416
|
+
"disablePersonalizedFilter": {
|
417
|
+
"type": "boolean",
|
418
|
+
"mutable": false,
|
419
|
+
"complexType": {
|
420
|
+
"original": "boolean",
|
421
|
+
"resolved": "boolean",
|
422
|
+
"references": {}
|
423
|
+
},
|
424
|
+
"required": false,
|
425
|
+
"optional": false,
|
426
|
+
"docs": {
|
427
|
+
"tags": [],
|
428
|
+
"text": "Desabilita a apresenta\u00E7\u00E3o da op\u00E7\u00E3o de filtros personalizados na filter bar (chip de filtros) \ne no modal lateral de filtros (container de filtros personalizados)."
|
429
|
+
},
|
430
|
+
"attribute": "disable-personalized-filter",
|
431
|
+
"reflect": false
|
359
432
|
}
|
360
433
|
};
|
361
434
|
}
|
435
|
+
static get listeners() {
|
436
|
+
return [{
|
437
|
+
"name": "deleteFilter",
|
438
|
+
"method": "deletePersonalizedFilterListener",
|
439
|
+
"target": undefined,
|
440
|
+
"capture": false,
|
441
|
+
"passive": false
|
442
|
+
}];
|
443
|
+
}
|
362
444
|
}
|
@@ -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
|
}
|
@@ -31,6 +31,7 @@ export class SnkFilterBar {
|
|
31
31
|
this.resourceID = undefined;
|
32
32
|
this.filterConfig = undefined;
|
33
33
|
this.messagesBuilder = undefined;
|
34
|
+
this.disablePersonalizedFilter = undefined;
|
34
35
|
this.allowDefault = undefined;
|
35
36
|
this.scrollerLocked = false;
|
36
37
|
this.showPersonalizedFilter = false;
|
@@ -74,7 +75,7 @@ export class SnkFilterBar {
|
|
74
75
|
* Faz o recarregamento da filterbar buscando o state no servidor.
|
75
76
|
*/
|
76
77
|
async reload() {
|
77
|
-
this.loadConfigFromStorage();
|
78
|
+
this.loadConfigFromStorage(true);
|
78
79
|
}
|
79
80
|
/**
|
80
81
|
* Retorna um item de filtro pelo ID.
|
@@ -114,6 +115,24 @@ export class SnkFilterBar {
|
|
114
115
|
this.updateFilter(filterItem);
|
115
116
|
return Promise.resolve();
|
116
117
|
}
|
118
|
+
/**
|
119
|
+
* Remove um item de filtro.
|
120
|
+
*
|
121
|
+
* @param filterID - ID do a ser adicionado
|
122
|
+
*
|
123
|
+
* @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
|
124
|
+
*/
|
125
|
+
async removeFilterItem(filterID) {
|
126
|
+
const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
|
127
|
+
if (itemIndex == -1) {
|
128
|
+
console.warn("[SnkFilterBar.removeFilterItem] FilterItem não encontrado");
|
129
|
+
return Promise.resolve(undefined);
|
130
|
+
}
|
131
|
+
const itemToRemove = this.filterConfig[itemIndex];
|
132
|
+
;
|
133
|
+
this.filterConfig = this.filterConfig.filter(item => item.id !== filterID);
|
134
|
+
return Promise.resolve(itemToRemove);
|
135
|
+
}
|
117
136
|
componentDidLoad() {
|
118
137
|
if (this._element) {
|
119
138
|
const dataInfo = { dataUnit: this.dataUnit };
|
@@ -161,6 +180,9 @@ export class SnkFilterBar {
|
|
161
180
|
*/
|
162
181
|
getMessage(key, params, defaultValue) {
|
163
182
|
var _a;
|
183
|
+
if (this.messagesBuilder == undefined && this._application) {
|
184
|
+
this.messagesBuilder = this._application.messagesBuilder;
|
185
|
+
}
|
164
186
|
return ((_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params)) || defaultValue;
|
165
187
|
}
|
166
188
|
getFilter(_dataUnit) {
|
@@ -264,7 +286,10 @@ export class SnkFilterBar {
|
|
264
286
|
loadPermitions() {
|
265
287
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
266
288
|
}
|
267
|
-
loadConfigFromStorage() {
|
289
|
+
async loadConfigFromStorage(clearCache) {
|
290
|
+
if (clearCache) {
|
291
|
+
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
292
|
+
}
|
268
293
|
return new Promise(accept => {
|
269
294
|
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
270
295
|
.then((filters) => {
|
@@ -319,9 +344,11 @@ export class SnkFilterBar {
|
|
319
344
|
filterConfig: filtersConfigCopy,
|
320
345
|
configName: this.configName,
|
321
346
|
onComplete: callbackOnApplyFilter,
|
347
|
+
disablePersonalizedFilter: this.disablePersonalizedFilter,
|
322
348
|
getMessage: (key, props) => this.getMessage(key, props),
|
323
349
|
onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
|
324
|
-
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id)
|
350
|
+
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
|
351
|
+
onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
|
325
352
|
};
|
326
353
|
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
327
354
|
await this._filterModalFactory.showModal();
|
@@ -339,6 +366,11 @@ export class SnkFilterBar {
|
|
339
366
|
this.showPersonalizedFilter = true;
|
340
367
|
this.personalizedFilterId = id;
|
341
368
|
}
|
369
|
+
deletePersonalizedFilter(filter, filterItemType, configName) {
|
370
|
+
if (filterItemType === FilterItemType.PERSONALIZED) {
|
371
|
+
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
372
|
+
}
|
373
|
+
}
|
342
374
|
handleHidePersonalizedFilter(reloadFilterBar) {
|
343
375
|
if (reloadFilterBar) {
|
344
376
|
this.loadConfigFromStorage().then(() => {
|
@@ -483,6 +515,23 @@ export class SnkFilterBar {
|
|
483
515
|
"tags": [],
|
484
516
|
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
485
517
|
}
|
518
|
+
},
|
519
|
+
"disablePersonalizedFilter": {
|
520
|
+
"type": "boolean",
|
521
|
+
"mutable": false,
|
522
|
+
"complexType": {
|
523
|
+
"original": "boolean",
|
524
|
+
"resolved": "boolean",
|
525
|
+
"references": {}
|
526
|
+
},
|
527
|
+
"required": false,
|
528
|
+
"optional": false,
|
529
|
+
"docs": {
|
530
|
+
"tags": [],
|
531
|
+
"text": "Desabilita a apresenta\u00E7\u00E3o da op\u00E7\u00E3o de filtros personalizados na filter bar (chip de filtros) \ne no modal lateral de filtros (container de filtros personalizados)."
|
532
|
+
},
|
533
|
+
"attribute": "disable-personalized-filter",
|
534
|
+
"reflect": false
|
486
535
|
}
|
487
536
|
};
|
488
537
|
}
|
@@ -612,6 +661,38 @@ export class SnkFilterBar {
|
|
612
661
|
"text": "filterItem - Item a ser adicionado, caso o item j\u00E1 exista com o ID ele n\u00E3o ser\u00E1 adicionado novamente"
|
613
662
|
}]
|
614
663
|
}
|
664
|
+
},
|
665
|
+
"removeFilterItem": {
|
666
|
+
"complexType": {
|
667
|
+
"signature": "(filterID: string) => Promise<SnkFilterItemConfig | undefined>",
|
668
|
+
"parameters": [{
|
669
|
+
"tags": [{
|
670
|
+
"name": "param",
|
671
|
+
"text": "filterID - ID do a ser adicionado"
|
672
|
+
}],
|
673
|
+
"text": "- ID do a ser adicionado"
|
674
|
+
}],
|
675
|
+
"references": {
|
676
|
+
"Promise": {
|
677
|
+
"location": "global"
|
678
|
+
},
|
679
|
+
"SnkFilterItemConfig": {
|
680
|
+
"location": "import",
|
681
|
+
"path": "./filter-item/snk-filter-item"
|
682
|
+
}
|
683
|
+
},
|
684
|
+
"return": "Promise<SnkFilterItemConfig>"
|
685
|
+
},
|
686
|
+
"docs": {
|
687
|
+
"text": "Remove um item de filtro.",
|
688
|
+
"tags": [{
|
689
|
+
"name": "param",
|
690
|
+
"text": "filterID - ID do a ser adicionado"
|
691
|
+
}, {
|
692
|
+
"name": "returns",
|
693
|
+
"text": "- Retorna o item de filtro removido, ou undefined caso n\u00E3o encontrado."
|
694
|
+
}]
|
695
|
+
}
|
615
696
|
}
|
616
697
|
};
|
617
698
|
}
|
@@ -1,12 +1,14 @@
|
|
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, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
|
4
4
|
this._filterConfig = filterConfig;
|
5
5
|
this._configName = configName;
|
6
6
|
this._onComplete = onComplete;
|
7
7
|
this._getMessage = getMessage;
|
8
|
+
this._disablePersonalizedFilter = disablePersonalizedFilter;
|
8
9
|
this._addPersonalizedFilterFn = onAddPersonalizedFilter;
|
9
10
|
this._editPersonalizedFilterFn = onEditPersonalizedFilter;
|
11
|
+
this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
|
10
12
|
}
|
11
13
|
applyFilters(newFilterConfig) {
|
12
14
|
this._onComplete(newFilterConfig);
|
@@ -17,11 +19,13 @@ class SnkFilterModalFactory {
|
|
17
19
|
filterModal.className = "ez-size-height--full";
|
18
20
|
filterModal.filters = this._filterConfig;
|
19
21
|
filterModal.configName = this._configName;
|
22
|
+
filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
|
20
23
|
filterModal.getMessage = this._getMessage.bind(this);
|
21
24
|
filterModal.applyFilters = this.applyFilters.bind(this);
|
22
25
|
filterModal.closeModal = () => this._closeModal();
|
23
26
|
filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
|
24
27
|
filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
|
28
|
+
filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
|
25
29
|
return filterModal;
|
26
30
|
}
|
27
31
|
async showModal() {
|