@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-kb-74339.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/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-29b65619.js → ContinuousInsertUtils-64e47516.js} +29 -20
- package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
- package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
- package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
- package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
- 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/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +102 -60
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
- package/dist/cjs/snk-crud.cjs.entry.js +5 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-7dbdad0e.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
- package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-eee43c8b.js} +8 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -8
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
- package/dist/collection/components/snk-application/snk-application.js +3 -53
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +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-simple-crud/snk-simple-crud.js +3 -1
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
- package/dist/collection/lib/utils/CrudUtils.js +25 -16
- package/dist/components/ContinuousInsertUtils.js +25 -16
- package/dist/components/DataFetcher.js +7 -5
- package/dist/components/SnkMessageBuilder.js +10 -0
- package/dist/components/dataunit-fetcher.js +2 -2
- 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/pesquisa-fetcher.js +6 -1
- 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-application2.js +95 -53
- package/dist/components/snk-detail-view2.js +3 -0
- package/dist/components/snk-distinct-search.d.ts +11 -0
- package/dist/components/snk-distinct-search.js +163 -0
- package/dist/components/snk-simple-crud2.js +3 -1
- package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
- package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
- package/dist/esm/{SnkFormConfigManager-f1a0fc92.js → SnkFormConfigManager-b409c745.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
- package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
- package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
- 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/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +102 -60
- package/dist/esm/snk-attach.entry.js +5 -5
- package/dist/esm/snk-config-options_3.entry.js +4 -4
- package/dist/esm/snk-crud.entry.js +5 -5
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-7a579dbd.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-distinct-search.entry.js +119 -0
- package/dist/esm/snk-filter-bar_4.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/{snk-guides-viewer-8fa1321a.js → snk-guides-viewer-e8ca764a.js} +8 -5
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +10 -8
- package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
- package/dist/sankhyablocks/{p-49b01ec2.entry.js → p-00f9fe5c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fadc8339.js → p-0e206e62.js} +1 -1
- package/dist/sankhyablocks/{p-ab05d5f2.entry.js → p-0e250436.entry.js} +1 -1
- package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
- package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
- package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
- package/dist/sankhyablocks/{p-a75d242d.entry.js → p-1dbd5c18.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fa6c5826.entry.js → p-30ebcbe0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
- package/dist/sankhyablocks/p-3755b46f.entry.js +1 -0
- package/dist/sankhyablocks/{p-052213ba.entry.js → p-3858a2e4.entry.js} +1 -1
- package/dist/sankhyablocks/p-42130213.entry.js +1 -0
- package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
- package/dist/sankhyablocks/{p-8dfc2ba9.entry.js → p-563b7c28.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
- package/dist/sankhyablocks/{p-c2e4ac99.entry.js → p-a2c790ac.entry.js} +1 -1
- package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
- package/dist/sankhyablocks/p-aaf94476.js +1 -0
- package/dist/sankhyablocks/{p-2ef45894.entry.js → p-b389ed49.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5dd8cf4f.js → p-c75fae8e.js} +1 -1
- package/dist/sankhyablocks/p-d8665750.js +1 -0
- package/dist/sankhyablocks/{p-ee7023c4.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/p-e4391e16.js +1 -0
- package/dist/sankhyablocks/{p-42288374.entry.js → p-f0aaad2b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-f4e221b2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
- package/dist/types/components/snk-application/snk-application.d.ts +3 -12
- 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/DataFetcher.d.ts +1 -0
- 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/dist/types/lib/utils/CrudUtils.d.ts +1 -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-2923c1b5.js +0 -1
- package/dist/sankhyablocks/p-7281cdab.entry.js +0 -1
- package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
- package/dist/sankhyablocks/p-ca5ec380.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DataFetcher } from "../DataFetcher";
|
|
2
|
+
export default class DistinctSearchFetcher {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.SERVICE = 'mge@Pesquisa.getSelectDistinct';
|
|
5
|
+
}
|
|
6
|
+
buildRequestBody(coluna, instancia) {
|
|
7
|
+
return {
|
|
8
|
+
selectDistinct: {
|
|
9
|
+
instancia,
|
|
10
|
+
coluna,
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
parseResponseBody(response) {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
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 : [];
|
|
17
|
+
return ocorrencias;
|
|
18
|
+
}
|
|
19
|
+
async fetchItens(coluna, instancia) {
|
|
20
|
+
const requestBody = this.buildRequestBody(coluna, instancia);
|
|
21
|
+
const response = await DataFetcher.get().callServiceBroker(this.SERVICE, requestBody);
|
|
22
|
+
const parsedResponse = this.parseResponseBody(response);
|
|
23
|
+
return parsedResponse;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -96,9 +96,14 @@ export class PesquisaFetcher {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
const urlOptions = {
|
|
100
|
+
urlParams: {
|
|
101
|
+
"quietMode": true
|
|
102
|
+
}
|
|
103
|
+
};
|
|
99
104
|
return new Promise((resolve, reject) => {
|
|
100
105
|
DataFetcher.get()
|
|
101
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
|
106
|
+
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody), urlOptions)
|
|
102
107
|
.then(result => resolve(result))
|
|
103
108
|
.catch(error => reject(error));
|
|
104
109
|
});
|
|
@@ -7,6 +7,7 @@ import snkCrudMessages from "./resources/snk-crud.msg";
|
|
|
7
7
|
import snkSimpleCrudMessages from "./resources/snk-simple-crud.msg";
|
|
8
8
|
import fileViewerMessages from "./resources/file-viewer.msg";
|
|
9
9
|
import snkApplicationMessages from "./resources/snk-application.msg";
|
|
10
|
+
import snkDistinctSearchMessages from "./resources/snk-distinct-search.msg";
|
|
10
11
|
import { snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg";
|
|
11
12
|
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg";
|
|
12
13
|
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg";
|
|
@@ -48,6 +49,7 @@ export class SnkMessageBuilder {
|
|
|
48
49
|
snkEntityList: snkEntityListMessages,
|
|
49
50
|
snkActionsButton: snkActionsButtonMessages,
|
|
50
51
|
snkPrintSelector: snkPrintSelectorMessages,
|
|
52
|
+
snkDistinctSearch: snkDistinctSearchMessages,
|
|
51
53
|
};
|
|
52
54
|
this._currentOperation = OperationMap.CLEAN;
|
|
53
55
|
this._domainName = domainName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const snkDistinctSearchMessages = {
|
|
2
|
+
titleBadgeNew: "novo",
|
|
3
|
+
titleAdd: "Adicionar",
|
|
4
|
+
availableResults: "resultados disponíveis",
|
|
5
|
+
availableResult: "resultado disponível",
|
|
6
|
+
limitResult: "Esta pesquisa foi limitada, existem mais resultados",
|
|
7
|
+
emptyResult: "Nenhum resultado disponível. <br/>Você pode adicionar um novo termo",
|
|
8
|
+
};
|
|
9
|
+
export default snkDistinctSearchMessages;
|
|
@@ -13,6 +13,28 @@ export class CrudUtils {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
static parseCrudResults(entities, onlyFirst) {
|
|
17
|
+
if (!Array.isArray(entities)) {
|
|
18
|
+
entities = [entities];
|
|
19
|
+
}
|
|
20
|
+
const crudFindResults = [];
|
|
21
|
+
for (const entity of entities) {
|
|
22
|
+
let crudFindResult = {
|
|
23
|
+
fields: new Map()
|
|
24
|
+
};
|
|
25
|
+
for (let key in entity) {
|
|
26
|
+
let fieldValue = entity[key];
|
|
27
|
+
if (fieldValue.hasOwnProperty('$')) {
|
|
28
|
+
crudFindResult.fields.set(key, fieldValue.$);
|
|
29
|
+
}
|
|
30
|
+
if (onlyFirst) {
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
crudFindResults.push(crudFindResult);
|
|
35
|
+
}
|
|
36
|
+
return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
|
|
37
|
+
}
|
|
16
38
|
static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
|
|
17
39
|
const SERVICE_CRUD_FIND = "mge@crud.find";
|
|
18
40
|
let parsedFields = [];
|
|
@@ -61,24 +83,11 @@ export class CrudUtils {
|
|
|
61
83
|
DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
|
|
62
84
|
var _a;
|
|
63
85
|
let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
|
|
64
|
-
if (entities
|
|
65
|
-
let crudFindResult = {
|
|
66
|
-
fields: new Map()
|
|
67
|
-
};
|
|
68
|
-
for (let key in entities) {
|
|
69
|
-
let fieldValue = entities[key];
|
|
70
|
-
if (fieldValue.hasOwnProperty('$')) {
|
|
71
|
-
crudFindResult.fields.set(key, fieldValue.$);
|
|
72
|
-
}
|
|
73
|
-
if (onlyFirst) {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
resolve(crudFindResult);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
86
|
+
if (!entities) {
|
|
80
87
|
resolve(null);
|
|
81
88
|
}
|
|
89
|
+
const crudFindResults = this.parseCrudResults(entities, onlyFirst);
|
|
90
|
+
resolve(crudFindResults);
|
|
82
91
|
});
|
|
83
92
|
});
|
|
84
93
|
}
|
|
@@ -23,6 +23,28 @@ class CrudUtils {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
static parseCrudResults(entities, onlyFirst) {
|
|
27
|
+
if (!Array.isArray(entities)) {
|
|
28
|
+
entities = [entities];
|
|
29
|
+
}
|
|
30
|
+
const crudFindResults = [];
|
|
31
|
+
for (const entity of entities) {
|
|
32
|
+
let crudFindResult = {
|
|
33
|
+
fields: new Map()
|
|
34
|
+
};
|
|
35
|
+
for (let key in entity) {
|
|
36
|
+
let fieldValue = entity[key];
|
|
37
|
+
if (fieldValue.hasOwnProperty('$')) {
|
|
38
|
+
crudFindResult.fields.set(key, fieldValue.$);
|
|
39
|
+
}
|
|
40
|
+
if (onlyFirst) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
crudFindResults.push(crudFindResult);
|
|
45
|
+
}
|
|
46
|
+
return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
|
|
47
|
+
}
|
|
26
48
|
static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
|
|
27
49
|
const SERVICE_CRUD_FIND = "mge@crud.find";
|
|
28
50
|
let parsedFields = [];
|
|
@@ -70,24 +92,11 @@ class CrudUtils {
|
|
|
70
92
|
DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
|
|
71
93
|
var _a;
|
|
72
94
|
let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
|
|
73
|
-
if (entities
|
|
74
|
-
let crudFindResult = {
|
|
75
|
-
fields: new Map()
|
|
76
|
-
};
|
|
77
|
-
for (let key in entities) {
|
|
78
|
-
let fieldValue = entities[key];
|
|
79
|
-
if (fieldValue.hasOwnProperty('$')) {
|
|
80
|
-
crudFindResult.fields.set(key, fieldValue.$);
|
|
81
|
-
}
|
|
82
|
-
if (onlyFirst) {
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
resolve(crudFindResult);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
95
|
+
if (!entities) {
|
|
89
96
|
resolve(null);
|
|
90
97
|
}
|
|
98
|
+
const crudFindResults = this.parseCrudResults(entities, onlyFirst);
|
|
99
|
+
resolve(crudFindResults);
|
|
91
100
|
});
|
|
92
101
|
});
|
|
93
102
|
}
|
|
@@ -6777,7 +6777,8 @@ class DataFetcher {
|
|
|
6777
6777
|
}
|
|
6778
6778
|
payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
|
|
6779
6779
|
}
|
|
6780
|
-
|
|
6780
|
+
const requestId = StringUtils.generateUUID();
|
|
6781
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
|
|
6781
6782
|
http.open("POST", url, true);
|
|
6782
6783
|
http.withCredentials = true;
|
|
6783
6784
|
http.send(ObjectUtils.objectToString(payloadJson));
|
|
@@ -6817,7 +6818,7 @@ class DataFetcher {
|
|
|
6817
6818
|
else if (http.readyState == 4 && http.status != 200) {
|
|
6818
6819
|
reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
|
|
6819
6820
|
}
|
|
6820
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
|
|
6821
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
|
|
6821
6822
|
};
|
|
6822
6823
|
});
|
|
6823
6824
|
}
|
|
@@ -6922,7 +6923,8 @@ class DataFetcher {
|
|
|
6922
6923
|
const errorsResponse = [];
|
|
6923
6924
|
const responseExtensions = [];
|
|
6924
6925
|
const url = this.buildGraphQlURL(quietMode);
|
|
6925
|
-
|
|
6926
|
+
const requestId = StringUtils.generateUUID();
|
|
6927
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
|
|
6926
6928
|
try {
|
|
6927
6929
|
const response = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
|
|
6928
6930
|
response.forEach((resItem, index) => {
|
|
@@ -6956,11 +6958,11 @@ class DataFetcher {
|
|
|
6956
6958
|
});
|
|
6957
6959
|
}
|
|
6958
6960
|
else {
|
|
6959
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
|
6961
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
|
|
6960
6962
|
throw new ErrorException("Falha de comunicação", err.message);
|
|
6961
6963
|
}
|
|
6962
6964
|
}
|
|
6963
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
|
6965
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
|
|
6964
6966
|
return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
|
|
6965
6967
|
}
|
|
6966
6968
|
isHttpError(err) {
|
|
@@ -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;
|
|
@@ -712,7 +712,7 @@ class DataUnitDataLoader {
|
|
|
712
712
|
}
|
|
713
713
|
const count = loadingInfo.count;
|
|
714
714
|
if (loadingInfo.loadingInProgress) {
|
|
715
|
-
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
715
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
if (loadingInfo.needReload) {
|
|
@@ -720,7 +720,7 @@ class DataUnitDataLoader {
|
|
|
720
720
|
dataUnit.gotoPage(0);
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
|
-
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
723
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
|
|
724
724
|
}
|
|
725
725
|
static registryLoading(dataUnit, loadingInfo) {
|
|
726
726
|
if (loadingInfo == undefined) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function normalizeString(text = "") {
|
|
2
|
+
return text.normalize('NFD').replace(/[\u0300-\u036f/\s'"&.-]/g, "").toUpperCase();
|
|
3
|
+
}
|
|
4
|
+
function filterItems(searchArgument, distinctItems, maxItems) {
|
|
5
|
+
const normalizedSearch = normalizeString(searchArgument);
|
|
6
|
+
const filteredDistincts = distinctItems.filter((item) => normalizeString(item).includes(normalizedSearch));
|
|
7
|
+
const isLimited = filteredDistincts.length > maxItems;
|
|
8
|
+
const items = filteredDistincts.slice(0, maxItems);
|
|
9
|
+
return { items, isLimited };
|
|
10
|
+
}
|
|
11
|
+
function getMatchOption(value, distinctItems) {
|
|
12
|
+
const normalizedSearch = normalizeString(value);
|
|
13
|
+
const item = distinctItems.find((item) => normalizeString(item) === normalizedSearch);
|
|
14
|
+
return item;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { filterItems as f, getMatchOption as g, normalizeString as n };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* sankhyablocks custom elements */
|
|
2
|
+
export { InputDistinctSearch as InputDistinctSearch } from '../types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search';
|
|
3
|
+
export { SearchModal as SearchModal } from '../types/components/snk-distinct-search/subcomponents/search-modal/search-modal';
|
|
2
4
|
export { SnkActionsButton as SnkActionsButton } from '../types/components/snk-actions-button/snk-actions-button';
|
|
3
5
|
export { SnkActionsForm as SnkActionsForm } from '../types/components/snk-actions-button/subcomponents/snk-actions-form';
|
|
4
6
|
export { SnkApplication as SnkApplication } from '../types/components/snk-application/snk-application';
|
|
@@ -11,6 +13,7 @@ export { SnkCustomSlotElements as SnkCustomSlotElements } from '../types/compone
|
|
|
11
13
|
export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
|
|
12
14
|
export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
|
|
13
15
|
export { SnkDetailView as SnkDetailView } from '../types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view';
|
|
16
|
+
export { SnkDistinctSearch as SnkDistinctSearch } from '../types/components/snk-distinct-search/snk-distinct-search';
|
|
14
17
|
export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-list/snk-entity-list';
|
|
15
18
|
export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
|
|
16
19
|
export { SnkExpressionGroup as SnkExpressionGroup } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group';
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
export { InputDistinctSearch, defineCustomElement as defineCustomElementInputDistinctSearch } from './input-distinct-search.js';
|
|
3
|
+
export { SearchModal, defineCustomElement as defineCustomElementSearchModal } from './search-modal.js';
|
|
2
4
|
export { SnkActionsButton, defineCustomElement as defineCustomElementSnkActionsButton } from './snk-actions-button.js';
|
|
3
5
|
export { SnkActionsForm, defineCustomElement as defineCustomElementSnkActionsForm } from './snk-actions-form.js';
|
|
4
6
|
export { SnkApplication, defineCustomElement as defineCustomElementSnkApplication } from './snk-application.js';
|
|
@@ -11,6 +13,7 @@ export { SnkCustomSlotElements, defineCustomElement as defineCustomElementSnkCus
|
|
|
11
13
|
export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
|
|
12
14
|
export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
|
|
13
15
|
export { SnkDetailView, defineCustomElement as defineCustomElementSnkDetailView } from './snk-detail-view.js';
|
|
16
|
+
export { SnkDistinctSearch, defineCustomElement as defineCustomElementSnkDistinctSearch } from './snk-distinct-search.js';
|
|
14
17
|
export { SnkEntityList, defineCustomElement as defineCustomElementSnkEntityList } from './snk-entity-list.js';
|
|
15
18
|
export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
|
|
16
19
|
export { SnkExpressionGroup, defineCustomElement as defineCustomElementSnkExpressionGroup } from './snk-expression-group.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface InputDistinctSearch extends Components.InputDistinctSearch, HTMLElement {}
|
|
4
|
+
export const InputDistinctSearch: {
|
|
5
|
+
prototype: InputDistinctSearch;
|
|
6
|
+
new (): InputDistinctSearch;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { KeyboardManager } from '@sankhyalabs/core';
|
|
3
|
+
import { f as filterItems, n as normalizeString, g as getMatchOption } from './filter-distinct-search.js';
|
|
4
|
+
|
|
5
|
+
const inputDistinctSearchCss = ":host{--max-height-popover:180px;--scrollbar--color-default:var(--scrollbar--default, #626e82);--scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--scrollbar--border-radius:var(--border--radius-small, 6px);--scrollbar--width:var(--space--medium, 12px)}.divider{margin:var(--space--extra-small, 3px) 0;border:var(--border--small, 1px solid) var(--color--disable-secondary, #F2F5F8)}.new-value{color:var(--text--primary, #626e82);padding:var(--space--2xs, 8px) var(--space--3xs, 4px);font-size:var(--text--medium, 14px);font-family:var(--font-pattern, Roboto);cursor:pointer;border-radius:var(--border--radius-small, 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:none;background:none;width:100%;display:flex;min-height:max-content}.new-value-selected{background-color:var(--color--primary-300, #E2F4EF)}.new-value:hover{background-color:var(--background--medium, #e0e0e0)}.popover-content{margin:var(--space--small, 6px);max-height:calc(var(--max-height-popover) - (2 * var(--space--small, 6px)));display:flex;flex-direction:column}.list-container{overflow:auto;scrollbar-width:thin;scrollbar-color:var(--scrollbar--color-clicked) var(--scrollbar--color-background);padding-right:var(--space--small, 6px)}.list-container::-webkit-scrollbar{background-color:var(--scrollbar--color-background);width:var(--scrollbar--width);max-width:var(--scrollbar--width);min-width:var(--scrollbar--width)}.list-container::-webkit-scrollbar-track{background-color:var(--scrollbar--color-background);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb{background-color:var(--scrollbar--color-default);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb:vertical:hover,.list-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--scrollbar--color-hover)}.list-container::-webkit-scrollbar-thumb:vertical:active,.list-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--scrollbar--color-clicked)}ez-popover{--ez-popover__box--z-index:15}.space-error{--ez-popover__margin:-19px 0 0 0}ez-list{--ez-list__item--margin:0}ez-text-input{--ez-text-input__icon--margin:var(--space--xs, 12px)}.badge-primary{--ez-badge--background-color:var(--color--primary-300);--ez-badge--color:var(--color--primary)}";
|
|
6
|
+
|
|
7
|
+
const InputDistinctSearch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.changeValue = createEvent(this, "changeValue", 7);
|
|
13
|
+
this.iconClick = createEvent(this, "iconClick", 7);
|
|
14
|
+
this.textValue = "";
|
|
15
|
+
this.isNewItem = false;
|
|
16
|
+
this.filteredItems = [];
|
|
17
|
+
this.isNewItemSelected = false;
|
|
18
|
+
this.application = undefined;
|
|
19
|
+
this.distinctItems = [];
|
|
20
|
+
this.label = "";
|
|
21
|
+
this.value = "";
|
|
22
|
+
this.maxItems = 100;
|
|
23
|
+
this.debounceTime = 300;
|
|
24
|
+
this.canShowError = false;
|
|
25
|
+
this.mode = 'regular';
|
|
26
|
+
this.restrict = undefined;
|
|
27
|
+
this.errorMessage = undefined;
|
|
28
|
+
}
|
|
29
|
+
async observerValue(newValue) {
|
|
30
|
+
await this.selectedNewItem(newValue, true);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Seleciona um item
|
|
34
|
+
*/
|
|
35
|
+
async selectValue(value, isNewItem = false) {
|
|
36
|
+
this.isNewItem = isNewItem;
|
|
37
|
+
this.textValue = value;
|
|
38
|
+
await this._refFilterInput.setValue(value);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Método para limpa o campo de entrada de pesquisa
|
|
42
|
+
*/
|
|
43
|
+
clearInput() {
|
|
44
|
+
this._refFilterInput.setValue("");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retorna se o conteúdo é inválido.
|
|
48
|
+
*/
|
|
49
|
+
isInvalid() {
|
|
50
|
+
return this._refFilterInput.isInvalid();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Remove o foco do campo
|
|
54
|
+
*/
|
|
55
|
+
setBlur() {
|
|
56
|
+
this._refFilterInput.setBlur();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Aplica o foco do campo
|
|
60
|
+
*/
|
|
61
|
+
setFocus() {
|
|
62
|
+
this._refFilterInput.setFocus();
|
|
63
|
+
}
|
|
64
|
+
getMessage(key) {
|
|
65
|
+
return this.application.messagesBuilder.getMessage(key, null);
|
|
66
|
+
}
|
|
67
|
+
async optionLoader(searchArgument) {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
if (this._debounceTimeout) {
|
|
70
|
+
clearTimeout(this._debounceTimeout);
|
|
71
|
+
}
|
|
72
|
+
this._debounceTimeout = setTimeout(() => {
|
|
73
|
+
const { items } = filterItems(searchArgument, this.distinctItems, this.maxItems);
|
|
74
|
+
this.filteredItems = items;
|
|
75
|
+
resolve();
|
|
76
|
+
}, this.debounceTime);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async openPopOver() {
|
|
80
|
+
var _a;
|
|
81
|
+
await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.showUnder(this._refFilterInput));
|
|
82
|
+
}
|
|
83
|
+
async closePopOver() {
|
|
84
|
+
var _a;
|
|
85
|
+
this.isNewItemSelected = false;
|
|
86
|
+
await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.hide());
|
|
87
|
+
await this._refList.removeSelection();
|
|
88
|
+
}
|
|
89
|
+
async onTextChange(event) {
|
|
90
|
+
this.textValue = event.detail;
|
|
91
|
+
await this.optionLoader(event.detail);
|
|
92
|
+
await this.selectFirstItem();
|
|
93
|
+
}
|
|
94
|
+
onIconClick() {
|
|
95
|
+
this.iconClick.emit();
|
|
96
|
+
}
|
|
97
|
+
buidItems() {
|
|
98
|
+
var _a;
|
|
99
|
+
const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
|
|
100
|
+
label: item,
|
|
101
|
+
id: normalizeString(item),
|
|
102
|
+
}));
|
|
103
|
+
return items;
|
|
104
|
+
}
|
|
105
|
+
async setValue(value, isNewItem = false, preventEventEmit = false) {
|
|
106
|
+
this.isNewItem = isNewItem;
|
|
107
|
+
this.textValue = value;
|
|
108
|
+
await this._refFilterInput.setValue(value);
|
|
109
|
+
await this.closePopOver();
|
|
110
|
+
if (!preventEventEmit) {
|
|
111
|
+
this.changeValue.emit({
|
|
112
|
+
value,
|
|
113
|
+
isNewItem,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async selectedNewItem(value, preventEventEmit = false) {
|
|
118
|
+
if (!this.textValue && !value) {
|
|
119
|
+
await this.setValue("", false, preventEventEmit);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const item = getMatchOption(value !== null && value !== void 0 ? value : this.textValue, this.distinctItems);
|
|
123
|
+
if (item) {
|
|
124
|
+
await this.setValue(item, false, preventEventEmit);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
await this.setValue(this.textValue || value, true, preventEventEmit);
|
|
128
|
+
}
|
|
129
|
+
async setSelectedValue() {
|
|
130
|
+
const selectedValue = await this._refList.getSelection();
|
|
131
|
+
await this.selectedNewItem((selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) || this.textValue, true);
|
|
132
|
+
await this._refFilterInput.setBlur();
|
|
133
|
+
this._element.focus();
|
|
134
|
+
}
|
|
135
|
+
async selectNextItem() {
|
|
136
|
+
if (this.isNewItemSelected) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const itemSelected = await this._refList.getSelection();
|
|
140
|
+
const itemsAmount = this.filteredItems.length;
|
|
141
|
+
const indexSelected = this.filteredItems.findIndex((item) => item === (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.label));
|
|
142
|
+
const isLastItemSelected = indexSelected === (itemsAmount - 1);
|
|
143
|
+
const optionNewItemIsAvailable = !!this.textValue;
|
|
144
|
+
if (!isLastItemSelected || !optionNewItemIsAvailable) {
|
|
145
|
+
this.isNewItemSelected = false;
|
|
146
|
+
await this._refList.selectNextItem();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.isNewItemSelected = true;
|
|
150
|
+
await this._refList.removeSelection();
|
|
151
|
+
}
|
|
152
|
+
async selectPreviousItem() {
|
|
153
|
+
const itemsAmount = this.filteredItems.length;
|
|
154
|
+
const lastItem = this.filteredItems[itemsAmount - 1];
|
|
155
|
+
if (this.isNewItemSelected && lastItem) {
|
|
156
|
+
this.isNewItemSelected = false;
|
|
157
|
+
await this._refList.setSelection({
|
|
158
|
+
id: normalizeString(lastItem),
|
|
159
|
+
label: lastItem
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
await this._refList.selectPreviousItem();
|
|
164
|
+
}
|
|
165
|
+
bindKeyboardManager() {
|
|
166
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
167
|
+
this._keyboardManager
|
|
168
|
+
.bind("ArrowDown", () => { this.selectNextItem(); })
|
|
169
|
+
.bind("ArrowUp", () => { this.selectPreviousItem(); })
|
|
170
|
+
.bind("Enter", () => { this.setSelectedValue(); })
|
|
171
|
+
.bind("Tab", () => { this.setSelectedValue(); });
|
|
172
|
+
}
|
|
173
|
+
unbindKeyboardManager() {
|
|
174
|
+
this._keyboardManager
|
|
175
|
+
.unbind("ArrowDown")
|
|
176
|
+
.unbind("ArrowUp")
|
|
177
|
+
.unbind("Enter")
|
|
178
|
+
.unbind("Tab");
|
|
179
|
+
}
|
|
180
|
+
async selectFirstItem() {
|
|
181
|
+
if (!this.filteredItems.length) {
|
|
182
|
+
await this._refList.removeSelection();
|
|
183
|
+
this.isNewItemSelected = true;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const firstItem = this.filteredItems[0];
|
|
187
|
+
this.isNewItemSelected = false;
|
|
188
|
+
await this._refList.setSelection({
|
|
189
|
+
id: normalizeString(firstItem),
|
|
190
|
+
label: firstItem,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
initializeComponent() {
|
|
194
|
+
const { items } = filterItems("", this.distinctItems, this.maxItems);
|
|
195
|
+
this.filteredItems = items;
|
|
196
|
+
}
|
|
197
|
+
componentWillLoad() {
|
|
198
|
+
this.initializeComponent();
|
|
199
|
+
}
|
|
200
|
+
async componentDidLoad() {
|
|
201
|
+
this.bindKeyboardManager();
|
|
202
|
+
this.selectFirstItem();
|
|
203
|
+
await this.selectedNewItem(this.value, true);
|
|
204
|
+
}
|
|
205
|
+
disconnectedCallback() {
|
|
206
|
+
this.unbindKeyboardManager();
|
|
207
|
+
}
|
|
208
|
+
buildNewItemOption() {
|
|
209
|
+
if (!this.textValue) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
return (h(Fragment, null, !!this.filteredItems.length &&
|
|
213
|
+
h("hr", { class: "divider" }), h("button", { slot: "bottomSlot", class: {
|
|
214
|
+
"new-value": true,
|
|
215
|
+
"new-value-selected": this.isNewItemSelected,
|
|
216
|
+
}, title: `${this.getMessage("snkDistinctSearch.titleAdd")} '${this.textValue}'`, onClick: () => this.selectedNewItem.bind(this)(undefined, true) }, this.getMessage("snkDistinctSearch.titleAdd"), " '", this.textValue, "'")));
|
|
217
|
+
}
|
|
218
|
+
render() {
|
|
219
|
+
return (h(Host, { onBlur: () => this.selectedNewItem.bind(this)() }, h("ez-filter-input", { ref: (ref) => this._refFilterInput = ref, label: this.label, value: this.textValue, onEzChange: this.onTextChange.bind(this), onEzIconClick: this.onIconClick.bind(this), onEzFocusIn: this.openPopOver.bind(this), canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage, enabledIconClick: true }, this.isNewItem &&
|
|
220
|
+
h("ez-badge", { slot: "right", label: this.getMessage("snkDistinctSearch.titleBadgeNew"), size: "small-medium", class: "badge-primary" })), h("ez-popover", { ref: (ref) => this._refPopOver = ref, boxWidth: "full-width", autoClose: false, overlayType: "none", class: {
|
|
221
|
+
'space-error': this.canShowError,
|
|
222
|
+
} }, h("div", { class: "popover-content" }, h("section", { class: "list-container" }, h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buidItems(), onEzClickItem: ({ detail }) => this.setValue.bind(this)(detail.label, false, true), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })), this.buildNewItemOption()))));
|
|
223
|
+
}
|
|
224
|
+
get _element() { return this; }
|
|
225
|
+
static get watchers() { return {
|
|
226
|
+
"value": ["observerValue"]
|
|
227
|
+
}; }
|
|
228
|
+
static get style() { return inputDistinctSearchCss; }
|
|
229
|
+
}, [1, "input-distinct-search", {
|
|
230
|
+
"application": [16],
|
|
231
|
+
"distinctItems": [16],
|
|
232
|
+
"label": [1],
|
|
233
|
+
"value": [1],
|
|
234
|
+
"maxItems": [2, "max-items"],
|
|
235
|
+
"debounceTime": [2, "debounce-time"],
|
|
236
|
+
"canShowError": [4, "can-show-error"],
|
|
237
|
+
"mode": [1],
|
|
238
|
+
"restrict": [1],
|
|
239
|
+
"errorMessage": [1, "error-message"],
|
|
240
|
+
"textValue": [32],
|
|
241
|
+
"isNewItem": [32],
|
|
242
|
+
"filteredItems": [32],
|
|
243
|
+
"isNewItemSelected": [32],
|
|
244
|
+
"selectValue": [64],
|
|
245
|
+
"clearInput": [64],
|
|
246
|
+
"isInvalid": [64],
|
|
247
|
+
"setBlur": [64],
|
|
248
|
+
"setFocus": [64]
|
|
249
|
+
}]);
|
|
250
|
+
function defineCustomElement() {
|
|
251
|
+
if (typeof customElements === "undefined") {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const components = ["input-distinct-search"];
|
|
255
|
+
components.forEach(tagName => { switch (tagName) {
|
|
256
|
+
case "input-distinct-search":
|
|
257
|
+
if (!customElements.get(tagName)) {
|
|
258
|
+
customElements.define(tagName, InputDistinctSearch);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
} });
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export { InputDistinctSearch as I, defineCustomElement as d };
|
|
@@ -96,9 +96,14 @@ class PesquisaFetcher {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
const urlOptions = {
|
|
100
|
+
urlParams: {
|
|
101
|
+
"quietMode": true
|
|
102
|
+
}
|
|
103
|
+
};
|
|
99
104
|
return new Promise((resolve, reject) => {
|
|
100
105
|
DataFetcher.get()
|
|
101
|
-
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
|
|
106
|
+
.callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody), urlOptions)
|
|
102
107
|
.then(result => resolve(result))
|
|
103
108
|
.catch(error => reject(error));
|
|
104
109
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SearchModal extends Components.SearchModal, HTMLElement {}
|
|
4
|
+
export const SearchModal: {
|
|
5
|
+
prototype: SearchModal;
|
|
6
|
+
new (): SearchModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|