@sankhyalabs/sankhyablocks 2.1.2 → 2.1.4
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 +32 -65
- 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} +528 -198
- package/dist/cjs/snk-form-config.cjs.entry.js +30 -24
- 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-90350a55.js → taskbar-elements-a0b857c0.js} +5 -9
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/snk-application/snk-application.js +4 -3
- 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.js +47 -28
- 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 +5 -9
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +39 -11
- package/dist/collection/lib/configs/ConfigStorage.js +15 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -0
- 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 +4 -37
- package/dist/components/snk-configurator2.js +63 -165
- package/dist/components/snk-crud.js +53 -29
- package/dist/components/snk-form-config2.js +25 -19
- 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 +45 -33
- 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 +5 -38
- 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} +529 -200
- package/dist/esm/snk-form-config.entry.js +25 -19
- package/dist/esm/snk-form.entry.js +30 -17
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/{taskbar-elements-0f41cd77.js → taskbar-elements-4d6584cd.js} +5 -9
- package/dist/sankhyablocks/p-105cd4a8.entry.js +1 -0
- package/dist/sankhyablocks/p-4131d41e.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-87896198.entry.js +1 -0
- package/dist/sankhyablocks/p-bd6d4a83.js +1 -0
- package/dist/sankhyablocks/p-cae38f51.entry.js +1 -0
- 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/snk-taskbar/snk-taskbar.d.ts +3 -1
- 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-599846fb.entry.js +0 -75
- package/dist/sankhyablocks/p-59d8c47a.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-cb8d71ba.entry.js +0 -1
- package/dist/sankhyablocks/p-ce7c38a1.entry.js +0 -1
- package/dist/sankhyablocks/p-d50651a3.js +0 -1
- package/dist/sankhyablocks/p-e8591491.entry.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,9 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { DateUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
-
import { C as ConfigurableElementsStorage, d as defineCustomElement$7 } from './snk-config-modal2.js';
|
|
4
3
|
import { T as TaskbarProcessor } from './taskbar-processor.js';
|
|
5
|
-
import {
|
|
6
|
-
import { d as defineCustomElement$5 } from './snk-
|
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
|
+
import { d as defineCustomElement$5 } from './snk-config-options2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './snk-field-config2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './snk-form-config2.js';
|
|
9
8
|
import { d as defineCustomElement$2 } from './snk-tab-config2.js';
|
|
@@ -17,7 +16,6 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
17
16
|
this.__registerHost();
|
|
18
17
|
this.exit = createEvent(this, "exit", 7);
|
|
19
18
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
20
|
-
this.configChanged = createEvent(this, "configChanged", 7);
|
|
21
19
|
this._renderTimer = 500;
|
|
22
20
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
23
21
|
"snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "CONFIGURATOR", "INSERT"],
|
|
@@ -28,21 +26,30 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
28
26
|
this._showFormConfig = false;
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
|
-
* Método responsável em abrir
|
|
29
|
+
* Método responsável em abrir o modal de configurações do form.
|
|
32
30
|
*/
|
|
33
|
-
async
|
|
34
|
-
this._showFormConfig =
|
|
31
|
+
async showConfig() {
|
|
32
|
+
this._showFormConfig = true;
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
37
|
-
* Método responsável
|
|
35
|
+
* Método responsável em fechar o modal de configurações do form.
|
|
38
36
|
*/
|
|
39
|
-
async
|
|
40
|
-
this.
|
|
41
|
-
if (!this.loadConfig(config)) {
|
|
42
|
-
this.loadInsertionConfig();
|
|
43
|
-
}
|
|
37
|
+
async hideConfig() {
|
|
38
|
+
this._showFormConfig = false;
|
|
44
39
|
}
|
|
45
|
-
loadConfig(
|
|
40
|
+
loadConfig() {
|
|
41
|
+
ConfigStorage.get()
|
|
42
|
+
.loadFormConfig(this.configName)
|
|
43
|
+
.then((config) => {
|
|
44
|
+
if (!this.setConfig(config)) {
|
|
45
|
+
this.loadInsertionConfig();
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
console.warn(error);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
setConfig(config) {
|
|
46
53
|
if ((config === null || config === void 0 ? void 0 : config.fields) == undefined) {
|
|
47
54
|
return false;
|
|
48
55
|
}
|
|
@@ -120,7 +127,13 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
127
|
return ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) ? this._dataState.selectedRecords[0] : undefined;
|
|
121
128
|
}
|
|
122
129
|
changeConfig(config) {
|
|
123
|
-
this.
|
|
130
|
+
this._editionFormConfig = {};
|
|
131
|
+
if (!this.setConfig(config)) {
|
|
132
|
+
this.loadInsertionConfig();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
closeConfig() {
|
|
136
|
+
this.hideConfig();
|
|
124
137
|
}
|
|
125
138
|
getDisabledButtons() {
|
|
126
139
|
const disabled = [];
|
|
@@ -132,9 +145,6 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
132
145
|
}
|
|
133
146
|
return disabled;
|
|
134
147
|
}
|
|
135
|
-
componentDidRender() {
|
|
136
|
-
ConfigurableElementsStorage.setForm(this.configName, this._element);
|
|
137
|
-
}
|
|
138
148
|
componentWillLoad() {
|
|
139
149
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
140
150
|
let parent = this._element.parentElement;
|
|
@@ -159,6 +169,7 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
159
169
|
}
|
|
160
170
|
parent = parent.parentElement;
|
|
161
171
|
}
|
|
172
|
+
this.loadConfig();
|
|
162
173
|
}
|
|
163
174
|
componentWillRender() {
|
|
164
175
|
var _a;
|
|
@@ -178,7 +189,7 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
178
189
|
return undefined;
|
|
179
190
|
}
|
|
180
191
|
return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
181
|
-
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(),
|
|
192
|
+
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
182
193
|
}
|
|
183
194
|
get _element() { return this; }
|
|
184
195
|
static get style() { return snkFormCss; }
|
|
@@ -192,31 +203,21 @@ const SnkForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
192
203
|
"_editionFormConfig": [32],
|
|
193
204
|
"_insertionFormConfig": [32],
|
|
194
205
|
"_showFormConfig": [32],
|
|
195
|
-
"
|
|
196
|
-
"
|
|
206
|
+
"showConfig": [64],
|
|
207
|
+
"hideConfig": [64]
|
|
197
208
|
}]);
|
|
198
209
|
function defineCustomElement() {
|
|
199
210
|
if (typeof customElements === "undefined") {
|
|
200
211
|
return;
|
|
201
212
|
}
|
|
202
|
-
const components = ["snk-form", "snk-config-
|
|
213
|
+
const components = ["snk-form", "snk-config-options", "snk-field-config", "snk-form-config", "snk-tab-config", "snk-taskbar"];
|
|
203
214
|
components.forEach(tagName => { switch (tagName) {
|
|
204
215
|
case "snk-form":
|
|
205
216
|
if (!customElements.get(tagName)) {
|
|
206
217
|
customElements.define(tagName, SnkForm);
|
|
207
218
|
}
|
|
208
219
|
break;
|
|
209
|
-
case "snk-config-modal":
|
|
210
|
-
if (!customElements.get(tagName)) {
|
|
211
|
-
defineCustomElement$7();
|
|
212
|
-
}
|
|
213
|
-
break;
|
|
214
220
|
case "snk-config-options":
|
|
215
|
-
if (!customElements.get(tagName)) {
|
|
216
|
-
defineCustomElement$6();
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
case "snk-configurator":
|
|
220
221
|
if (!customElements.get(tagName)) {
|
|
221
222
|
defineCustomElement$5();
|
|
222
223
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Components, JSX } from "../types/components";
|
|
2
2
|
|
|
3
|
-
interface
|
|
4
|
-
export const
|
|
5
|
-
prototype:
|
|
6
|
-
new ():
|
|
3
|
+
interface SnkGridConfig extends Components.SnkGridConfig, HTMLElement {}
|
|
4
|
+
export const SnkGridConfig: {
|
|
5
|
+
prototype: SnkGridConfig;
|
|
6
|
+
new (): SnkGridConfig;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Used to define this component and all nested components recursively.
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { StringUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
+
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
5
|
+
import { O as ORDER_VALUES } from './constants.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './snk-select-box2.js';
|
|
7
|
+
|
|
8
|
+
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)}";
|
|
9
|
+
|
|
10
|
+
const EzGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
this.configChange = createEvent(this, "configChange", 7);
|
|
15
|
+
this.configCancel = createEvent(this, "configCancel", 7);
|
|
16
|
+
this._orderListItems = [];
|
|
17
|
+
this._orderPriorityList = [];
|
|
18
|
+
this._columListItems = [];
|
|
19
|
+
this._selectedIndex = -1;
|
|
20
|
+
this._dataChanged = false;
|
|
21
|
+
this._componenteInternalKey = Date.now();
|
|
22
|
+
/**
|
|
23
|
+
* Aba selecionada das configurações da grade.
|
|
24
|
+
*/
|
|
25
|
+
this.selectedIndex = 0;
|
|
26
|
+
}
|
|
27
|
+
/* Creation Methods */
|
|
28
|
+
async saveConfig(config) {
|
|
29
|
+
var _a;
|
|
30
|
+
if (config == undefined || ((_a = this._application) === null || _a === void 0 ? void 0 : _a.configName) == undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
ConfigStorage.saveGridConfig(config, this._application.configName)
|
|
34
|
+
.then((response) => {
|
|
35
|
+
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
36
|
+
ApplicationUtils.info(this.getMessage("snkGridConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
|
37
|
+
this.configChange.emit(config);
|
|
38
|
+
this._orderList.clearHistory();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
44
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
45
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
46
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-grid.msg.ts"
|
|
47
|
+
*/
|
|
48
|
+
getMessage(key, params) {
|
|
49
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
50
|
+
}
|
|
51
|
+
createOrderList() {
|
|
52
|
+
let newList = [];
|
|
53
|
+
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) => {
|
|
54
|
+
var _a;
|
|
55
|
+
let configItem = (_a = this.config) === null || _a === void 0 ? void 0 : _a.columns.find((item) => item.name === column.name);
|
|
56
|
+
let item = { name: column.name, label: column.label };
|
|
57
|
+
if (configItem) {
|
|
58
|
+
item['orderIndex'] = configItem.orderIndex;
|
|
59
|
+
item['ascending'] = configItem.ascending;
|
|
60
|
+
}
|
|
61
|
+
if (!column.hidden) {
|
|
62
|
+
newList.push(item);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
newList.sort((a, b) => {
|
|
66
|
+
//OS dois tem order index 0 e pelo menos um deles tem orientação de ordenação.
|
|
67
|
+
if (a.orderIndex == 0 && b.orderIndex == 0 && (a.ascending != undefined || b.ascending != undefined)) {
|
|
68
|
+
if (a.ascending != undefined)
|
|
69
|
+
return -1;
|
|
70
|
+
if (b.ascending != undefined)
|
|
71
|
+
return 1;
|
|
72
|
+
return 0;
|
|
73
|
+
//Pelo menos um deles tem order index diferente de 0 e os dois tem orientação de ordenação.
|
|
74
|
+
}
|
|
75
|
+
else if (a.ascending != undefined && b.ascending != undefined) {
|
|
76
|
+
return (a.orderIndex - b.orderIndex);
|
|
77
|
+
//Pelo menos um deles tem order index diferente de 0 e pelo menos um deles tem orientação de ordenação.
|
|
78
|
+
}
|
|
79
|
+
else if (a.ascending != undefined || b.ascending != undefined) {
|
|
80
|
+
if (a.ascending != undefined)
|
|
81
|
+
return -1;
|
|
82
|
+
if (b.ascending != undefined)
|
|
83
|
+
return 1;
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
return (a.orderIndex - b.orderIndex);
|
|
87
|
+
});
|
|
88
|
+
this._orderListItems = newList;
|
|
89
|
+
}
|
|
90
|
+
createColumnList() {
|
|
91
|
+
let visibleGroup = {
|
|
92
|
+
group: this.getMessage("snkGridConfig.group.visible"),
|
|
93
|
+
items: [],
|
|
94
|
+
};
|
|
95
|
+
let hiddenGroup = {
|
|
96
|
+
group: this.getMessage("snkGridConfig.group.hidden"),
|
|
97
|
+
items: [],
|
|
98
|
+
sort: ORDER_VALUES.asc.value
|
|
99
|
+
};
|
|
100
|
+
this.columns.forEach((column) => {
|
|
101
|
+
let item = { label: column.label };
|
|
102
|
+
if (column.hidden) {
|
|
103
|
+
hiddenGroup.items.push(item);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
visibleGroup.items.push(item);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this._columListItems = [visibleGroup, hiddenGroup];
|
|
110
|
+
}
|
|
111
|
+
buildColumnListSlot(item, group) {
|
|
112
|
+
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); } })));
|
|
113
|
+
}
|
|
114
|
+
buildOrderListSlot(item) {
|
|
115
|
+
let selectedOption = ORDER_VALUES.none.value;
|
|
116
|
+
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
117
|
+
selectedOption = item.ascending == true ? ORDER_VALUES.asc.value : ORDER_VALUES.desc.value;
|
|
118
|
+
}
|
|
119
|
+
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); } })));
|
|
120
|
+
}
|
|
121
|
+
updateOrder(sortOrder, updatedItemLabel) {
|
|
122
|
+
var _a;
|
|
123
|
+
this._dataChanged = true;
|
|
124
|
+
let newList = [...this.columns];
|
|
125
|
+
let newItem = newList.find((item) => item.label === updatedItemLabel);
|
|
126
|
+
if (newItem) {
|
|
127
|
+
newItem.sort = sortOrder.value === ORDER_VALUES.none.value ? undefined : sortOrder.value;
|
|
128
|
+
}
|
|
129
|
+
let orderArray;
|
|
130
|
+
if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
131
|
+
this._orderPriorityList.find((item) => item.label === newItem.label).sort = sortOrder;
|
|
132
|
+
this._orderPriorityList.filter((item) => item.sort).map((item, index) => {
|
|
133
|
+
if (item.label === newItem.label) {
|
|
134
|
+
newItem.sortIndex = index;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
orderArray = newList.filter((item) => item.sort && item.hidden !== true)
|
|
140
|
+
.map((item, index) => {
|
|
141
|
+
return { label: item.label, orderIndex: index };
|
|
142
|
+
});
|
|
143
|
+
orderArray.forEach((element) => {
|
|
144
|
+
newList.find((item) => item.label === element.label).sortIndex = element.orderIndex;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
this.columns = newList;
|
|
148
|
+
}
|
|
149
|
+
/* Actions Methods */
|
|
150
|
+
switchColumnGroup(evt, switchedItem) {
|
|
151
|
+
evt.stopPropagation();
|
|
152
|
+
let newList = [...this._columListItems];
|
|
153
|
+
this._dataChanged = true;
|
|
154
|
+
if (evt.detail === true) {
|
|
155
|
+
let hiddenGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.hidden"));
|
|
156
|
+
let index = hiddenGroup.items.findIndex((item) => item.label === switchedItem.label);
|
|
157
|
+
if (index >= 0) {
|
|
158
|
+
hiddenGroup.items.splice(index, 1);
|
|
159
|
+
}
|
|
160
|
+
let visibleGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"));
|
|
161
|
+
visibleGroup.items.push(switchedItem);
|
|
162
|
+
this._columListItems = newList;
|
|
163
|
+
this.createOrderList();
|
|
164
|
+
}
|
|
165
|
+
else if (evt.detail === false) {
|
|
166
|
+
let visibleGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"));
|
|
167
|
+
let index = visibleGroup.items.findIndex((item) => item.label === switchedItem.label);
|
|
168
|
+
if (index >= 0) {
|
|
169
|
+
visibleGroup.items.splice(index, 1);
|
|
170
|
+
}
|
|
171
|
+
let hiddenGroup = newList.find((group) => group.group === this.getMessage("snkGridConfig.group.hidden"));
|
|
172
|
+
hiddenGroup.items.push(switchedItem);
|
|
173
|
+
this._columListItems = newList;
|
|
174
|
+
this.createOrderList();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
finish() {
|
|
178
|
+
if (!this._dataChanged) {
|
|
179
|
+
this.closeConfig();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
let newColumnList = [];
|
|
183
|
+
this._columListItems.forEach((group) => {
|
|
184
|
+
group.items.forEach((item) => {
|
|
185
|
+
const baseColumn = this.columns.find((column) => column.label === item.label);
|
|
186
|
+
let newColumnItem = Object.assign({}, baseColumn);
|
|
187
|
+
if (group.group === this.getMessage("snkGridConfig.group.hidden")) {
|
|
188
|
+
newColumnItem.hidden = true;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
newColumnItem.hidden = false;
|
|
192
|
+
}
|
|
193
|
+
newColumnList.push(newColumnItem);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
this.columns = newColumnList;
|
|
197
|
+
this._dataChanged = false;
|
|
198
|
+
this.closeConfig();
|
|
199
|
+
this.save();
|
|
200
|
+
}
|
|
201
|
+
save() {
|
|
202
|
+
var _a;
|
|
203
|
+
let _newConfig;
|
|
204
|
+
if (this.config) {
|
|
205
|
+
_newConfig = this.config;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
_newConfig = this.createConfigFromState(this.columns);
|
|
209
|
+
}
|
|
210
|
+
let _newColumnConfigList = [];
|
|
211
|
+
let orderArray;
|
|
212
|
+
if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
213
|
+
orderArray = this.columns.filter((item) => item.sort && item.hidden !== true)
|
|
214
|
+
.map((item) => {
|
|
215
|
+
return { label: item.label, orderIndex: 0 };
|
|
216
|
+
});
|
|
217
|
+
let indexCount = 0;
|
|
218
|
+
let newOrderArray = [];
|
|
219
|
+
this._orderPriorityList.forEach((orderPriorityItem) => {
|
|
220
|
+
let item = orderArray.find((column) => column.label === orderPriorityItem.label);
|
|
221
|
+
if (item) {
|
|
222
|
+
item.orderIndex = indexCount;
|
|
223
|
+
newOrderArray.push(item);
|
|
224
|
+
indexCount++;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (newOrderArray.length > 0) {
|
|
228
|
+
orderArray = newOrderArray;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
for (let i = 0; i < this.columns.length; i++) {
|
|
232
|
+
const column = this.columns[i];
|
|
233
|
+
let _newColumnConfig = _newConfig.columns.find((_newColumnConfig) => column.name === _newColumnConfig.name);
|
|
234
|
+
if (column.hidden === true && _newColumnConfig) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (_newColumnConfig) {
|
|
238
|
+
_newColumnConfig.width = column.width;
|
|
239
|
+
}
|
|
240
|
+
else if (column.hidden === false) {
|
|
241
|
+
_newColumnConfig = { name: column.name, width: column.width, orderIndex: 0 };
|
|
242
|
+
}
|
|
243
|
+
if (_newColumnConfig) {
|
|
244
|
+
if (column.sort) {
|
|
245
|
+
_newColumnConfig.ascending = column.sort.toUpperCase() === ORDER_VALUES.asc.value ? true : false;
|
|
246
|
+
if (orderArray) {
|
|
247
|
+
adjustPriorityOrder(column, _newColumnConfig);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
_newColumnConfig.orderIndex = column.sortIndex;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
delete _newColumnConfig.ascending;
|
|
255
|
+
_newColumnConfig.orderIndex = 0;
|
|
256
|
+
}
|
|
257
|
+
_newColumnConfigList.push(_newColumnConfig);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
_newConfig.columns = _newColumnConfigList;
|
|
261
|
+
this.saveConfig(_newConfig);
|
|
262
|
+
function adjustPriorityOrder(column, _newColumnConfig) {
|
|
263
|
+
if (orderArray) {
|
|
264
|
+
let orderItem = orderArray.find((item) => item.label === column.label);
|
|
265
|
+
if (orderItem) {
|
|
266
|
+
_newColumnConfig.orderIndex = orderItem.orderIndex;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
createConfigFromState(state) {
|
|
272
|
+
let newConfig = { columns: [] };
|
|
273
|
+
state.forEach((columnState) => {
|
|
274
|
+
if (!columnState.hidden) {
|
|
275
|
+
let newConfigColumn = { name: columnState.name };
|
|
276
|
+
if (columnState.width) {
|
|
277
|
+
newConfigColumn['width'] = columnState.width;
|
|
278
|
+
}
|
|
279
|
+
if (columnState.sort) {
|
|
280
|
+
newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === ORDER_VALUES.asc.value);
|
|
281
|
+
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
newConfigColumn['orderIndex'] = 0;
|
|
285
|
+
}
|
|
286
|
+
if (newConfigColumn) {
|
|
287
|
+
newConfig.columns.push(newConfigColumn);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
return newConfig;
|
|
292
|
+
}
|
|
293
|
+
async locateColumn(evt, searchingText) {
|
|
294
|
+
var _a;
|
|
295
|
+
const hitEnter = evt.key === "Enter";
|
|
296
|
+
if (!searchingText) {
|
|
297
|
+
searchingText = (_a = evt.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
|
|
298
|
+
}
|
|
299
|
+
let newSelected = -1;
|
|
300
|
+
if (this.selectedIndex === 1) {
|
|
301
|
+
if (searchingText) {
|
|
302
|
+
const matchedIndexes = [];
|
|
303
|
+
let orderListDatasource;
|
|
304
|
+
await this._orderList.getList().then((listGroup) => {
|
|
305
|
+
orderListDatasource = listGroup;
|
|
306
|
+
orderListDatasource.forEach((column, index) => {
|
|
307
|
+
if (this.compareWords(column, searchingText)) {
|
|
308
|
+
matchedIndexes.push(index);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
if (matchedIndexes.length > 0) {
|
|
313
|
+
if (hitEnter) {
|
|
314
|
+
for (let j = 0; j < matchedIndexes.length; j++) {
|
|
315
|
+
if (matchedIndexes[j] > this._selectedIndex) {
|
|
316
|
+
newSelected = matchedIndexes[j];
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (newSelected === -1) {
|
|
322
|
+
newSelected = matchedIndexes[0];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
this._selectedIndex = newSelected;
|
|
326
|
+
let selectedColumn;
|
|
327
|
+
selectedColumn = orderListDatasource[newSelected];
|
|
328
|
+
if (selectedColumn) {
|
|
329
|
+
this._orderList.setSelection({ label: selectedColumn.label }, true);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
this._orderList.setSelection(undefined);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
this._orderList.setSelection(undefined);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
if (searchingText) {
|
|
341
|
+
const matchedIndexes = [];
|
|
342
|
+
this.columns.forEach((column, index) => {
|
|
343
|
+
if (this.compareWords(column, searchingText)) {
|
|
344
|
+
matchedIndexes.push(index);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
if (matchedIndexes.length > 0) {
|
|
348
|
+
if (hitEnter) {
|
|
349
|
+
for (let j = 0; j < matchedIndexes.length; j++) {
|
|
350
|
+
if (matchedIndexes[j] > this._selectedIndex) {
|
|
351
|
+
newSelected = matchedIndexes[j];
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (newSelected === -1) {
|
|
357
|
+
newSelected = matchedIndexes[0];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
this._selectedIndex = newSelected;
|
|
361
|
+
let selectedColumn = this.columns[newSelected];
|
|
362
|
+
if (selectedColumn) {
|
|
363
|
+
this._columnList.setSelection({ label: selectedColumn.label }, true);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
this._columnList.setSelection(undefined);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this._columnList.setSelection(undefined);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
compareWords(column, searchingText) {
|
|
375
|
+
if (StringUtils.replaceAccentuatedChars(column.label).indexOf(StringUtils.replaceAccentuatedChars(searchingText)) > -1) {
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
getColumnNames() {
|
|
381
|
+
const listNames = [];
|
|
382
|
+
listNames.push(this.getMessage("snkGridConfig.tab.columns"));
|
|
383
|
+
listNames.push(this.getMessage("snkGridConfig.tab.lineOrdering"));
|
|
384
|
+
return listNames.join(',');
|
|
385
|
+
}
|
|
386
|
+
closeConfig() {
|
|
387
|
+
this._orderList.scrollToTop();
|
|
388
|
+
this._columnList.scrollToTop();
|
|
389
|
+
this._searchElement.value = "";
|
|
390
|
+
if (this._dataChanged) {
|
|
391
|
+
let options = {
|
|
392
|
+
canClose: false,
|
|
393
|
+
labelCancel: this.getMessage("snkGridConfig.confirm.cancel"),
|
|
394
|
+
labelConfirm: this.getMessage("snkGridConfig.confirm.save"),
|
|
395
|
+
btnConfirmDanger: false
|
|
396
|
+
};
|
|
397
|
+
ApplicationUtils.confirm(this.getMessage("snkGridConfig.confirm.alert"), this.getMessage("snkGridConfig.confirm.msgCancel"), null, DialogType.WARN, options)
|
|
398
|
+
.then((response) => {
|
|
399
|
+
if (!response) {
|
|
400
|
+
this._dataChanged = false;
|
|
401
|
+
this.configCancel.emit();
|
|
402
|
+
this._orderList.clearHistory();
|
|
403
|
+
this._componenteInternalKey = Date.now();
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.finish();
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
this.configCancel.emit();
|
|
412
|
+
this._orderList.clearHistory();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/* Handlers */
|
|
416
|
+
handleTabChange(tab) {
|
|
417
|
+
if ((tab === null || tab === void 0 ? void 0 : tab.index) != undefined) {
|
|
418
|
+
if (this.selectedIndex !== tab.index) {
|
|
419
|
+
if (tab.index === 0) {
|
|
420
|
+
this._orderList.scrollToTop();
|
|
421
|
+
}
|
|
422
|
+
else if (tab.index === 1) {
|
|
423
|
+
this._columnList.scrollToTop();
|
|
424
|
+
}
|
|
425
|
+
this._searchElement.value = "";
|
|
426
|
+
}
|
|
427
|
+
if (tab.index === 1) {
|
|
428
|
+
this.createOrderList();
|
|
429
|
+
}
|
|
430
|
+
this.selectedIndex = tab.index;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
handleColumnListChange(evt) {
|
|
434
|
+
var _a;
|
|
435
|
+
if (evt.detail) {
|
|
436
|
+
let visibleItems = (_a = evt.detail.find((group) => group.group === this.getMessage("snkGridConfig.group.visible"))) === null || _a === void 0 ? void 0 : _a.items;
|
|
437
|
+
if (visibleItems) {
|
|
438
|
+
this._dataChanged = true;
|
|
439
|
+
this._orderListItems = visibleItems;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
handleOrderListChange(evt) {
|
|
444
|
+
if (evt.detail) {
|
|
445
|
+
let orderPriorityList = evt.detail;
|
|
446
|
+
if (orderPriorityList) {
|
|
447
|
+
this._dataChanged = true;
|
|
448
|
+
this._orderPriorityList = orderPriorityList;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
componentWillRender() {
|
|
453
|
+
var _a;
|
|
454
|
+
if (((_a = this.columns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
455
|
+
this.createColumnList();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
componentDidRender() {
|
|
459
|
+
var _a;
|
|
460
|
+
if (((_a = this.columns) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
461
|
+
this.locateColumn(new KeyboardEvent("arrow-right", { key: "ArrowRight" }), this._searchElement.value);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
componentWillLoad() {
|
|
465
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
466
|
+
}
|
|
467
|
+
render() {
|
|
468
|
+
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() }))));
|
|
469
|
+
}
|
|
470
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
471
|
+
static get style() { return snkGridConfigCss; }
|
|
472
|
+
}, [2, "snk-grid-config", {
|
|
473
|
+
"selectedIndex": [1026, "selected-index"],
|
|
474
|
+
"columns": [1040],
|
|
475
|
+
"config": [1040],
|
|
476
|
+
"saveConfig": [64]
|
|
477
|
+
}]);
|
|
478
|
+
function defineCustomElement() {
|
|
479
|
+
if (typeof customElements === "undefined") {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const components = ["snk-grid-config", "snk-select-box"];
|
|
483
|
+
components.forEach(tagName => { switch (tagName) {
|
|
484
|
+
case "snk-grid-config":
|
|
485
|
+
if (!customElements.get(tagName)) {
|
|
486
|
+
customElements.define(tagName, EzGridConfig);
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
case "snk-select-box":
|
|
490
|
+
if (!customElements.get(tagName)) {
|
|
491
|
+
defineCustomElement$1();
|
|
492
|
+
}
|
|
493
|
+
break;
|
|
494
|
+
} });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export { EzGridConfig as E, defineCustomElement as d };
|