@sankhyalabs/sankhyablocks 1.4.0-beta.7 → 1.4.0-beta.8
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-aebcc2f5.js +69 -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-188190ee.js} +2 -0
- 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 +163 -0
- package/dist/cjs/{snk-filter-bar_5.cjs.entry.js → snk-configurator_6.cjs.entry.js} +193 -6
- 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 +1 -1
- 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-4c2c6704.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 +33 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +3 -3
- 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 +248 -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 +58 -0
- package/dist/components/SnkMessageBuilder.js +87 -11
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/constants.js +60 -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 +178 -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-personalized.js +2 -0
- 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-c4e3341e.js +60 -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-bafb2cef.js} +2 -1
- 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 +159 -0
- package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +194 -8
- 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 +1 -1
- 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-2035b1c7.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-03f9c407.js +1 -0
- package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-04ad681a.entry.js} +1 -1
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-1963b46f.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-26c503a6.entry.js +1 -0
- package/dist/sankhyablocks/{p-2e49afef.entry.js → p-31631fb6.entry.js} +1 -1
- package/dist/sankhyablocks/p-361299e8.js +26 -0
- package/dist/sankhyablocks/p-434e0dcf.entry.js +1 -0
- package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6c61416a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-49580cdd.entry.js → p-857c4735.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4574a955.entry.js → p-8cd8977c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6386d720.entry.js → p-916068ff.entry.js} +1 -1
- package/dist/sankhyablocks/p-9f2c5fac.entry.js +1 -0
- package/dist/sankhyablocks/p-ad658f44.js +1 -0
- package/dist/sankhyablocks/p-ae302037.entry.js +75 -0
- package/dist/sankhyablocks/p-af11b0e7.js +1 -0
- package/dist/sankhyablocks/p-af306302.entry.js +1 -0
- package/dist/sankhyablocks/p-b6d6b172.js +1 -0
- package/dist/sankhyablocks/{p-40b27004.entry.js → p-cc85ba53.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-ccdf59eb.entry.js} +1 -1
- package/dist/sankhyablocks/p-ce789145.entry.js +1 -0
- package/dist/sankhyablocks/p-cf81e313.entry.js +1 -0
- package/dist/sankhyablocks/{p-0ea25487.entry.js → p-d1ae76ec.entry.js} +1 -1
- package/dist/sankhyablocks/p-d50651a3.js +1 -0
- package/dist/sankhyablocks/{p-fac2b6a9.js → p-ddb03141.js} +2 -2
- package/dist/sankhyablocks/p-ee906940.entry.js +1 -0
- package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-f9084ecb.entry.js} +1 -1
- package/dist/sankhyablocks/p-fa75fba5.entry.js +1 -0
- 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 +41 -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 +62 -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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SnkConfigModal extends Components.SnkConfigModal, HTMLElement {}
|
|
4
|
+
export const SnkConfigModal: {
|
|
5
|
+
prototype: SnkConfigModal;
|
|
6
|
+
new (): SnkConfigModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { V as VIEW_MODE } from './constants.js';
|
|
4
|
+
|
|
5
|
+
class ConfigurableElementsStorage {
|
|
6
|
+
static setGrid(id, grid) {
|
|
7
|
+
this._gridById.set(id, grid);
|
|
8
|
+
}
|
|
9
|
+
static setForm(id, form) {
|
|
10
|
+
this._formById.set(id, form);
|
|
11
|
+
}
|
|
12
|
+
static getGrid(id) {
|
|
13
|
+
return this._gridById.get(id);
|
|
14
|
+
}
|
|
15
|
+
static getForm(id) {
|
|
16
|
+
return this._formById.get(id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
ConfigurableElementsStorage._gridById = new Map();
|
|
20
|
+
ConfigurableElementsStorage._formById = new Map();
|
|
21
|
+
|
|
22
|
+
const snkConfigModalCss = ".sc-snk-config-modal-h{--snk-config-modal__button-close--padding-left:var(--space--medium, 12px);--snk-config-modal__title--color:var(--title--primary, #2B3A54);--snk-config-modal__title--font-family:var(--font-pattern, \"Sora\");--snk-config-modal__title--font-size:var(--title--large, 20px);--snk-config-modal__title--font-weight:var(--text-weight--extra-large, 700);--snk-config-modal__subtitle--color:var(--title--primary, #2B3A54);--snk-config-modal__subtitle--font-family:var(--font-pattern, \"Sora\");--snk-config-modal__subtitle--font-size:var(--text--medium, 14px);--snk-config-modal__subtitle--font-weight:var(--text-weight--large, 600);--snk-config-modal__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-config-modal__scrollbar--width:var(--space--medium, 12px);--snk-config-modal__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-config-modal__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-config-modal-h{width:359px;max-width:359px}}.snk-config-modal__button-config.sc-snk-config-modal{--ez-button--min-width:100%}.snk-config-modal__header.sc-snk-config-modal{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-config-modal__title.sc-snk-config-modal{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-config-modal__title--color);font-size:var(--snk-config-modal__title--font-size);font-family:var(--snk-config-modal__title--font-family);font-weight:var(--snk-config-modal__title--font-weight)}.snk-config-modal__subtitle.sc-snk-config-modal{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-config-modal__subtitle--color);font-size:var(--snk-config-modal__subtitle--font-size);font-family:var(--snk-config-modal__subtitle--font-family);font-weight:var(--snk-config-modal__subtitle--font-weight)}.snk-config-modal__button-close.sc-snk-config-modal{padding-left:var(--snk-config-modal__button-close--padding-left)}.snk-config-modal__main.sc-snk-config-modal{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-config-modal__scrollbar--background-color-primary) var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-track{background-color:var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-thumb{background-color:var(--snk-config-modal__scrollbar--background-color-primary);border-radius:var(--snk-config-modal__scrollbar--border-radius)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar{background-color:var(--snk-config-modal__scrollbar--background-color-secondary);width:var(--snk-config-modal__scrollbar--width);max-width:var(--snk-config-modal__scrollbar--width);min-width:var(--snk-config-modal__scrollbar--width)}";
|
|
23
|
+
|
|
24
|
+
const GRID_MODE = VIEW_MODE.grid;
|
|
25
|
+
const FORM_MODE = VIEW_MODE.form;
|
|
26
|
+
const SnkConfigModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.__registerHost();
|
|
30
|
+
this.cancelConfig = createEvent(this, "cancelConfig", 7);
|
|
31
|
+
this.changeConfig = createEvent(this, "changeConfig", 7);
|
|
32
|
+
/**
|
|
33
|
+
* Define se o modo grid está ativo.
|
|
34
|
+
*/
|
|
35
|
+
this.gridMode = true;
|
|
36
|
+
}
|
|
37
|
+
dispatchChange(openConfig = false) {
|
|
38
|
+
const data = {
|
|
39
|
+
viewMode: this.gridMode ? GRID_MODE.index : FORM_MODE.index,
|
|
40
|
+
openConfig
|
|
41
|
+
};
|
|
42
|
+
this.changeConfig.emit(data);
|
|
43
|
+
}
|
|
44
|
+
closeConfig() {
|
|
45
|
+
this.cancelConfig.emit();
|
|
46
|
+
}
|
|
47
|
+
onChecked(evt) {
|
|
48
|
+
const value = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
49
|
+
this.gridMode = value === "G" ? true : false;
|
|
50
|
+
this.dispatchChange();
|
|
51
|
+
}
|
|
52
|
+
onClicked() {
|
|
53
|
+
this.dispatchChange(true);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
57
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
58
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
59
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
|
|
60
|
+
*/
|
|
61
|
+
getMessage(key) {
|
|
62
|
+
return this._application.messagesBuilder.getMessage(key, {});
|
|
63
|
+
}
|
|
64
|
+
componentWillLoad() {
|
|
65
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return (h(Host, null, h("div", { class: "snk-config-modal__header" }, h("label", { class: "snk-config-modal__title" }, this.getMessage("snkConfigModal.titleConfigurations")), h("div", { class: "snk-config-modal__button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "snk-config-modal__main" }, h("ez-radio-button", { class: "ez-margin-top--medium", label: this.getMessage("snkConfigModal.subTitleModeConfig"), value: this.gridMode ? "G" : "F", onEzChange: (evt) => this.onChecked(evt) }, ConfigurableElementsStorage.getForm(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelGrid"), value: "G" }), ConfigurableElementsStorage.getGrid(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelForm"), value: "F" })), h("ez-button", { mode: "slim", label: this.gridMode
|
|
69
|
+
? this.getMessage("snkConfigModal.labelConfigGrid")
|
|
70
|
+
: this.getMessage("snkConfigModal.labelConfigForm"), class: "snk-config-modal__button-config ez-button--primary", onClick: () => this.onClicked() }), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" }))));
|
|
71
|
+
}
|
|
72
|
+
static get style() { return snkConfigModalCss; }
|
|
73
|
+
}, [2, "snk-config-modal", {
|
|
74
|
+
"configName": [1, "config-name"],
|
|
75
|
+
"gridMode": [4, "grid-mode"]
|
|
76
|
+
}]);
|
|
77
|
+
function defineCustomElement() {
|
|
78
|
+
if (typeof customElements === "undefined") {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const components = ["snk-config-modal"];
|
|
82
|
+
components.forEach(tagName => { switch (tagName) {
|
|
83
|
+
case "snk-config-modal":
|
|
84
|
+
if (!customElements.get(tagName)) {
|
|
85
|
+
customElements.define(tagName, SnkConfigModal);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
} });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { ConfigurableElementsStorage as C, SnkConfigModal as S, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SnkConfigOptions extends Components.SnkConfigOptions, HTMLElement {}
|
|
4
|
+
export const SnkConfigOptions: {
|
|
5
|
+
prototype: SnkConfigOptions;
|
|
6
|
+
new (): SnkConfigOptions;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { formFieldBuilder } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
+
import { DataType, getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
5
|
+
import { a as VARS_BY_TYPE, D as DEFAULT_TYPE, C as CONFIG_EVENTS } from './constants.js';
|
|
6
|
+
|
|
7
|
+
const snkConfigOptionsCss = ".sc-snk-config-options-h{width:100%;border:2px solid var(--color--secondary-200);border-radius:15px}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
|
|
8
|
+
|
|
9
|
+
const SnkConfigOptions = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.configOptionsChanged = createEvent(this, "configOptionsChanged", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Armazena as propriedades do campo
|
|
16
|
+
*/
|
|
17
|
+
this.fieldConfig = {};
|
|
18
|
+
}
|
|
19
|
+
onConfigDefault(optionSelected) {
|
|
20
|
+
if (optionSelected != undefined) {
|
|
21
|
+
this._defaultType = optionSelected;
|
|
22
|
+
this.fieldConfig.defaultValue = {
|
|
23
|
+
type: this._defaultType
|
|
24
|
+
};
|
|
25
|
+
this.configOptionsChanged.emit(this.fieldConfig);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
buildOptions() {
|
|
29
|
+
var _a, _b, _c;
|
|
30
|
+
const interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
|
|
31
|
+
return VARS_BY_TYPE.UserInterface[interfaceField];
|
|
32
|
+
}
|
|
33
|
+
enabledValueDefault() {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
36
|
+
if (((_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault) === "true" && VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
getFieldProperties(field) {
|
|
42
|
+
var _a;
|
|
43
|
+
if (field != undefined) {
|
|
44
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
getMessage(key, params) {
|
|
48
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
49
|
+
}
|
|
50
|
+
getDefaultType() {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
|
|
53
|
+
}
|
|
54
|
+
getValidatedValue(fieldValue) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (fieldValue == undefined) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
60
|
+
const dataType = field === null || field === void 0 ? void 0 : field.dataType;
|
|
61
|
+
if (dataType == undefined) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const value = dataType !== DataType.OBJECT && dataType !== DataType.DATE
|
|
65
|
+
&& typeof fieldValue === "object" && "value" in fieldValue
|
|
66
|
+
? fieldValue.value
|
|
67
|
+
: fieldValue;
|
|
68
|
+
return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
|
|
69
|
+
}
|
|
70
|
+
onChange(evt) {
|
|
71
|
+
this.fieldConfig.defaultValue.value = this.getValidatedValue(evt === null || evt === void 0 ? void 0 : evt.detail);
|
|
72
|
+
this.configOptionsChanged.emit(this.fieldConfig);
|
|
73
|
+
}
|
|
74
|
+
onSearch(searchArgument) {
|
|
75
|
+
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
76
|
+
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
loadDataField() {
|
|
80
|
+
this._element.querySelectorAll("[data-field-name]")
|
|
81
|
+
.forEach((field) => {
|
|
82
|
+
var _a, _b, _c, _d;
|
|
83
|
+
field.enabled = ((_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault) === "true";
|
|
84
|
+
if (field.enabled) {
|
|
85
|
+
const value = this.fieldConfig.defaultValue.value;
|
|
86
|
+
if (value != undefined) {
|
|
87
|
+
const fieldName = field.dataset.fieldName;
|
|
88
|
+
const dataType = (_d = (_c = this.dataUnit) === null || _c === void 0 ? void 0 : _c.getField(fieldName)) === null || _d === void 0 ? void 0 : _d.dataType;
|
|
89
|
+
field.value = getConvertedValue(dataType, value);
|
|
90
|
+
}
|
|
91
|
+
field.addEventListener(CONFIG_EVENTS.fieldChanged, (evt) => {
|
|
92
|
+
return this.onChange(evt);
|
|
93
|
+
});
|
|
94
|
+
if (field.tagName === "EZ-SEARCH") {
|
|
95
|
+
field.optionLoader = (searchArgument) => {
|
|
96
|
+
return this.onSearch(searchArgument);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
loadDefaultValue() {
|
|
103
|
+
var _a;
|
|
104
|
+
if (this.fieldConfig == undefined) {
|
|
105
|
+
this._defaultType = DEFAULT_TYPE.fixed;
|
|
106
|
+
this.fieldConfig = {
|
|
107
|
+
defaultValue: {
|
|
108
|
+
type: this._defaultType
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
|
|
113
|
+
this._defaultType = DEFAULT_TYPE.fixed;
|
|
114
|
+
this.fieldConfig.defaultValue = {
|
|
115
|
+
type: this._defaultType
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
this._defaultType = this.fieldConfig.defaultValue.type;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
getEnabledByProperty(property) {
|
|
123
|
+
const properties = this._fieldProperties;
|
|
124
|
+
if (properties != undefined && properties[property] === true) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
getValueByProperty(property) {
|
|
130
|
+
const properties = this._fieldProperties;
|
|
131
|
+
if (properties != undefined && properties[property] === true) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
return this.fieldConfig[property];
|
|
135
|
+
}
|
|
136
|
+
componentWillLoad() {
|
|
137
|
+
var _a;
|
|
138
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
139
|
+
this.loadDefaultValue();
|
|
140
|
+
this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
141
|
+
}
|
|
142
|
+
componentDidRender() {
|
|
143
|
+
this.loadDataField();
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
var _a, _b, _c, _d;
|
|
147
|
+
return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: ((_c = (_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.allowDefault) === "true", onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === DEFAULT_TYPE.variable ?
|
|
148
|
+
h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
|
|
149
|
+
:
|
|
150
|
+
((_d = this._fieldProperties) === null || _d === void 0 ? void 0 : _d.userInterface) &&
|
|
151
|
+
formFieldBuilder({
|
|
152
|
+
descriptor: this._fieldProperties,
|
|
153
|
+
config: this.fieldConfig
|
|
154
|
+
}).$children$)), h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: "switch", label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: "switch", label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: "switch", label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
|
|
155
|
+
}
|
|
156
|
+
get _element() { return this; }
|
|
157
|
+
static get style() { return snkConfigOptionsCss; }
|
|
158
|
+
}, [2, "snk-config-options", {
|
|
159
|
+
"fieldConfig": [16],
|
|
160
|
+
"idConfig": [513, "id-config"],
|
|
161
|
+
"dataUnit": [16],
|
|
162
|
+
"_defaultType": [32]
|
|
163
|
+
}]);
|
|
164
|
+
function defineCustomElement() {
|
|
165
|
+
if (typeof customElements === "undefined") {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const components = ["snk-config-options"];
|
|
169
|
+
components.forEach(tagName => { switch (tagName) {
|
|
170
|
+
case "snk-config-options":
|
|
171
|
+
if (!customElements.get(tagName)) {
|
|
172
|
+
customElements.define(tagName, SnkConfigOptions);
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
} });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { SnkConfigOptions as S, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SnkConfigurator extends Components.SnkConfigurator, HTMLElement {}
|
|
4
|
+
export const SnkConfigurator: {
|
|
5
|
+
prototype: SnkConfigurator;
|
|
6
|
+
new (): SnkConfigurator;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
+
import { C as CONFIG_EVENTS, V as VIEW_MODE } from './constants.js';
|
|
5
|
+
import { C as ConfigurableElementsStorage, d as defineCustomElement$1 } from './snk-config-modal2.js';
|
|
6
|
+
|
|
7
|
+
const GRID_MODE = VIEW_MODE.grid;
|
|
8
|
+
const FORM_MODE = VIEW_MODE.form;
|
|
9
|
+
const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.changeViewMode = createEvent(this, "changeViewMode", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Nome do componente que será vinculado ao `data-configurator-parent` para controlar o modal de configurações.
|
|
16
|
+
*/
|
|
17
|
+
this.name = "snkConfigurator";
|
|
18
|
+
/**
|
|
19
|
+
* Define se o campo está habilitado.
|
|
20
|
+
*/
|
|
21
|
+
this.enabled = true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
25
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
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, {});
|
|
31
|
+
}
|
|
32
|
+
controlConfigModal(opened) {
|
|
33
|
+
var _a;
|
|
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
|
+
}
|
|
40
|
+
}
|
|
41
|
+
changeConfigModal(evt) {
|
|
42
|
+
const data = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
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
|
+
}
|
|
53
|
+
}
|
|
54
|
+
callShowConfig(viewMode) {
|
|
55
|
+
if (viewMode === GRID_MODE.index) {
|
|
56
|
+
if (this._grid == undefined) {
|
|
57
|
+
this.findGrid();
|
|
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
|
+
}
|
|
71
|
+
}
|
|
72
|
+
getConfigModal() {
|
|
73
|
+
const modalContainer = document.createElement("ez-modal");
|
|
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;
|
|
92
|
+
}
|
|
93
|
+
findConfigModal() {
|
|
94
|
+
let modalContainer = document.body.querySelector(`[data-configurator-modal="${this.name}"]`);
|
|
95
|
+
if (modalContainer == undefined) {
|
|
96
|
+
modalContainer = this.getConfigModal();
|
|
97
|
+
document.body.appendChild(modalContainer);
|
|
98
|
+
}
|
|
99
|
+
this._modal = modalContainer;
|
|
100
|
+
this._configModal = modalContainer.querySelector("snk-config-modal");
|
|
101
|
+
}
|
|
102
|
+
findGrid() {
|
|
103
|
+
if (this._grid != undefined) {
|
|
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
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
findForm() {
|
|
115
|
+
if (this._form != undefined) {
|
|
116
|
+
return;
|
|
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
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else if ((config === null || config === void 0 ? void 0 : config.columns) != undefined) {
|
|
138
|
+
this._application.saveGridConfig(config)
|
|
139
|
+
.then((response) => {
|
|
140
|
+
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
141
|
+
this.setGridConfig(response.resource);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
setGridConfig(strConfig) {
|
|
148
|
+
if (this._grid != undefined) {
|
|
149
|
+
const config = ObjectUtils.stringToObject(strConfig);
|
|
150
|
+
this._grid.setConfig(config).then(() => {
|
|
151
|
+
ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
loadGridConfig() {
|
|
156
|
+
if (this._application != undefined && this.configName != undefined && this._grid != undefined) {
|
|
157
|
+
this._application.loadGridConfig(this.configName).then((config) => {
|
|
158
|
+
this._grid.setConfig(config);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
loadFormConfig(showInfoSuccess = false) {
|
|
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
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
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
|
+
render() {
|
|
185
|
+
return (h("ez-button", { mode: "icon", iconName: "settings-inverted", size: "small", enabled: this.enabled, onClick: () => this.controlConfigModal(true) }));
|
|
186
|
+
}
|
|
187
|
+
get _element() { return this; }
|
|
188
|
+
}, [2, "snk-configurator", {
|
|
189
|
+
"configName": [1, "config-name"],
|
|
190
|
+
"name": [1],
|
|
191
|
+
"enabled": [4]
|
|
192
|
+
}]);
|
|
193
|
+
function defineCustomElement() {
|
|
194
|
+
if (typeof customElements === "undefined") {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const components = ["snk-configurator", "snk-config-modal"];
|
|
198
|
+
components.forEach(tagName => { switch (tagName) {
|
|
199
|
+
case "snk-configurator":
|
|
200
|
+
if (!customElements.get(tagName)) {
|
|
201
|
+
customElements.define(tagName, SnkConfigurator);
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case "snk-config-modal":
|
|
205
|
+
if (!customElements.get(tagName)) {
|
|
206
|
+
defineCustomElement$1();
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
} });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { SnkConfigurator as S, defineCustomElement as d };
|