@sankhyalabs/sankhyablocks 2.1.3 → 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 +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 +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-d762e436.js → taskbar-elements-a0b857c0.js} +4 -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.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 +4 -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 +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 +14 -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 +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-1092b0b7.js → taskbar-elements-4d6584cd.js} +4 -8
- 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.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,8 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { V as VIEW_MODE } from './constants.js';
|
|
4
|
+
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
|
5
|
+
|
|
6
|
+
const snkConfiguratorCss = ".sc-snk-configurator-h{--snk-configurator__button-close--padding-left:var(--space--medium, 12px);--snk-configurator__title--color:var(--title--primary, #2B3A54);--snk-configurator__title--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__title--font-size:var(--title--large, 20px);--snk-configurator__title--font-weight:var(--text-weight--extra-large, 700);--snk-configurator__subtitle--color:var(--title--primary, #2B3A54);--snk-configurator__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-configurator__subtitle--font-size:var(--text--medium, 14px);--snk-configurator__subtitle--font-weight:var(--text-weight--large, 600);--snk-configurator__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-configurator__scrollbar--width:var(--space--medium, 12px);--snk-configurator__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-configurator__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0)}.snk-configurator.sc-snk-configurator{display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.snk-configurator.sc-snk-configurator{width:359px;max-width:359px}}.snk-configurator__button-config.sc-snk-configurator{--ez-button--min-width:100%}.snk-configurator__header.sc-snk-configurator{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-configurator__title.sc-snk-configurator{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-configurator__title--color);font-size:var(--snk-configurator__title--font-size);font-family:var(--snk-configurator__title--font-family);font-weight:var(--snk-configurator__title--font-weight)}.snk-configurator__subtitle.sc-snk-configurator{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-configurator__subtitle--color);font-size:var(--snk-configurator__subtitle--font-size);font-family:var(--snk-configurator__subtitle--font-family);font-weight:var(--snk-configurator__subtitle--font-weight)}.snk-configurator__button-close.sc-snk-configurator{padding-left:var(--snk-configurator__button-close--padding-left)}.snk-configurator__main.sc-snk-configurator{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-configurator__scrollbar--background-color-primary) var(--snk-configurator__scrollbar--background-color-secondary)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-track{background-color:var(--snk-configurator__scrollbar--background-color-secondary)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar-thumb{background-color:var(--snk-configurator__scrollbar--background-color-primary);border-radius:var(--snk-configurator__scrollbar--border-radius)}.snk-configurator__main.sc-snk-configurator::-webkit-scrollbar{background-color:var(--snk-configurator__scrollbar--background-color-secondary);width:var(--snk-configurator__scrollbar--width);max-width:var(--snk-configurator__scrollbar--width);min-width:var(--snk-configurator__scrollbar--width)}";
|
|
6
7
|
|
|
7
8
|
const GRID_MODE = VIEW_MODE.grid;
|
|
8
9
|
const FORM_MODE = VIEW_MODE.form;
|
|
@@ -10,202 +11,99 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
10
11
|
constructor() {
|
|
11
12
|
super();
|
|
12
13
|
this.__registerHost();
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
this.name = "snkConfigurator";
|
|
14
|
+
this.configSelected = createEvent(this, "configSelected", 7);
|
|
15
|
+
this.openConfig = createEvent(this, "openConfig", 7);
|
|
16
|
+
this._opened = false;
|
|
18
17
|
/**
|
|
19
|
-
* Define
|
|
18
|
+
* Define qual modo de visualização está ativo.
|
|
20
19
|
*/
|
|
21
|
-
this.
|
|
20
|
+
this.viewMode = GRID_MODE.name;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
27
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
|
|
28
|
-
*/
|
|
29
|
-
getMessage(key) {
|
|
30
|
-
return this._application.messagesBuilder.getMessage(key, {});
|
|
22
|
+
async open() {
|
|
23
|
+
this._opened = true;
|
|
24
|
+
this.configSelected.emit(this.getViewModeValue());
|
|
31
25
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (this._modal != undefined) {
|
|
35
|
-
this._modal.opened = opened;
|
|
36
|
-
if (this._configModal != undefined) {
|
|
37
|
-
this._configModal.gridMode = ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.offsetParent) != undefined;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
26
|
+
async close() {
|
|
27
|
+
this.closeConfig();
|
|
40
28
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (data === null || data === void 0 ? void 0 : data.openConfig) {
|
|
44
|
-
this.controlConfigModal(false);
|
|
45
|
-
this.callShowConfig(data === null || data === void 0 ? void 0 : data.viewMode);
|
|
46
|
-
}
|
|
47
|
-
else if ((data === null || data === void 0 ? void 0 : data.viewMode) === GRID_MODE.index) {
|
|
48
|
-
this.changeViewMode.emit(GRID_MODE.name);
|
|
49
|
-
}
|
|
50
|
-
else if ((data === null || data === void 0 ? void 0 : data.viewMode) === FORM_MODE.index) {
|
|
51
|
-
this.changeViewMode.emit(FORM_MODE.name);
|
|
52
|
-
}
|
|
29
|
+
closeConfig() {
|
|
30
|
+
this._opened = false;
|
|
53
31
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
if (this._grid != undefined) {
|
|
60
|
-
this._grid.setShowGridConfig(true);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else if (viewMode === FORM_MODE.index) {
|
|
64
|
-
if (this._form == undefined) {
|
|
65
|
-
this.findForm();
|
|
66
|
-
}
|
|
67
|
-
if (this._form != undefined) {
|
|
68
|
-
this._form.setShowFormConfig(true);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
32
|
+
onViewModeChanged(evt) {
|
|
33
|
+
const value = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
34
|
+
this.viewMode = value;
|
|
35
|
+
this.configSelected.emit(value);
|
|
71
36
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
modalContainer.modalSize = "small";
|
|
75
|
-
modalContainer.opened = false;
|
|
76
|
-
modalContainer.closeEsc = false;
|
|
77
|
-
modalContainer.closeOutsideClick = false;
|
|
78
|
-
modalContainer.dataset.configuratorModal = this.name;
|
|
79
|
-
modalContainer.addEventListener(CONFIG_EVENTS.closeModal, () => {
|
|
80
|
-
this.controlConfigModal(false);
|
|
81
|
-
});
|
|
82
|
-
const modalContent = document.createElement("snk-config-modal");
|
|
83
|
-
modalContent.addEventListener(CONFIG_EVENTS.cancelConfig, () => {
|
|
84
|
-
this.controlConfigModal(false);
|
|
85
|
-
});
|
|
86
|
-
modalContent.addEventListener(CONFIG_EVENTS.changeConfig, (evt) => {
|
|
87
|
-
this.changeConfigModal(evt);
|
|
88
|
-
});
|
|
89
|
-
modalContent.configName = this.configName;
|
|
90
|
-
modalContainer.append(modalContent);
|
|
91
|
-
return modalContainer;
|
|
37
|
+
onClickOpenConfig() {
|
|
38
|
+
this.openConfig.emit(this.viewMode);
|
|
92
39
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
modalContainer = this.getConfigModal();
|
|
97
|
-
document.body.appendChild(modalContainer);
|
|
40
|
+
isAllowed(configName) {
|
|
41
|
+
if (AuthorizationConfig[configName]) {
|
|
42
|
+
return this._permissions ? this._permissions.isSup || this._permissions[configName] : false;
|
|
98
43
|
}
|
|
99
|
-
|
|
100
|
-
this._configModal = modalContainer.querySelector("snk-config-modal");
|
|
44
|
+
return true;
|
|
101
45
|
}
|
|
102
|
-
|
|
103
|
-
if (this.
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
this._grid = ConfigurableElementsStorage.getGrid(this.configName);
|
|
107
|
-
if (this._grid != undefined && this._grid.dataset.eventConfigChanged == undefined) {
|
|
108
|
-
this._grid.dataset.eventConfigChanged = "true";
|
|
109
|
-
this._grid.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
|
|
110
|
-
this.saveConfig(evt);
|
|
111
|
-
});
|
|
46
|
+
enableModeConfig() {
|
|
47
|
+
if (!this.isAllowed(AuthorizationConfig.CONFIG_GRID) || !this.isAllowed(AuthorizationConfig.CONFIG)) {
|
|
48
|
+
return false;
|
|
112
49
|
}
|
|
50
|
+
return true;
|
|
113
51
|
}
|
|
114
|
-
|
|
115
|
-
if (this.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this._form = ConfigurableElementsStorage.getForm(this.configName);
|
|
119
|
-
if (this._form != undefined && this._form.dataset.eventConfigChanged == undefined) {
|
|
120
|
-
this._form.dataset.eventConfigChanged = "true";
|
|
121
|
-
this._form.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
|
|
122
|
-
this.saveConfig(evt);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
saveConfig(evt) {
|
|
127
|
-
const config = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
128
|
-
if (this._application != undefined && config != undefined) {
|
|
129
|
-
if ((config === null || config === void 0 ? void 0 : config.fields) != undefined) {
|
|
130
|
-
this._application.saveFormConfig(config, this.configName)
|
|
131
|
-
.then((response) => {
|
|
132
|
-
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
133
|
-
this.loadFormConfig(true);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
52
|
+
getViewModeValue() {
|
|
53
|
+
if (this._permissions != undefined) {
|
|
54
|
+
if (!this.isAllowed(AuthorizationConfig.CONFIG_GRID)) {
|
|
55
|
+
this.viewMode = FORM_MODE.name;
|
|
136
56
|
}
|
|
137
|
-
else if ((
|
|
138
|
-
this.
|
|
139
|
-
.then((response) => {
|
|
140
|
-
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
141
|
-
this.setGridConfig(response.resource);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
57
|
+
else if (!this.isAllowed(AuthorizationConfig.CONFIG)) {
|
|
58
|
+
this.viewMode = GRID_MODE.name;
|
|
144
59
|
}
|
|
145
60
|
}
|
|
61
|
+
return this.viewMode;
|
|
146
62
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
65
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
66
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
67
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
|
|
68
|
+
*/
|
|
69
|
+
getMessage(key) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
return (_b = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage(key, {});
|
|
154
72
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
});
|
|
73
|
+
componentWillLoad() {
|
|
74
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
75
|
+
if (this._application) {
|
|
76
|
+
this._application.getAllAccess().then(access => this._permissions = access);
|
|
160
77
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (this._application != undefined && this.configName != undefined && this._form != undefined) {
|
|
164
|
-
this._application.loadFormConfig(this.configName).then((config) => {
|
|
165
|
-
this._form.setConfig(config).then(() => {
|
|
166
|
-
if (showInfoSuccess) {
|
|
167
|
-
ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
});
|
|
78
|
+
else {
|
|
79
|
+
this._permissions = {};
|
|
171
80
|
}
|
|
172
81
|
}
|
|
173
|
-
loadConfig() {
|
|
174
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
175
|
-
this.loadGridConfig();
|
|
176
|
-
this.loadFormConfig();
|
|
177
|
-
}
|
|
178
|
-
componentDidLoad() {
|
|
179
|
-
this.findConfigModal();
|
|
180
|
-
this.findGrid();
|
|
181
|
-
this.findForm();
|
|
182
|
-
this.loadConfig();
|
|
183
|
-
}
|
|
184
82
|
render() {
|
|
185
|
-
return (h("ez-button", { mode:
|
|
83
|
+
return (h("ez-modal", { opened: this._opened, "close-esc": false, "close-outside-click": false, "modal-size": "small" }, h("div", { class: "snk-configurator" }, h("div", { class: "snk-configurator__header" }, h("label", { class: "snk-configurator__title" }, this.getMessage("snkConfigurator.titleConfigurations")), h("div", { class: "snk-configurator__button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "snk-configurator__main" }, h("ez-radio-button", { class: "ez-margin-top--medium", label: this.getMessage("snkConfigurator.subTitleModeConfig"), value: this.getViewModeValue(), onEzChange: (evt) => this.onViewModeChanged(evt), enabled: this.enableModeConfig() }, h("ez-radio-button-option", { label: this.getMessage("snkConfigurator.labelGrid"), value: GRID_MODE.name }), h("ez-radio-button-option", { label: this.getMessage("snkConfigurator.labelForm"), value: FORM_MODE.name })), h("ez-button", { mode: "slim", label: this.viewMode === GRID_MODE.name
|
|
84
|
+
? this.getMessage("snkConfigurator.labelConfigGrid")
|
|
85
|
+
: this.getMessage("snkConfigurator.labelConfigForm"), class: "snk-configurator__button-config ez-button--primary", onClick: () => this.onClickOpenConfig() }), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })))));
|
|
186
86
|
}
|
|
187
|
-
get
|
|
87
|
+
static get style() { return snkConfiguratorCss; }
|
|
188
88
|
}, [2, "snk-configurator", {
|
|
189
89
|
"configName": [1, "config-name"],
|
|
190
|
-
"
|
|
191
|
-
"
|
|
90
|
+
"viewMode": [1, "view-mode"],
|
|
91
|
+
"_opened": [32],
|
|
92
|
+
"_permissions": [32],
|
|
93
|
+
"open": [64],
|
|
94
|
+
"close": [64]
|
|
192
95
|
}]);
|
|
193
96
|
function defineCustomElement() {
|
|
194
97
|
if (typeof customElements === "undefined") {
|
|
195
98
|
return;
|
|
196
99
|
}
|
|
197
|
-
const components = ["snk-configurator"
|
|
100
|
+
const components = ["snk-configurator"];
|
|
198
101
|
components.forEach(tagName => { switch (tagName) {
|
|
199
102
|
case "snk-configurator":
|
|
200
103
|
if (!customElements.get(tagName)) {
|
|
201
104
|
customElements.define(tagName, SnkConfigurator);
|
|
202
105
|
}
|
|
203
106
|
break;
|
|
204
|
-
case "snk-config-modal":
|
|
205
|
-
if (!customElements.get(tagName)) {
|
|
206
|
-
defineCustomElement$1();
|
|
207
|
-
}
|
|
208
|
-
break;
|
|
209
107
|
} });
|
|
210
108
|
}
|
|
211
109
|
|
|
@@ -2,18 +2,19 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { V as VIEW_MODE } from './constants.js';
|
|
4
4
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
9
|
-
import { d as defineCustomElement$
|
|
10
|
-
import { d as defineCustomElement$
|
|
11
|
-
import { d as defineCustomElement$
|
|
12
|
-
import { d as defineCustomElement$
|
|
13
|
-
import { d as defineCustomElement$
|
|
14
|
-
import { d as defineCustomElement$
|
|
15
|
-
import { d as defineCustomElement$
|
|
16
|
-
import { d as defineCustomElement$
|
|
5
|
+
import { d as defineCustomElement$g } from './snk-config-options2.js';
|
|
6
|
+
import { d as defineCustomElement$f } from './snk-configurator2.js';
|
|
7
|
+
import { d as defineCustomElement$e } from './snk-field-config2.js';
|
|
8
|
+
import { d as defineCustomElement$d } from './snk-filter-bar2.js';
|
|
9
|
+
import { d as defineCustomElement$c } from './snk-filter-detail2.js';
|
|
10
|
+
import { d as defineCustomElement$b } from './snk-filter-item2.js';
|
|
11
|
+
import { d as defineCustomElement$a } from './snk-filter-list2.js';
|
|
12
|
+
import { d as defineCustomElement$9 } from './snk-filter-modal2.js';
|
|
13
|
+
import { d as defineCustomElement$8 } from './snk-form2.js';
|
|
14
|
+
import { d as defineCustomElement$7 } from './snk-form-config2.js';
|
|
15
|
+
import { d as defineCustomElement$6 } from './snk-grid2.js';
|
|
16
|
+
import { d as defineCustomElement$5 } from './snk-grid-config2.js';
|
|
17
|
+
import { d as defineCustomElement$4 } from './snk-select-box2.js';
|
|
17
18
|
import { d as defineCustomElement$3 } from './snk-tab-config2.js';
|
|
18
19
|
|
|
19
20
|
const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
|
|
@@ -25,6 +26,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
25
26
|
super();
|
|
26
27
|
this.__registerHost();
|
|
27
28
|
this.actionClick = createEvent(this, "actionClick", 7);
|
|
29
|
+
this._viewMode = GRID_MODE.name;
|
|
28
30
|
/**
|
|
29
31
|
* Determina se pode haver mais de uma linha selecionada na grade
|
|
30
32
|
*/
|
|
@@ -38,22 +40,38 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
38
40
|
}
|
|
39
41
|
async gridToForm(keepFormMode = false) {
|
|
40
42
|
this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE.index;
|
|
41
|
-
this.
|
|
43
|
+
this.setViewMode(FORM_MODE);
|
|
42
44
|
}
|
|
43
45
|
async executeAction(act) {
|
|
44
46
|
if (act === TaskbarElement.GRID_MODE) {
|
|
45
|
-
this.
|
|
47
|
+
this.setViewMode(GRID_MODE);
|
|
46
48
|
}
|
|
47
49
|
else if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE) {
|
|
48
50
|
this.gridToForm(act !== TaskbarElement.UPDATE);
|
|
49
51
|
}
|
|
52
|
+
else if (act === TaskbarElement.CONFIGURATOR) {
|
|
53
|
+
this._snkConfigurator.open();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
setViewMode(viewMode) {
|
|
57
|
+
this._viewStack.show(viewMode.index);
|
|
58
|
+
this._viewMode = viewMode.name;
|
|
59
|
+
}
|
|
60
|
+
openConfig(viewMode) {
|
|
61
|
+
this._snkConfigurator.close();
|
|
62
|
+
if (viewMode === GRID_MODE.name) {
|
|
63
|
+
this._snkGrid.showConfig();
|
|
64
|
+
}
|
|
65
|
+
else if (viewMode === FORM_MODE.name) {
|
|
66
|
+
this._snkForm.showConfig();
|
|
67
|
+
}
|
|
50
68
|
}
|
|
51
69
|
insertionModeHandler() {
|
|
52
70
|
this.gridToForm();
|
|
53
71
|
}
|
|
54
72
|
cancelHandler() {
|
|
55
73
|
if (this._backToGrid) {
|
|
56
|
-
this.
|
|
74
|
+
this.setViewMode(GRID_MODE);
|
|
57
75
|
}
|
|
58
76
|
}
|
|
59
77
|
componentWillLoad() {
|
|
@@ -83,7 +101,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
103
|
render() {
|
|
86
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref
|
|
104
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { ref: (ref) => this._snkForm = ref, configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
87
105
|
}
|
|
88
106
|
get _element() { return this; }
|
|
89
107
|
static get style() { return snkCrudCss; }
|
|
@@ -96,75 +114,81 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
114
|
"multipleSelection": [4, "multiple-selection"],
|
|
97
115
|
"_dataUnit": [32],
|
|
98
116
|
"_dataState": [32],
|
|
117
|
+
"_viewMode": [32],
|
|
99
118
|
"goToView": [64]
|
|
100
119
|
}]);
|
|
101
120
|
function defineCustomElement$1() {
|
|
102
121
|
if (typeof customElements === "undefined") {
|
|
103
122
|
return;
|
|
104
123
|
}
|
|
105
|
-
const components = ["snk-crud", "snk-config-
|
|
124
|
+
const components = ["snk-crud", "snk-config-options", "snk-configurator", "snk-field-config", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal", "snk-form", "snk-form-config", "snk-grid", "snk-grid-config", "snk-select-box", "snk-tab-config", "snk-taskbar"];
|
|
106
125
|
components.forEach(tagName => { switch (tagName) {
|
|
107
126
|
case "snk-crud":
|
|
108
127
|
if (!customElements.get(tagName)) {
|
|
109
128
|
customElements.define(tagName, SnkCrud$1);
|
|
110
129
|
}
|
|
111
130
|
break;
|
|
112
|
-
case "snk-config-
|
|
131
|
+
case "snk-config-options":
|
|
132
|
+
if (!customElements.get(tagName)) {
|
|
133
|
+
defineCustomElement$g();
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "snk-configurator":
|
|
113
137
|
if (!customElements.get(tagName)) {
|
|
114
138
|
defineCustomElement$f();
|
|
115
139
|
}
|
|
116
140
|
break;
|
|
117
|
-
case "snk-config
|
|
141
|
+
case "snk-field-config":
|
|
118
142
|
if (!customElements.get(tagName)) {
|
|
119
143
|
defineCustomElement$e();
|
|
120
144
|
}
|
|
121
145
|
break;
|
|
122
|
-
case "snk-
|
|
146
|
+
case "snk-filter-bar":
|
|
123
147
|
if (!customElements.get(tagName)) {
|
|
124
148
|
defineCustomElement$d();
|
|
125
149
|
}
|
|
126
150
|
break;
|
|
127
|
-
case "snk-
|
|
151
|
+
case "snk-filter-detail":
|
|
128
152
|
if (!customElements.get(tagName)) {
|
|
129
153
|
defineCustomElement$c();
|
|
130
154
|
}
|
|
131
155
|
break;
|
|
132
|
-
case "snk-filter-
|
|
156
|
+
case "snk-filter-item":
|
|
133
157
|
if (!customElements.get(tagName)) {
|
|
134
158
|
defineCustomElement$b();
|
|
135
159
|
}
|
|
136
160
|
break;
|
|
137
|
-
case "snk-filter-
|
|
161
|
+
case "snk-filter-list":
|
|
138
162
|
if (!customElements.get(tagName)) {
|
|
139
163
|
defineCustomElement$a();
|
|
140
164
|
}
|
|
141
165
|
break;
|
|
142
|
-
case "snk-filter-
|
|
166
|
+
case "snk-filter-modal":
|
|
143
167
|
if (!customElements.get(tagName)) {
|
|
144
168
|
defineCustomElement$9();
|
|
145
169
|
}
|
|
146
170
|
break;
|
|
147
|
-
case "snk-
|
|
171
|
+
case "snk-form":
|
|
148
172
|
if (!customElements.get(tagName)) {
|
|
149
173
|
defineCustomElement$8();
|
|
150
174
|
}
|
|
151
175
|
break;
|
|
152
|
-
case "snk-
|
|
176
|
+
case "snk-form-config":
|
|
153
177
|
if (!customElements.get(tagName)) {
|
|
154
178
|
defineCustomElement$7();
|
|
155
179
|
}
|
|
156
180
|
break;
|
|
157
|
-
case "snk-
|
|
181
|
+
case "snk-grid":
|
|
158
182
|
if (!customElements.get(tagName)) {
|
|
159
183
|
defineCustomElement$6();
|
|
160
184
|
}
|
|
161
185
|
break;
|
|
162
|
-
case "snk-
|
|
186
|
+
case "snk-grid-config":
|
|
163
187
|
if (!customElements.get(tagName)) {
|
|
164
188
|
defineCustomElement$5();
|
|
165
189
|
}
|
|
166
190
|
break;
|
|
167
|
-
case "snk-
|
|
191
|
+
case "snk-select-box":
|
|
168
192
|
if (!customElements.get(tagName)) {
|
|
169
193
|
defineCustomElement$4();
|
|
170
194
|
}
|
|
@@ -3,7 +3,7 @@ import { a as draggable_bundle, d as defineCustomElement$1 } from './snk-tab-con
|
|
|
3
3
|
import { ObjectUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { C as CONFIG_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
|
|
6
|
-
import { a as UserConfigType } from './
|
|
6
|
+
import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage.js';
|
|
7
7
|
import { d as defineCustomElement$3 } from './snk-config-options2.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './snk-field-config2.js';
|
|
9
9
|
|
|
@@ -20,6 +20,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
20
20
|
super();
|
|
21
21
|
this.__registerHost();
|
|
22
22
|
this.configChange = createEvent(this, "configChange", 7);
|
|
23
|
+
this.configClose = createEvent(this, "configClose", 7);
|
|
23
24
|
this._listEnabledFields = [];
|
|
24
25
|
this._renderTimer = 500;
|
|
25
26
|
this._sortableTimer = 100;
|
|
@@ -163,14 +164,9 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
163
164
|
&& this._optionFormConfigChanged === true
|
|
164
165
|
&& this._formConfigChanged === false;
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
-
var _a;
|
|
168
|
-
if (((_a = this._tempGroups) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
169
|
-
ApplicationUtils.alert(this.getMessage("snkFormConfig.confirm.title"), this.getMessage("snkFormConfig.confirm.group"));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const isDefault = this.isDefaultConfiguration();
|
|
167
|
+
buildConfigToSave() {
|
|
173
168
|
let formConfig = {};
|
|
169
|
+
const isDefault = this.isDefaultConfiguration();
|
|
174
170
|
if (isDefault) {
|
|
175
171
|
formConfig = ObjectUtils.copy(this.formConfig);
|
|
176
172
|
}
|
|
@@ -188,9 +184,24 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
186
|
formConfig.defaultConfiguration = isDefault;
|
|
191
|
-
|
|
187
|
+
return formConfig;
|
|
188
|
+
}
|
|
189
|
+
saveConfig() {
|
|
190
|
+
var _a;
|
|
191
|
+
if (((_a = this._tempGroups) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
192
|
+
ApplicationUtils.alert(this.getMessage("snkFormConfig.confirm.title"), this.getMessage("snkFormConfig.confirm.group"));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const formConfig = this.buildConfigToSave();
|
|
192
196
|
this._formConfigChanged = false;
|
|
193
197
|
this._optionFormConfigChanged = false;
|
|
198
|
+
ConfigStorage.saveFormConfig(formConfig, this.configName)
|
|
199
|
+
.then((response) => {
|
|
200
|
+
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
201
|
+
ApplicationUtils.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
|
202
|
+
this.configChange.emit(formConfig);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
194
205
|
}
|
|
195
206
|
applyOptionConfig() {
|
|
196
207
|
if (this._optionFormConfigChanged === true && this._optionFormConfigSelected != undefined) {
|
|
@@ -244,12 +255,12 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
244
255
|
this.openConfirmDialog(this.getMessage("snkFormConfig.confirm.exit")).then((canClose) => {
|
|
245
256
|
if (canClose) {
|
|
246
257
|
this._formConfigChanged = false;
|
|
247
|
-
this.
|
|
258
|
+
this.configClose.emit();
|
|
248
259
|
}
|
|
249
260
|
});
|
|
250
261
|
}
|
|
251
262
|
else {
|
|
252
|
-
this.
|
|
263
|
+
this.configClose.emit();
|
|
253
264
|
}
|
|
254
265
|
}
|
|
255
266
|
openConfirmDialog(msg = "", title = this.getMessage("snkFormConfig.confirm.title")) {
|
|
@@ -453,9 +464,8 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
453
464
|
this._sortableGroup.on(CONFIG_EVENTS.dragStop, (evt) => this.controlStopDraggingGroup(evt));
|
|
454
465
|
}
|
|
455
466
|
loadUserConfig() {
|
|
456
|
-
var _a;
|
|
457
467
|
if (this._application != undefined) {
|
|
458
|
-
this._application.fetchUserAvailableConfigs(
|
|
468
|
+
this._application.fetchUserAvailableConfigs(this.configName)
|
|
459
469
|
.then((userConfig) => {
|
|
460
470
|
this._formConfigOptions = userConfig;
|
|
461
471
|
let isDefault = this._formConfig != undefined ? this._formConfig.defaultConfiguration : true;
|
|
@@ -507,14 +517,13 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
507
517
|
}
|
|
508
518
|
}
|
|
509
519
|
loadConfigByUser() {
|
|
510
|
-
var _a;
|
|
511
520
|
if (this._application != undefined) {
|
|
512
521
|
const option = this._optionFormConfigSelected;
|
|
513
522
|
const fetchActionName = (option === null || option === void 0 ? void 0 : option.origin) === UserConfigType.DEFAULT ? "fetchDefaultConfig" :
|
|
514
523
|
(option === null || option === void 0 ? void 0 : option.origin) === UserConfigType.USER ? "fetchLegacyConfig" :
|
|
515
524
|
undefined;
|
|
516
525
|
if (fetchActionName != undefined) {
|
|
517
|
-
this._application[fetchActionName](
|
|
526
|
+
this._application[fetchActionName](this.configName)
|
|
518
527
|
.then((formConfig) => {
|
|
519
528
|
if (formConfig != undefined) {
|
|
520
529
|
this._formConfig = formConfig;
|
|
@@ -771,9 +780,6 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
771
780
|
this.onFilterChange(filterValue);
|
|
772
781
|
}
|
|
773
782
|
}
|
|
774
|
-
setShowFormConfig(value) {
|
|
775
|
-
this.parentForm.setShowFormConfig(value);
|
|
776
|
-
}
|
|
777
783
|
changeTabSelected(tabSelected) {
|
|
778
784
|
this._tabSelected = tabSelected.index;
|
|
779
785
|
const selectorTab = this._formContainer.querySelector("div#tab" + tabSelected.index);
|
|
@@ -964,7 +970,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
964
970
|
}, [2, "snk-form-config", {
|
|
965
971
|
"dataUnit": [16],
|
|
966
972
|
"formConfig": [16],
|
|
967
|
-
"
|
|
973
|
+
"configName": [513, "config-name"],
|
|
968
974
|
"_formConfigOptions": [32],
|
|
969
975
|
"_fieldConfigSelected": [32],
|
|
970
976
|
"_layoutFormConfig": [32],
|