@sankhyalabs/sankhyablocks 2.1.3 → 2.1.5
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/AuthorizationConfig-79ffae4b.js +7 -0
- package/dist/cjs/{form-config-fetcher-2de7c16a.js → ConfigStorage-c112de1d.js} +101 -1
- package/dist/cjs/{SnkMessageBuilder-89482d28.js → SnkMessageBuilder-61f00e7f.js} +33 -5
- package/dist/cjs/{constants-9056ca9e.js → constants-a47a5190.js} +15 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +30 -64
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/{snk-field-config_2.cjs.entry.js → snk-configurator_3.cjs.entry.js} +134 -13
- package/dist/cjs/snk-crud.cjs.entry.js +23 -6
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/{snk-configurator_6.cjs.entry.js → snk-filter-bar_7.cjs.entry.js} +498 -188
- package/dist/cjs/snk-form-config.cjs.entry.js +32 -26
- package/dist/cjs/snk-form.cjs.entry.js +30 -17
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-elements-d762e436.js → taskbar-elements-997af1c9.js} +9 -8
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/snk-application/snk-application.js +3 -2
- package/dist/collection/components/snk-configurator/AuthorizationConfig.js +5 -0
- package/dist/collection/components/snk-configurator/snk-configurator.css +124 -0
- package/dist/collection/components/snk-configurator/snk-configurator.js +126 -181
- package/dist/collection/components/snk-crud/snk-crud.js +23 -5
- package/dist/collection/components/snk-form/snk-form.js +37 -54
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +1 -1
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +48 -29
- package/dist/collection/components/snk-grid/snk-grid.js +69 -20
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.css +166 -0
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +605 -0
- package/dist/collection/components/snk-grid/subcomponents/snk-select-box/snk-select-box.css +9 -0
- package/dist/collection/components/snk-grid/subcomponents/snk-select-box/snk-select-box.js +70 -0
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -8
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +9 -1
- package/dist/collection/lib/configs/ConfigStorage.js +15 -15
- package/dist/collection/lib/message/SnkMessageBuilder.js +5 -3
- package/dist/collection/lib/message/resources/snk-configurator.msg.js +0 -3
- package/dist/collection/lib/message/resources/snk-form.msg.js +3 -0
- package/dist/collection/lib/message/resources/snk-grid.msg.js +26 -0
- package/dist/collection/lib/utils/constants.js +14 -0
- package/dist/components/AuthorizationConfig.js +7 -0
- package/dist/components/{form-config-fetcher.js → ConfigStorage.js} +100 -2
- package/dist/components/SnkMessageBuilder.js +33 -5
- package/dist/components/constants.js +15 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +2 -1
- package/dist/components/snk-application2.js +2 -36
- package/dist/components/snk-configurator2.js +63 -165
- package/dist/components/snk-crud.js +53 -29
- package/dist/components/snk-form-config2.js +27 -21
- package/dist/components/snk-form2.js +33 -32
- package/dist/components/{snk-config-modal.d.ts → snk-grid-config.d.ts} +4 -4
- package/dist/components/snk-grid-config.js +6 -0
- package/dist/components/snk-grid-config2.js +497 -0
- package/dist/components/snk-grid2.js +65 -27
- package/dist/components/snk-select-box.d.ts +11 -0
- package/dist/components/snk-select-box.js +6 -0
- package/dist/components/snk-select-box2.js +38 -0
- package/dist/components/snk-taskbar2.js +19 -22
- package/dist/esm/AuthorizationConfig-dcbd207a.js +7 -0
- package/dist/esm/{form-config-fetcher-96c6c2dc.js → ConfigStorage-99025655.js} +100 -2
- package/dist/esm/{SnkMessageBuilder-a27fc561.js → SnkMessageBuilder-f5ef87df.js} +33 -5
- package/dist/esm/{constants-c6039d3d.js → constants-babe1a08.js} +15 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +3 -37
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/{snk-field-config_2.entry.js → snk-configurator_3.entry.js} +134 -14
- package/dist/esm/snk-crud.entry.js +23 -6
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/{snk-configurator_6.entry.js → snk-filter-bar_7.entry.js} +499 -190
- package/dist/esm/snk-form-config.entry.js +27 -21
- package/dist/esm/snk-form.entry.js +30 -17
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/{taskbar-elements-1092b0b7.js → taskbar-elements-a0a8b106.js} +9 -8
- package/dist/sankhyablocks/p-09720dd1.js +1 -0
- package/dist/sankhyablocks/p-105cd4a8.entry.js +1 -0
- package/dist/sankhyablocks/p-133cf71d.entry.js +1 -0
- package/dist/sankhyablocks/p-341b2ceb.entry.js +1 -0
- package/dist/sankhyablocks/p-395d5e42.entry.js +1 -0
- package/dist/sankhyablocks/{p-8706fe65.entry.js → p-43aff8f5.entry.js} +1 -1
- package/dist/sankhyablocks/p-53f33e9d.entry.js +1 -0
- package/dist/sankhyablocks/p-639b8f6e.entry.js +76 -0
- package/dist/sankhyablocks/{p-a5b26df2.js → p-6673c77c.js} +1 -1
- package/dist/sankhyablocks/p-6ba8f415.js +26 -0
- package/dist/sankhyablocks/{p-2517529d.js → p-877bd6cf.js} +1 -1
- package/dist/sankhyablocks/{p-f37cdeb5.entry.js → p-cd03ea9e.entry.js} +1 -1
- package/dist/sankhyablocks/p-dc36cfbf.js +1 -0
- package/dist/sankhyablocks/{p-92782503.entry.js → p-eb94df0b.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +0 -1
- package/dist/types/components/snk-configurator/AuthorizationConfig.d.ts +4 -0
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +21 -24
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-form/snk-form.d.ts +6 -9
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +7 -3
- package/dist/types/components/snk-grid/snk-grid.d.ts +13 -3
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +66 -0
- package/dist/types/components/snk-grid/subcomponents/snk-select-box/snk-select-box.d.ts +7 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -4
- package/dist/types/components.d.ts +104 -74
- package/dist/types/lib/configs/ConfigStorage.d.ts +3 -3
- package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +0 -1
- package/dist/types/lib/message/resources/snk-grid.msg.d.ts +2 -0
- package/dist/types/lib/utils/constants.d.ts +14 -0
- package/package.json +1 -1
- package/react/components.d.ts +2 -1
- package/react/components.js +2 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/configurableElementsStorage-93459c72.js +0 -20
- package/dist/cjs/snk-config-modal.cjs.entry.js +0 -62
- package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +0 -16
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +0 -122
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +0 -137
- package/dist/components/snk-config-modal.js +0 -6
- package/dist/components/snk-config-modal2.js +0 -91
- package/dist/esm/configurableElementsStorage-cdc144b5.js +0 -18
- package/dist/esm/snk-config-modal.entry.js +0 -58
- package/dist/sankhyablocks/p-361299e8.js +0 -26
- package/dist/sankhyablocks/p-429c5e3f.entry.js +0 -1
- package/dist/sankhyablocks/p-4fab64ec.js +0 -1
- package/dist/sankhyablocks/p-60eef7cd.entry.js +0 -1
- package/dist/sankhyablocks/p-626cf022.entry.js +0 -1
- package/dist/sankhyablocks/p-6511d132.entry.js +0 -1
- package/dist/sankhyablocks/p-8c14bbfb.entry.js +0 -76
- package/dist/sankhyablocks/p-c4ae984b.entry.js +0 -1
- package/dist/sankhyablocks/p-ce7c38a1.entry.js +0 -1
- package/dist/sankhyablocks/p-d50651a3.js +0 -1
- package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +0 -8
- package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +0 -38
|
@@ -1,194 +1,14 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import {
|
|
3
|
-
import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
-
import { C as CONFIG_EVENTS, c as VIEW_MODE } from './constants-c6039d3d.js';
|
|
5
|
-
import { C as ConfigurableElementsStorage } from './configurableElementsStorage-cdc144b5.js';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-e4121713.js';
|
|
2
|
+
import { DataType, ObjectUtils, StringUtils, ErrorException, ApplicationContext, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
|
|
6
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
7
4
|
import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
|
8
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
registerInstance(this, hostRef);
|
|
16
|
-
this.changeViewMode = createEvent(this, "changeViewMode", 7);
|
|
17
|
-
/**
|
|
18
|
-
* Nome do componente que será vinculado ao `data-configurator-parent` para controlar o modal de configurações.
|
|
19
|
-
*/
|
|
20
|
-
this.name = "snkConfigurator";
|
|
21
|
-
/**
|
|
22
|
-
* Define se o campo está habilitado.
|
|
23
|
-
*/
|
|
24
|
-
this.enabled = true;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
28
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
|
29
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
30
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
|
|
31
|
-
*/
|
|
32
|
-
getMessage(key) {
|
|
33
|
-
return this._application.messagesBuilder.getMessage(key, {});
|
|
34
|
-
}
|
|
35
|
-
controlConfigModal(opened) {
|
|
36
|
-
var _a;
|
|
37
|
-
if (this._modal != undefined) {
|
|
38
|
-
this._modal.opened = opened;
|
|
39
|
-
if (this._configModal != undefined) {
|
|
40
|
-
this._configModal.gridMode = ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.offsetParent) != undefined;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
changeConfigModal(evt) {
|
|
45
|
-
const data = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
46
|
-
if (data === null || data === void 0 ? void 0 : data.openConfig) {
|
|
47
|
-
this.controlConfigModal(false);
|
|
48
|
-
this.callShowConfig(data === null || data === void 0 ? void 0 : data.viewMode);
|
|
49
|
-
}
|
|
50
|
-
else if ((data === null || data === void 0 ? void 0 : data.viewMode) === GRID_MODE.index) {
|
|
51
|
-
this.changeViewMode.emit(GRID_MODE.name);
|
|
52
|
-
}
|
|
53
|
-
else if ((data === null || data === void 0 ? void 0 : data.viewMode) === FORM_MODE.index) {
|
|
54
|
-
this.changeViewMode.emit(FORM_MODE.name);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
callShowConfig(viewMode) {
|
|
58
|
-
if (viewMode === GRID_MODE.index) {
|
|
59
|
-
if (this._grid == undefined) {
|
|
60
|
-
this.findGrid();
|
|
61
|
-
}
|
|
62
|
-
if (this._grid != undefined) {
|
|
63
|
-
this._grid.setShowGridConfig(true);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else if (viewMode === FORM_MODE.index) {
|
|
67
|
-
if (this._form == undefined) {
|
|
68
|
-
this.findForm();
|
|
69
|
-
}
|
|
70
|
-
if (this._form != undefined) {
|
|
71
|
-
this._form.setShowFormConfig(true);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
getConfigModal() {
|
|
76
|
-
const modalContainer = document.createElement("ez-modal");
|
|
77
|
-
modalContainer.modalSize = "small";
|
|
78
|
-
modalContainer.opened = false;
|
|
79
|
-
modalContainer.closeEsc = false;
|
|
80
|
-
modalContainer.closeOutsideClick = false;
|
|
81
|
-
modalContainer.dataset.configuratorModal = this.name;
|
|
82
|
-
modalContainer.addEventListener(CONFIG_EVENTS.closeModal, () => {
|
|
83
|
-
this.controlConfigModal(false);
|
|
84
|
-
});
|
|
85
|
-
const modalContent = document.createElement("snk-config-modal");
|
|
86
|
-
modalContent.addEventListener(CONFIG_EVENTS.cancelConfig, () => {
|
|
87
|
-
this.controlConfigModal(false);
|
|
88
|
-
});
|
|
89
|
-
modalContent.addEventListener(CONFIG_EVENTS.changeConfig, (evt) => {
|
|
90
|
-
this.changeConfigModal(evt);
|
|
91
|
-
});
|
|
92
|
-
modalContent.configName = this.configName;
|
|
93
|
-
modalContainer.append(modalContent);
|
|
94
|
-
return modalContainer;
|
|
95
|
-
}
|
|
96
|
-
findConfigModal() {
|
|
97
|
-
let modalContainer = document.body.querySelector(`[data-configurator-modal="${this.name}"]`);
|
|
98
|
-
if (modalContainer == undefined) {
|
|
99
|
-
modalContainer = this.getConfigModal();
|
|
100
|
-
document.body.appendChild(modalContainer);
|
|
101
|
-
}
|
|
102
|
-
this._modal = modalContainer;
|
|
103
|
-
this._configModal = modalContainer.querySelector("snk-config-modal");
|
|
104
|
-
}
|
|
105
|
-
findGrid() {
|
|
106
|
-
if (this._grid != undefined) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this._grid = ConfigurableElementsStorage.getGrid(this.configName);
|
|
110
|
-
if (this._grid != undefined && this._grid.dataset.eventConfigChanged == undefined) {
|
|
111
|
-
this._grid.dataset.eventConfigChanged = "true";
|
|
112
|
-
this._grid.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
|
|
113
|
-
this.saveConfig(evt);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
findForm() {
|
|
118
|
-
if (this._form != undefined) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this._form = ConfigurableElementsStorage.getForm(this.configName);
|
|
122
|
-
if (this._form != undefined && this._form.dataset.eventConfigChanged == undefined) {
|
|
123
|
-
this._form.dataset.eventConfigChanged = "true";
|
|
124
|
-
this._form.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
|
|
125
|
-
this.saveConfig(evt);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
saveConfig(evt) {
|
|
130
|
-
const config = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
131
|
-
if (this._application != undefined && config != undefined) {
|
|
132
|
-
if ((config === null || config === void 0 ? void 0 : config.fields) != undefined) {
|
|
133
|
-
this._application.saveFormConfig(config, this.configName)
|
|
134
|
-
.then((response) => {
|
|
135
|
-
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
136
|
-
this.loadFormConfig(true);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
else if ((config === null || config === void 0 ? void 0 : config.columns) != undefined) {
|
|
141
|
-
this._application.saveGridConfig(config)
|
|
142
|
-
.then((response) => {
|
|
143
|
-
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
144
|
-
this.setGridConfig(response.resource);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
setGridConfig(strConfig) {
|
|
151
|
-
if (this._grid != undefined) {
|
|
152
|
-
const config = ObjectUtils.stringToObject(strConfig);
|
|
153
|
-
this._grid.setConfig(config).then(() => {
|
|
154
|
-
ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
loadGridConfig() {
|
|
159
|
-
if (this._application != undefined && this.configName != undefined && this._grid != undefined) {
|
|
160
|
-
this._application.loadGridConfig(this.configName).then((config) => {
|
|
161
|
-
this._grid.setConfig(config);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
loadFormConfig(showInfoSuccess = false) {
|
|
166
|
-
if (this._application != undefined && this.configName != undefined && this._form != undefined) {
|
|
167
|
-
this._application.loadFormConfig(this.configName).then((config) => {
|
|
168
|
-
this._form.setConfig(config).then(() => {
|
|
169
|
-
if (showInfoSuccess) {
|
|
170
|
-
ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
loadConfig() {
|
|
177
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
178
|
-
this.loadGridConfig();
|
|
179
|
-
this.loadFormConfig();
|
|
180
|
-
}
|
|
181
|
-
componentDidLoad() {
|
|
182
|
-
this.findConfigModal();
|
|
183
|
-
this.findGrid();
|
|
184
|
-
this.findForm();
|
|
185
|
-
this.loadConfig();
|
|
186
|
-
}
|
|
187
|
-
render() {
|
|
188
|
-
return (h("ez-button", { mode: "icon", iconName: "settings-inverted", size: "small", enabled: this.enabled, onClick: () => this.controlConfigModal(true) }));
|
|
189
|
-
}
|
|
190
|
-
get _element() { return getElement(this); }
|
|
191
|
-
};
|
|
6
|
+
import { CheckMode, ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
7
|
+
import { C as ConfigStorage } from './ConfigStorage-99025655.js';
|
|
8
|
+
import { O as ORDER_VALUES } from './constants-babe1a08.js';
|
|
9
|
+
import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
|
|
10
|
+
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-a0a8b106.js';
|
|
11
|
+
import './_commonjsHelpers-9943807e.js';
|
|
192
12
|
|
|
193
13
|
const buildFilter = (item) => {
|
|
194
14
|
switch (item.type) {
|
|
@@ -992,6 +812,488 @@ const SnkFilterModal = class {
|
|
|
992
812
|
}
|
|
993
813
|
};
|
|
994
814
|
|
|
815
|
+
const snkGridConfigCss = ".sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__scrollbar--width:var(--space--medium, 12px);--snk-grid-config__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-grid-config__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__group--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-grid-config-h{width:359px;max-width:359px}}.padding-right--medium.sc-snk-grid-config{padding-right:var(--space--medium)}ez-list.sc-snk-grid-config{height:100%}.height-calc.sc-snk-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-snk-grid-config{display:flex;justify-content:flex-end;width:100%;padding-top:var(--snk-grid-config__footer--padding-top)}.hidden.sc-snk-grid-config{display:none}.tabselector-container.sc-snk-grid-config{padding:var(--snk-grid-config__tabselector-container--padding) 0}.button-close.sc-snk-grid-config{padding-left:var(--snk-grid-config__button-close--padding-left)}.title-container.sc-snk-grid-config{display:flex;justify-content:space-between;align-items:center;width:100%}.title.sc-snk-grid-config{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-grid-config__title--color);font-size:var(--snk-grid-config__title--font-size);font-family:var(--snk-grid-config__title--font-family);font-weight:var(--snk-grid-config__title--font-weight)}.subtitle.sc-snk-grid-config{color:var(--text--primary);font-size:var(--snk-grid-config__subtitle--font-size);font-family:var(--snk-grid-config__subtitle--font-family)}.grid-config__main.sc-snk-grid-config{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-grid-config__scrollbar--background-color-primary) var(--snk-grid-config__scrollbar--background-color-secondary);padding-right:var(--snk-grid-config__main--padding-right)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-track{background-color:var(--snk-grid-config__scrollbar--background-color-secondary)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb{background-color:var(--snk-grid-config__scrollbar--background-color-primary);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar{width:var(--snk-grid-config__scrollbar--width);max-width:var(--snk-grid-config__scrollbar--width);min-width:var(--snk-grid-config__scrollbar--width);background-color:var(--snk-grid-config__scrollbar--background-color-secondary)}.group-name.sc-snk-grid-config{font-family:var(--snk-grid-config__group--font-family);font-size:var(--snk-grid-config__group--font-size);font-weight:var(--snk-grid-config__group--font-weight);padding-bottom:var(--snk-grid-config__group--padding-bottom)}";
|
|
816
|
+
|
|
817
|
+
const EzGridConfig = class {
|
|
818
|
+
constructor(hostRef) {
|
|
819
|
+
registerInstance(this, hostRef);
|
|
820
|
+
this.configChange = createEvent(this, "configChange", 7);
|
|
821
|
+
this.configCancel = createEvent(this, "configCancel", 7);
|
|
822
|
+
this._orderListItems = [];
|
|
823
|
+
this._orderPriorityList = [];
|
|
824
|
+
this._columListItems = [];
|
|
825
|
+
this._selectedIndex = -1;
|
|
826
|
+
this._dataChanged = false;
|
|
827
|
+
this._componenteInternalKey = Date.now();
|
|
828
|
+
/**
|
|
829
|
+
* Aba selecionada das configurações da grade.
|
|
830
|
+
*/
|
|
831
|
+
this.selectedIndex = 0;
|
|
832
|
+
}
|
|
833
|
+
/* Creation Methods */
|
|
834
|
+
async saveConfig(config) {
|
|
835
|
+
var _a;
|
|
836
|
+
if (config == undefined || ((_a = this._application) === null || _a === void 0 ? void 0 : _a.configName) == undefined) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
ConfigStorage.saveGridConfig(config, this._application.configName)
|
|
840
|
+
.then((response) => {
|
|
841
|
+
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
842
|
+
ApplicationUtils.info(this.getMessage("snkGridConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
|
843
|
+
this.configChange.emit(config);
|
|
844
|
+
this._orderList.clearHistory();
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
850
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
851
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
852
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-grid.msg.ts"
|
|
853
|
+
*/
|
|
854
|
+
getMessage(key, params) {
|
|
855
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
856
|
+
}
|
|
857
|
+
createOrderList() {
|
|
858
|
+
let newList = [];
|
|
859
|
+
this.columns.filter(col => { var _a; return StringUtils.getBooleanValue((_a = col === null || col === void 0 ? void 0 : col.props) === null || _a === void 0 ? void 0 : _a.get("sortable"), true); }).forEach((column) => {
|
|
860
|
+
var _a;
|
|
861
|
+
let configItem = (_a = this.config) === null || _a === void 0 ? void 0 : _a.columns.find((item) => item.name === column.name);
|
|
862
|
+
let item = { name: column.name, label: column.label };
|
|
863
|
+
if (configItem) {
|
|
864
|
+
item['orderIndex'] = configItem.orderIndex;
|
|
865
|
+
item['ascending'] = configItem.ascending;
|
|
866
|
+
}
|
|
867
|
+
if (!column.hidden) {
|
|
868
|
+
newList.push(item);
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
newList.sort((a, b) => {
|
|
872
|
+
//OS dois tem order index 0 e pelo menos um deles tem orientação de ordenação.
|
|
873
|
+
if (a.orderIndex == 0 && b.orderIndex == 0 && (a.ascending != undefined || b.ascending != undefined)) {
|
|
874
|
+
if (a.ascending != undefined)
|
|
875
|
+
return -1;
|
|
876
|
+
if (b.ascending != undefined)
|
|
877
|
+
return 1;
|
|
878
|
+
return 0;
|
|
879
|
+
//Pelo menos um deles tem order index diferente de 0 e os dois tem orientação de ordenação.
|
|
880
|
+
}
|
|
881
|
+
else if (a.ascending != undefined && b.ascending != undefined) {
|
|
882
|
+
return (a.orderIndex - b.orderIndex);
|
|
883
|
+
//Pelo menos um deles tem order index diferente de 0 e pelo menos um deles tem orientação de ordenação.
|
|
884
|
+
}
|
|
885
|
+
else if (a.ascending != undefined || b.ascending != undefined) {
|
|
886
|
+
if (a.ascending != undefined)
|
|
887
|
+
return -1;
|
|
888
|
+
if (b.ascending != undefined)
|
|
889
|
+
return 1;
|
|
890
|
+
return 0;
|
|
891
|
+
}
|
|
892
|
+
return (a.orderIndex - b.orderIndex);
|
|
893
|
+
});
|
|
894
|
+
this._orderListItems = newList;
|
|
895
|
+
}
|
|
896
|
+
createColumnList() {
|
|
897
|
+
let visibleGroup = {
|
|
898
|
+
group: this.getMessage("snkGridConfig.group.visible"),
|
|
899
|
+
items: [],
|
|
900
|
+
};
|
|
901
|
+
let hiddenGroup = {
|
|
902
|
+
group: this.getMessage("snkGridConfig.group.hidden"),
|
|
903
|
+
items: [],
|
|
904
|
+
sort: ORDER_VALUES.asc.value
|
|
905
|
+
};
|
|
906
|
+
this.columns.forEach((column) => {
|
|
907
|
+
let item = { label: column.label };
|
|
908
|
+
if (column.hidden) {
|
|
909
|
+
hiddenGroup.items.push(item);
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
visibleGroup.items.push(item);
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
this._columListItems = [visibleGroup, hiddenGroup];
|
|
916
|
+
}
|
|
917
|
+
buildColumnListSlot(item, group) {
|
|
918
|
+
return (h("div", null, h("ez-check", { mode: 'switch', id: 'switch' + ((item === null || item === void 0 ? void 0 : item.label) || '') + ((group === null || group === void 0 ? void 0 : group.group) || ''), value: group.group === this.getMessage("snkGridConfig.group.visible"), onEzChange: (evt) => { this.switchColumnGroup(evt, item); } })));
|
|
919
|
+
}
|
|
920
|
+
buildOrderListSlot(item) {
|
|
921
|
+
let selectedOption = ORDER_VALUES.none.value;
|
|
922
|
+
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
923
|
+
selectedOption = item.ascending == true ? ORDER_VALUES.asc.value : ORDER_VALUES.desc.value;
|
|
924
|
+
}
|
|
925
|
+
return (h("div", null, h("snk-select-box", { selectedOption: selectedOption, key: 'snk-select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (evt) => { evt.stopPropagation(); this.updateOrder(evt.detail, item.label); } })));
|
|
926
|
+
}
|
|
927
|
+
updateOrder(sortOrder, updatedItemLabel) {
|
|
928
|
+
var _a;
|
|
929
|
+
this._dataChanged = true;
|
|
930
|
+
let newList = [...this.columns];
|
|
931
|
+
let newItem = newList.find((item) => item.label === updatedItemLabel);
|
|
932
|
+
if (newItem) {
|
|
933
|
+
newItem.sort = sortOrder.value === ORDER_VALUES.none.value ? undefined : sortOrder.value;
|
|
934
|
+
}
|
|
935
|
+
let orderArray;
|
|
936
|
+
if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
937
|
+
this._orderPriorityList.find((item) => item.label === newItem.label).sort = sortOrder;
|
|
938
|
+
this._orderPriorityList.filter((item) => item.sort).map((item, index) => {
|
|
939
|
+
if (item.label === newItem.label) {
|
|
940
|
+
newItem.sortIndex = index;
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
orderArray = newList.filter((item) => item.sort && item.hidden !== true)
|
|
946
|
+
.map((item, index) => {
|
|
947
|
+
return { label: item.label, orderIndex: index };
|
|
948
|
+
});
|
|
949
|
+
orderArray.forEach((element) => {
|
|
950
|
+
newList.find((item) => item.label === element.label).sortIndex = element.orderIndex;
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
this.columns = newList;
|
|
954
|
+
}
|
|
955
|
+
/* Actions Methods */
|
|
956
|
+
switchColumnGroup(evt, switchedItem) {
|
|
957
|
+
evt.stopPropagation();
|
|
958
|
+
let newList = [...this._columListItems];
|
|
959
|
+
this._dataChanged = true;
|
|
960
|
+
if (evt.detail === true) {
|
|
961
|
+
let hiddenGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.hidden"));
|
|
962
|
+
let index = hiddenGroup.items.findIndex((item) => item.label === switchedItem.label);
|
|
963
|
+
if (index >= 0) {
|
|
964
|
+
hiddenGroup.items.splice(index, 1);
|
|
965
|
+
}
|
|
966
|
+
let visibleGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"));
|
|
967
|
+
visibleGroup.items.push(switchedItem);
|
|
968
|
+
this._columListItems = newList;
|
|
969
|
+
this.createOrderList();
|
|
970
|
+
}
|
|
971
|
+
else if (evt.detail === false) {
|
|
972
|
+
let visibleGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"));
|
|
973
|
+
let index = visibleGroup.items.findIndex((item) => item.label === switchedItem.label);
|
|
974
|
+
if (index >= 0) {
|
|
975
|
+
visibleGroup.items.splice(index, 1);
|
|
976
|
+
}
|
|
977
|
+
let hiddenGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.hidden"));
|
|
978
|
+
hiddenGroup.items.push(switchedItem);
|
|
979
|
+
this._columListItems = newList;
|
|
980
|
+
this.createOrderList();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
finish() {
|
|
984
|
+
if (!this._dataChanged) {
|
|
985
|
+
this.closeConfig();
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
let newColumnList = [];
|
|
989
|
+
this._columListItems.forEach((group) => {
|
|
990
|
+
group.items.forEach((item) => {
|
|
991
|
+
const baseColumn = this.columns.find((column) => column.label === item.label);
|
|
992
|
+
let newColumnItem = Object.assign({}, baseColumn);
|
|
993
|
+
if (group.group === this.getMessage("snkGridConfig.group.hidden")) {
|
|
994
|
+
newColumnItem.hidden = true;
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
newColumnItem.hidden = false;
|
|
998
|
+
}
|
|
999
|
+
newColumnList.push(newColumnItem);
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
this.columns = newColumnList;
|
|
1003
|
+
this._dataChanged = false;
|
|
1004
|
+
this.closeConfig();
|
|
1005
|
+
this.save();
|
|
1006
|
+
}
|
|
1007
|
+
save() {
|
|
1008
|
+
var _a;
|
|
1009
|
+
let _newConfig;
|
|
1010
|
+
if (this.config) {
|
|
1011
|
+
_newConfig = this.config;
|
|
1012
|
+
}
|
|
1013
|
+
else {
|
|
1014
|
+
_newConfig = this.createConfigFromState(this.columns);
|
|
1015
|
+
}
|
|
1016
|
+
let _newColumnConfigList = [];
|
|
1017
|
+
let orderArray;
|
|
1018
|
+
if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1019
|
+
orderArray = this.columns.filter((item) => item.sort && item.hidden !== true)
|
|
1020
|
+
.map((item) => {
|
|
1021
|
+
return { label: item.label, orderIndex: 0 };
|
|
1022
|
+
});
|
|
1023
|
+
let indexCount = 0;
|
|
1024
|
+
let newOrderArray = [];
|
|
1025
|
+
this._orderPriorityList.forEach((orderPriorityItem) => {
|
|
1026
|
+
let item = orderArray.find((column) => column.label === orderPriorityItem.label);
|
|
1027
|
+
if (item) {
|
|
1028
|
+
item.orderIndex = indexCount;
|
|
1029
|
+
newOrderArray.push(item);
|
|
1030
|
+
indexCount++;
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
if (newOrderArray.length > 0) {
|
|
1034
|
+
orderArray = newOrderArray;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
1038
|
+
const column = this.columns[i];
|
|
1039
|
+
let _newColumnConfig = _newConfig.columns.find((_newColumnConfig) => column.name === _newColumnConfig.name);
|
|
1040
|
+
if (column.hidden === true && _newColumnConfig) {
|
|
1041
|
+
continue;
|
|
1042
|
+
}
|
|
1043
|
+
if (_newColumnConfig) {
|
|
1044
|
+
_newColumnConfig.width = column.width;
|
|
1045
|
+
}
|
|
1046
|
+
else if (column.hidden === false) {
|
|
1047
|
+
_newColumnConfig = { name: column.name, width: column.width, orderIndex: 0 };
|
|
1048
|
+
}
|
|
1049
|
+
if (_newColumnConfig) {
|
|
1050
|
+
if (column.sort) {
|
|
1051
|
+
_newColumnConfig.ascending = column.sort.toUpperCase() === ORDER_VALUES.asc.value ? true : false;
|
|
1052
|
+
if (orderArray) {
|
|
1053
|
+
adjustPriorityOrder(column, _newColumnConfig);
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
_newColumnConfig.orderIndex = column.sortIndex;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
delete _newColumnConfig.ascending;
|
|
1061
|
+
_newColumnConfig.orderIndex = 0;
|
|
1062
|
+
}
|
|
1063
|
+
_newColumnConfigList.push(_newColumnConfig);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
_newConfig.columns = _newColumnConfigList;
|
|
1067
|
+
this.saveConfig(_newConfig);
|
|
1068
|
+
function adjustPriorityOrder(column, _newColumnConfig) {
|
|
1069
|
+
if (orderArray) {
|
|
1070
|
+
let orderItem = orderArray.find((item) => item.label === column.label);
|
|
1071
|
+
if (orderItem) {
|
|
1072
|
+
_newColumnConfig.orderIndex = orderItem.orderIndex;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
createConfigFromState(state) {
|
|
1078
|
+
let newConfig = { columns: [] };
|
|
1079
|
+
state.forEach((columnState) => {
|
|
1080
|
+
if (!columnState.hidden) {
|
|
1081
|
+
let newConfigColumn = { name: columnState.name };
|
|
1082
|
+
if (columnState.width) {
|
|
1083
|
+
newConfigColumn['width'] = columnState.width;
|
|
1084
|
+
}
|
|
1085
|
+
if (columnState.sort) {
|
|
1086
|
+
newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === ORDER_VALUES.asc.value);
|
|
1087
|
+
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
newConfigColumn['orderIndex'] = 0;
|
|
1091
|
+
}
|
|
1092
|
+
if (newConfigColumn) {
|
|
1093
|
+
newConfig.columns.push(newConfigColumn);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
return newConfig;
|
|
1098
|
+
}
|
|
1099
|
+
async locateColumn(evt, searchingText) {
|
|
1100
|
+
var _a;
|
|
1101
|
+
const hitEnter = evt.key === "Enter";
|
|
1102
|
+
if (!searchingText) {
|
|
1103
|
+
searchingText = (_a = evt.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
|
|
1104
|
+
}
|
|
1105
|
+
let newSelected = -1;
|
|
1106
|
+
if (this.selectedIndex === 1) {
|
|
1107
|
+
if (searchingText) {
|
|
1108
|
+
const matchedIndexes = [];
|
|
1109
|
+
let orderListDatasource;
|
|
1110
|
+
await this._orderList.getList().then((listGroup) => {
|
|
1111
|
+
orderListDatasource = listGroup;
|
|
1112
|
+
orderListDatasource.forEach((column, index) => {
|
|
1113
|
+
if (this.compareWords(column, searchingText)) {
|
|
1114
|
+
matchedIndexes.push(index);
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
});
|
|
1118
|
+
if (matchedIndexes.length > 0) {
|
|
1119
|
+
if (hitEnter) {
|
|
1120
|
+
for (let j = 0; j < matchedIndexes.length; j++) {
|
|
1121
|
+
if (matchedIndexes[j] > this._selectedIndex) {
|
|
1122
|
+
newSelected = matchedIndexes[j];
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
if (newSelected === -1) {
|
|
1128
|
+
newSelected = matchedIndexes[0];
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
this._selectedIndex = newSelected;
|
|
1132
|
+
let selectedColumn;
|
|
1133
|
+
selectedColumn = orderListDatasource[newSelected];
|
|
1134
|
+
if (selectedColumn) {
|
|
1135
|
+
this._orderList.setSelection({ label: selectedColumn.label }, true);
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
this._orderList.setSelection(undefined);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
this._orderList.setSelection(undefined);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
else {
|
|
1146
|
+
if (searchingText) {
|
|
1147
|
+
const matchedIndexes = [];
|
|
1148
|
+
this.columns.forEach((column, index) => {
|
|
1149
|
+
if (this.compareWords(column, searchingText)) {
|
|
1150
|
+
matchedIndexes.push(index);
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
if (matchedIndexes.length > 0) {
|
|
1154
|
+
if (hitEnter) {
|
|
1155
|
+
for (let j = 0; j < matchedIndexes.length; j++) {
|
|
1156
|
+
if (matchedIndexes[j] > this._selectedIndex) {
|
|
1157
|
+
newSelected = matchedIndexes[j];
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (newSelected === -1) {
|
|
1163
|
+
newSelected = matchedIndexes[0];
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
this._selectedIndex = newSelected;
|
|
1167
|
+
let selectedColumn = this.columns[newSelected];
|
|
1168
|
+
if (selectedColumn) {
|
|
1169
|
+
this._columnList.setSelection({ label: selectedColumn.label }, true);
|
|
1170
|
+
}
|
|
1171
|
+
else {
|
|
1172
|
+
this._columnList.setSelection(undefined);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
else {
|
|
1176
|
+
this._columnList.setSelection(undefined);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
compareWords(column, searchingText) {
|
|
1181
|
+
if (StringUtils.replaceAccentuatedChars(column.label).indexOf(StringUtils.replaceAccentuatedChars(searchingText)) > -1) {
|
|
1182
|
+
return true;
|
|
1183
|
+
}
|
|
1184
|
+
return false;
|
|
1185
|
+
}
|
|
1186
|
+
getColumnNames() {
|
|
1187
|
+
const listNames = [];
|
|
1188
|
+
listNames.push(this.getMessage("snkGridConfig.tab.columns"));
|
|
1189
|
+
listNames.push(this.getMessage("snkGridConfig.tab.lineOrdering"));
|
|
1190
|
+
return listNames.join(',');
|
|
1191
|
+
}
|
|
1192
|
+
closeConfig() {
|
|
1193
|
+
this._orderList.scrollToTop();
|
|
1194
|
+
this._columnList.scrollToTop();
|
|
1195
|
+
this._searchElement.value = "";
|
|
1196
|
+
if (this._dataChanged) {
|
|
1197
|
+
let options = {
|
|
1198
|
+
canClose: false,
|
|
1199
|
+
labelCancel: this.getMessage("snkGridConfig.confirm.cancel"),
|
|
1200
|
+
labelConfirm: this.getMessage("snkGridConfig.confirm.save"),
|
|
1201
|
+
btnConfirmDanger: false
|
|
1202
|
+
};
|
|
1203
|
+
ApplicationUtils.confirm(this.getMessage("snkGridConfig.confirm.alert"), this.getMessage("snkGridConfig.confirm.msgCancel"), null, DialogType.WARN, options)
|
|
1204
|
+
.then((response) => {
|
|
1205
|
+
if (!response) {
|
|
1206
|
+
this._dataChanged = false;
|
|
1207
|
+
this.configCancel.emit();
|
|
1208
|
+
this._orderList.clearHistory();
|
|
1209
|
+
this._componenteInternalKey = Date.now();
|
|
1210
|
+
}
|
|
1211
|
+
else {
|
|
1212
|
+
this.finish();
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
else {
|
|
1217
|
+
this.configCancel.emit();
|
|
1218
|
+
this._orderList.clearHistory();
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
/* Handlers */
|
|
1222
|
+
handleTabChange(tab) {
|
|
1223
|
+
if ((tab === null || tab === void 0 ? void 0 : tab.index) != undefined) {
|
|
1224
|
+
if (this.selectedIndex !== tab.index) {
|
|
1225
|
+
if (tab.index === 0) {
|
|
1226
|
+
this._orderList.scrollToTop();
|
|
1227
|
+
}
|
|
1228
|
+
else if (tab.index === 1) {
|
|
1229
|
+
this._columnList.scrollToTop();
|
|
1230
|
+
}
|
|
1231
|
+
this._searchElement.value = "";
|
|
1232
|
+
}
|
|
1233
|
+
if (tab.index === 1) {
|
|
1234
|
+
this.createOrderList();
|
|
1235
|
+
}
|
|
1236
|
+
this.selectedIndex = tab.index;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
handleColumnListChange(evt) {
|
|
1240
|
+
var _a;
|
|
1241
|
+
if (evt.detail) {
|
|
1242
|
+
let visibleItems = (_a = evt.detail.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"))) === null || _a === void 0 ? void 0 : _a.items;
|
|
1243
|
+
if (visibleItems) {
|
|
1244
|
+
this._dataChanged = true;
|
|
1245
|
+
this._orderListItems = visibleItems;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
handleOrderListChange(evt) {
|
|
1250
|
+
if (evt.detail) {
|
|
1251
|
+
let orderPriorityList = evt.detail;
|
|
1252
|
+
if (orderPriorityList) {
|
|
1253
|
+
this._dataChanged = true;
|
|
1254
|
+
this._orderPriorityList = orderPriorityList;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
componentWillRender() {
|
|
1259
|
+
var _a;
|
|
1260
|
+
if (((_a = this.columns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1261
|
+
this.createColumnList();
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
componentDidRender() {
|
|
1265
|
+
var _a;
|
|
1266
|
+
if (((_a = this.columns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1267
|
+
this.locateColumn(new KeyboardEvent("arrow-right", { key: "ArrowRight" }), this._searchElement.value);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
componentWillLoad() {
|
|
1271
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
1272
|
+
}
|
|
1273
|
+
render() {
|
|
1274
|
+
return (h(Host, null, h("div", { class: "grid-config__header" }, h("div", { class: "title-container" }, h("div", { class: "" }, h("label", { class: "title" }, this.getMessage("snkGridConfig.gridConfiguration")), h("label", { class: "subtitle" }, this.getMessage("snkGridConfig.columnVisibilityOrder"))), h("div", { class: "button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "tabselector-container" }, h("ez-tabselector", { selectedIndex: this.selectedIndex, onEzChange: (evt) => { this.handleTabChange(evt.detail); }, tabs: this.getColumnNames() })), h("div", null, h("ez-text-input", { ref: (el) => this._searchElement = el, label: this.getMessage("snkGridConfig.findColumn"), onKeyUp: (evt) => this.locateColumn(evt) }, h("ez-icon", { slot: "leftIcon", size: "medium", iconName: "search" })))), h("div", { class: "grid-config__main" }, h("ez-list", { ref: (el) => this._columnList = el, class: this.selectedIndex === 0 ? "" : "hidden", dataSource: this._columListItems, onEzChange: (evt) => this.handleColumnListChange(evt), ezDraggable: true, ezSelectable: true, itemSlotBuilder: (item, group) => this.buildColumnListSlot(item, group), useGroups: true }), h("div", { class: this.selectedIndex === 1 ? "group-name" : "hidden" }, this.getMessage("snkGridConfig.info.sortingSequence")), h("ez-list", { ref: (el) => this._orderList = el, class: this.selectedIndex === 1 ? "height-calc" : "hidden", dataSource: this._orderListItems, ezSelectable: true, onEzChange: (evt) => this.handleOrderListChange(evt), ezDraggable: true, itemSlotBuilder: (item) => this.buildOrderListSlot(item) })), h("div", { class: "grid-config__footer" }, h("ez-button", { class: "padding-right--medium", label: this.getMessage("snkGridConfig.cancel"), onClick: () => this.closeConfig() }), h("ez-button", { label: this.getMessage("snkGridConfig.complete"), class: "ez-button--primary", onClick: () => this.finish() }))));
|
|
1275
|
+
}
|
|
1276
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
1277
|
+
};
|
|
1278
|
+
EzGridConfig.style = snkGridConfigCss;
|
|
1279
|
+
|
|
1280
|
+
const snkSelectBoxCss = "ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";
|
|
1281
|
+
|
|
1282
|
+
const SelectBox = class {
|
|
1283
|
+
constructor(hostRef) {
|
|
1284
|
+
registerInstance(this, hostRef);
|
|
1285
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
1286
|
+
this.selectedOption = ORDER_VALUES.none;
|
|
1287
|
+
}
|
|
1288
|
+
render() {
|
|
1289
|
+
return (h("ez-combo-box", { class: "grid-config-combo ez-input--inverted", label: "", suppressSearch: true, value: this.selectedOption, enabled: true, canShowError: false, suppressEmptyOption: true }, Object.keys(ORDER_VALUES).map((key) => {
|
|
1290
|
+
return h("option", { value: ORDER_VALUES[key].value }, ORDER_VALUES[key].label);
|
|
1291
|
+
})));
|
|
1292
|
+
}
|
|
1293
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
1294
|
+
};
|
|
1295
|
+
SelectBox.style = snkSelectBoxCss;
|
|
1296
|
+
|
|
995
1297
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
|
996
1298
|
|
|
997
1299
|
const SnkTaskbar = class {
|
|
@@ -1032,6 +1334,13 @@ const SnkTaskbar = class {
|
|
|
1032
1334
|
return elements;
|
|
1033
1335
|
}
|
|
1034
1336
|
isAllowed(buttonName) {
|
|
1337
|
+
if (buttonName === AuthorizationElements.CONFIGURATOR) {
|
|
1338
|
+
return this._permissions
|
|
1339
|
+
? this._permissions.isSup
|
|
1340
|
+
|| this._permissions[AuthorizationConfig.CONFIG_GRID]
|
|
1341
|
+
|| this._permissions[AuthorizationConfig.CONFIG]
|
|
1342
|
+
: false;
|
|
1343
|
+
}
|
|
1035
1344
|
if (AuthorizationElements[buttonName]) {
|
|
1036
1345
|
return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
|
|
1037
1346
|
}
|
|
@@ -1096,7 +1405,7 @@ const SnkTaskbar = class {
|
|
|
1096
1405
|
className += "ez-padding-left--medium";
|
|
1097
1406
|
}
|
|
1098
1407
|
if (TaskbarElement[def.toString()]) {
|
|
1099
|
-
return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList
|
|
1408
|
+
return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
1100
1409
|
}
|
|
1101
1410
|
else {
|
|
1102
1411
|
return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
@@ -1164,4 +1473,4 @@ const SnkTaskbar = class {
|
|
|
1164
1473
|
};
|
|
1165
1474
|
SnkTaskbar.style = snkTaskbarCss;
|
|
1166
1475
|
|
|
1167
|
-
export {
|
|
1476
|
+
export { SnkFilterBar as snk_filter_bar, SnkFilterItem as snk_filter_item, SnkFilterList as snk_filter_list, SnkFilterModal as snk_filter_modal, EzGridConfig as snk_grid_config, SelectBox as snk_select_box, SnkTaskbar as snk_taskbar };
|