@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-81085.0 → 0.0.0-bugfix-dev-KB-74406.0
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/{ContinuousInsertUtils-aa63f0a9.js → ClientSideExporterProvider-6b781452.js} +71 -2
- package/dist/cjs/IFetchDataExporterParams-e78ec415.js +8 -0
- package/dist/cjs/{dataunit-fetcher-c32fdff7.js → dataunit-fetcher-8291ac21.js} +21 -7
- package/dist/cjs/{index-1dfc7a6e.js → index-e3e39724.js} +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_5.cjs.entry.js +3 -3
- package/dist/cjs/snk-application.cjs.entry.js +9 -2
- package/dist/cjs/snk-attach.cjs.entry.js +3 -3
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +3 -14
- package/dist/cjs/snk-data-exporter.cjs.entry.js +13 -16
- package/dist/cjs/{snk-data-unit-2c7c1964.js → snk-data-unit-d75e6220.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +9 -8
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +34 -16
- package/dist/cjs/{snk-guides-viewer-c1c56eca.js → snk-guides-viewer-a029ff50.js} +3 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-pesquisa.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +25 -79
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-9ad1f9c0.js → taskbar-elements-7e19882d.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +8 -1
- package/dist/collection/components/snk-configurator/snk-configurator.css +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +0 -11
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +3 -9
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +17 -5
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +7 -4
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +3 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +4 -3
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -2
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.css +6 -0
- package/dist/collection/components/snk-grid/snk-grid.js +47 -6
- package/dist/collection/components/snk-grid-config/snk-grid-config.css +1 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +1 -1
- package/dist/collection/lib/@types/index.js +5 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +21 -7
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.js +6 -1
- package/dist/components/ContinuousInsertUtils.js +70 -2
- package/dist/components/ISave.js +6 -1
- package/dist/components/dataunit-fetcher.js +21 -7
- package/dist/components/snk-application2.js +8 -1
- package/dist/components/snk-configurator2.js +1 -1
- package/dist/components/snk-crud.js +0 -11
- package/dist/components/snk-data-exporter2.js +17 -14
- package/dist/components/snk-filter-bar2.js +5 -5
- package/dist/components/snk-filter-item2.js +4 -3
- package/dist/components/snk-filter-number.js +1 -1
- package/dist/components/snk-grid-config2.js +1 -1
- package/dist/components/snk-grid2.js +26 -8
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-simple-crud2.js +3 -59
- package/dist/esm/{ContinuousInsertUtils-af683684.js → ClientSideExporterProvider-ff89c7e9.js} +71 -3
- package/dist/esm/IFetchDataExporterParams-d73bed3d.js +8 -0
- package/dist/esm/{dataunit-fetcher-26c2bed4.js → dataunit-fetcher-5247a708.js} +21 -7
- package/dist/esm/{index-3aa4977a.js → index-b40568ff.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +2 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_5.entry.js +3 -3
- package/dist/esm/snk-application.entry.js +9 -2
- package/dist/esm/snk-attach.entry.js +3 -3
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +3 -14
- package/dist/esm/snk-data-exporter.entry.js +13 -16
- package/dist/esm/{snk-data-unit-a36df23f.js → snk-data-unit-bfd10c71.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-bar_4.entry.js +9 -8
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +28 -10
- package/dist/esm/{snk-guides-viewer-2b96b7f7.js → snk-guides-viewer-fa45714d.js} +3 -3
- package/dist/esm/snk-guides-viewer.entry.js +4 -4
- package/dist/esm/snk-pesquisa.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +7 -61
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-d59867f1.js → taskbar-elements-d2353c64.js} +1 -1
- package/dist/sankhyablocks/{p-7d0627f4.entry.js → p-0b00d69c.entry.js} +1 -1
- package/dist/sankhyablocks/p-0f3698af.js +1 -0
- package/dist/sankhyablocks/{p-c4d87e71.entry.js → p-172848d4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c9eb2bf5.entry.js → p-29d08446.entry.js} +1 -1
- package/dist/sankhyablocks/p-38179225.js +60 -0
- package/dist/sankhyablocks/{p-7e7a7473.js → p-3fc82614.js} +1 -1
- package/dist/sankhyablocks/p-40e323f9.js +1 -0
- package/dist/sankhyablocks/{p-f4ceb72c.entry.js → p-4c9adf1c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-70ae0779.js → p-655bdd60.js} +1 -1
- package/dist/sankhyablocks/p-700a4cc3.entry.js +1 -0
- package/dist/sankhyablocks/p-79f823f3.entry.js +1 -0
- package/dist/sankhyablocks/p-8f3f2306.js +1 -0
- package/dist/sankhyablocks/{p-28ca3908.entry.js → p-a962a3e4.entry.js} +1 -1
- package/dist/sankhyablocks/p-aa1a0f3e.entry.js +1 -0
- package/dist/sankhyablocks/{p-80dd8976.entry.js → p-b02e58fd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d5687306.entry.js → p-b0ff53b7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-538b3174.entry.js → p-c82deea7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-31c3c9d0.entry.js → p-d2d0535f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c6aefba8.js → p-de9da2f2.js} +1 -1
- package/dist/sankhyablocks/p-e10faff0.entry.js +11 -0
- package/dist/sankhyablocks/p-e36f89d1.entry.js +1 -0
- package/dist/sankhyablocks/{p-045398fb.entry.js → p-f8db6795.entry.js} +1 -1
- package/dist/sankhyablocks/p-fa0cf19c.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/data/export-result.d.ts +2 -1
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +0 -1
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +2 -1
- package/dist/types/components/snk-data-exporter/interfaces/IRecordID.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +3 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +7 -0
- package/dist/types/components.d.ts +9 -1
- package/dist/types/lib/@types/index.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +5 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-01ba23cd.entry.js +0 -1
- package/dist/sankhyablocks/p-0c50ba37.entry.js +0 -11
- package/dist/sankhyablocks/p-15f5f702.js +0 -1
- package/dist/sankhyablocks/p-30cf616e.js +0 -1
- package/dist/sankhyablocks/p-43d58b74.entry.js +0 -1
- package/dist/sankhyablocks/p-78d49c74.js +0 -60
- package/dist/sankhyablocks/p-bf6bc973.entry.js +0 -1
- package/dist/sankhyablocks/p-d434bb9a.entry.js +0 -1
- package/dist/sankhyablocks/p-edbe8e15.entry.js +0 -1
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index
|
|
5
|
+
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const constants = require('./constants-241934b3.js');
|
|
9
|
-
const taskbarElements = require('./taskbar-elements-
|
|
9
|
+
const taskbarElements = require('./taskbar-elements-7e19882d.js');
|
|
10
10
|
require('./DataFetcher-65879b2c.js');
|
|
11
11
|
require('./pesquisa-fetcher-5c583c93.js');
|
|
12
|
-
const
|
|
13
|
-
const index = require('./index-
|
|
12
|
+
const ClientSideExporterProvider = require('./ClientSideExporterProvider-6b781452.js');
|
|
13
|
+
const index$1 = require('./index-e3e39724.js');
|
|
14
14
|
require('./ISave-e91b70a7.js');
|
|
15
15
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
|
16
16
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
17
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
|
17
|
+
const dataunitFetcher = require('./dataunit-fetcher-8291ac21.js');
|
|
18
18
|
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
19
19
|
const formConfigFetcher = require('./form-config-fetcher-90126e4c.js');
|
|
20
20
|
const fieldSearch = require('./field-search-68e34bf4.js');
|
|
21
21
|
const ConfigStorage = require('./ConfigStorage-d024aec8.js');
|
|
22
22
|
const SnkFormConfigManager = require('./SnkFormConfigManager-c11d8468.js');
|
|
23
|
-
const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
|
24
23
|
const index$2 = require('./index-102ba62d.js');
|
|
25
24
|
require('./PrintUtils-bcaeb82f.js');
|
|
26
25
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
|
|
26
|
+
require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
|
|
27
|
+
require('./IFetchDataExporterParams-e78ec415.js');
|
|
27
28
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
|
28
29
|
require('@sankhyalabs/core/dist/utils/SortingUtils');
|
|
29
30
|
require('./ResourceIDUtils-5ff86aa7.js');
|
|
@@ -31,73 +32,18 @@ require('./ResourceIDUtils-5ff86aa7.js');
|
|
|
31
32
|
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
32
33
|
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
33
34
|
|
|
34
|
-
class ClientSideExporterProvider extends ContinuousInsertUtils.CommonsExporter {
|
|
35
|
-
getSelectedNumber() {
|
|
36
|
-
return this.dataUnit.getSelectionInfo().length;
|
|
37
|
-
}
|
|
38
|
-
getTotalRecords() {
|
|
39
|
-
var _a, _b, _c;
|
|
40
|
-
const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
41
|
-
return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
42
|
-
}
|
|
43
|
-
getSelectedIDs() {
|
|
44
|
-
return GetSelectedRecordsIDsInfo.getSelectedRecordsIDsInfo(this.dataUnit);
|
|
45
|
-
}
|
|
46
|
-
getRecordID() {
|
|
47
|
-
var _a, _b, _c;
|
|
48
|
-
return (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
49
|
-
}
|
|
50
|
-
async getRecords() {
|
|
51
|
-
if (this.dataUnit.records.length === 0) {
|
|
52
|
-
return Promise.resolve([]);
|
|
53
|
-
}
|
|
54
|
-
const selectionInfo = this.dataUnit.getSelectionInfo();
|
|
55
|
-
const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
|
|
56
|
-
return Promise.resolve(records == undefined ? [] : records);
|
|
57
|
-
}
|
|
58
|
-
getHiddenOptions() {
|
|
59
|
-
return [
|
|
60
|
-
index.DataExporterOption.EXPORT_BY_EMAIL,
|
|
61
|
-
index.DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
|
62
|
-
index.DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
|
63
|
-
index.DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
64
|
-
index.DataExporterOption.EXPORT_PAGE_TO_XLS
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
formatValue(record, column) {
|
|
68
|
-
const { id, descriptionFrom } = column;
|
|
69
|
-
const value = record[descriptionFrom || id];
|
|
70
|
-
if (value == undefined) {
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
if (descriptionFrom != undefined) {
|
|
74
|
-
return value.label;
|
|
75
|
-
}
|
|
76
|
-
const fieldDescriptor = this.dataUnit.getField(id);
|
|
77
|
-
if (fieldDescriptor.userInterface === core.UserInterface.SEARCH) {
|
|
78
|
-
return value.value;
|
|
79
|
-
}
|
|
80
|
-
if (column.customFormatter) {
|
|
81
|
-
const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
|
|
82
|
-
const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
|
|
83
|
-
return formattedValue;
|
|
84
|
-
}
|
|
85
|
-
return this.dataUnit.getFormattedValue(id, value);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
35
|
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid__container--shadow--outline:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
|
|
90
36
|
|
|
91
37
|
const SnkSimpleCrud = class {
|
|
92
38
|
constructor(hostRef) {
|
|
93
|
-
index
|
|
94
|
-
this.dataStateChange = index
|
|
95
|
-
this.dataUnitReady = index
|
|
96
|
-
this.actionClick = index
|
|
97
|
-
this.formItemsReady = index
|
|
98
|
-
this.configuratorSave = index
|
|
99
|
-
this.configuratorCancel = index
|
|
100
|
-
this._multiSelectionListDataSource = new
|
|
39
|
+
index.registerInstance(this, hostRef);
|
|
40
|
+
this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
|
|
41
|
+
this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
|
|
42
|
+
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
43
|
+
this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
|
|
44
|
+
this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
|
|
45
|
+
this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
|
|
46
|
+
this._multiSelectionListDataSource = new ClientSideExporterProvider.SnkMultiSelectionListDataSource();
|
|
101
47
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
102
48
|
this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
|
|
103
49
|
this._customEditors = new Map();
|
|
@@ -408,8 +354,8 @@ const SnkSimpleCrud = class {
|
|
|
408
354
|
this.processMetadata();
|
|
409
355
|
this.onModeChange();
|
|
410
356
|
this.configDatasource();
|
|
411
|
-
this._rmPrecisionCustomValueFormatter = new
|
|
412
|
-
this._continuousInsertUtils = new
|
|
357
|
+
this._rmPrecisionCustomValueFormatter = new ClientSideExporterProvider.RmPrecisionCustomValueFormatter();
|
|
358
|
+
this._continuousInsertUtils = new ClientSideExporterProvider.ContinuousInsertUtils(this.application, this.resolveResourceID(), this.configName);
|
|
413
359
|
if (this.enableGridInsert) {
|
|
414
360
|
this._continuousInsertUtils.getConfig().then(value => this.enableContinuousInsert = value);
|
|
415
361
|
}
|
|
@@ -680,8 +626,8 @@ const SnkSimpleCrud = class {
|
|
|
680
626
|
}
|
|
681
627
|
getTopTaskBarId() {
|
|
682
628
|
var _a;
|
|
683
|
-
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index.PresentationMode.PRIMARY}` :
|
|
684
|
-
`snkGridTopTaskbar.regular${index.PresentationMode.PRIMARY}`;
|
|
629
|
+
return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index$1.PresentationMode.PRIMARY}` :
|
|
630
|
+
`snkGridTopTaskbar.regular${index$1.PresentationMode.PRIMARY}`;
|
|
685
631
|
}
|
|
686
632
|
async keyDownListener(event) {
|
|
687
633
|
if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
|
|
@@ -744,7 +690,7 @@ const SnkSimpleCrud = class {
|
|
|
744
690
|
if (this._grid == undefined) {
|
|
745
691
|
return;
|
|
746
692
|
}
|
|
747
|
-
const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
|
|
693
|
+
const dataExporterProvider = new ClientSideExporterProvider.ClientSideExporterProvider(this.dataUnit, this._grid);
|
|
748
694
|
index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
|
|
749
695
|
}
|
|
750
696
|
getDataExporterStoreKey() {
|
|
@@ -752,7 +698,7 @@ const SnkSimpleCrud = class {
|
|
|
752
698
|
}
|
|
753
699
|
setGridConfig(config) {
|
|
754
700
|
this.gridConfig = config;
|
|
755
|
-
|
|
701
|
+
ClientSideExporterProvider.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
|
756
702
|
}
|
|
757
703
|
setFormConfig(config, forceUpdate) {
|
|
758
704
|
if (this.formConfig && !forceUpdate)
|
|
@@ -823,7 +769,7 @@ const SnkSimpleCrud = class {
|
|
|
823
769
|
}
|
|
824
770
|
renderTaskbarContent() {
|
|
825
771
|
var _a;
|
|
826
|
-
return (index
|
|
772
|
+
return (index.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall'} ez-padding--small`, dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
|
827
773
|
}
|
|
828
774
|
/* istanbul ignore next */
|
|
829
775
|
render() {
|
|
@@ -831,11 +777,11 @@ const SnkSimpleCrud = class {
|
|
|
831
777
|
if (this.dataUnit == undefined) {
|
|
832
778
|
return;
|
|
833
779
|
}
|
|
834
|
-
return (index
|
|
780
|
+
return (index.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: `ez-box ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section` }, index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
835
781
|
? undefined
|
|
836
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), index
|
|
782
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, this.renderTaskbarContent(), index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, this.renderTaskbarContent(), index.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), index.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
837
783
|
}
|
|
838
|
-
get _element() { return index
|
|
784
|
+
get _element() { return index.getElement(this); }
|
|
839
785
|
static get watchers() { return {
|
|
840
786
|
"resourceID": ["handleResourceIDChanged"],
|
|
841
787
|
"entityName": ["onChangeEntityName"],
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
|
|
8
|
-
const taskbarElements = require('./taskbar-elements-
|
|
9
|
-
const index$1 = require('./index-
|
|
8
|
+
const taskbarElements = require('./taskbar-elements-7e19882d.js');
|
|
9
|
+
const index$1 = require('./index-e3e39724.js');
|
|
10
10
|
require('./index-102ba62d.js');
|
|
11
11
|
|
|
12
12
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";
|
|
@@ -176,7 +176,14 @@ export class SnkApplication {
|
|
|
176
176
|
const allAccess = {};
|
|
177
177
|
allAccess['isSup'] = auths.isSup;
|
|
178
178
|
Object.entries(AutorizationType).forEach((data) => {
|
|
179
|
-
|
|
179
|
+
if (data[1] === AutorizationType.CLONE) {
|
|
180
|
+
const insertPermission = auths.actions[AutorizationType.INSERT] || false;
|
|
181
|
+
const clonePermission = auths.actions[AutorizationType.CLONE] || false;
|
|
182
|
+
allAccess[data[0]] = insertPermission && clonePermission;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
allAccess[data[0]] = auths.actions[data[1]] || false;
|
|
186
|
+
}
|
|
180
187
|
});
|
|
181
188
|
resolve(allAccess);
|
|
182
189
|
}).catch(error => reject(error));
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
39
39
|
--snk-configurator__scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
40
40
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
41
|
-
--snk-configurator__scrollbar--width: var(--space--
|
|
41
|
+
--snk-configurator__scrollbar--width: var(--space--small, 6px);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.snk-configurator {
|
|
@@ -297,15 +297,6 @@ export class SnkCrud {
|
|
|
297
297
|
.bind("F8", handleAddRecord.bind(this), { description: "Adiciona um novo registro.", element: this._element })
|
|
298
298
|
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
|
299
299
|
.bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
|
300
|
-
.bind("ctrl + .", () => {
|
|
301
|
-
if (dataUnit.getSelectionInfo().records.length === 0) {
|
|
302
|
-
return dataUnit.selectFirst();
|
|
303
|
-
}
|
|
304
|
-
return dataUnit.nextRecord();
|
|
305
|
-
}, {
|
|
306
|
-
description: "Avança para o próximo registro.", element: this._element
|
|
307
|
-
})
|
|
308
|
-
.bind("ctrl + ,", dataUnit.previousRecord.bind(dataUnit), { description: "Retorna ao registro anterior.", element: this._element })
|
|
309
300
|
.bind("F5", async () => {
|
|
310
301
|
const currentView = await this._viewStack.getSelectedIndex();
|
|
311
302
|
if (VIEW_MODE.GRID === currentView) {
|
|
@@ -333,8 +324,6 @@ export class SnkCrud {
|
|
|
333
324
|
.unbind("F8")
|
|
334
325
|
.unbind("F9")
|
|
335
326
|
.unbind("ctrl + F9")
|
|
336
|
-
.unbind("ctrl + .")
|
|
337
|
-
.unbind("ctrl + ,")
|
|
338
327
|
.unbind("F5")
|
|
339
328
|
.unbind("Escape");
|
|
340
329
|
}
|
package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js
CHANGED
|
@@ -10,17 +10,11 @@ export default class ClientSideExporterStrategy {
|
|
|
10
10
|
const visibleColumns = getVisibleColumns(columns);
|
|
11
11
|
return visibleColumns;
|
|
12
12
|
}
|
|
13
|
-
async getColumns(resolveProps) {
|
|
14
|
-
var _a;
|
|
15
|
-
if ((_a = getOptionKey(resolveProps === null || resolveProps === void 0 ? void 0 : resolveProps.exportOption)) === null || _a === void 0 ? void 0 : _a.includes("PDF")) {
|
|
16
|
-
return await this.getParsedColumns();
|
|
17
|
-
}
|
|
18
|
-
return await this._provider.getColumnsMetadata();
|
|
19
|
-
}
|
|
20
13
|
async executeExport(resolveProps) {
|
|
14
|
+
var _a;
|
|
21
15
|
const { methodName, gridTitle } = resolveProps;
|
|
22
|
-
const records = await this._provider.getRecords();
|
|
23
|
-
const columns = await this.
|
|
16
|
+
const records = await this._provider.getRecords(resolveProps.type);
|
|
17
|
+
const columns = ((_a = getOptionKey(resolveProps === null || resolveProps === void 0 ? void 0 : resolveProps.exportOption)) === null || _a === void 0 ? void 0 : _a.includes("PDF")) ? await this.getParsedColumns() : await this._provider.getColumnsMetadata();
|
|
24
18
|
const [serviceName, processor] = this.getExecutor(methodName);
|
|
25
19
|
const payload = {
|
|
26
20
|
serviceName,
|
package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js
CHANGED
|
@@ -2,6 +2,7 @@ import { CommonsExporter } from "../interfaces/IExporterProvider";
|
|
|
2
2
|
import { UserInterface } from "@sankhyalabs/core";
|
|
3
3
|
import { getSelectedRecordsIDsInfo as getSelectedIDs } from '../../../lib/utils/GetSelectedRecordsIDsInfo';
|
|
4
4
|
import { DataExporterOption } from "../../../lib/@types";
|
|
5
|
+
import { IExportType } from "../../../lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams";
|
|
5
6
|
export default class ClientSideExporterProvider extends CommonsExporter {
|
|
6
7
|
getSelectedNumber() {
|
|
7
8
|
return this.dataUnit.getSelectionInfo().length;
|
|
@@ -18,13 +19,24 @@ export default class ClientSideExporterProvider extends CommonsExporter {
|
|
|
18
19
|
var _a, _b, _c;
|
|
19
20
|
return (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
20
21
|
}
|
|
21
|
-
async getRecords() {
|
|
22
|
-
if (this.dataUnit.records.length === 0)
|
|
23
|
-
return
|
|
22
|
+
async getRecords(exportType) {
|
|
23
|
+
if (this.dataUnit.records.length === 0)
|
|
24
|
+
return [];
|
|
25
|
+
switch (exportType) {
|
|
26
|
+
case IExportType.ALL:
|
|
27
|
+
return this.dataUnit.getSelectionInfo().getAllRecords();
|
|
28
|
+
case IExportType.SELECTION:
|
|
29
|
+
return this.resolveRecordsFromSelection();
|
|
30
|
+
case IExportType.PAGE:
|
|
31
|
+
return this.dataUnit.records;
|
|
32
|
+
default:
|
|
33
|
+
return this.resolveRecordsFromSelection();
|
|
24
34
|
}
|
|
35
|
+
}
|
|
36
|
+
resolveRecordsFromSelection() {
|
|
25
37
|
const selectionInfo = this.dataUnit.getSelectionInfo();
|
|
26
|
-
const
|
|
27
|
-
return
|
|
38
|
+
const selectionRecords = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? selectionInfo.getAllRecords() : selectionInfo.records;
|
|
39
|
+
return selectionRecords.length ? selectionRecords : this.dataUnit.records;
|
|
28
40
|
}
|
|
29
41
|
getHiddenOptions() {
|
|
30
42
|
return [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApplicationContext, DataType, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
+
import { IExportType } from '../../lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams';
|
|
4
5
|
import { ItemBuilder } from './structure/ItemBuilder';
|
|
5
6
|
import { DataExporterFormat, DataExporterOption, DataExporterType } from '../../lib/@types';
|
|
6
7
|
import { REPORT_LAUNCHER_RESOURCE_ID } from '../../lib/utils/constants';
|
|
@@ -105,7 +106,9 @@ export class SnkDataExporter {
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
getExporterStrategy() {
|
|
108
|
-
return this.provider.getRecords == undefined
|
|
109
|
+
return this.provider.getRecords == undefined
|
|
110
|
+
? new ServerSideExporterStrategy(this.provider)
|
|
111
|
+
: new ClientSideExporterStrategy(this.provider);
|
|
109
112
|
}
|
|
110
113
|
getOptionKey(option) {
|
|
111
114
|
return Object.keys(DataExporterOption)
|
|
@@ -115,12 +118,12 @@ export class SnkDataExporter {
|
|
|
115
118
|
}
|
|
116
119
|
getExportType(option) {
|
|
117
120
|
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF || option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
|
|
118
|
-
return
|
|
121
|
+
return IExportType.ALL;
|
|
119
122
|
}
|
|
120
123
|
if (option === DataExporterOption.EXPORT_PAGE_TO_PDF || option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
|
|
121
|
-
return
|
|
124
|
+
return IExportType.PAGE;
|
|
122
125
|
}
|
|
123
|
-
return
|
|
126
|
+
return IExportType.SELECTION;
|
|
124
127
|
}
|
|
125
128
|
async dispatchExporter(option) {
|
|
126
129
|
var _a, _b, _c;
|
|
@@ -125,7 +125,7 @@ function buildNumber(item) {
|
|
|
125
125
|
const variation = props.variation;
|
|
126
126
|
if (variation === FilterNumberVariation.INTERVAL) {
|
|
127
127
|
const { start, end } = value !== null && value !== void 0 ? value : { start: 0, end: 0 };
|
|
128
|
-
if (start && end) {
|
|
128
|
+
if (!isNaN(start) && !isNaN(end)) {
|
|
129
129
|
return {
|
|
130
130
|
name: id,
|
|
131
131
|
expression: props.intervalExpression.fullfill,
|
|
@@ -135,7 +135,7 @@ function buildNumber(item) {
|
|
|
135
135
|
]
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
if (start) {
|
|
138
|
+
if (!isNaN(start)) {
|
|
139
139
|
return {
|
|
140
140
|
name: id,
|
|
141
141
|
expression: props.intervalExpression.onlystart,
|
|
@@ -144,7 +144,7 @@ function buildNumber(item) {
|
|
|
144
144
|
]
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
if (end) {
|
|
147
|
+
if (!isNaN(end)) {
|
|
148
148
|
return {
|
|
149
149
|
name: id,
|
|
150
150
|
expression: props.intervalExpression.onlyend,
|
|
@@ -19,7 +19,7 @@ export class SnkFilterPeriod {
|
|
|
19
19
|
if (this.getVariation() === FilterNumberVariation.INTERVAL) {
|
|
20
20
|
const start = this._startInterval.value;
|
|
21
21
|
const end = this._endInterval.value;
|
|
22
|
-
this.value = (start || end ? { start, end } : undefined);
|
|
22
|
+
this.value = (!isNaN(start) || !isNaN(end) ? { start, end } : undefined);
|
|
23
23
|
this.valueChanged.emit(this.value);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -27,6 +27,7 @@ export class SnkFilterItem {
|
|
|
27
27
|
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
28
28
|
if (open) {
|
|
29
29
|
this._closeCallback = resolve;
|
|
30
|
+
this._chipElement.blur();
|
|
30
31
|
window.requestAnimationFrame(() => {
|
|
31
32
|
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
|
|
32
33
|
this._popover.show();
|
|
@@ -201,13 +202,13 @@ export class SnkFilterItem {
|
|
|
201
202
|
}
|
|
202
203
|
if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
|
|
203
204
|
const { start, end } = value;
|
|
204
|
-
if (start && end) {
|
|
205
|
+
if (!isNaN(start) && !isNaN(end)) {
|
|
205
206
|
return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
|
|
206
207
|
}
|
|
207
|
-
if (start) {
|
|
208
|
+
if (!isNaN(start)) {
|
|
208
209
|
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
|
|
209
210
|
}
|
|
210
|
-
if (end) {
|
|
211
|
+
if (!isNaN(end)) {
|
|
211
212
|
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
font-family: var(--font-pattern, Arial);
|
|
19
19
|
font-weight: var(--text-weight--large, 600);
|
|
20
20
|
color: var(--color--title-primary, #2B3A54);
|
|
21
|
-
margin-top:
|
|
21
|
+
margin-top: 12px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
:host([data-mode="hidden"]) {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.snk-filter-bar__scroller {
|
|
103
|
-
height: calc(100% + var(--space-extra-small,
|
|
103
|
+
height: calc(100% + var(--space-extra-small, 0px));
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.snk-filter-bar__filter-item-container {
|
|
@@ -484,7 +484,7 @@ export class SnkFilterBar {
|
|
|
484
484
|
if (this.mode !== "regular") {
|
|
485
485
|
return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
|
|
486
486
|
}
|
|
487
|
-
return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
|
487
|
+
return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
|
488
488
|
}
|
|
489
489
|
static get is() { return "snk-filter-bar"; }
|
|
490
490
|
static get encapsulation() { return "scoped"; }
|
|
@@ -32,4 +32,10 @@
|
|
|
32
32
|
|
|
33
33
|
.snk-grid-container__without-shadow {
|
|
34
34
|
--ezgrid__container--shadow: unset;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.snk-grid-container__footer {
|
|
38
|
+
background-color: var(--background--xlight, #FFF);
|
|
39
|
+
border-radius: 0 0 var(--border--radius-medium) var(--border--radius-medium);
|
|
40
|
+
box-shadow: var(--shadow--small);
|
|
35
41
|
}
|
|
@@ -2,7 +2,7 @@ import { h, Fragment, } from '@stencil/core';
|
|
|
2
2
|
import { Action as DUAction, ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
|
|
4
4
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
5
|
-
import { PresentationMode } from '../../lib/@types';
|
|
5
|
+
import { ExporterStrategy, PresentationMode } from '../../lib/@types';
|
|
6
6
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
7
7
|
import store from "../../lib/store";
|
|
8
8
|
import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionListDataSource';
|
|
@@ -12,6 +12,7 @@ import { CrudUtils } from '../../lib';
|
|
|
12
12
|
import RmPrecisionCustomValueFormatter from '../../lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter';
|
|
13
13
|
import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
|
|
14
14
|
import { ContinuousInsertUtils } from '../../lib/utils/ContinuousInsertUtils';
|
|
15
|
+
import ClientSideExporterProvider from '../snk-data-exporter/providers/ClientSideExporterProvider';
|
|
15
16
|
export class SnkGrid {
|
|
16
17
|
constructor() {
|
|
17
18
|
this._customEditors = new Map();
|
|
@@ -76,6 +77,7 @@ export class SnkGrid {
|
|
|
76
77
|
this.autoFocus = true;
|
|
77
78
|
this.enableGridInsert = false;
|
|
78
79
|
this.outlineMode = false;
|
|
80
|
+
this.strategyExporter = ExporterStrategy.SERVER_SIDE;
|
|
79
81
|
}
|
|
80
82
|
reloadConfig() {
|
|
81
83
|
this.loadConfig();
|
|
@@ -211,10 +213,24 @@ export class SnkGrid {
|
|
|
211
213
|
this._gridConfig = config;
|
|
212
214
|
CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
|
|
213
215
|
}
|
|
216
|
+
fixColumNameCharset(columnName) {
|
|
217
|
+
try {
|
|
218
|
+
return decodeURIComponent(escape(columnName));
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
return columnName;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
normalizeGridConfig(config) {
|
|
225
|
+
if (!config)
|
|
226
|
+
return config;
|
|
227
|
+
const columnsMapped = config.columns.map(column => (Object.assign(Object.assign({}, column), { name: this.fixColumNameCharset(column.name) })));
|
|
228
|
+
return Object.assign(Object.assign({}, config), { columns: columnsMapped });
|
|
229
|
+
}
|
|
214
230
|
loadConfig() {
|
|
215
231
|
ConfigStorage.loadGridConfig(this.configName, this.resourceID)
|
|
216
232
|
.then((config) => {
|
|
217
|
-
this.setGridConfig(config);
|
|
233
|
+
this.setGridConfig(this.normalizeGridConfig(config));
|
|
218
234
|
})
|
|
219
235
|
.catch((error) => {
|
|
220
236
|
console.warn(error);
|
|
@@ -226,12 +242,12 @@ export class SnkGrid {
|
|
|
226
242
|
}
|
|
227
243
|
}
|
|
228
244
|
gridConfigChangeHandler(evt) {
|
|
229
|
-
const config = evt.detail;
|
|
245
|
+
const config = this.normalizeGridConfig(evt.detail);
|
|
230
246
|
ConfigStorage.saveGridConfig(config, this.configName, this.resourceID);
|
|
231
247
|
evt.stopPropagation();
|
|
232
248
|
}
|
|
233
249
|
modalConfigChangeHandler(evt) {
|
|
234
|
-
const config = evt.detail;
|
|
250
|
+
const config = this.normalizeGridConfig(evt.detail);
|
|
235
251
|
this._grid.setColumnsState(config.columns)
|
|
236
252
|
.then(() => {
|
|
237
253
|
this.setGridConfig(config);
|
|
@@ -241,7 +257,9 @@ export class SnkGrid {
|
|
|
241
257
|
evt.stopPropagation();
|
|
242
258
|
}
|
|
243
259
|
async dataExporterProviderStore() {
|
|
244
|
-
const dataExporterProvider =
|
|
260
|
+
const dataExporterProvider = this.strategyExporter === ExporterStrategy.SERVER_SIDE
|
|
261
|
+
? new ServerSideExporterProvider(this._dataUnit, this._grid)
|
|
262
|
+
: new ClientSideExporterProvider(this._dataUnit, this._grid);
|
|
245
263
|
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
|
|
246
264
|
}
|
|
247
265
|
addElementID() {
|
|
@@ -467,7 +485,7 @@ export class SnkGrid {
|
|
|
467
485
|
return undefined;
|
|
468
486
|
}
|
|
469
487
|
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--extra-small" }, this._showSnkFilterBar &&
|
|
470
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, 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), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp }), 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, overflowStrategy: 'none' }, 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, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
488
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, 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), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp }), 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, overflowStrategy: 'none' }, 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, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), 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 snk-grid-container__footer" }, 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), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
471
489
|
}
|
|
472
490
|
static get is() { return "snk-grid"; }
|
|
473
491
|
static get encapsulation() { return "scoped"; }
|
|
@@ -985,6 +1003,29 @@ export class SnkGrid {
|
|
|
985
1003
|
"attribute": "outline-mode",
|
|
986
1004
|
"reflect": false,
|
|
987
1005
|
"defaultValue": "false"
|
|
1006
|
+
},
|
|
1007
|
+
"strategyExporter": {
|
|
1008
|
+
"type": "string",
|
|
1009
|
+
"mutable": true,
|
|
1010
|
+
"complexType": {
|
|
1011
|
+
"original": "IExporterStrategyMode",
|
|
1012
|
+
"resolved": "\"ClientSideExporterStrategy\" | \"ServerSideExporterStrategy\"",
|
|
1013
|
+
"references": {
|
|
1014
|
+
"IExporterStrategyMode": {
|
|
1015
|
+
"location": "import",
|
|
1016
|
+
"path": "../snk-data-exporter/interfaces/IRecordID"
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
"required": false,
|
|
1021
|
+
"optional": false,
|
|
1022
|
+
"docs": {
|
|
1023
|
+
"tags": [],
|
|
1024
|
+
"text": "Modo de exporta\u00E7\u00E3o dos dados."
|
|
1025
|
+
},
|
|
1026
|
+
"attribute": "strategy-exporter",
|
|
1027
|
+
"reflect": false,
|
|
1028
|
+
"defaultValue": "ExporterStrategy.SERVER_SIDE"
|
|
988
1029
|
}
|
|
989
1030
|
};
|
|
990
1031
|
}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
54
54
|
--snk-grid-config__scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
55
55
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
56
|
-
--snk-grid-config__scrollbar--width: var(--space--
|
|
56
|
+
--snk-grid-config__scrollbar--width: var(--space--small, 6px);
|
|
57
57
|
|
|
58
58
|
display: grid;
|
|
59
59
|
grid-template-rows: auto 1fr auto;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
/*@doc Define o raio da borda da barra de rolagem do componente.*/
|
|
42
42
|
--snk-pesquisa__scrollbar--border-radius: var(--border--radius-small, 6px);
|
|
43
43
|
/*@doc Define a largura da barra de rolagem do componente.*/
|
|
44
|
-
--snk-pesquisa__scrollbar--width: var(--space--
|
|
44
|
+
--snk-pesquisa__scrollbar--width: var(--space--small, 6px);
|
|
45
45
|
|
|
46
46
|
height: 100%;
|
|
47
47
|
display: flex;
|
|
@@ -35,3 +35,8 @@ export var DataExporterType;
|
|
|
35
35
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
|
36
36
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
|
37
37
|
})(DataExporterType || (DataExporterType = {}));
|
|
38
|
+
export var ExporterStrategy;
|
|
39
|
+
(function (ExporterStrategy) {
|
|
40
|
+
ExporterStrategy["SERVER_SIDE"] = "ServerSideExporterStrategy";
|
|
41
|
+
ExporterStrategy["CLIENT_SIDE"] = "ClientSideExporterStrategy";
|
|
42
|
+
})(ExporterStrategy || (ExporterStrategy = {}));
|