@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-81512.2 → 0.0.0-bugfix-dev-KB-76031.2
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/{ContinuousInsertUtils-e9454466.js → ContinuousInsertUtils-2718aaaa.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-8ea97d88.js → dataunit-fetcher-c32fdff7.js} +171 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-8a4857b5.js → pesquisa-fetcher-3b86b6c4.js} +6 -5
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +34 -12
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_5.cjs.entry.js +3 -3
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-attach.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-72ef8777.js → snk-data-unit-2c7c1964.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +3 -3
- package/dist/cjs/{snk-guides-viewer-0a547d11.js → snk-guides-viewer-266339d2.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +22 -35
- package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
- package/dist/cjs/snk-taskbar.cjs.entry.js +8 -2
- package/dist/collection/components/snk-grid-config/snk-grid-config.css +1 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +0 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +41 -5
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +4 -1
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +36 -7
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +6 -4
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +11 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +22 -34
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +9 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +57 -12
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +108 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +0 -1
- package/dist/components/ISave.js +7 -6
- package/dist/components/dataunit-fetcher.js +171 -17
- package/dist/components/pesquisa-grid2.js +21 -6
- package/dist/components/pesquisa-tree2.js +15 -6
- package/dist/components/snk-grid-config2.js +1 -1
- package/dist/components/snk-pesquisa2.js +23 -35
- package/dist/components/snk-taskbar2.js +9 -3
- package/dist/esm/{ContinuousInsertUtils-c599f41b.js → ContinuousInsertUtils-deb7767f.js} +2 -2
- package/dist/esm/{dataunit-fetcher-8dd93d8b.js → dataunit-fetcher-26c2bed4.js} +171 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-3b206fe3.js → pesquisa-fetcher-767abffa.js} +7 -6
- package/dist/esm/pesquisa-grid_2.entry.js +34 -12
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_5.entry.js +3 -3
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-attach.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-11a49fc3.js → snk-data-unit-a36df23f.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +3 -3
- package/dist/esm/{snk-guides-viewer-a87a4639.js → snk-guides-viewer-9f03a9a0.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +22 -35
- package/dist/esm/snk-simple-crud.entry.js +3 -3
- package/dist/esm/snk-taskbar.entry.js +9 -3
- package/dist/sankhyablocks/{p-1a91d1f3.entry.js → p-045398fb.entry.js} +1 -1
- package/dist/sankhyablocks/{p-bd2e8377.entry.js → p-09b4a36b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f1120c28.entry.js → p-0d2c8bc8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4d3e557b.js → p-18f58d73.js} +1 -1
- package/dist/sankhyablocks/{p-4b85ab68.entry.js → p-1f17a44e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-619aeac8.entry.js → p-28ca3908.entry.js} +1 -1
- package/dist/sankhyablocks/p-4fe8bb73.js +6 -0
- package/dist/sankhyablocks/{p-b1e0fcdd.entry.js → p-5dbed7b4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-60e4db34.js → p-70ae0779.js} +1 -1
- package/dist/sankhyablocks/p-78d49c74.js +60 -0
- package/dist/sankhyablocks/{p-c691d03b.entry.js → p-8003f06a.entry.js} +1 -1
- package/dist/sankhyablocks/p-800a8209.entry.js +1 -0
- package/dist/sankhyablocks/{p-5b5e877f.js → p-86fc5865.js} +1 -1
- package/dist/sankhyablocks/p-8e4f53f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-cc8b7b73.entry.js → p-9070bfe3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-07f40d74.entry.js → p-9cec99d8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7b5f24ec.entry.js → p-b896f0df.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ad5ae3ef.entry.js → p-d3a44f8f.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +11 -5
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +8 -4
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +6 -1
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +5 -6
- package/dist/types/components.d.ts +18 -2
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +9 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -3
- package/package.json +1 -1
- package/dist/sankhyablocks/p-500f7114.js +0 -6
- package/dist/sankhyablocks/p-ddefbbc7.js +0 -60
- package/dist/sankhyablocks/p-ef0e94b9.entry.js +0 -1
- package/dist/sankhyablocks/p-ef566451.entry.js +0 -1
|
@@ -178,7 +178,6 @@ export class PesquisaFetcher {
|
|
|
178
178
|
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
179
179
|
var _a, _b, _c;
|
|
180
180
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
181
|
-
console.log("criteria: ", criteria);
|
|
182
181
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
183
182
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
184
183
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
package/dist/components/ISave.js
CHANGED
|
@@ -57,8 +57,6 @@ function buildUserInterface(field) {
|
|
|
57
57
|
return UserInterface.DATETIME;
|
|
58
58
|
if (field['type'] === 'T')
|
|
59
59
|
return UserInterface.TIME;
|
|
60
|
-
if (field['type'] === 'I')
|
|
61
|
-
return UserInterface.INTEGERNUMBER;
|
|
62
60
|
return undefined;
|
|
63
61
|
}
|
|
64
62
|
function buildDataType(rawType) {
|
|
@@ -70,8 +68,6 @@ function buildDataType(rawType) {
|
|
|
70
68
|
return DataType.DATE;
|
|
71
69
|
case 'B':
|
|
72
70
|
return DataType.OBJECT;
|
|
73
|
-
case 'I':
|
|
74
|
-
return DataType.NUMBER;
|
|
75
71
|
default:
|
|
76
72
|
return DataType.TEXT;
|
|
77
73
|
}
|
|
@@ -93,6 +89,12 @@ function parseGridConfig(rawConfig) {
|
|
|
93
89
|
return undefined;
|
|
94
90
|
return { columns };
|
|
95
91
|
}
|
|
92
|
+
var PESQUISA_VIEW_MODE;
|
|
93
|
+
(function (PESQUISA_VIEW_MODE) {
|
|
94
|
+
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["GRID"] = 0] = "GRID";
|
|
95
|
+
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["CARDS"] = 1] = "CARDS";
|
|
96
|
+
PESQUISA_VIEW_MODE[PESQUISA_VIEW_MODE["TREE"] = 2] = "TREE";
|
|
97
|
+
})(PESQUISA_VIEW_MODE || (PESQUISA_VIEW_MODE = {}));
|
|
96
98
|
|
|
97
99
|
class PesquisaFetcher {
|
|
98
100
|
constructor() {
|
|
@@ -270,7 +272,6 @@ class PesquisaFetcher {
|
|
|
270
272
|
buildLoadTreeRequestBody(entityName, argument, criteria, searchOptions) {
|
|
271
273
|
var _a, _b, _c;
|
|
272
274
|
const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
|
|
273
|
-
console.log("criteria: ", criteria);
|
|
274
275
|
const incomeSearchOptions = (_a = listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) !== null && _a !== void 0 ? _a : searchOptions;
|
|
275
276
|
const rootEntity = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.rootEntity;
|
|
276
277
|
const codeFieldName = incomeSearchOptions === null || incomeSearchOptions === void 0 ? void 0 : incomeSearchOptions.codeFieldName;
|
|
@@ -393,4 +394,4 @@ var SaveErrorsEnum;
|
|
|
393
394
|
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
|
394
395
|
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
|
395
396
|
|
|
396
|
-
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d };
|
|
397
|
+
export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, PesquisaFetcher as a, DataExporterType as b, DataExporterFormat as c, buildGridMetadata as d, PESQUISA_VIEW_MODE as e };
|
|
@@ -443,12 +443,13 @@ class DatasetStrategy {
|
|
|
443
443
|
const serviceName = "DatasetSP.loadRecords";
|
|
444
444
|
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
|
|
445
445
|
const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
|
|
446
|
-
const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
|
446
|
+
const { result: responseRecords, pagerID: pagerId, askRowsLimit } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
|
447
447
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
|
448
448
|
const loadingInProgress = pagerId != undefined;
|
|
449
449
|
const count = loadingInfo.count + records.length;
|
|
450
450
|
const isInsertingNewRecord = dataUnit.hasNewRecord();
|
|
451
|
-
const
|
|
451
|
+
const hasLocalSorting = localSorting.length > 0;
|
|
452
|
+
const needReload = !loadingInProgress && hasLocalSorting;
|
|
452
453
|
/**
|
|
453
454
|
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
454
455
|
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
@@ -459,7 +460,8 @@ class DatasetStrategy {
|
|
|
459
460
|
return Promise.resolve({
|
|
460
461
|
records,
|
|
461
462
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
462
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord
|
|
463
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord, askRowsLimit,
|
|
464
|
+
hasLocalSorting })
|
|
463
465
|
});
|
|
464
466
|
}
|
|
465
467
|
catch (error) {
|
|
@@ -511,8 +513,7 @@ class DatasetStrategy {
|
|
|
511
513
|
},
|
|
512
514
|
}
|
|
513
515
|
};
|
|
514
|
-
|
|
515
|
-
return parsedRequestBody;
|
|
516
|
+
return JSON.stringify(requestBody);
|
|
516
517
|
}
|
|
517
518
|
getFieldsList(dataUnit) {
|
|
518
519
|
let fields = ["__record__id__", "__record__label__"];
|
|
@@ -639,7 +640,117 @@ class DatasetStrategy {
|
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
642
|
|
|
643
|
+
async function showAskCancelPaginationPopup() {
|
|
644
|
+
return new Promise((resolve) => {
|
|
645
|
+
const { checkboxContainer, checkbox } = buildCheckboxContainer();
|
|
646
|
+
const popup = builPopup(resolve, checkbox);
|
|
647
|
+
const contentContainer = buildContentContainer();
|
|
648
|
+
contentContainer.appendChild(buildMessage());
|
|
649
|
+
contentContainer.appendChild(checkboxContainer);
|
|
650
|
+
const actionsContainer = buildActionsContainer();
|
|
651
|
+
actionsContainer.appendChild(buildContinuePaginationBtn(popup, checkbox, resolve));
|
|
652
|
+
actionsContainer.appendChild(buildCancelPaginationBtn(popup, resolve));
|
|
653
|
+
contentContainer.appendChild(actionsContainer);
|
|
654
|
+
popup.appendChild(contentContainer);
|
|
655
|
+
document.body.appendChild(popup);
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function buildCheckboxContainer() {
|
|
659
|
+
const checkboxContainer = document.createElement('div');
|
|
660
|
+
checkboxContainer.style.marginBottom = '14px';
|
|
661
|
+
checkboxContainer.style.display = 'flex';
|
|
662
|
+
checkboxContainer.style.alignItems = 'center';
|
|
663
|
+
const { checkbox, checkboxLabel } = buildCheckbox();
|
|
664
|
+
checkboxContainer.appendChild(checkbox);
|
|
665
|
+
checkboxContainer.appendChild(checkboxLabel);
|
|
666
|
+
return { checkboxContainer, checkbox };
|
|
667
|
+
}
|
|
668
|
+
function buildCheckbox() {
|
|
669
|
+
const checkbox = document.createElement('input');
|
|
670
|
+
checkbox.type = 'checkbox';
|
|
671
|
+
checkbox.id = 'loadAll';
|
|
672
|
+
const checkboxLabel = document.createElement('label');
|
|
673
|
+
checkboxLabel.htmlFor = 'loadAll';
|
|
674
|
+
checkboxLabel.textContent = 'Carregar tudo';
|
|
675
|
+
checkboxLabel.style.marginLeft = '5px';
|
|
676
|
+
return { checkbox, checkboxLabel };
|
|
677
|
+
}
|
|
678
|
+
function buildActionsContainer() {
|
|
679
|
+
const actionsContainer = document.createElement('div');
|
|
680
|
+
actionsContainer.style.display = 'flex';
|
|
681
|
+
actionsContainer.style.flexDirection = 'row';
|
|
682
|
+
actionsContainer.style.justifyContent = 'end';
|
|
683
|
+
actionsContainer.style.gap = '5px';
|
|
684
|
+
return actionsContainer;
|
|
685
|
+
}
|
|
686
|
+
function buildContentContainer() {
|
|
687
|
+
const contentContainer = document.createElement('div');
|
|
688
|
+
contentContainer.style.display = 'flex';
|
|
689
|
+
contentContainer.style.flexDirection = 'column';
|
|
690
|
+
contentContainer.style.fontFamily = 'var(--font-pattern, Roboto)';
|
|
691
|
+
contentContainer.style.fontSize = 'var(--text--medium)';
|
|
692
|
+
return contentContainer;
|
|
693
|
+
}
|
|
694
|
+
function buildMessage() {
|
|
695
|
+
const message = document.createElement('div');
|
|
696
|
+
const line1 = document.createElement('p');
|
|
697
|
+
const line2 = document.createElement('p');
|
|
698
|
+
const line3 = document.createElement('p');
|
|
699
|
+
line3.style.fontWeight = 'var(--text-weight--large, 600)';
|
|
700
|
+
line1.textContent = 'Uma quantidade de registros muito grande está sendo carregada.';
|
|
701
|
+
line2.textContent = 'Recomendamos que a paginação seja cancelada e que seja criado um filtro para os registros.';
|
|
702
|
+
line3.textContent = 'Deseja cancelar o carregamento?';
|
|
703
|
+
message.appendChild(line1);
|
|
704
|
+
message.appendChild(line2);
|
|
705
|
+
message.appendChild(line3);
|
|
706
|
+
return message;
|
|
707
|
+
}
|
|
708
|
+
function buildCancelPaginationBtn(popup, resolve) {
|
|
709
|
+
const cancelPaginationBtn = document.createElement('ez-button');
|
|
710
|
+
cancelPaginationBtn.label = 'Cancelar paginação';
|
|
711
|
+
cancelPaginationBtn.size = 'medium';
|
|
712
|
+
cancelPaginationBtn.classList.add('ez-button--primary');
|
|
713
|
+
cancelPaginationBtn.onclick = () => {
|
|
714
|
+
document.body.removeChild(popup);
|
|
715
|
+
resolve(CancelPaginationResponse.CANCEL);
|
|
716
|
+
};
|
|
717
|
+
return cancelPaginationBtn;
|
|
718
|
+
}
|
|
719
|
+
function buildContinuePaginationBtn(popup, checkBox, resolve) {
|
|
720
|
+
const continuePaginationBtn = document.createElement('ez-button');
|
|
721
|
+
continuePaginationBtn.label = 'Continuar';
|
|
722
|
+
continuePaginationBtn.size = 'medium';
|
|
723
|
+
continuePaginationBtn.onclick = () => {
|
|
724
|
+
document.body.removeChild(popup);
|
|
725
|
+
resolve(checkBox.checked ? CancelPaginationResponse.LOAD_ALL : CancelPaginationResponse.CONTINUE);
|
|
726
|
+
};
|
|
727
|
+
return continuePaginationBtn;
|
|
728
|
+
}
|
|
729
|
+
function builPopup(resolve, checkBox) {
|
|
730
|
+
const popup = document.createElement('ez-popup');
|
|
731
|
+
popup.opened = true;
|
|
732
|
+
popup.size = 'x-small';
|
|
733
|
+
popup.ezTitle = 'Aviso';
|
|
734
|
+
popup.heightMode = "auto";
|
|
735
|
+
popup.addEventListener('ezClosePopup', () => {
|
|
736
|
+
document.body.removeChild(popup);
|
|
737
|
+
resolve(checkBox.checked ? CancelPaginationResponse.LOAD_ALL : CancelPaginationResponse.CONTINUE);
|
|
738
|
+
}, { once: true });
|
|
739
|
+
popup.addEventListener('ezPopupAction', () => {
|
|
740
|
+
document.body.removeChild(popup);
|
|
741
|
+
resolve(CancelPaginationResponse.CANCEL);
|
|
742
|
+
}, { once: true });
|
|
743
|
+
return popup;
|
|
744
|
+
}
|
|
745
|
+
var CancelPaginationResponse;
|
|
746
|
+
(function (CancelPaginationResponse) {
|
|
747
|
+
CancelPaginationResponse["CANCEL"] = "CANCEL";
|
|
748
|
+
CancelPaginationResponse["CONTINUE"] = "CONTINUE";
|
|
749
|
+
CancelPaginationResponse["LOAD_ALL"] = "LOAD_ALL";
|
|
750
|
+
})(CancelPaginationResponse || (CancelPaginationResponse = {}));
|
|
751
|
+
|
|
642
752
|
class DataUnitDataLoader {
|
|
753
|
+
constructor() { }
|
|
643
754
|
static async debounce(dataUnit, callBack) {
|
|
644
755
|
const duName = dataUnit.name;
|
|
645
756
|
if (DataUnitDataLoader._debouncingTimeouts[duName]) {
|
|
@@ -685,25 +796,67 @@ class DataUnitDataLoader {
|
|
|
685
796
|
}
|
|
686
797
|
static async callLoader(dataUnit, request, requestLoadingInfo, dataLoader) {
|
|
687
798
|
if (dataLoader == undefined) {
|
|
688
|
-
//dataLoader = new DataUnitStrategy();
|
|
689
799
|
dataLoader = new DatasetStrategy();
|
|
690
800
|
}
|
|
691
801
|
const result = await dataLoader.load(dataUnit, request, requestLoadingInfo);
|
|
692
|
-
const
|
|
693
|
-
if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo))
|
|
802
|
+
const responseLoadingInfo = result.loadingInfo;
|
|
803
|
+
if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo))
|
|
694
804
|
return Promise.resolve(undefined);
|
|
805
|
+
this.handleCache(dataLoader, responseLoadingInfo, dataUnit, result.records);
|
|
806
|
+
if (dataUnit.cancelPagination)
|
|
807
|
+
return this.handlePaginationCanceled(dataUnit, result);
|
|
808
|
+
//Não existem mais páginas a serem carregadas
|
|
809
|
+
if (this.canFinishPagination(dataUnit, responseLoadingInfo))
|
|
810
|
+
return Promise.resolve(result);
|
|
811
|
+
const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
|
|
812
|
+
let newLoadingInfo = this.buildNewLoadingInfo(responseLoadingInfo);
|
|
813
|
+
if (this.canProceedPagination(responseLoadingInfo))
|
|
814
|
+
return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
|
|
815
|
+
const confirm = await showAskCancelPaginationPopup();
|
|
816
|
+
if (confirm === CancelPaginationResponse.CANCEL)
|
|
817
|
+
return this.handlePaginationCanceled(dataUnit, result);
|
|
818
|
+
if (confirm === CancelPaginationResponse.LOAD_ALL) {
|
|
819
|
+
newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { loadAllRecords: true });
|
|
695
820
|
}
|
|
821
|
+
newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { lastRowLimitAsked: newLoadingInfo.count });
|
|
822
|
+
return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
|
|
823
|
+
}
|
|
824
|
+
static buildNewLoadingInfo(responseLoadingInfo) {
|
|
825
|
+
let newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
|
|
826
|
+
return newLoadingInfo;
|
|
827
|
+
}
|
|
828
|
+
static handleCache(dataLoader, responseLoadingInfo, dataUnit, records) {
|
|
696
829
|
const recreateCache = !dataLoader.canSlice() || responseLoadingInfo.count === 0;
|
|
697
830
|
PreloadManager.cacheRecords(dataUnit, records, recreateCache, responseLoadingInfo.loadingInProgress);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
.catch(reason => console.error(reason));
|
|
704
|
-
}
|
|
831
|
+
}
|
|
832
|
+
static recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result) {
|
|
833
|
+
this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
|
|
834
|
+
.then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
|
|
835
|
+
.catch(reason => console.error(reason));
|
|
705
836
|
return Promise.resolve(result);
|
|
706
837
|
}
|
|
838
|
+
static canFinishPagination(dataUnit, responseLoadingInfo) {
|
|
839
|
+
return !PreloadManager.isCacheEnabled(dataUnit) || !responseLoadingInfo.loadingInProgress;
|
|
840
|
+
}
|
|
841
|
+
static canProceedPagination(info) {
|
|
842
|
+
const { count, askRowsLimit, loadAllRecords, lastRowLimitAsked } = info;
|
|
843
|
+
if (loadAllRecords)
|
|
844
|
+
return true;
|
|
845
|
+
if (!count || !askRowsLimit)
|
|
846
|
+
return true;
|
|
847
|
+
const askRowLimitNumber = Number(askRowsLimit);
|
|
848
|
+
if (count < askRowLimitNumber)
|
|
849
|
+
return true;
|
|
850
|
+
const nextLimitToAsk = askRowLimitNumber + (lastRowLimitAsked ? lastRowLimitAsked : 0);
|
|
851
|
+
return count < nextLimitToAsk;
|
|
852
|
+
}
|
|
853
|
+
static handlePaginationCanceled(dataUnit, result) {
|
|
854
|
+
dataUnit.cancelPagination = false;
|
|
855
|
+
let loadingInfo = result.loadingInfo;
|
|
856
|
+
loadingInfo = Object.assign(Object.assign({}, loadingInfo), { total: loadingInfo.count, loadingInProgress: false, pagerId: undefined, needReload: loadingInfo.hasLocalSorting });
|
|
857
|
+
const loadDataResult = { records: result.records, loadingInfo };
|
|
858
|
+
return Promise.resolve(loadDataResult);
|
|
859
|
+
}
|
|
707
860
|
static afterLoadingPage(dataUnit, loadingInfo) {
|
|
708
861
|
PreloadManager.setLoadingStatus(dataUnit, loadingInfo.loadingInProgress);
|
|
709
862
|
const dataUnitPagination = dataUnit.getPaginationInfo();
|
|
@@ -743,7 +896,7 @@ class DataUnitDataLoader {
|
|
|
743
896
|
// controle de paginação voltar pra primeira página.
|
|
744
897
|
offset = 0;
|
|
745
898
|
}
|
|
746
|
-
const { total, count, loadingInProgress } = loadingInfo;
|
|
899
|
+
const { total, count, loadingInProgress, askRowsLimit } = loadingInfo;
|
|
747
900
|
const firstRecord = (count === 0 || pageSize === 0) ? 0 : offset + 1;
|
|
748
901
|
const lastRecord = offset + Math.min(pageSize, limit);
|
|
749
902
|
return {
|
|
@@ -752,7 +905,8 @@ class DataUnitDataLoader {
|
|
|
752
905
|
lastRecord,
|
|
753
906
|
firstRecord,
|
|
754
907
|
currentPage: offset / limit,
|
|
755
|
-
hasMore: lastRecord < count || loadingInProgress
|
|
908
|
+
hasMore: lastRecord < count || loadingInProgress,
|
|
909
|
+
askRowsLimit
|
|
756
910
|
};
|
|
757
911
|
}
|
|
758
912
|
}
|
|
@@ -8,7 +8,7 @@ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
|
8
8
|
import './filter-item-type.enum.js';
|
|
9
9
|
import './form-config-fetcher.js';
|
|
10
10
|
|
|
11
|
-
const pesquisaGridCss = ".sc-pesquisa-grid-h{
|
|
11
|
+
const pesquisaGridCss = ".sc-pesquisa-grid-h{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";
|
|
12
12
|
|
|
13
13
|
const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -21,21 +21,31 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
21
21
|
this.pkField = undefined;
|
|
22
22
|
this.descriptionField = undefined;
|
|
23
23
|
this.entityName = undefined;
|
|
24
|
+
this.shouldLoadConfig = false;
|
|
25
|
+
this._gridConfig = undefined;
|
|
24
26
|
this._inMemoryLoader = undefined;
|
|
25
27
|
this._dataunit = undefined;
|
|
26
|
-
this._gridConfig = undefined;
|
|
27
28
|
}
|
|
28
29
|
observeDataSource(newValue) {
|
|
29
30
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
30
31
|
return;
|
|
31
32
|
this._inMemoryLoader.records = [...newValue];
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
observeMetadata() {
|
|
34
35
|
this.initializeDataUnit();
|
|
36
|
+
}
|
|
37
|
+
async observeShouldLoadConfig(newValue) {
|
|
38
|
+
if (!newValue || this._gridConfig)
|
|
39
|
+
return;
|
|
40
|
+
await this.loadGridConfig();
|
|
41
|
+
}
|
|
42
|
+
async loadGridConfig() {
|
|
35
43
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
36
44
|
}
|
|
37
45
|
initializeDataUnit() {
|
|
38
46
|
var _a;
|
|
47
|
+
if (!this.metadata)
|
|
48
|
+
return;
|
|
39
49
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
40
50
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
41
51
|
this._dataunit.pageSize = 0;
|
|
@@ -53,10 +63,14 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
53
63
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
54
64
|
}
|
|
55
65
|
render() {
|
|
66
|
+
if (!this.metadata || !this._dataunit)
|
|
67
|
+
return;
|
|
56
68
|
return (h(Host, null, h("ez-grid", { dataUnit: this._dataunit, config: this._gridConfig, canEdit: false, suppressCheckboxColumn: true, compact: true, autoFocus: false, onEzDoubleClick: ({ detail }) => this.handleDbClick(detail), onConfigChange: async (event) => this.handleConfigChanged(event) })));
|
|
57
69
|
}
|
|
58
70
|
static get watchers() { return {
|
|
59
|
-
"dataSource": ["observeDataSource"]
|
|
71
|
+
"dataSource": ["observeDataSource"],
|
|
72
|
+
"metadata": ["observeMetadata"],
|
|
73
|
+
"shouldLoadConfig": ["observeShouldLoadConfig"]
|
|
60
74
|
}; }
|
|
61
75
|
static get style() { return pesquisaGridCss; }
|
|
62
76
|
}, [2, "pesquisa-grid", {
|
|
@@ -65,9 +79,10 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
65
79
|
"pkField": [1, "pk-field"],
|
|
66
80
|
"descriptionField": [1, "description-field"],
|
|
67
81
|
"entityName": [1, "entity-name"],
|
|
82
|
+
"shouldLoadConfig": [4, "should-load-config"],
|
|
83
|
+
"_gridConfig": [32],
|
|
68
84
|
"_inMemoryLoader": [32],
|
|
69
|
-
"_dataunit": [32]
|
|
70
|
-
"_gridConfig": [32]
|
|
85
|
+
"_dataunit": [32]
|
|
71
86
|
}]);
|
|
72
87
|
function defineCustomElement() {
|
|
73
88
|
if (typeof customElements === "undefined") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
|
|
4
|
-
const pesquisaTreeCss = ".sc-pesquisa-tree-h{--snk-pesquisa--tree__action-container--top:var(--space--sm);--snk-pesquisa--tree__action-container--right:var(--space--small);--snk-pesquisa--tree__min-height:var(--space--extra-large);background:var(--background--xlight, #FFF);position:relative;
|
|
4
|
+
const pesquisaTreeCss = ".sc-pesquisa-tree-h{--snk-pesquisa--tree__action-container--top:var(--space--sm);--snk-pesquisa--tree__action-container--right:var(--space--small);--snk-pesquisa--tree__min-height:var(--space--extra-large);background:var(--background--xlight, #FFF);position:relative;min-height:var(--snk-pesquisa--tree__min-height);height:100%;display:block;overflow-y:auto}.sc-pesquisa-tree-h:hover .actions-container.sc-pesquisa-tree{display:flex}.actions-container.sc-pesquisa-tree{flex-direction:row;position:absolute;top:var(--snk-pesquisa--tree__action-container--top);right:var(--snk-pesquisa--tree__action-container--right);display:none}";
|
|
5
5
|
|
|
6
6
|
const PesquisaTree = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -11,12 +11,20 @@ const PesquisaTree = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
11
11
|
this.treeLoader = undefined;
|
|
12
12
|
this.argument = undefined;
|
|
13
13
|
this.allowsNonAnalytic = false;
|
|
14
|
+
this.shouldLoadTree = false;
|
|
14
15
|
this.items = [];
|
|
15
16
|
}
|
|
16
17
|
async applyFilter() {
|
|
17
18
|
await this._tree.applyFilter(this.argument);
|
|
18
19
|
}
|
|
20
|
+
async observeShouldLoadTree(newValue) {
|
|
21
|
+
if (!newValue || this.items.length > 0)
|
|
22
|
+
return;
|
|
23
|
+
await this.loadTree();
|
|
24
|
+
}
|
|
19
25
|
async loadTree() {
|
|
26
|
+
if (!this.shouldLoadTree)
|
|
27
|
+
return;
|
|
20
28
|
if (!this.treeLoader || typeof this.treeLoader !== 'function')
|
|
21
29
|
return;
|
|
22
30
|
const response = await this.treeLoader((this.argument || '').trim());
|
|
@@ -45,23 +53,24 @@ const PesquisaTree = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
45
53
|
};
|
|
46
54
|
this.pesquisaTreeSelectItem.emit(option);
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
await this.loadTree();
|
|
50
|
-
}
|
|
51
|
-
renderEmptyMessate() {
|
|
56
|
+
renderEmptyMessage() {
|
|
52
57
|
return (h("div", { class: "ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary" }, h("span", null, "Nenhum registro encontrado...")));
|
|
53
58
|
}
|
|
54
59
|
render() {
|
|
55
60
|
var _a;
|
|
56
61
|
return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
|
|
57
|
-
this.
|
|
62
|
+
this.renderEmptyMessage() :
|
|
58
63
|
h(Fragment, null, h("div", { class: 'actions-container' }, h("ez-button", { size: 'small', mode: 'icon', class: 'ez-margin-right--small', iconName: 'show-list', title: "Expandir", onClick: () => this.handleExpandAll() }), h("ez-button", { size: 'small', mode: 'icon', iconName: 'hide-list', title: "Recolher", onClick: () => this.handleCloseAll() })), h("ez-tree", { ref: (element) => this._tree = element, onEzDbClickItem: ({ detail }) => this.handleDbClick(detail), items: this.items }))));
|
|
59
64
|
}
|
|
65
|
+
static get watchers() { return {
|
|
66
|
+
"shouldLoadTree": ["observeShouldLoadTree"]
|
|
67
|
+
}; }
|
|
60
68
|
static get style() { return pesquisaTreeCss; }
|
|
61
69
|
}, [2, "pesquisa-tree", {
|
|
62
70
|
"treeLoader": [16],
|
|
63
71
|
"argument": [1025],
|
|
64
72
|
"allowsNonAnalytic": [4, "allows-non-analytic"],
|
|
73
|
+
"shouldLoadTree": [4, "should-load-tree"],
|
|
65
74
|
"items": [32],
|
|
66
75
|
"applyFilter": [64]
|
|
67
76
|
}]);
|
|
@@ -6,7 +6,7 @@ import { C as ConfigStorage } from './ConfigStorage.js';
|
|
|
6
6
|
import { O as ORDER_VALUES } from './constants.js';
|
|
7
7
|
import { d as defineCustomElement$1 } from './snk-select-box2.js';
|
|
8
8
|
|
|
9
|
-
const snkGridConfigCss = ".sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);--snk-grid-config__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-grid-config__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-grid-config__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-grid-config__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__scrollbar--width:var(--space--
|
|
9
|
+
const snkGridConfigCss = ".sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-family:var(--font-pattern, \"Roboto\");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);--snk-grid-config__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-grid-config__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-grid-config__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-grid-config__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__scrollbar--width:var(--space--small, 8px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-grid-config-h{width:359px;max-width:359px}}.padding-right--medium.sc-snk-grid-config{padding-right:var(--space--medium)}ez-list.sc-snk-grid-config{height:100%}.height-calc.sc-snk-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-snk-grid-config{display:flex;justify-content:flex-end;width:100%;padding-top:var(--snk-grid-config__footer--padding-top)}.hidden.sc-snk-grid-config{display:none}.tabselector-container.sc-snk-grid-config{padding:var(--snk-grid-config__tabselector-container--padding) 0}.button-close.sc-snk-grid-config{padding-left:var(--snk-grid-config__button-close--padding-left)}.title-container.sc-snk-grid-config{display:flex;justify-content:space-between;align-items:center;width:100%}.title.sc-snk-grid-config{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-grid-config__title--color);font-size:var(--snk-grid-config__title--font-size);font-family:var(--snk-grid-config__title--font-family);font-weight:var(--snk-grid-config__title--font-weight)}.subtitle.sc-snk-grid-config{color:var(--text--primary);font-size:var(--snk-grid-config__subtitle--font-size);font-family:var(--snk-grid-config__subtitle--font-family)}.grid-config__main.sc-snk-grid-config{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-grid-config__scrollbar--color-clicked) var(--snk-grid-config__scrollbar--color-background);padding-right:var(--snk-grid-config__main--padding-right)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar{width:var(--snk-grid-config__scrollbar--width);max-width:var(--snk-grid-config__scrollbar--width);min-width:var(--snk-grid-config__scrollbar--width);background-color:var(--snk-grid-config__scrollbar--color-background)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-track{background-color:var(--snk-grid-config__scrollbar--color-background);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb{background-color:var(--snk-grid-config__scrollbar--color-default);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:hover,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-grid-config__scrollbar--color-hover)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:vertical:active,.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-grid-config__scrollbar--color-clicked)}.group-name.sc-snk-grid-config{font-family:var(--snk-grid-config__group--font-family);font-size:var(--snk-grid-config__group--font-size);font-weight:var(--snk-grid-config__group--font-weight);padding-bottom:var(--snk-grid-config__group--padding-bottom)}";
|
|
10
10
|
|
|
11
11
|
const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ObjectUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { a as PesquisaFetcher, d as buildGridMetadata } from './ISave.js';
|
|
3
|
+
import { a as PesquisaFetcher, d as buildGridMetadata, e as PESQUISA_VIEW_MODE } from './ISave.js';
|
|
4
4
|
import './DataFetcher.js';
|
|
5
5
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
6
6
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
7
7
|
import './dataunit-fetcher.js';
|
|
8
8
|
import './filter-item-type.enum.js';
|
|
9
9
|
import './form-config-fetcher.js';
|
|
10
|
-
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
11
10
|
import { d as defineCustomElement$2 } from './pesquisa-grid2.js';
|
|
12
11
|
import { d as defineCustomElement$1 } from './pesquisa-tree2.js';
|
|
13
12
|
|
|
14
|
-
const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--color-secondary:var(--text--secondary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--
|
|
13
|
+
const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--color-secondary:var(--text--secondary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);--snk-pesquisa__scrollbar--color-default:var(--scrollbar--default, #626e82);--snk-pesquisa__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--snk-pesquisa__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--snk-pesquisa__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--snk-pesquisa__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__scrollbar--width:var(--space--small, 8px);height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__scrollbar--color-clicked) var(--snk-pesquisa__scrollbar--color-background);padding-right:var(--snk-pesquisa__content--padding-right);height:100vh}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__scrollbar--color-background);width:var(--snk-pesquisa__scrollbar--width);max-width:var(--snk-pesquisa__scrollbar--width);min-width:var(--snk-pesquisa__scrollbar--width)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__scrollbar--color-background);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__scrollbar--color-default);border-radius:var(--snk-pesquisa__scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:hover,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--snk-pesquisa__scrollbar--color-hover)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:vertical:active,.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--snk-pesquisa__scrollbar--color-clicked)}.snk-pesquisa__records-label.sc-snk-pesquisa{display:flex;flex-direction:row;justify-content:space-between;font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__records-label.hidden.sc-snk-pesquisa{display:none}.snk-pesquisa__records.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color)}.snk-pesquisa__records-limit.sc-snk-pesquisa{color:var(--snk-pesquisa__records--color-secondary)}.snk-pesquisa__records-limit.hidden.sc-snk-pesquisa,.snk-pesquisa__records.hidden.sc-snk-pesquisa{visibility:hidden}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}.snk-pesquisa__cards-container.sc-snk-pesquisa{height:100%;overflow-y:auto}";
|
|
15
14
|
|
|
16
15
|
const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
17
16
|
constructor() {
|
|
@@ -31,6 +30,7 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
31
30
|
this._itemList = undefined;
|
|
32
31
|
this._startLoading = false;
|
|
33
32
|
this._presentationMode = "list";
|
|
33
|
+
this._currentView = undefined;
|
|
34
34
|
this.searchLoader = undefined;
|
|
35
35
|
this.treeLoader = undefined;
|
|
36
36
|
this.selectItem = undefined;
|
|
@@ -333,25 +333,29 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
333
333
|
}
|
|
334
334
|
async componentDidLoad() {
|
|
335
335
|
ElementIDUtils.addIDInfo(this._element);
|
|
336
|
+
await this.chooseViewMode();
|
|
336
337
|
}
|
|
337
|
-
async
|
|
338
|
+
async handleChangeViewMode() {
|
|
338
339
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
340
|
+
await this.chooseViewMode();
|
|
339
341
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
340
342
|
}
|
|
341
|
-
|
|
342
|
-
var _a;
|
|
343
|
-
|
|
343
|
+
async chooseViewMode() {
|
|
344
|
+
var _a, _b;
|
|
345
|
+
if (this._presentationMode !== 'list') {
|
|
346
|
+
await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(PESQUISA_VIEW_MODE.GRID));
|
|
347
|
+
this._currentView = PESQUISA_VIEW_MODE.GRID;
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const view = this.isHierarchyEntity ? PESQUISA_VIEW_MODE.TREE : PESQUISA_VIEW_MODE.CARDS;
|
|
351
|
+
await ((_b = this._viewStack) === null || _b === void 0 ? void 0 : _b.show(view));
|
|
352
|
+
this._currentView = view;
|
|
344
353
|
}
|
|
345
354
|
//Os limites de exibição são diferentes para lista e grade
|
|
346
355
|
hideLimitMessage() {
|
|
347
356
|
if (!this._itemList)
|
|
348
357
|
return true;
|
|
349
|
-
|
|
350
|
-
if (this.isHierarchyEntity)
|
|
351
|
-
return true;
|
|
352
|
-
return this._itemList.length <= 100;
|
|
353
|
-
}
|
|
354
|
-
return this._itemList.length <= 150;
|
|
358
|
+
return this._itemList.length < 100;
|
|
355
359
|
}
|
|
356
360
|
hideRecordsMessage() {
|
|
357
361
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
@@ -374,30 +378,13 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
374
378
|
title: 'Modo lista',
|
|
375
379
|
};
|
|
376
380
|
}
|
|
377
|
-
renderContent() {
|
|
378
|
-
if (!this._itemList)
|
|
379
|
-
return;
|
|
380
|
-
if (this._presentationMode === 'list') {
|
|
381
|
-
return this.isHierarchyEntity ? this.renderTree() : this.renderCards();
|
|
382
|
-
}
|
|
383
|
-
return this.renderPesquisaGrid();
|
|
384
|
-
}
|
|
385
|
-
renderTree() {
|
|
386
|
-
return h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) }));
|
|
387
|
-
}
|
|
388
|
-
renderCards() {
|
|
389
|
-
return (h("ez-scroller", { direction: EzScrollDirection.VERTICAL }, h("div", { class: "snk-pesquisa__cards-container" }, this._itemList.map((item) => {
|
|
390
|
-
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
391
|
-
}))));
|
|
392
|
-
}
|
|
393
|
-
renderPesquisaGrid() {
|
|
394
|
-
return h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) });
|
|
395
|
-
}
|
|
396
381
|
render() {
|
|
397
|
-
var _a;
|
|
382
|
+
var _a, _b;
|
|
398
383
|
return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument, "data-element-id": "searchInput" }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
|
|
399
384
|
? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
400
|
-
: undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.
|
|
385
|
+
: undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() }), h("ez-button", { class: "ez-margin-left--medium", mode: "icon", iconName: this.getButtonModeInfo().iconName, title: this.getButtonModeInfo().title, onClick: async () => await this.handleChangeViewMode() })), h("div", { class: `snk-pesquisa__records-label ${this._currentView === PESQUISA_VIEW_MODE.TREE ? 'hidden' : ''}` }, h("label", { class: `snk-pesquisa__records ${this.hideRecordsMessage() ? "hidden" : ""}` }, this.getMessageView()), h("label", { class: `snk-pesquisa__records-limit ${this.hideLimitMessage() ? "hidden" : ""}` }, "Essa pesquisa foi limitada, existem mais resultados.")), h("div", { class: "snk-pesquisa__content" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("pesquisa-grid", { metadata: this._gridMetadata, dataSource: this._gridDataSource, pkField: this._pkField, descriptionField: this._descriptionField, entityName: this.entityName, shouldLoadConfig: this._currentView === PESQUISA_VIEW_MODE.GRID, onPesquisaGridSelectItem: ({ detail }) => this.selectItem(detail) })), h("stack-item", null, h("div", { class: 'snk-pesquisa__cards-container' }, (_b = this._itemList) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
386
|
+
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
387
|
+
}))), h("stack-item", null, h("pesquisa-tree", { ref: (element) => this._pesquisaTree = element, argument: this.argument, treeLoader: this.treeLoader, allowsNonAnalytic: this.allowsNonAnalytic, shouldLoadTree: this._currentView === PESQUISA_VIEW_MODE.TREE, onPesquisaTreeSelectItem: ({ detail }) => this.selectItem(detail) })))))));
|
|
401
388
|
}
|
|
402
389
|
get _element() { return this; }
|
|
403
390
|
static get watchers() { return {
|
|
@@ -414,7 +401,8 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
414
401
|
"allowsNonAnalytic": [4, "allows-non-analytic"],
|
|
415
402
|
"_itemList": [32],
|
|
416
403
|
"_startLoading": [32],
|
|
417
|
-
"_presentationMode": [32]
|
|
404
|
+
"_presentationMode": [32],
|
|
405
|
+
"_currentView": [32]
|
|
418
406
|
}]);
|
|
419
407
|
function defineCustomElement() {
|
|
420
408
|
if (typeof customElements === "undefined") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { Action, LockManager, LockManagerOperation, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { Action, LockManager, LockManagerOperation, SilentException, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
|
4
4
|
import { P as PresentationMode } from './ISave.js';
|
|
5
5
|
import { s as store } from './index2.js';
|
|
@@ -300,8 +300,14 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
300
300
|
case TaskbarElement.SAVE:
|
|
301
301
|
if (!this._isWaitingForSave) {
|
|
302
302
|
this._isWaitingForSave = true;
|
|
303
|
-
this.dataUnit.saveData()
|
|
304
|
-
|
|
303
|
+
this.dataUnit.saveData().catch((err) => {
|
|
304
|
+
if (err instanceof SilentException) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
throw err;
|
|
309
|
+
}
|
|
310
|
+
}).finally(() => {
|
|
305
311
|
this._isWaitingForSave = false;
|
|
306
312
|
});
|
|
307
313
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher-5221b992.js';
|
|
2
|
-
import './pesquisa-fetcher-
|
|
2
|
+
import './pesquisa-fetcher-767abffa.js';
|
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
4
4
|
import './index-3aa4977a.js';
|
|
5
5
|
import './ISave-d8c8bc59.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
|
8
|
+
import { P as PreloadManager } from './dataunit-fetcher-26c2bed4.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
10
|
import './form-config-fetcher-126e2471.js';
|
|
11
11
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|