@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-74224.1
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-f079f5fd.js → ConfigStorage-ecc0ed20.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-29b65619.js} +20 -29
- package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-cadeef8e.js} +5 -7
- package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-f1c92f79.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-7691a2c1.js → SnkMessageBuilder-bae64d0d.js} +0 -10
- package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-d68841bc.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-f89461c1.js} +3 -3
- package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-ed497282.js} +1 -1
- package/dist/cjs/index-f9e81701.js +28 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-ca89181c.js} +2 -7
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +30 -27
- package/dist/cjs/snk-application.cjs.entry.js +60 -102
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-config-options.cjs.entry.js +239 -0
- 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-7dbdad0e.js → snk-data-unit-668dc5e8.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-filter-bar_4.cjs.entry.js → snk-filter-bar.cjs.entry.js} +3 -688
- package/dist/cjs/snk-filter-item.cjs.entry.js +312 -0
- package/dist/cjs/snk-filter-list.cjs.entry.js +152 -0
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal.cjs.entry.js +249 -0
- package/dist/cjs/{snk-config-options_3.cjs.entry.js → snk-form-config.cjs.entry.js} +3 -365
- package/dist/cjs/snk-form.cjs.entry.js +144 -0
- package/dist/cjs/snk-grid.cjs.entry.js +6 -6
- package/dist/cjs/{snk-guides-viewer-eee43c8b.js → snk-guides-viewer-4236cb9d.js} +5 -8
- 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 +14 -14
- package/dist/collection/collection-manifest.json +31 -14
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
- package/dist/collection/components/snk-application/snk-application.js +53 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +0 -3
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +7 -7
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -6
- package/dist/collection/lib/message/SnkMessageBuilder.js +0 -2
- package/dist/collection/lib/utils/CrudUtils.js +16 -25
- package/dist/components/ContinuousInsertUtils.js +16 -25
- package/dist/components/DataFetcher.js +5 -7
- package/dist/components/SnkMessageBuilder.js +0 -10
- package/dist/components/dataunit-fetcher.js +2 -2
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -3
- package/dist/components/pesquisa-fetcher.js +1 -6
- package/dist/components/snk-actions-button2.js +27 -26
- package/dist/components/snk-application2.js +53 -95
- package/dist/components/snk-detail-view2.js +0 -3
- package/dist/components/snk-simple-crud2.js +7 -7
- package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-7b36d041.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-30caa626.js} +20 -29
- package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-a9c598f2.js} +5 -7
- package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-139f09fa.js} +3 -3
- package/dist/esm/{SnkMessageBuilder-7ace6803.js → SnkMessageBuilder-6fff4a4c.js} +0 -10
- package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-749d880f.js} +1 -1
- package/dist/esm/{constants-7302ee87.js → constants-8457af36.js} +1 -1
- package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-c24c76c6.js} +3 -3
- package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-adbe5d34.js} +1 -1
- package/dist/esm/index-a7d3d3f1.js +28 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-8edaa8cd.js} +2 -7
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +32 -29
- package/dist/esm/snk-application.entry.js +60 -102
- package/dist/esm/snk-attach.entry.js +6 -6
- package/dist/esm/snk-config-options.entry.js +235 -0
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +6 -6
- package/dist/esm/snk-data-exporter.entry.js +7 -7
- package/dist/esm/{snk-data-unit-7a579dbd.js → snk-data-unit-0fdfb6c2.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/{snk-filter-bar_4.entry.js → snk-filter-bar.entry.js} +5 -687
- package/dist/esm/snk-filter-item.entry.js +308 -0
- package/dist/esm/snk-filter-list.entry.js +148 -0
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-filter-modal.entry.js +245 -0
- package/dist/esm/{snk-config-options_3.entry.js → snk-form-config.entry.js} +6 -366
- package/dist/esm/snk-form.entry.js +140 -0
- package/dist/esm/snk-grid.entry.js +6 -6
- package/dist/esm/{snk-guides-viewer-e8ca764a.js → snk-guides-viewer-8934c537.js} +6 -9
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +15 -15
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/sankhyablocks/p-01086ff7.entry.js +1 -0
- package/dist/sankhyablocks/{p-126c58ea.js → p-06421fdb.js} +1 -1
- package/dist/sankhyablocks/{p-e3a285a2.js → p-16869f77.js} +1 -1
- package/dist/sankhyablocks/p-17425c72.js +1 -0
- package/dist/sankhyablocks/{p-341465ce.js → p-1bf06cd3.js} +2 -2
- package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-212213d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-2923c1b5.js +1 -0
- package/dist/sankhyablocks/p-3b60db06.entry.js +1 -0
- package/dist/sankhyablocks/{p-00f9fe5c.entry.js → p-430e4d3c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9ffd9fc7.js → p-4d9549cf.js} +1 -1
- package/dist/sankhyablocks/{p-c75fae8e.js → p-5dd8cf4f.js} +1 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/{p-41793e17.entry.js → p-7663f597.entry.js} +1 -1
- package/dist/sankhyablocks/{p-47d24ac8.js → p-7ac7932c.js} +2 -2
- package/dist/sankhyablocks/{p-2d3f9482.entry.js → p-8eb67fa4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f0aaad2b.entry.js → p-92eadb1c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8b4fc28f.entry.js → p-95df461f.entry.js} +1 -1
- package/dist/sankhyablocks/p-a42e7a1e.entry.js +11 -0
- package/dist/sankhyablocks/p-a724e798.entry.js +1 -0
- package/dist/sankhyablocks/{p-1dbd5c18.entry.js → p-a75d242d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0e206e62.js → p-afbb070d.js} +1 -1
- package/dist/sankhyablocks/{p-95ce311a.js → p-b0ef4383.js} +1 -1
- package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
- package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-b9c67e45.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b389ed49.entry.js → p-be5d8fcb.entry.js} +1 -1
- package/dist/sankhyablocks/p-ca5ec380.js +1 -0
- package/dist/sankhyablocks/p-d3f53df2.entry.js +1 -0
- package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-dcead955.entry.js} +1 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
- package/dist/sankhyablocks/{p-00278e07.js → p-f3434fc4.js} +1 -1
- package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-fb34e0cf.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd8e631c.entry.js +1 -0
- package/dist/sankhyablocks/p-feba9d4b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
- package/dist/types/components/snk-application/snk-application.d.ts +12 -3
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
- package/dist/types/components.d.ts +1 -393
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -1
- package/dist/types/lib/utils/CrudUtils.d.ts +0 -1
- package/package.json +2 -3
- package/react/components.d.ts +0 -3
- package/react/components.js +0 -3
- package/react/components.js.map +1 -1
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +0 -471
- package/dist/cjs/snk-distinct-search.cjs.entry.js +0 -123
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +0 -28
- package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +0 -16
- package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +0 -52
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +0 -4
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +0 -372
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +0 -110
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +0 -544
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +0 -28
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +0 -593
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +0 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +0 -25
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +0 -9
- package/dist/collection/sw.js +0 -46
- package/dist/components/filter-distinct-search.js +0 -17
- package/dist/components/input-distinct-search.d.ts +0 -11
- package/dist/components/input-distinct-search.js +0 -6
- package/dist/components/input-distinct-search2.js +0 -264
- package/dist/components/search-modal.d.ts +0 -11
- package/dist/components/search-modal.js +0 -6
- package/dist/components/search-modal2.js +0 -264
- package/dist/components/snk-distinct-search.d.ts +0 -11
- package/dist/components/snk-distinct-search.js +0 -163
- package/dist/esm/input-distinct-search_2.entry.js +0 -466
- package/dist/esm/snk-distinct-search.entry.js +0 -119
- package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
- package/dist/sankhyablocks/p-154aa2a6.entry.js +0 -11
- package/dist/sankhyablocks/p-18cb1acb.entry.js +0 -1
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +0 -1
- package/dist/sankhyablocks/p-3755b46f.entry.js +0 -1
- package/dist/sankhyablocks/p-3858a2e4.entry.js +0 -1
- package/dist/sankhyablocks/p-42130213.entry.js +0 -1
- package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
- package/dist/sankhyablocks/p-aaf94476.js +0 -1
- package/dist/sankhyablocks/p-d8665750.js +0 -1
- package/dist/sankhyablocks/p-e4391e16.js +0 -1
- package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +0 -11
- package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +0 -12
- package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +0 -13
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +0 -83
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +0 -105
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +0 -127
- package/dist/types/components/snk-distinct-search/types/index.d.ts +0 -12
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +0 -4
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +0 -6
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +0 -2
- /package/dist/collection/components/{snk-distinct-search/types → snk-actions-button/interfaces}/index.js +0 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-f9e81701.js');
|
|
6
|
+
const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
|
|
7
|
+
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
|
+
const filterType_enum = require('./filter-type.enum-b14ce507.js');
|
|
9
|
+
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
|
|
10
|
+
const core = require('@sankhyalabs/core');
|
|
11
|
+
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
|
|
12
|
+
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
|
13
|
+
require('./index-c5771aba.js');
|
|
14
|
+
|
|
15
|
+
const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
|
16
|
+
|
|
17
|
+
const SnkFilterModal = class {
|
|
18
|
+
constructor(hostRef) {
|
|
19
|
+
index.registerInstance(this, hostRef);
|
|
20
|
+
this.getMessage = undefined;
|
|
21
|
+
this.configName = undefined;
|
|
22
|
+
this.filters = undefined;
|
|
23
|
+
this.applyFilters = undefined;
|
|
24
|
+
this.closeModal = undefined;
|
|
25
|
+
this.addPersonalizedFilter = undefined;
|
|
26
|
+
this.editPersonalizedFilter = undefined;
|
|
27
|
+
this.deletePersonalizedFilter = undefined;
|
|
28
|
+
this.filtersToDelete = [];
|
|
29
|
+
this.disablePersonalizedFilter = undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Emitido quando um filtro personalizado é deletado.
|
|
33
|
+
*/
|
|
34
|
+
deletePersonalizedFilterListener(event) {
|
|
35
|
+
this.filtersToDelete.push(event.detail);
|
|
36
|
+
}
|
|
37
|
+
getCustomMessage(key, params) {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
|
|
40
|
+
}
|
|
41
|
+
//TODO: tratar clear all dos filtros personalizados
|
|
42
|
+
handleClearAll() {
|
|
43
|
+
const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
|
|
44
|
+
if (filter.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
45
|
+
acc.multiListFilters.push(filter);
|
|
46
|
+
return acc;
|
|
47
|
+
}
|
|
48
|
+
if (filter.filterType === filterType_enum.FilterType.QUICK_FILTER) {
|
|
49
|
+
acc.quickFilters.push(filter);
|
|
50
|
+
return acc;
|
|
51
|
+
}
|
|
52
|
+
if (filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER) {
|
|
53
|
+
acc.customFilters.push(filter);
|
|
54
|
+
return acc;
|
|
55
|
+
}
|
|
56
|
+
if (filter.filterType === filterType_enum.FilterType.OTHER_FILTERS) {
|
|
57
|
+
acc.otherFilters.push(filter);
|
|
58
|
+
return acc;
|
|
59
|
+
}
|
|
60
|
+
return acc;
|
|
61
|
+
}, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
|
|
62
|
+
this.handleClearFilterList(quickFilters);
|
|
63
|
+
this.handleClearCustomFilters(customFilters);
|
|
64
|
+
this.handleClearOthersFilters(otherFilters);
|
|
65
|
+
multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
|
|
66
|
+
}
|
|
67
|
+
handleClearOthersFilters(otherFilters) {
|
|
68
|
+
this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
|
69
|
+
}
|
|
70
|
+
handleClearCustomFilters(customFilters) {
|
|
71
|
+
this.filters.forEach((filter, index) => {
|
|
72
|
+
if (filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER)
|
|
73
|
+
this.filters[index] = this.clearAllCustomFilter(customFilters).shift();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
clearAllCustomFilter(filterConfigSnapshot) {
|
|
77
|
+
return filterConfigSnapshot.map(filterItem => {
|
|
78
|
+
const copy = Object.assign({}, filterItem);
|
|
79
|
+
delete copy.value;
|
|
80
|
+
copy.visible = false;
|
|
81
|
+
if (copy.groupedItems) {
|
|
82
|
+
copy.groupedItems = this.clearAllCustomFilter(copy.groupedItems);
|
|
83
|
+
}
|
|
84
|
+
return copy;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
handleClose() {
|
|
88
|
+
const hasChangesToSave = core.ObjectUtils.objectToString(this.filters) !== core.ObjectUtils.objectToString(this._originalFilterConfig);
|
|
89
|
+
if (!hasChangesToSave) {
|
|
90
|
+
this.closeModal();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
return utils.ApplicationUtils.confirm(this.getCustomMessage('validations.notSaved.title'), this.getCustomMessage('validations.notSaved.message')).then((cancelAction) => {
|
|
94
|
+
if (cancelAction)
|
|
95
|
+
this.closeModal();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
handleApplyFilters() {
|
|
99
|
+
const filterPersonalized = this.filters.find(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER);
|
|
100
|
+
if (this.isValidCustomFilter(filterPersonalized)) {
|
|
101
|
+
this.applyFilters(this.filters);
|
|
102
|
+
}
|
|
103
|
+
if (this.filtersToDelete.length > 0) {
|
|
104
|
+
this.filtersToDelete.forEach(filter => {
|
|
105
|
+
this.deletePersonalizedFilter(filter, this.configName);
|
|
106
|
+
});
|
|
107
|
+
this.filtersToDelete = [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
isValidCustomFilter(filterPersonalized) {
|
|
111
|
+
const isValid = PersonalizedFilterUtils.PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
|
|
112
|
+
if (!isValid) {
|
|
113
|
+
utils.ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
modalActionListener(evt) {
|
|
119
|
+
const modalAction = evt.detail;
|
|
120
|
+
switch (modalAction) {
|
|
121
|
+
case ezModalContainer.ModalAction.CANCEL:
|
|
122
|
+
this.handleClearAll();
|
|
123
|
+
break;
|
|
124
|
+
case ezModalContainer.ModalAction.OK:
|
|
125
|
+
this.handleApplyFilters();
|
|
126
|
+
break;
|
|
127
|
+
case ezModalContainer.ModalAction.CLOSE:
|
|
128
|
+
this.handleClose();
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
handleFilterChange(filterConfig) {
|
|
133
|
+
this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
|
|
134
|
+
}
|
|
135
|
+
handleClearFilterList(filterList) {
|
|
136
|
+
this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
|
|
137
|
+
}
|
|
138
|
+
handleClearSigleFilter(filterItem) {
|
|
139
|
+
if (filterItemType_enum.FilterItemType.MULTI_LIST === filterItem.type) {
|
|
140
|
+
let filterItemCopy = core.ObjectUtils.copy(filterItem);
|
|
141
|
+
this.uncheckFilterValues(filterItemCopy.value);
|
|
142
|
+
const filterListCopy = core.ObjectUtils.copy(this.filters);
|
|
143
|
+
const index = filterListCopy.findIndex(item => item.id === filterItem.id);
|
|
144
|
+
filterListCopy.splice(index, 1, filterItemCopy);
|
|
145
|
+
this.filters = core.ObjectUtils.copy(filterListCopy);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (filterItemType_enum.FilterItemType.CHECK_BOX_LIST === filterItem.type) {
|
|
149
|
+
const filterListCopy = core.ObjectUtils.copy(this.filters);
|
|
150
|
+
filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
|
|
151
|
+
this.filters = core.ObjectUtils.copy(filterListCopy);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.filters.find(filter => filter.id === filterItem.id).value = undefined;
|
|
155
|
+
}
|
|
156
|
+
uncheckFilterValues(valueList) {
|
|
157
|
+
valueList.forEach(value => {
|
|
158
|
+
if (!!value) {
|
|
159
|
+
value.check = false;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return valueList;
|
|
163
|
+
}
|
|
164
|
+
renderFilterItem(filterItem, fullRow) {
|
|
165
|
+
return (index.h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
|
|
166
|
+
}
|
|
167
|
+
isDefaultFilterNumberVariation(filter) {
|
|
168
|
+
var _a;
|
|
169
|
+
return filter.type === filterItemType_enum.FilterItemType.NUMBER
|
|
170
|
+
&& (!filter.props.variation || ((_a = filter.props) === null || _a === void 0 ? void 0 : _a.variation) === filterNumberVariation.FilterNumberVariation.DEFAULT);
|
|
171
|
+
}
|
|
172
|
+
mountFiltersLines(filters) {
|
|
173
|
+
const MAX_LINE_LENGTH = 2;
|
|
174
|
+
let currentLine = 0;
|
|
175
|
+
let forceAddCurrent = false;
|
|
176
|
+
const filtersLines = {};
|
|
177
|
+
for (let curr = 0; curr < filters.length; curr++) {
|
|
178
|
+
filtersLines[currentLine] = filtersLines[currentLine] || [];
|
|
179
|
+
const item = filters[curr];
|
|
180
|
+
const isLast = curr === filters.length - 1;
|
|
181
|
+
const currentItemMatch = item.type === filterItemType_enum.FilterItemType.TEXT || this.isDefaultFilterNumberVariation(item);
|
|
182
|
+
const nextItemMatch = isLast ? false : filters[curr + 1].type === filterItemType_enum.FilterItemType.TEXT || this.isDefaultFilterNumberVariation(filters[curr + 1]);
|
|
183
|
+
if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
|
|
184
|
+
filtersLines[currentLine].push(item);
|
|
185
|
+
forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
|
|
186
|
+
if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
|
|
187
|
+
++currentLine;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
filtersLines[currentLine] = filtersLines[currentLine] || [];
|
|
191
|
+
filtersLines[currentLine].push(item);
|
|
192
|
+
++currentLine;
|
|
193
|
+
}
|
|
194
|
+
return Object.values(filtersLines);
|
|
195
|
+
}
|
|
196
|
+
renderFilterLine(filters) {
|
|
197
|
+
const fullLine = filters.length === 1;
|
|
198
|
+
return filters.map((filter) => this.renderFilterItem(filter, fullLine));
|
|
199
|
+
}
|
|
200
|
+
getIformedFiltersCount(listItems) {
|
|
201
|
+
let countInformedItens = 0;
|
|
202
|
+
listItems.forEach(item => {
|
|
203
|
+
var _a, _b, _c, _d, _e, _f;
|
|
204
|
+
if (filterItemType_enum.FilterItemType.MULTI_LIST === item.type) {
|
|
205
|
+
countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (filterItemType_enum.FilterItemType.CHECK_BOX_LIST === item.type) {
|
|
209
|
+
countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
|
|
210
|
+
.filter(([_, value]) => value === true)
|
|
211
|
+
.map(([key, _]) => key).length;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (item.groupedItems != undefined) {
|
|
215
|
+
countInformedItens = item.groupedItems.filter(item => item.visible).length;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (!!item.value) {
|
|
219
|
+
countInformedItens++;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return countInformedItens;
|
|
223
|
+
}
|
|
224
|
+
renderCollapsibleFilterBox(label, listItems, isSingleItem, shouldRenderFooter = true) {
|
|
225
|
+
if (!listItems.length)
|
|
226
|
+
return null;
|
|
227
|
+
const appliedFilters = this.getIformedFiltersCount(listItems);
|
|
228
|
+
const lines = this.mountFiltersLines(listItems);
|
|
229
|
+
return (index.h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (index.h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), index.h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (index.h("div", { class: "ez-flex ez-flex--justify-end grow" }, index.h("ez-button", { class: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
|
|
230
|
+
}
|
|
231
|
+
componentWillRender() {
|
|
232
|
+
this._modalTitle = this.getCustomMessage('title');
|
|
233
|
+
this._okButtonLabel = this.getCustomMessage('okButtonLabel');
|
|
234
|
+
this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
|
|
235
|
+
}
|
|
236
|
+
componentDidLoad() {
|
|
237
|
+
if (!this._originalFilterConfig)
|
|
238
|
+
this._originalFilterConfig = this.filters;
|
|
239
|
+
}
|
|
240
|
+
render() {
|
|
241
|
+
const customFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER);
|
|
242
|
+
const quickFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.QUICK_FILTER);
|
|
243
|
+
const otherFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.OTHER_FILTERS);
|
|
244
|
+
return (index.h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, index.h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
SnkFilterModal.style = snkFilterModalCss;
|
|
248
|
+
|
|
249
|
+
exports.snk_filter_modal = SnkFilterModal;
|
|
@@ -3,376 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
|
6
|
+
const Sortable = require('./Sortable-fb1c4cbb.js');
|
|
6
7
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
9
|
const constants = require('./constants-35ddd366.js');
|
|
10
|
-
const
|
|
11
|
-
const ResourceIDUtils = require('./ResourceIDUtils-5ff86aa7.js');
|
|
12
|
-
const Sortable = require('./Sortable-fb1c4cbb.js');
|
|
13
|
-
const formConfigFetcher = require('./form-config-fetcher-39397ac5.js');
|
|
10
|
+
const formConfigFetcher = require('./form-config-fetcher-ed497282.js');
|
|
14
11
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
|
15
|
-
require('./
|
|
16
|
-
require('./filter-item-type.enum-a7ffdaa6.js');
|
|
17
|
-
require('./DataFetcher-e059eb72.js');
|
|
12
|
+
require('./DataFetcher-cadeef8e.js');
|
|
18
13
|
require('./PrintUtils-bcaeb82f.js');
|
|
19
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
20
15
|
|
|
21
|
-
const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
|
|
22
|
-
|
|
23
|
-
const SnkConfigOptions = class {
|
|
24
|
-
constructor(hostRef) {
|
|
25
|
-
index.registerInstance(this, hostRef);
|
|
26
|
-
this.configOptionsChanged = index.createEvent(this, "configOptionsChanged", 7);
|
|
27
|
-
this._defaultType = undefined;
|
|
28
|
-
this.fieldConfig = {};
|
|
29
|
-
this.idConfig = undefined;
|
|
30
|
-
this.dataUnit = undefined;
|
|
31
|
-
this.messagesBuilder = undefined;
|
|
32
|
-
}
|
|
33
|
-
onConfigDefault(optionSelected) {
|
|
34
|
-
if (optionSelected != undefined) {
|
|
35
|
-
this._defaultType = optionSelected;
|
|
36
|
-
this.fieldConfig.defaultValue = {
|
|
37
|
-
type: this._defaultType
|
|
38
|
-
};
|
|
39
|
-
this.configOptionsChanged.emit(this.fieldConfig);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
buildOptions() {
|
|
43
|
-
var _a, _b, _c;
|
|
44
|
-
let 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;
|
|
45
|
-
if (interfaceField === core.UserInterface.SEARCH) {
|
|
46
|
-
interfaceField = core.UserInterface.INTEGERNUMBER;
|
|
47
|
-
}
|
|
48
|
-
return constants.VARS_BY_TYPE.UserInterface[interfaceField];
|
|
49
|
-
}
|
|
50
|
-
enabledValueDefault() {
|
|
51
|
-
var _a, _b, _c;
|
|
52
|
-
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
53
|
-
const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
|
|
54
|
-
const hasVariableVar = constants.VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)
|
|
55
|
-
|| (field === null || field === void 0 ? void 0 : field.userInterface) === core.UserInterface.SEARCH;
|
|
56
|
-
if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
isAllowDefault() {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
|
|
64
|
-
if (allowDefault == undefined) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
return allowDefault === "true";
|
|
68
|
-
}
|
|
69
|
-
loadDefaultValue() {
|
|
70
|
-
var _a;
|
|
71
|
-
if (this.fieldConfig == undefined) {
|
|
72
|
-
this._defaultType = constants.DEFAULT_TYPE.fixed;
|
|
73
|
-
this.fieldConfig = {
|
|
74
|
-
defaultValue: {
|
|
75
|
-
type: this._defaultType
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
|
|
80
|
-
this._defaultType = constants.DEFAULT_TYPE.fixed;
|
|
81
|
-
this.fieldConfig.defaultValue = {
|
|
82
|
-
type: this._defaultType
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this._defaultType = this.fieldConfig.defaultValue.type;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
getFieldProperties(field) {
|
|
90
|
-
var _a;
|
|
91
|
-
if (field != undefined) {
|
|
92
|
-
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
getMessage(key, params) {
|
|
96
|
-
return this.messagesBuilder.getMessage(key, params);
|
|
97
|
-
}
|
|
98
|
-
getDefaultType() {
|
|
99
|
-
var _a;
|
|
100
|
-
return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : constants.DEFAULT_TYPE.fixed;
|
|
101
|
-
}
|
|
102
|
-
getEnabledByProperty(attribName, propertyName) {
|
|
103
|
-
const fieldDescriptor = this._fieldProperties;
|
|
104
|
-
if (fieldDescriptor == undefined) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
const fieldProperties = fieldDescriptor.properties || {};
|
|
108
|
-
return fieldProperties.hasOwnProperty(propertyName) ? fieldProperties[propertyName] !== "S" : fieldDescriptor[attribName] !== true;
|
|
109
|
-
}
|
|
110
|
-
getValueByProperty(property) {
|
|
111
|
-
const properties = this._fieldProperties;
|
|
112
|
-
if (properties != undefined && properties[property] === true) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
return this.fieldConfig[property];
|
|
116
|
-
}
|
|
117
|
-
getValidatedValue(fieldValue) {
|
|
118
|
-
var _a, _b;
|
|
119
|
-
if (fieldValue == undefined) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
123
|
-
const dataType = field === null || field === void 0 ? void 0 : field.dataType;
|
|
124
|
-
if (dataType == undefined) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
|
|
128
|
-
dataType !== DataType.DataType.OBJECT && dataType !== DataType.DataType.DATE
|
|
129
|
-
&& typeof fieldValue === "object"
|
|
130
|
-
? fieldValue.value
|
|
131
|
-
: fieldValue;
|
|
132
|
-
return dataType === DataType.DataType.OBJECT ? JSON.stringify(value) : value;
|
|
133
|
-
}
|
|
134
|
-
buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
|
|
135
|
-
let options;
|
|
136
|
-
let precision = 0;
|
|
137
|
-
let prettyPrecision = 0;
|
|
138
|
-
const TagName = userInterface == undefined || constants.TAGS_BY_TYPE[userInterface] == undefined
|
|
139
|
-
? constants.TAGS_BY_TYPE.DEFAULT
|
|
140
|
-
: constants.TAGS_BY_TYPE[userInterface];
|
|
141
|
-
if (userInterface === core.UserInterface.OPTIONSELECTOR) {
|
|
142
|
-
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
143
|
-
if (typeof prop === "string") {
|
|
144
|
-
const parsed = core.ObjectUtils.stringToObject(prop);
|
|
145
|
-
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
options = prop;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else if (userInterface === core.UserInterface.DECIMALNUMBER) {
|
|
152
|
-
precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
153
|
-
prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
154
|
-
}
|
|
155
|
-
return index.h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
|
|
156
|
-
}
|
|
157
|
-
getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
|
|
158
|
-
switch (userInterface) {
|
|
159
|
-
case core.UserInterface.SEARCH:
|
|
160
|
-
return {
|
|
161
|
-
suppressEmptyOption: required,
|
|
162
|
-
optionLoader: (searchArgument) => this.onSearch(searchArgument)
|
|
163
|
-
};
|
|
164
|
-
case core.UserInterface.OPTIONSELECTOR:
|
|
165
|
-
return {
|
|
166
|
-
suppressEmptyOption: required,
|
|
167
|
-
options
|
|
168
|
-
};
|
|
169
|
-
case core.UserInterface.CHECKBOX:
|
|
170
|
-
case core.UserInterface.SWITCH:
|
|
171
|
-
return {
|
|
172
|
-
mode
|
|
173
|
-
};
|
|
174
|
-
case core.UserInterface.INTEGERNUMBER:
|
|
175
|
-
case core.UserInterface.DECIMALNUMBER:
|
|
176
|
-
return {
|
|
177
|
-
precision,
|
|
178
|
-
prettyPrecision,
|
|
179
|
-
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
180
|
-
};
|
|
181
|
-
case core.UserInterface.DATE:
|
|
182
|
-
case core.UserInterface.DATETIME:
|
|
183
|
-
case core.UserInterface.TIME:
|
|
184
|
-
return {
|
|
185
|
-
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
186
|
-
};
|
|
187
|
-
default:
|
|
188
|
-
return {};
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
onChange(fieldValue) {
|
|
192
|
-
this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
|
|
193
|
-
this.configOptionsChanged.emit(this.fieldConfig);
|
|
194
|
-
}
|
|
195
|
-
onSearch(searchArgument) {
|
|
196
|
-
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
197
|
-
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
buildField(descriptor, config) {
|
|
201
|
-
const { name, label, readOnly, required, defaultValue } = config;
|
|
202
|
-
const { userInterface, properties } = descriptor;
|
|
203
|
-
const allowDefault = properties === null || properties === void 0 ? void 0 : properties.allowDefault;
|
|
204
|
-
let value;
|
|
205
|
-
let enabled = core.StringUtils.getBooleanValue(allowDefault, !readOnly);
|
|
206
|
-
if (userInterface === core.UserInterface.FILE) {
|
|
207
|
-
enabled = false;
|
|
208
|
-
}
|
|
209
|
-
if (enabled) {
|
|
210
|
-
value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
|
|
211
|
-
if (value != undefined) {
|
|
212
|
-
value = DataType.getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
const configField = { value, enabled, label, name, required, userInterface };
|
|
216
|
-
switch (userInterface) {
|
|
217
|
-
case core.UserInterface.SWITCH:
|
|
218
|
-
return this.buildInputDefault(configField, undefined, utils.CheckMode.SWITCH);
|
|
219
|
-
case core.UserInterface.CHECKBOX:
|
|
220
|
-
return this.buildInputDefault(configField, undefined, utils.CheckMode.REGULAR);
|
|
221
|
-
case core.UserInterface.OPTIONSELECTOR:
|
|
222
|
-
case core.UserInterface.DECIMALNUMBER:
|
|
223
|
-
return this.buildInputDefault(configField, properties);
|
|
224
|
-
default:
|
|
225
|
-
return this.buildInputDefault(configField);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
componentWillLoad() {
|
|
229
|
-
var _a;
|
|
230
|
-
this.loadDefaultValue();
|
|
231
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
232
|
-
this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
233
|
-
}
|
|
234
|
-
componentDidLoad() {
|
|
235
|
-
core.ElementIDUtils.addIDInfo(this._element, this.fieldConfig.name);
|
|
236
|
-
}
|
|
237
|
-
render() {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
return (index.h(index.Host, null, index.h("div", { id: this.idConfig }, index.h("div", { class: "ez-row ez-padding--medium" }, index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.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); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, index.h("option", { value: constants.DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), index.h("option", { value: constants.DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === constants.DEFAULT_TYPE.variable ?
|
|
240
|
-
index.h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), 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() })
|
|
241
|
-
:
|
|
242
|
-
((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
|
|
243
|
-
this.buildField(this._fieldProperties, this.fieldConfig))), index.h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required", "systemRequired"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly", "systemReadOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
|
|
244
|
-
}
|
|
245
|
-
get _element() { return index.getElement(this); }
|
|
246
|
-
};
|
|
247
|
-
SnkConfigOptions.style = snkConfigOptionsCss;
|
|
248
|
-
|
|
249
|
-
const snkFormCss = ".sc-snk-form-h{--snk-form__header--min-height:94px;display:block}.snk-form__form--hidden.sc-snk-form{display:none}";
|
|
250
|
-
|
|
251
|
-
const SnkForm = class {
|
|
252
|
-
constructor(hostRef) {
|
|
253
|
-
index.registerInstance(this, hostRef);
|
|
254
|
-
this.exit = index.createEvent(this, "exit", 7);
|
|
255
|
-
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
256
|
-
this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
|
|
257
|
-
this._customEditors = new Map();
|
|
258
|
-
this._dataUnit = undefined;
|
|
259
|
-
this._dataState = undefined;
|
|
260
|
-
this._showFormConfig = false;
|
|
261
|
-
this._configManager = undefined;
|
|
262
|
-
this.configName = undefined;
|
|
263
|
-
this.recordsValidator = undefined;
|
|
264
|
-
this.messagesBuilder = undefined;
|
|
265
|
-
this.formLegacyConfigName = undefined;
|
|
266
|
-
this.resourceID = undefined;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Exibe a janela de configurações do formulário.
|
|
270
|
-
*/
|
|
271
|
-
async showConfig() {
|
|
272
|
-
this._showFormConfig = true;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Fecha a janela de configurações do formulário.
|
|
276
|
-
*/
|
|
277
|
-
async hideConfig() {
|
|
278
|
-
this._showFormConfig = false;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Registra um editor customizado para campos da grade e formulário.
|
|
282
|
-
*/
|
|
283
|
-
async addCustomEditor(fieldName, customEditor) {
|
|
284
|
-
if (this._form) {
|
|
285
|
-
this._form.addCustomEditor(fieldName, customEditor);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
const newCustomEditors = new Map(this._customEditors);
|
|
289
|
-
newCustomEditors.set(fieldName, customEditor);
|
|
290
|
-
this._customEditors = newCustomEditors;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
294
|
-
*/
|
|
295
|
-
async setFieldProp(fieldName, propName, value) {
|
|
296
|
-
await this._form.setFieldProp(fieldName, propName, value);
|
|
297
|
-
}
|
|
298
|
-
closeConfig() {
|
|
299
|
-
this.hideConfig();
|
|
300
|
-
}
|
|
301
|
-
dataunitReady() {
|
|
302
|
-
const dataInfo = { dataUnit: this._dataUnit };
|
|
303
|
-
core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
304
|
-
}
|
|
305
|
-
setCustomEditors() {
|
|
306
|
-
if (!this._form) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
for (const [fieldName, customEditor] of this._customEditors) {
|
|
310
|
-
this._form.addCustomEditor(fieldName, customEditor);
|
|
311
|
-
this._customEditors.delete(fieldName);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
async componentDidRender() {
|
|
315
|
-
this.setCustomEditors();
|
|
316
|
-
}
|
|
317
|
-
async componentWillLoad() {
|
|
318
|
-
let parent = this._element.parentElement;
|
|
319
|
-
while (parent) {
|
|
320
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
321
|
-
this._snkDataUnit = parent;
|
|
322
|
-
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
323
|
-
this._dataState = this._snkDataUnit.dataState;
|
|
324
|
-
if (this._dataUnit) {
|
|
325
|
-
this.dataunitReady();
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
329
|
-
this._dataUnit = evt.detail;
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
parent = parent.parentElement;
|
|
336
|
-
}
|
|
337
|
-
if (this.resourceID == undefined) {
|
|
338
|
-
this.resourceID = await ResourceIDUtils.ResourceIDUtils.getResourceID();
|
|
339
|
-
}
|
|
340
|
-
this._configManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resourceID, undefined, this._dataUnit);
|
|
341
|
-
this.addFormLegacyConfig();
|
|
342
|
-
await this._configManager.loadConfig();
|
|
343
|
-
}
|
|
344
|
-
async handleDataStateChange(evt) {
|
|
345
|
-
var _a;
|
|
346
|
-
this._dataState = evt.detail;
|
|
347
|
-
const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
|
|
348
|
-
for (const field of fieldsWithRmPrecision || []) {
|
|
349
|
-
if (!field) {
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
|
|
353
|
-
if (!rmPrecision && rmPrecision !== 0) {
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
await this.setFieldProp(field, 'precision', rmPrecision);
|
|
357
|
-
await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
addFormLegacyConfig() {
|
|
361
|
-
if (this.formLegacyConfigName) {
|
|
362
|
-
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
render() {
|
|
366
|
-
if (!this._dataUnit || !this._dataState) {
|
|
367
|
-
return undefined;
|
|
368
|
-
}
|
|
369
|
-
return (index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
370
|
-
index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
|
|
371
|
-
}
|
|
372
|
-
get _element() { return index.getElement(this); }
|
|
373
|
-
};
|
|
374
|
-
SnkForm.style = snkFormCss;
|
|
375
|
-
|
|
376
16
|
const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}div.sc-snk-form-config:focus-visible,div.sc-snk-form-config:focus{outline:none}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -1)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -2)}}";
|
|
377
17
|
|
|
378
18
|
const CONTAINER_ID = {
|
|
@@ -1371,6 +1011,4 @@ const SnkFormConfig = class {
|
|
|
1371
1011
|
};
|
|
1372
1012
|
SnkFormConfig.style = snkFormConfigCss;
|
|
1373
1013
|
|
|
1374
|
-
exports.snk_config_options = SnkConfigOptions;
|
|
1375
|
-
exports.snk_form = SnkForm;
|
|
1376
1014
|
exports.snk_form_config = SnkFormConfig;
|