@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-74246.1 → 0.0.0-bugfix-dev-KB-76362.0
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/{SnkFormConfigManager-bff848f1.js → SnkFormConfigManager-63369164.js} +3 -3
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
- package/dist/cjs/index-f9e81701.js +8 -0
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-config-options_3.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-3d4d0e2a.js → snk-data-unit-7dbdad0e.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
- package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
- package/dist/cjs/{snk-guides-viewer-2b44c804.js → snk-guides-viewer-eee43c8b.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-simple-crud.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
- package/dist/collection/components/snk-distinct-search/types/index.js +1 -0
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
- package/dist/components/SnkFormConfigManager.js +3 -3
- package/dist/components/SnkMessageBuilder.js +10 -0
- package/dist/components/filter-distinct-search.js +17 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input-distinct-search.d.ts +11 -0
- package/dist/components/input-distinct-search.js +6 -0
- package/dist/components/input-distinct-search2.js +264 -0
- package/dist/components/search-modal.d.ts +11 -0
- package/dist/components/search-modal.js +6 -0
- package/dist/components/search-modal2.js +264 -0
- package/dist/components/snk-distinct-search.d.ts +11 -0
- package/dist/components/snk-distinct-search.js +163 -0
- package/dist/esm/{SnkFormConfigManager-f0532f7d.js → SnkFormConfigManager-b409c745.js} +3 -3
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
- package/dist/esm/index-a7d3d3f1.js +8 -0
- package/dist/esm/input-distinct-search_2.entry.js +466 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-config-options_3.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-618e0b80.js → snk-data-unit-7a579dbd.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +3 -3
- package/dist/esm/snk-distinct-search.entry.js +119 -0
- package/dist/esm/{snk-guides-viewer-15c916a3.js → snk-guides-viewer-e8ca764a.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-simple-crud.entry.js +1 -1
- package/dist/sankhyablocks/{p-9c3138f5.entry.js → p-00f9fe5c.entry.js} +1 -1
- package/dist/sankhyablocks/p-0e206e62.js +1 -0
- package/dist/sankhyablocks/{p-c88ad28e.entry.js → p-0e250436.entry.js} +1 -1
- package/dist/sankhyablocks/{p-da87e42c.entry.js → p-154aa2a6.entry.js} +1 -1
- package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
- package/dist/sankhyablocks/{p-bab79110.entry.js → p-30ebcbe0.entry.js} +1 -1
- package/dist/sankhyablocks/p-3755b46f.entry.js +1 -0
- package/dist/sankhyablocks/{p-d1da52e1.entry.js → p-42130213.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e41bd8ee.entry.js → p-b389ed49.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a75e9dcc.js → p-c75fae8e.js} +1 -1
- package/dist/sankhyablocks/p-d8665750.js +1 -0
- package/dist/sankhyablocks/{p-ae50d69f.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/{p-c1adf0dd.entry.js → p-f4e221b2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
- package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
- package/dist/types/components.d.ts +393 -1
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-a0ebd886.js +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { D as DataFetcher } from './DataFetcher.js';
|
|
3
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
4
|
+
import { d as defineCustomElement$3 } from './input-distinct-search2.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './search-modal2.js';
|
|
6
|
+
|
|
7
|
+
class DistinctSearchFetcher {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
|
|
10
|
+
}
|
|
11
|
+
buildRequestBody(coluna, instancia) {
|
|
12
|
+
return {
|
|
13
|
+
selectDistinct: {
|
|
14
|
+
instancia,
|
|
15
|
+
coluna,
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
parseResponseBody(response) {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
const ocorrencias = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.ocorrencias) === null || _a === void 0 ? void 0 : _a.ocorrencia) === null || _b === void 0 ? void 0 : _b.map(({ $ }) => $)) !== null && _c !== void 0 ? _c : [];
|
|
22
|
+
return ocorrencias;
|
|
23
|
+
}
|
|
24
|
+
async fetchItens(coluna, instancia) {
|
|
25
|
+
const requestBody = this.buildRequestBody(coluna, instancia);
|
|
26
|
+
const response = await DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
|
|
27
|
+
const parsedResponse = this.parseResponseBody(response);
|
|
28
|
+
return parsedResponse;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const snkDistinctSearchCss = ".sc-snk-distinct-search-h{display:block;width:100%}";
|
|
33
|
+
|
|
34
|
+
const SnkDistinctSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
this.__registerHost();
|
|
38
|
+
this.changeValue = createEvent(this, "changeValue", 7);
|
|
39
|
+
this.onIconClick = () => {
|
|
40
|
+
this._searchModalElement.value = this.value || "";
|
|
41
|
+
this._searchModalElement.openModal();
|
|
42
|
+
};
|
|
43
|
+
this.distinctItems = undefined;
|
|
44
|
+
this.value = "";
|
|
45
|
+
this.label = "";
|
|
46
|
+
this.configSearch = undefined;
|
|
47
|
+
this.maxItems = 100;
|
|
48
|
+
this.debounceTime = 300;
|
|
49
|
+
this.canShowError = false;
|
|
50
|
+
this.mode = 'regular';
|
|
51
|
+
this.restrict = undefined;
|
|
52
|
+
this.errorMessage = undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Método para limpa o campo de entrada de pesquisa
|
|
56
|
+
*/
|
|
57
|
+
clearInput() {
|
|
58
|
+
this._inputDistinctSearch.clearInput();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Retorna se o conteúdo é inválido.
|
|
62
|
+
*/
|
|
63
|
+
isInvalid() {
|
|
64
|
+
return this._inputDistinctSearch.isInvalid();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Remove o foco do campo
|
|
68
|
+
*/
|
|
69
|
+
setBlur() {
|
|
70
|
+
this._inputDistinctSearch.setBlur();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Aplica o foco do campo
|
|
74
|
+
*/
|
|
75
|
+
setFocus() {
|
|
76
|
+
this._inputDistinctSearch.setFocus();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Método para fechar o modal
|
|
80
|
+
*/
|
|
81
|
+
closeModal() {
|
|
82
|
+
this._searchModalElement.closeModal();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Método para abrir o modal
|
|
86
|
+
*/
|
|
87
|
+
openModal() {
|
|
88
|
+
this._searchModalElement.openModal();
|
|
89
|
+
}
|
|
90
|
+
async componentWillLoad() {
|
|
91
|
+
await this.fetchDistinctItems();
|
|
92
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
93
|
+
}
|
|
94
|
+
async fetchDistinctItems() {
|
|
95
|
+
const distinctFetcher = new DistinctSearchFetcher();
|
|
96
|
+
const response = await distinctFetcher.fetchItens(this.configSearch.column, this.configSearch.instance);
|
|
97
|
+
this.distinctItems = [...response];
|
|
98
|
+
}
|
|
99
|
+
onChange(event) {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
this.value = event.detail.value;
|
|
102
|
+
this._inputDistinctSearch.selectValue(event.detail.value, event.detail.isNewItem);
|
|
103
|
+
this.changeValue.emit(event.detail);
|
|
104
|
+
}
|
|
105
|
+
onPopupClose() {
|
|
106
|
+
this._inputDistinctSearch.setFocus();
|
|
107
|
+
}
|
|
108
|
+
getMessage(key) {
|
|
109
|
+
return this._application.messagesBuilder.getMessage(key, null);
|
|
110
|
+
}
|
|
111
|
+
renderEmptyMessage() {
|
|
112
|
+
return (h("span", { innerHTML: this.getMessage("snkDistinctSearch.emptyResult") }));
|
|
113
|
+
}
|
|
114
|
+
render() {
|
|
115
|
+
return (h(Host, null, h("input-distinct-search", { ref: (ref) => this._inputDistinctSearch = ref, application: this._application, label: this.label, distinctItems: this.distinctItems, onChangeValue: this.onChange.bind(this), debounceTime: this.debounceTime, value: this.value, onIconClick: this.onIconClick, maxItems: this.maxItems, canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage }), h("search-modal", { ref: (ref) => this._searchModalElement = ref, application: this._application, listItens: this.distinctItems, onChangeValue: this.onChange.bind(this), restrict: this.restrict, value: this.value, label: this.label, emptyMessage: this.renderEmptyMessage(), maxItens: this.maxItems, debounceTime: this.debounceTime, canShowError: this.canShowError, mode: this.mode, errorMessage: this.errorMessage, onPopupClose: this.onPopupClose.bind(this) })));
|
|
116
|
+
}
|
|
117
|
+
static get style() { return snkDistinctSearchCss; }
|
|
118
|
+
}, [2, "snk-distinct-search", {
|
|
119
|
+
"value": [1025],
|
|
120
|
+
"label": [1],
|
|
121
|
+
"configSearch": [16],
|
|
122
|
+
"maxItems": [2, "max-items"],
|
|
123
|
+
"debounceTime": [2, "debounce-time"],
|
|
124
|
+
"canShowError": [4, "can-show-error"],
|
|
125
|
+
"mode": [1],
|
|
126
|
+
"restrict": [1],
|
|
127
|
+
"errorMessage": [1, "error-message"],
|
|
128
|
+
"distinctItems": [32],
|
|
129
|
+
"clearInput": [64],
|
|
130
|
+
"isInvalid": [64],
|
|
131
|
+
"setBlur": [64],
|
|
132
|
+
"setFocus": [64],
|
|
133
|
+
"closeModal": [64],
|
|
134
|
+
"openModal": [64]
|
|
135
|
+
}]);
|
|
136
|
+
function defineCustomElement$1() {
|
|
137
|
+
if (typeof customElements === "undefined") {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const components = ["snk-distinct-search", "input-distinct-search", "search-modal"];
|
|
141
|
+
components.forEach(tagName => { switch (tagName) {
|
|
142
|
+
case "snk-distinct-search":
|
|
143
|
+
if (!customElements.get(tagName)) {
|
|
144
|
+
customElements.define(tagName, SnkDistinctSearch$1);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case "input-distinct-search":
|
|
148
|
+
if (!customElements.get(tagName)) {
|
|
149
|
+
defineCustomElement$3();
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case "search-modal":
|
|
153
|
+
if (!customElements.get(tagName)) {
|
|
154
|
+
defineCustomElement$2();
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
} });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const SnkDistinctSearch = SnkDistinctSearch$1;
|
|
161
|
+
const defineCustomElement = defineCustomElement$1;
|
|
162
|
+
|
|
163
|
+
export { SnkDistinctSearch, defineCustomElement };
|
|
@@ -88,13 +88,13 @@ class SnkFormConfigManager {
|
|
|
88
88
|
const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
|
|
89
89
|
const hasConfig = this.hasConfig();
|
|
90
90
|
if (hasConfig && !forceEmptyConfig) {
|
|
91
|
-
return fields.map(({ label, name, readOnly, visible, required, tab
|
|
91
|
+
return fields.map(({ label, name, readOnly, visible, required, tab }) => {
|
|
92
92
|
var _a;
|
|
93
93
|
if (label == undefined) {
|
|
94
94
|
const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
95
|
-
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab
|
|
95
|
+
return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
|
|
96
96
|
}
|
|
97
|
-
return { name, label, readOnly, visible, required, tab
|
|
97
|
+
return { name, label, readOnly, visible, required, tab };
|
|
98
98
|
})
|
|
99
99
|
.filter(field => this.isFieldVisible(field, descriptionFilter));
|
|
100
100
|
}
|
|
@@ -172,6 +172,15 @@ const snkAttachMessages$1 = {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
const snkDistinctSearchMessages = {
|
|
176
|
+
titleBadgeNew: "novo",
|
|
177
|
+
titleAdd: "Adicionar",
|
|
178
|
+
availableResults: "resultados disponíveis",
|
|
179
|
+
availableResult: "resultado disponível",
|
|
180
|
+
limitResult: "Esta pesquisa foi limitada, existem mais resultados",
|
|
181
|
+
emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
|
|
182
|
+
};
|
|
183
|
+
|
|
175
184
|
const snkConfigOptionsMessages = {
|
|
176
185
|
label: {
|
|
177
186
|
nameField: "Nome do Campo *",
|
|
@@ -552,6 +561,7 @@ class SnkMessageBuilder {
|
|
|
552
561
|
snkEntityList: snkEntityListMessages,
|
|
553
562
|
snkActionsButton: snkActionsButtonMessages,
|
|
554
563
|
snkPrintSelector: snkPrintSelectorMessages,
|
|
564
|
+
snkDistinctSearch: snkDistinctSearchMessages,
|
|
555
565
|
};
|
|
556
566
|
this._currentOperation = OperationMap.CLEAN;
|
|
557
567
|
this._domainName = domainName;
|
|
@@ -2110,6 +2110,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2110
2110
|
return import(
|
|
2111
2111
|
/* webpackMode: "lazy" */
|
|
2112
2112
|
'./snk-custom-slot-elements.entry.js').then(processMod, consoleError);
|
|
2113
|
+
case 'snk-distinct-search':
|
|
2114
|
+
return import(
|
|
2115
|
+
/* webpackMode: "lazy" */
|
|
2116
|
+
'./snk-distinct-search.entry.js').then(processMod, consoleError);
|
|
2113
2117
|
case 'snk-entity-list':
|
|
2114
2118
|
return import(
|
|
2115
2119
|
/* webpackMode: "lazy" */
|
|
@@ -2154,6 +2158,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2154
2158
|
return import(
|
|
2155
2159
|
/* webpackMode: "lazy" */
|
|
2156
2160
|
'./teste-pesquisa.entry.js').then(processMod, consoleError);
|
|
2161
|
+
case 'input-distinct-search_2':
|
|
2162
|
+
return import(
|
|
2163
|
+
/* webpackMode: "lazy" */
|
|
2164
|
+
'./input-distinct-search_2.entry.js').then(processMod, consoleError);
|
|
2157
2165
|
case 'snk-filter-modal-item':
|
|
2158
2166
|
return import(
|
|
2159
2167
|
/* webpackMode: "lazy" */
|