@sankhyalabs/sankhyablocks 1.4.0-beta.7 → 1.4.0-beta.9
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/{SnkMessageBuilder-b54dfb89.js → SnkMessageBuilder-6c2f7bcd.js} +87 -11
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
- package/dist/cjs/constants-9056ca9e.js +84 -0
- package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
- package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
- package/dist/cjs/{index-6fcf07f3.js → index-20e8b68a.js} +50 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +209 -6976
- package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +230 -0
- package/dist/cjs/{snk-filter-bar_5.cjs.entry.js → snk-configurator_6.cjs.entry.js} +194 -7
- package/dist/cjs/snk-crud.cjs.entry.js +13 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
- package/dist/cjs/snk-form.cjs.entry.js +146 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
- package/dist/cjs/{taskbar-elements-aedfeae6.js → taskbar-elements-9a4b1e19.js} +10 -6
- package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +27 -1
- package/dist/collection/components/snk-application/snk-application.js +144 -23
- package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
- package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
- package/dist/collection/components/snk-crud/snk-crud.js +15 -13
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +35 -4
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +3 -3
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +2 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-form/snk-form.css +4 -0
- package/dist/collection/components/snk-form/snk-form.js +108 -30
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
- package/dist/collection/components/snk-grid/snk-grid.js +92 -22
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +8 -1
- package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
- package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
- package/dist/collection/lib/utils/constants.js +72 -0
- package/dist/components/SnkMessageBuilder.js +87 -11
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/constants.js +74 -0
- package/dist/components/form-config-fetcher.js +6889 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/snk-application2.js +221 -6985
- package/dist/components/snk-config-modal.d.ts +11 -0
- package/dist/components/snk-config-modal.js +6 -0
- package/dist/components/snk-config-modal2.js +91 -0
- package/dist/components/snk-config-options.d.ts +11 -0
- package/dist/components/snk-config-options.js +6 -0
- package/dist/components/snk-config-options2.js +245 -0
- package/dist/components/snk-configurator.d.ts +11 -0
- package/dist/components/snk-configurator.js +6 -0
- package/dist/components/snk-configurator2.js +212 -0
- package/dist/components/snk-crud.js +62 -25
- package/dist/components/snk-field-config.d.ts +11 -0
- package/dist/components/snk-field-config.js +6 -0
- package/dist/components/snk-field-config2.js +70 -0
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-filter-modal2.js +2 -1
- package/dist/components/snk-filter-personalized.js +4 -1
- package/dist/components/snk-form-config.d.ts +11 -0
- package/dist/components/snk-form-config.js +6 -0
- package/dist/components/snk-form-config2.js +996 -0
- package/dist/components/snk-form2.js +79 -29
- package/dist/components/snk-grid2.js +43 -24
- package/dist/components/snk-tab-config.d.ts +11 -0
- package/dist/components/snk-tab-config.js +6 -0
- package/dist/components/snk-tab-config2.js +7220 -0
- package/dist/components/snk-taskbar2.js +27 -9
- package/dist/esm/{SnkMessageBuilder-d440381c.js → SnkMessageBuilder-5792c260.js} +87 -11
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
- package/dist/esm/constants-c6039d3d.js +74 -0
- package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
- package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
- package/dist/esm/{index-81dda3cf.js → index-e4121713.js} +50 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +220 -6987
- package/dist/esm/snk-config-modal.entry.js +58 -0
- package/dist/esm/snk-config-options.entry.js +226 -0
- package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +195 -9
- package/dist/esm/snk-crud.entry.js +13 -11
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-field-config_2.entry.js +130 -0
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-personalized.entry.js +3 -2
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +953 -0
- package/dist/esm/snk-form.entry.js +142 -0
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-tab-config.entry.js +317 -0
- package/dist/esm/{taskbar-elements-38eb5d51.js → taskbar-elements-e2ed0536.js} +10 -6
- package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-4574a955.entry.js → p-029ae4e4.entry.js} +1 -1
- package/dist/sankhyablocks/p-03f9c407.js +1 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
- package/dist/sankhyablocks/p-1feabfc7.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-2284c850.entry.js +1 -0
- package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
- package/dist/sankhyablocks/{p-0ea25487.entry.js → p-2dc76d79.entry.js} +1 -1
- package/dist/sankhyablocks/p-361299e8.js +26 -0
- package/dist/sankhyablocks/p-366aa0f5.entry.js +1 -0
- package/dist/sankhyablocks/p-36d2d9cf.entry.js +75 -0
- package/dist/sankhyablocks/{p-6386d720.entry.js → p-3a276f3d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-44ce5b90.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6988f4a6.entry.js} +1 -1
- package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
- package/dist/sankhyablocks/p-7b4a4a50.entry.js +1 -0
- package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
- package/dist/sankhyablocks/{p-40b27004.entry.js → p-9dc4426d.entry.js} +1 -1
- package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
- package/dist/sankhyablocks/p-a5b26df2.js +1 -0
- package/dist/sankhyablocks/p-b6d6b172.js +1 -0
- package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-cc4bef9f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2e49afef.entry.js → p-d1ac09c9.entry.js} +1 -1
- package/dist/sankhyablocks/p-d50651a3.js +1 -0
- package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
- package/dist/sankhyablocks/{p-49580cdd.entry.js → p-deb1f523.entry.js} +1 -1
- package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
- package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-e9beab79.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +29 -14
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
- package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
- package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +8 -6
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +3 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +65 -0
- package/dist/types/components/snk-form/snk-form.d.ts +71 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
- package/dist/types/components.d.ts +358 -13
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
- package/dist/types/lib/utils/constants.d.ts +76 -0
- package/dist/types/lib/utils/pesquisa.d.ts +2 -1
- package/package.json +4 -3
- package/react/components.d.ts +6 -0
- package/react/components.js +6 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +0 -247
- package/dist/esm/snk-form_2.entry.js +0 -242
- package/dist/sankhyablocks/p-21e940aa.entry.js +0 -1
- package/dist/sankhyablocks/p-2eea7eea.js +0 -1
- package/dist/sankhyablocks/p-42036db1.entry.js +0 -84
- package/dist/sankhyablocks/p-77216252.entry.js +0 -1
- package/dist/sankhyablocks/p-86f15ffe.js +0 -1
- package/dist/sankhyablocks/p-97009a2c.entry.js +0 -1
- package/dist/sankhyablocks/p-a14c49db.entry.js +0 -1
- package/dist/sankhyablocks/p-fac2b6a9.js +0 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { C as ConfigurableElementsStorage } from './configurableElementsStorage-cdc144b5.js';
|
|
4
|
+
import { T as TaskbarProcessor } from './taskbar-processor-aa6772c9.js';
|
|
5
|
+
|
|
6
|
+
const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}.snk-form__form--hidden.sc-snk-form{display:none}";
|
|
7
|
+
|
|
8
|
+
const SnkForm = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.exit = createEvent(this, "exit", 7);
|
|
12
|
+
this.actionClick = createEvent(this, "actionClick", 7);
|
|
13
|
+
this.configChanged = createEvent(this, "configChanged", 7);
|
|
14
|
+
this._renderTimer = 500;
|
|
15
|
+
this._taskbarProcessor = new TaskbarProcessor({
|
|
16
|
+
"snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "CONFIGURATOR", "INSERT"],
|
|
17
|
+
"snkForm.finish_edition": ["CANCEL", "SAVE"]
|
|
18
|
+
});
|
|
19
|
+
this._editionFormConfig = {};
|
|
20
|
+
this._insertionFormConfig = {};
|
|
21
|
+
this._showFormConfig = false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Método responsável em abrir ou fechar o modal de configurações do form.
|
|
25
|
+
*/
|
|
26
|
+
async setShowFormConfig(value) {
|
|
27
|
+
this._showFormConfig = value;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Método responsável por setar as configurações do form.
|
|
31
|
+
*/
|
|
32
|
+
async setConfig(config) {
|
|
33
|
+
this._editionFormConfig = {};
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
this._editionFormConfig = config != undefined ? config : {};
|
|
36
|
+
this.loadInsertionConfig();
|
|
37
|
+
}, this._renderTimer);
|
|
38
|
+
}
|
|
39
|
+
getFormConfig() {
|
|
40
|
+
return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
|
|
41
|
+
}
|
|
42
|
+
exitForm() {
|
|
43
|
+
if (this._dataUnit.isDirty()) {
|
|
44
|
+
this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.exit.emit();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getDisabledButtons() {
|
|
51
|
+
const disabled = [];
|
|
52
|
+
if (!this._dataState.hasPrevious) {
|
|
53
|
+
disabled.push("PREVIOUS");
|
|
54
|
+
}
|
|
55
|
+
if (!this._dataState.hasNext) {
|
|
56
|
+
disabled.push("NEXT");
|
|
57
|
+
}
|
|
58
|
+
return disabled;
|
|
59
|
+
}
|
|
60
|
+
loadInsertionConfig() {
|
|
61
|
+
var _a;
|
|
62
|
+
if (this._dataUnit) {
|
|
63
|
+
const copyFormConfig = ObjectUtils.copy(this._editionFormConfig || {});
|
|
64
|
+
copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(fieldCfg => {
|
|
65
|
+
const def = this._dataUnit.getField(fieldCfg.name);
|
|
66
|
+
if (def === null || def === void 0 ? void 0 : def.readOnly) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
this._insertionFormConfig = copyFormConfig;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
76
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
77
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
78
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
|
|
79
|
+
*/
|
|
80
|
+
getMessage(key) {
|
|
81
|
+
return this._application.messagesBuilder.getMessage(key, this.getMessageParams());
|
|
82
|
+
}
|
|
83
|
+
getMessageParams() {
|
|
84
|
+
var _a;
|
|
85
|
+
return ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) ? this._dataState.selectedRecords[0] : undefined;
|
|
86
|
+
}
|
|
87
|
+
changeConfig(config) {
|
|
88
|
+
this.configChanged.emit(config);
|
|
89
|
+
}
|
|
90
|
+
componentDidRender() {
|
|
91
|
+
ConfigurableElementsStorage.setForm(this.configName, this._element);
|
|
92
|
+
}
|
|
93
|
+
componentWillLoad() {
|
|
94
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
95
|
+
let parent = this._element.parentElement;
|
|
96
|
+
while (parent) {
|
|
97
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
98
|
+
this._snkDataUnit = parent;
|
|
99
|
+
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
100
|
+
this._dataState = this._snkDataUnit.dataState;
|
|
101
|
+
if (this._dataUnit) {
|
|
102
|
+
this.loadInsertionConfig();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
106
|
+
this._dataUnit = evt.detail;
|
|
107
|
+
this.loadInsertionConfig();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
111
|
+
this._dataState = evt.detail;
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
parent = parent.parentElement;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
componentWillRender() {
|
|
119
|
+
var _a;
|
|
120
|
+
const taskbarId = ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkForm.finish_edition" : "snkForm.regular";
|
|
121
|
+
const disabledButtons = [];
|
|
122
|
+
if (!this._dataState || !this._dataState.hasPrevious) {
|
|
123
|
+
disabledButtons.push("PREVIOUS");
|
|
124
|
+
}
|
|
125
|
+
if (!this._dataState || !this._dataState.hasNext) {
|
|
126
|
+
disabledButtons.push("NEXT");
|
|
127
|
+
}
|
|
128
|
+
this._taskbarProcessor.process(taskbarId, this.taskbarManager, this._dataState, disabledButtons);
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
var _a;
|
|
132
|
+
if (!this._dataUnit || !this._dataState) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
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 &&
|
|
136
|
+
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), parentForm: this._element, onConfigChange: (evt) => { this.changeConfig(evt.detail); } }))))));
|
|
137
|
+
}
|
|
138
|
+
get _element() { return getElement(this); }
|
|
139
|
+
};
|
|
140
|
+
SnkForm.style = snkFormCss;
|
|
141
|
+
|
|
142
|
+
export { SnkForm as snk_form };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-e4121713.js';
|
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
4
|
const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-pesquisa__content-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__content-scrollbar--background-color-primary) var(--snk-pesquisa__content-scrollbar--background-color-secondary);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color-primary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { d as draggable_bundle } from './draggable.bundle-41d56f06.js';
|
|
3
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
4
|
+
import { C as CONFIG_EVENTS, K as KEY_EVENTS, b as TYPE_ACTIONS, T as TAB_NAMES } from './constants-c6039d3d.js';
|
|
5
|
+
import './_commonjsHelpers-9943807e.js';
|
|
6
|
+
|
|
7
|
+
const snkTabConfigCss = "@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}.sc-snk-tab-config-h{--snk-tab-config--backward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--snk-tab-config--forward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');display:flex;position:relative;width:100%;overflow:hidden}.tab-config__scroll.sc-snk-tab-config{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.tab-config__scroll--start-hidden.sc-snk-tab-config{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.tab-config__scroll--middle.sc-snk-tab-config{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab-config__scroll--end-hidden.sc-snk-tab-config{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab-config__lower-bar.sc-snk-tab-config{position:absolute;left:0%;right:0%;top:91%;bottom:0%;border-radius:2px;background:var(--color--disable-primary);border:2px solid var(--color--disable-primary)}.tab-config__tab.sc-snk-tab-config{display:flex;border:none;background-color:unset;cursor:pointer;align-items:center;justify-content:center;min-width:fit-content;color:var(--text--primary, #626e82);font-family:var(--font-pattern, \"Sora, Algerian\");font-size:var(--title--small, 14px);padding:var(--space--small, 6px) var(--space--medium, 12px)}.tab-config__tab.sc-snk-tab-config:focus,.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{outline:none}.tab-config__tab--is-active.sc-snk-tab-config{position:relative;color:var(--color--primary, #008561)}.tab-config__tab.sc-snk-tab-config:hover{color:var(--color--secondary, #383c45)}.tab-config__tab--is-active.sc-snk-tab-config:hover{color:var(--color--primary, #008561)}.tab-config__tab--is-active.sc-snk-tab-config::after{content:\"\";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.tab-config__tab--is-focused.sc-snk-tab-config{border:1px dashed var(--color--primary, #000000c5)}.tab-config__tab-label.sc-snk-tab-config{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow);margin-bottom:var(--space--extra-small, 3px)}.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config ez-icon.sc-snk-tab-config{--ez-icon--color:var(--color--secondary-700, #1C1D22)}.tab-config__backward-button.sc-snk-tab-config{left:0px;box-shadow:10px 10px 5px 5px white;background:white}.tab-config__forward-button.sc-snk-tab-config{box-shadow:10px 10px 5px 20px white;background:white}.tab-config__forward-button.sc-snk-tab-config::after,.tab-config__backward-button.sc-snk-tab-config::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.tab-config__forward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--forward-icon);mask-image:var(--snk-tab-config--forward-icon)}.tab-config__backward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--backward-icon);mask-image:var(--snk-tab-config--backward-icon)}.tab-config__forward-button.sc-snk-tab-config:hover::after,.tab-config__backward-button.sc-snk-tab-config:hover::after{background-color:var(--color--primary, #4e4e4e)}.tab-config__new-button.sc-snk-tab-config:hover ez-icon.sc-snk-tab-config{--ez-icon--color:var(--color--primary, #4e4e4e)}.tab-config__hidden.sc-snk-tab-config{display:none}.tab-config__scroll.sc-snk-tab-config::-webkit-scrollbar{display:none}.tab-config__left-icon.sc-snk-tab-config{padding-right:var(--space--small);--ez-icon--color:var(--text--disable)}.tab-config__left-icon--eye-off.sc-snk-tab-config{--ez-icon--color:var(--text--disable, #AFB6C0)}.tab-config__right-icon.sc-snk-tab-config{visibility:hidden;padding-left:var(--space--small)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{visibility:visible}.tab-config__tab--is-active.sc-snk-tab-config .tab-config__right-icon.sc-snk-tab-config{visibility:visible;--ez-icon--color:var(--color--primary)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--color--secondary, #383c45)}.tab-config__tab--is-active.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--color--primary)}.tab-config__actions-button.sc-snk-tab-config{--ez-actions-button__btn-action--min-width:100px;visibility:hidden;opacity:0;transition:visibility 1s linear,opacity 0.3s linear}.tab-config__tab.sc-snk-tab-config:hover .tab-config__actions-button.sc-snk-tab-config{visibility:visible;opacity:1;transition:visibility 0.2s linear, opacity 0.10s linear}[data-draggable-element].sc-snk-tab-config{cursor:grab}.tab-config__tab-label-disabled.sc-snk-tab-config{color:var(--text--disable, #AFB6C0)}.tab-config__slot.sc-snk-tab-config{margin-left:var(--space--small, 6px)}";
|
|
8
|
+
|
|
9
|
+
const SnkTabConfig = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.ezTabChange = createEvent(this, "ezTabChange", 7);
|
|
13
|
+
this.editionTitleTab = createEvent(this, "editionTitleTab", 7);
|
|
14
|
+
this.deleteTab = createEvent(this, "deleteTab", 7);
|
|
15
|
+
this.hideTab = createEvent(this, "hideTab", 7);
|
|
16
|
+
this.ezOrderChange = createEvent(this, "ezOrderChange", 7);
|
|
17
|
+
this.canStartDrag = createEvent(this, "canStartDrag", 7);
|
|
18
|
+
this._refTabActions = [];
|
|
19
|
+
this._actionsHide = [];
|
|
20
|
+
this._actionsShow = [];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
24
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
25
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
26
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
|
|
27
|
+
*/
|
|
28
|
+
getMessage(key, params) {
|
|
29
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
30
|
+
}
|
|
31
|
+
controlSortableTab() {
|
|
32
|
+
if (this._sortableTab) {
|
|
33
|
+
this._sortableTab.destroy();
|
|
34
|
+
}
|
|
35
|
+
this._sortableTab = new draggable_bundle.Sortable(this._hostElem.querySelectorAll('[data-draggable-parent="tab"]'), {
|
|
36
|
+
draggable: '[data-draggable-element="tab"]',
|
|
37
|
+
mirror: {
|
|
38
|
+
constrainDimensions: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
this._sortableTab.on(CONFIG_EVENTS.dragStart, (evt) => this.controlStartDraggingTab(evt));
|
|
42
|
+
this._sortableTab.on(CONFIG_EVENTS.dragStop, (evt) => this.controlStopDraggingTab(evt));
|
|
43
|
+
}
|
|
44
|
+
controlStartDraggingTab(evt) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const mouseEvent = (_a = evt === null || evt === void 0 ? void 0 : evt.dragEvent) === null || _a === void 0 ? void 0 : _a.originalEvent;
|
|
47
|
+
const targetElement = mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.target;
|
|
48
|
+
const targetName = (_b = targetElement === null || targetElement === void 0 ? void 0 : targetElement.tagName) === null || _b === void 0 ? void 0 : _b.toUpperCase();
|
|
49
|
+
if (this._activeEditText === true || targetName === "EZ-ACTIONS-BUTTON") {
|
|
50
|
+
evt === null || evt === void 0 ? void 0 : evt.cancel();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.canStartDrag.emit();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
controlStopDraggingTab(evt) {
|
|
57
|
+
const updateTimer = 500;
|
|
58
|
+
if (evt.data.newIndex !== evt.data.oldIndex) {
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
const newIndex = (evt.data.newIndex || 0) + 1;
|
|
61
|
+
this.ezOrderChange.emit(newIndex);
|
|
62
|
+
}, updateTimer);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleTabClick(tab) {
|
|
66
|
+
this.selectedIndex = tab.index;
|
|
67
|
+
this._focusedIndex = tab.index;
|
|
68
|
+
this.selectedTab = tab.tabKey;
|
|
69
|
+
this.ezTabChange.emit(tab);
|
|
70
|
+
this.setFocusedBtn(false, tab.index);
|
|
71
|
+
this.setFocusedTab(tab.index);
|
|
72
|
+
}
|
|
73
|
+
handleSlotChange(ev) {
|
|
74
|
+
const slot = ev.target;
|
|
75
|
+
const content = slot.assignedElements()[0];
|
|
76
|
+
if (content) {
|
|
77
|
+
content.classList.add("tab-config__slot");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
scrollBackward() {
|
|
81
|
+
const container = this._scrollContainer;
|
|
82
|
+
if (container) {
|
|
83
|
+
container.scrollLeft -= container.clientWidth;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
scrollFoward() {
|
|
87
|
+
const container = this._scrollContainer;
|
|
88
|
+
if (container) {
|
|
89
|
+
let lastTab = null;
|
|
90
|
+
container.querySelectorAll(".tab-config__tab").forEach((tab) => {
|
|
91
|
+
if (tab.getBoundingClientRect().right < container.clientWidth) {
|
|
92
|
+
lastTab = tab;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
container.scrollLeft = lastTab.offsetLeft + lastTab.offsetWidth;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
updateScroll() {
|
|
99
|
+
const container = this._scrollContainer;
|
|
100
|
+
if (container) {
|
|
101
|
+
const { scrollWidth, clientWidth, scrollLeft } = container;
|
|
102
|
+
const remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
|
|
103
|
+
this._startHidden = container.scrollLeft > 0;
|
|
104
|
+
this._endHidden = remainingScroll > 0;
|
|
105
|
+
if (this._startHidden) {
|
|
106
|
+
this._backwardButton.classList.remove("tab-config__hidden");
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this._backwardButton.classList.add("tab-config__hidden");
|
|
110
|
+
}
|
|
111
|
+
if (this._endHidden) {
|
|
112
|
+
this._forwardButton.classList.remove("tab-config__hidden");
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this._forwardButton.classList.add("tab-config__hidden");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
domScrollHandler() {
|
|
120
|
+
window.clearTimeout(this._scrollCallBackScroll);
|
|
121
|
+
this._scrollCallBackScroll = window.setTimeout(() => { this.updateScroll(); }, 200);
|
|
122
|
+
}
|
|
123
|
+
setFocusedTab(index) {
|
|
124
|
+
window.clearTimeout(this._scrollCallBackFocus);
|
|
125
|
+
this._scrollCallBackFocus = window.setTimeout(() => {
|
|
126
|
+
const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
|
|
127
|
+
tabtoscroll.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
128
|
+
}, 200);
|
|
129
|
+
}
|
|
130
|
+
controlKeyEventEnter(evt) {
|
|
131
|
+
evt.preventDefault();
|
|
132
|
+
const selectedTab = this._processedTabs[this._focusedIndex];
|
|
133
|
+
this.handleTabClick(selectedTab);
|
|
134
|
+
this.setFocusedTab(selectedTab.index);
|
|
135
|
+
}
|
|
136
|
+
controlKeyEventArrow(evt) {
|
|
137
|
+
let operator = undefined;
|
|
138
|
+
if (evt.key === KEY_EVENTS.arrowLeft) {
|
|
139
|
+
operator = false;
|
|
140
|
+
}
|
|
141
|
+
else if (evt.key === KEY_EVENTS.arrowRight) {
|
|
142
|
+
operator = true;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (this._focusedIndex === undefined) {
|
|
148
|
+
if (operator === false) {
|
|
149
|
+
this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex - 1 : undefined;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex + 1 : undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
if (operator === false) {
|
|
157
|
+
this._focusedIndex = this._focusedIndex - 1;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this._focusedIndex = this._focusedIndex + 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (this._focusedIndex < 0) {
|
|
164
|
+
this._focusedIndex = 0;
|
|
165
|
+
}
|
|
166
|
+
else if (this._focusedIndex > this._processedTabs.length - 1) {
|
|
167
|
+
this._focusedIndex = this._processedTabs.length - 1;
|
|
168
|
+
}
|
|
169
|
+
this.setFocusedBtn(true, this._focusedIndex);
|
|
170
|
+
this.setFocusedTab(this._focusedIndex);
|
|
171
|
+
}
|
|
172
|
+
controlKeyEventEscape(evt) {
|
|
173
|
+
evt.preventDefault();
|
|
174
|
+
const currentTab = this._processedTabs[this.selectedIndex];
|
|
175
|
+
this._focusedIndex = undefined;
|
|
176
|
+
this.handleTabClick(currentTab);
|
|
177
|
+
this.setFocusedTab(this.selectedIndex);
|
|
178
|
+
}
|
|
179
|
+
setFocusedParam(evt) {
|
|
180
|
+
if (this._activeEditText === true || evt == undefined) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (evt.key === KEY_EVENTS.enter) {
|
|
184
|
+
this.controlKeyEventEnter(evt);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (evt.key === KEY_EVENTS.arrowLeft || evt.key === KEY_EVENTS.arrowRight) {
|
|
188
|
+
this.controlKeyEventArrow(evt);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (evt.key === KEY_EVENTS.tab || evt.key === KEY_EVENTS.escape) {
|
|
192
|
+
this.controlKeyEventEscape(evt);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
setFocusedBtn(visible, parameter) {
|
|
197
|
+
const tabsButtons = this._scrollContainer.querySelectorAll(".tab-config__tab");
|
|
198
|
+
tabsButtons.forEach((el) => {
|
|
199
|
+
el.classList.remove("tab-config__tab--is-focused");
|
|
200
|
+
if (el.id === "tab" + parameter && visible) {
|
|
201
|
+
el.classList.add("tab-config__tab--is-focused");
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
getStyledLabel(tabId) {
|
|
206
|
+
const tabElem = this._hostElem.querySelector(`#${tabId}`);
|
|
207
|
+
if (tabElem == undefined) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
let styledLabel = {
|
|
211
|
+
fontSize: window.getComputedStyle(tabElem).getPropertyValue('font-size'),
|
|
212
|
+
fontWeight: window.getComputedStyle(tabElem).getPropertyValue('font-weight'),
|
|
213
|
+
fontFamily: window.getComputedStyle(tabElem).getPropertyValue('font-family')
|
|
214
|
+
};
|
|
215
|
+
return styledLabel;
|
|
216
|
+
}
|
|
217
|
+
cancelEditText() {
|
|
218
|
+
var _a;
|
|
219
|
+
this._activeEditText = false;
|
|
220
|
+
if (this._scrollContainer != undefined) {
|
|
221
|
+
(_a = this._scrollContainer.querySelector('.tab-config__tab--is-active')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
handleActions(actionSelect, tab) {
|
|
225
|
+
const { value: typeAction } = actionSelect.detail;
|
|
226
|
+
if (typeAction === TYPE_ACTIONS.rename) {
|
|
227
|
+
this._activeEditText = true;
|
|
228
|
+
this._activeEditTextIndex = tab.index;
|
|
229
|
+
}
|
|
230
|
+
else if (typeAction === TYPE_ACTIONS.hide || typeAction === TYPE_ACTIONS.show) {
|
|
231
|
+
this.hideTab.emit(tab);
|
|
232
|
+
}
|
|
233
|
+
else if (typeAction === TYPE_ACTIONS.delete) {
|
|
234
|
+
this.deleteTab.emit(tab);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
handleSaveEditionText(editDetails) {
|
|
238
|
+
const { value, newValue } = editDetails.detail;
|
|
239
|
+
this._processedTabs.forEach((tab) => {
|
|
240
|
+
if (tab.label === value) {
|
|
241
|
+
tab.label = newValue;
|
|
242
|
+
this.cancelEditText();
|
|
243
|
+
this.editionTitleTab.emit(editDetails);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
onHideActions(index) {
|
|
248
|
+
const elementActionsBtn = this._refTabActions[index];
|
|
249
|
+
if (elementActionsBtn) {
|
|
250
|
+
elementActionsBtn.isOpened().then((isOpened) => {
|
|
251
|
+
if (isOpened) {
|
|
252
|
+
elementActionsBtn === null || elementActionsBtn === void 0 ? void 0 : elementActionsBtn.hideActions();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
componentWillLoad() {
|
|
258
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
259
|
+
if (this._application != undefined) {
|
|
260
|
+
this._actionsHide = [
|
|
261
|
+
{ value: TYPE_ACTIONS.rename, label: this.getMessage("snkTabConfig.labelRename") },
|
|
262
|
+
{ value: TYPE_ACTIONS.hide, label: this.getMessage("snkTabConfig.labelHide") },
|
|
263
|
+
{ value: TYPE_ACTIONS.delete, label: this.getMessage("snkTabConfig.labelDelete") }
|
|
264
|
+
];
|
|
265
|
+
this._actionsShow = [
|
|
266
|
+
{ value: TYPE_ACTIONS.rename, label: this.getMessage("snkTabConfig.labelRename") },
|
|
267
|
+
{ value: TYPE_ACTIONS.show, label: this.getMessage("snkTabConfig.labelShow") },
|
|
268
|
+
{ value: TYPE_ACTIONS.delete, label: this.getMessage("snkTabConfig.labelDelete") }
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
componentWillRender() {
|
|
273
|
+
if (this._processedTabs == undefined) {
|
|
274
|
+
this._processedTabs = [];
|
|
275
|
+
if (this.tabs) {
|
|
276
|
+
this.tabs.split(",").forEach((label) => {
|
|
277
|
+
label = label.trim();
|
|
278
|
+
this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
this._hostElem.querySelectorAll("snk-tab").forEach((elem) => {
|
|
282
|
+
const tabKey = elem.getAttribute("tabKey");
|
|
283
|
+
const label = elem.getAttribute("label") !== TAB_NAMES.main ? elem.getAttribute("label") : this.getMessage("snkFormConfig.form.mainArea");
|
|
284
|
+
const visible = elem.hasAttribute("visible");
|
|
285
|
+
const tab = { label, tabKey, index: this._processedTabs.length, visible };
|
|
286
|
+
const content = elem.firstChild;
|
|
287
|
+
if (content) {
|
|
288
|
+
content.setAttribute("slot", "tab" + tab.index);
|
|
289
|
+
this._hostElem.appendChild(content);
|
|
290
|
+
}
|
|
291
|
+
this._processedTabs.push(tab);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
componentDidRender() {
|
|
296
|
+
this.updateScroll();
|
|
297
|
+
this.controlSortableTab();
|
|
298
|
+
}
|
|
299
|
+
render() {
|
|
300
|
+
return (h(Host, null, h("button", { class: "tab-config__backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }), h("div", { class: "tab-config__lower-bar" }), h("div", { class: "tab-config__scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.setFocusedParam(ev), "data-draggable-parent": "tab" }, this._processedTabs.map((tab, index) => {
|
|
301
|
+
const tabId = "tab" + index;
|
|
302
|
+
const isSelected = index === this.selectedIndex || (this.selectedTab && tab.tabKey === this.selectedTab);
|
|
303
|
+
if (isSelected) {
|
|
304
|
+
this.selectedTab = tab.tabKey;
|
|
305
|
+
this.selectedIndex = index;
|
|
306
|
+
}
|
|
307
|
+
return h("button", { id: tabId, class: `tab-config__tab${isSelected ? " tab-config__tab--is-active" : ""}`, onClick: () => this.handleTabClick(tab), onDblClick: () => { this._activeEditText = true; this._activeEditTextIndex = index; }, "data-draggable-element": index > 0 ? "tab" : "", onMouseLeave: () => this.onHideActions(index) }, (this._activeEditText === true && this._activeEditTextIndex === index && index > 0) ||
|
|
308
|
+
h(Fragment, null, index > 0 && h("ez-icon", { iconName: tab.leftIcon || "drag-indicator", class: "tab-config__left-icon" }), (tab.visible === false && index > 0) && h("ez-icon", { iconName: tab.leftIcon || "eye-off", class: "tab-config__left-icon tab-config__left-icon--eye-off" }), h("span", { class: "tab-config__tab-label" + (tab.visible === false && index > 0 ? " tab-config__tab-label-disabled" : ""), title: tab.label }, tab.label), index > 0 &&
|
|
309
|
+
h("ez-actions-button", { class: "tab-config__actions-button", size: "small", ref: elem => this._refTabActions[index] = elem, actions: tab.visible === false ? this._actionsShow : this._actionsHide, isTransparent: true, arrowActive: true, onEzAction: (ev) => this.handleActions(ev, tab) }), h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } })), (this._activeEditText === true && index > 0 && this._activeEditTextIndex === index) &&
|
|
310
|
+
h("ez-text-edit", { value: tab.label, styled: this.getStyledLabel(tabId), class: "tab-config__edit-text", onSaveEdition: (ev) => this.handleSaveEditionText(ev), onCancelEdition: () => this.cancelEditText() }));
|
|
311
|
+
})), h("button", { class: "tab-config__forward-button", ref: (el) => this._forwardButton = el, onClick: () => this.scrollFoward() })));
|
|
312
|
+
}
|
|
313
|
+
get _hostElem() { return getElement(this); }
|
|
314
|
+
};
|
|
315
|
+
SnkTabConfig.style = snkTabConfigCss;
|
|
316
|
+
|
|
317
|
+
export { SnkTabConfig as snk_tab_config };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from './index-
|
|
1
|
+
import { h } from './index-e4121713.js';
|
|
2
2
|
|
|
3
3
|
var TaskbarElement;
|
|
4
4
|
(function (TaskbarElement) {
|
|
@@ -13,9 +13,9 @@ var TaskbarElement;
|
|
|
13
13
|
TaskbarElement["SAVE"] = "SAVE";
|
|
14
14
|
TaskbarElement["GRID_MODE"] = "GRID_MODE";
|
|
15
15
|
TaskbarElement["FORM_MODE"] = "FORM_MODE";
|
|
16
|
-
TaskbarElement["CONFIG_GRID"] = "CONFIG_GRID";
|
|
17
16
|
TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
|
|
18
17
|
TaskbarElement["DIVIDER"] = "DIVIDER";
|
|
18
|
+
TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
|
|
19
19
|
})(TaskbarElement || (TaskbarElement = {}));
|
|
20
20
|
var AuthorizationElements;
|
|
21
21
|
(function (AuthorizationElements) {
|
|
@@ -23,11 +23,12 @@ var AuthorizationElements;
|
|
|
23
23
|
AuthorizationElements["CLONE"] = "CLONE";
|
|
24
24
|
AuthorizationElements["REMOVE"] = "REMOVE";
|
|
25
25
|
AuthorizationElements["INSERT"] = "INSERT";
|
|
26
|
-
AuthorizationElements["
|
|
26
|
+
AuthorizationElements["CONFIGURATOR"] = "CONFIGURATOR";
|
|
27
27
|
})(AuthorizationElements || (AuthorizationElements = {}));
|
|
28
28
|
var VisibleWhenForbidden;
|
|
29
29
|
(function (VisibleWhenForbidden) {
|
|
30
30
|
VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
|
|
31
|
+
VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
|
|
31
32
|
})(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
|
|
32
33
|
const buildCustomButton = (def, className, action, isEnabled) => {
|
|
33
34
|
const { hint, text, iconName } = def;
|
|
@@ -43,7 +44,7 @@ const buildCustomButton = (def, className, action, isEnabled) => {
|
|
|
43
44
|
return textButton(def.name, className, text, hint, action, isEnabled);
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
|
-
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
47
|
+
const buildElem = (element, className, getTitle, action, isEnabled, actions, configName) => {
|
|
47
48
|
const title = getTitle(element);
|
|
48
49
|
switch (element) {
|
|
49
50
|
case TaskbarElement.PREVIOUS:
|
|
@@ -68,8 +69,8 @@ const buildElem = (element, className, getTitle, action, isEnabled, actions) =>
|
|
|
68
69
|
return iconButton("table", element, className, title, action, isEnabled);
|
|
69
70
|
case TaskbarElement.FORM_MODE:
|
|
70
71
|
return iconButton("list", element, className, title, action, isEnabled);
|
|
71
|
-
case TaskbarElement.
|
|
72
|
-
return
|
|
72
|
+
case TaskbarElement.CONFIGURATOR:
|
|
73
|
+
return configButton(element, className, getTitle, action, isEnabled, configName);
|
|
73
74
|
case TaskbarElement.MORE_OPTIONS:
|
|
74
75
|
return actions && actions.length > 0 ? h("ez-actions-button", { title: title, size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
|
|
75
76
|
case TaskbarElement.DIVIDER:
|
|
@@ -86,5 +87,8 @@ function iconTextButton(iconName, name, className, text, title, action, isEnable
|
|
|
86
87
|
return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
|
|
87
88
|
h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
88
89
|
}
|
|
90
|
+
function configButton(element, className, getTitle, action, isEnabled, configName) {
|
|
91
|
+
return h("snk-configurator", { key: "configurator", configName: configName, title: getTitle(element), class: className, enabled: isEnabled(element), onChangeViewMode: (evt) => action(evt === null || evt === void 0 ? void 0 : evt.detail) });
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
export { AuthorizationElements as A, TaskbarElement as T, VisibleWhenForbidden as V, buildCustomButton as a, buildElem as b };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
class TaskbarProcessor {
|
|
2
|
+
constructor(defaultButtons) {
|
|
3
|
+
this._defaultButtons = defaultButtons;
|
|
4
|
+
}
|
|
5
|
+
process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
|
|
6
|
+
var _a;
|
|
7
|
+
this.customButtons = new Map();
|
|
8
|
+
this.buttons = "";
|
|
9
|
+
this.disabledButtons = [];
|
|
10
|
+
(_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
|
|
11
|
+
let buttonName;
|
|
12
|
+
if (typeof btnDef === "string") {
|
|
13
|
+
buttonName = btnDef;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const customBtn = btnDef;
|
|
17
|
+
this.customButtons.set(customBtn.name, customBtn);
|
|
18
|
+
buttonName = customBtn.name;
|
|
19
|
+
}
|
|
20
|
+
if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
|
|
21
|
+
this.disabledButtons.push(buttonName);
|
|
22
|
+
}
|
|
23
|
+
if (this.buttons.length > 0) {
|
|
24
|
+
this.buttons += ",";
|
|
25
|
+
}
|
|
26
|
+
this.buttons += buttonName;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
30
|
+
const defaults = this._defaultButtons[taskbarId];
|
|
31
|
+
if (taskbarManager) {
|
|
32
|
+
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
33
|
+
}
|
|
34
|
+
return defaults;
|
|
35
|
+
}
|
|
36
|
+
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
37
|
+
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
38
|
+
if (taskbarManager && taskbarManager.isEnabled) {
|
|
39
|
+
return taskbarManager.isEnabled(taskbarId, dataState, buttonName, originalValue);
|
|
40
|
+
}
|
|
41
|
+
return originalValue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { TaskbarProcessor as T };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as e}from"./p-
|
|
1
|
+
import{r as t,h as e}from"./p-9ba3df4c.js";import{F as s}from"./p-9dd2b8cb.js";const i=class{constructor(e){t(this,e)}ezChangeListener(){const t=this._startDate.value,e=this._endDate.value;this.value=t||e?{start:t,end:e}:void 0}getDate(t){const e=this.value?this.value[t]:null;if(e instanceof Date)return e;if("string"==typeof e){let t=new Date(e);return t.setMinutes(t.getMinutes()+t.getTimezoneOffset()),t}return null}async show(){this._startDate.setFocus()}render(){if(this.config&&this.config.type===s.PERIOD)return e("div",{class:"ez-col ez-col--nowrap"},e("ez-date-input",{label:this.config.label,ref:t=>this._startDate=t,value:this.getDate("start")}),e("label",{class:"ez-text ez-text--medium ez-text--primary ez-margin--medium"},"até"),e("ez-date-input",{label:this.config.label,ref:t=>this._endDate=t,value:this.getDate("end")}))}};export{i as snk_filter_period}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t{constructor(t){this._defaultButtons=t}process(t,s,i,h=[]){var r;this.customButtons=new Map,this.buttons="",this.disabledButtons=[],null===(r=this.getButtonsArray(t,s,i))||void 0===r||r.forEach((r=>{let e;if("string"==typeof r)e=r;else{const t=r;this.customButtons.set(t.name,t),e=t.name}this.isEnabled(t,s,e,i,h)||this.disabledButtons.push(e),this.buttons.length>0&&(this.buttons+=","),this.buttons+=e}))}getButtonsArray(t,s,i){const h=this._defaultButtons[t];return s?s.getButtons(t,i,[...h]):h}isEnabled(t,s,i,h,r){const e=!r.includes(i);return s&&s.isEnabled?s.isEnabled(t,h,i,e):e}}export{t as T}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,n,o){return e(o={path:n,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},o.exports),o.exports}export{e as a,n as c}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as t,H as s}from"./p-9ba3df4c.js";import{UserInterface as a,ApplicationContext as i}from"@sankhyalabs/core";import{convertType as n}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as r}from"@sankhyalabs/ezui/dist/collection/utils";import{F as o}from"./p-9dd2b8cb.js";const l=class{constructor(t){e(this,t)}getValue(e,t){if(this.value&&t>=0&&t<this.value.length){const s=this.value[t];return e.type===a.SEARCH?s:n(e.dataType,s)}}setValue(e,t){this.value=null==this.value?Array(e).fill(null):[...this.value],this.value[e]=t,0==this.value.filter((e=>null!=e)).length&&(this.value=null)}doSearch(e,t,s){const a=i.getContextValue("__SNK__APPLICATION__");return new Promise(((i,n)=>{a.executePreparedSearch(e,t,s.searchContext).then((e=>{i(e)})).catch((e=>{n(e)}))}))}getParamsInterface(){var e,s,i;return(null===(i=null===(s=null===(e=this.config)||void 0===e?void 0:e.props)||void 0===s?void 0:s.personalizedFilter)||void 0===i?void 0:i.parameters).map(((e,s)=>{var i;const n="param_"+s;switch(e.type){case a.SEARCH:return t("ez-search",{id:n,suppressEmptyOption:!0,value:this.getValue(e,s),onEzChange:e=>this.setValue(s,e.detail),label:e.label,optionLoader:({mode:t,argument:s})=>this.doSearch(t,s,e)});case a.SWITCH:case a.CHECKBOX:return t("ez-check",{id:n,class:"ez-padding-bottom--medium",mode:a.SWITCH===e.type?r.SWITCH:r.REGULAR,value:this.getValue(e,s),label:e.label,onEzChange:e=>this.setValue(s,e.detail)});case a.DECIMALNUMBER:case a.INTEGERNUMBER:return t("ez-number-input",{id:n,label:e.label,value:this.getValue(e,s),precision:null===(i=e.props)||void 0===i?void 0:i.precision,onEzChange:e=>this.setValue(s,e.detail)});case a.OPTIONSELECTOR:return t("ez-combo-box",{id:n,label:e.label,value:this.getValue(e,s),options:e.options,onEzChange:e=>{var t;return this.setValue(s,null===(t=e.detail)||void 0===t?void 0:t.value)}});case a.DATE:return t("ez-date-input",{id:n,label:e.label,value:this.getValue(e,s),onEzChange:e=>this.setValue(s,e.detail)});case a.DATETIME:return t("ez-date-time-input",{id:n,label:e.label,value:this.getValue(e,s),onEzChange:e=>this.setValue(s,e.detail)});default:return t("ez-text-input",{id:n,label:e.label,value:this.getValue(e,s),onEzChange:e=>this.setValue(s,e.detail)})}}))}async show(){const e=document.querySelector("#param_0");e&&e.setFocus()}render(){if(this.config&&this.config.type===o.PERSONALIZED)return t(s,null,this.getParamsInterface())}};export{l as snk_filter_personalized}
|