@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76031.1 → 0.0.0-bugfix-dev-KB-81512.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-2718aaaa.js → ContinuousInsertUtils-e9454466.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-c32fdff7.js → dataunit-fetcher-8ea97d88.js} +17 -171
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-3b86b6c4.js → pesquisa-fetcher-8a4857b5.js} +5 -6
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +12 -34
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_5.cjs.entry.js +2 -2
- 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-2c7c1964.js → snk-data-unit-72ef8777.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-266339d2.js → snk-guides-viewer-0a547d11.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +35 -22
- package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -8
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +1 -0
- package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +5 -41
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +1 -4
- package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +7 -36
- package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +4 -6
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +0 -10
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +34 -22
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +3 -9
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +12 -57
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +8 -9
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -0
- package/dist/components/ISave.js +6 -7
- package/dist/components/dataunit-fetcher.js +17 -171
- package/dist/components/pesquisa-grid2.js +6 -21
- package/dist/components/pesquisa-tree2.js +6 -15
- package/dist/components/snk-pesquisa2.js +35 -23
- package/dist/components/snk-taskbar2.js +3 -9
- package/dist/esm/{ContinuousInsertUtils-deb7767f.js → ContinuousInsertUtils-c599f41b.js} +2 -2
- package/dist/esm/{dataunit-fetcher-26c2bed4.js → dataunit-fetcher-8dd93d8b.js} +17 -171
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-767abffa.js → pesquisa-fetcher-3b206fe3.js} +6 -7
- package/dist/esm/pesquisa-grid_2.entry.js +12 -34
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_5.entry.js +2 -2
- 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-a36df23f.js → snk-data-unit-11a49fc3.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-9f03a9a0.js → snk-guides-viewer-a87a4639.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +35 -22
- package/dist/esm/snk-simple-crud.entry.js +3 -3
- package/dist/esm/snk-taskbar.entry.js +3 -9
- package/dist/sankhyablocks/{p-9cec99d8.entry.js → p-07f40d74.entry.js} +1 -1
- package/dist/sankhyablocks/{p-045398fb.entry.js → p-1a91d1f3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1f17a44e.entry.js → p-4b85ab68.entry.js} +1 -1
- package/dist/sankhyablocks/{p-18f58d73.js → p-4d3e557b.js} +1 -1
- package/dist/sankhyablocks/p-500f7114.js +6 -0
- package/dist/sankhyablocks/{p-86fc5865.js → p-5b5e877f.js} +1 -1
- package/dist/sankhyablocks/{p-70ae0779.js → p-60e4db34.js} +1 -1
- package/dist/sankhyablocks/{p-28ca3908.entry.js → p-619aeac8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b896f0df.entry.js → p-7b5f24ec.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d3a44f8f.entry.js → p-ad5ae3ef.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5dbed7b4.entry.js → p-b1e0fcdd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-09b4a36b.entry.js → p-bd2e8377.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aa3ead06.entry.js → p-c691d03b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9070bfe3.entry.js → p-cc8b7b73.entry.js} +1 -1
- package/dist/sankhyablocks/p-ddefbbc7.js +60 -0
- package/dist/sankhyablocks/p-ef0e94b9.entry.js +1 -0
- package/dist/sankhyablocks/p-ef566451.entry.js +1 -0
- package/dist/sankhyablocks/{p-0d2c8bc8.entry.js → p-f1120c28.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +5 -11
- package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +4 -8
- package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +1 -6
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +6 -5
- package/dist/types/components.d.ts +2 -18
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +1 -9
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +0 -4
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -3
- package/package.json +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +0 -108
- package/dist/sankhyablocks/p-07583bae.entry.js +0 -1
- package/dist/sankhyablocks/p-4fe8bb73.js +0 -6
- package/dist/sankhyablocks/p-78d49c74.js +0 -60
- package/dist/sankhyablocks/p-800a8209.entry.js +0 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +0 -6
|
@@ -443,13 +443,12 @@ 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
|
|
446
|
+
const { result: responseRecords, pagerID: pagerId } = 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
|
|
452
|
-
const needReload = !loadingInProgress && hasLocalSorting;
|
|
451
|
+
const needReload = !loadingInProgress && localSorting.length > 0;
|
|
453
452
|
/**
|
|
454
453
|
* Caso precise recarregar dados, porém está no meio de uma inserção, os dados não devem recarregados instantaneamente,
|
|
455
454
|
* Mas sim, sinalizar que o dataUnit está aguardando para der recarregado.
|
|
@@ -460,8 +459,7 @@ class DatasetStrategy {
|
|
|
460
459
|
return Promise.resolve({
|
|
461
460
|
records,
|
|
462
461
|
loadingInfo: Object.assign(Object.assign({}, loadingInfo), { pagerId,
|
|
463
|
-
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord
|
|
464
|
-
hasLocalSorting })
|
|
462
|
+
loadingInProgress, total: loadingInProgress ? undefined : count, count, needReload: needReload && !isInsertingNewRecord })
|
|
465
463
|
});
|
|
466
464
|
}
|
|
467
465
|
catch (error) {
|
|
@@ -513,7 +511,8 @@ class DatasetStrategy {
|
|
|
513
511
|
},
|
|
514
512
|
}
|
|
515
513
|
};
|
|
516
|
-
|
|
514
|
+
const parsedRequestBody = JSON.stringify(requestBody);
|
|
515
|
+
return parsedRequestBody;
|
|
517
516
|
}
|
|
518
517
|
getFieldsList(dataUnit) {
|
|
519
518
|
let fields = ["__record__id__", "__record__label__"];
|
|
@@ -640,117 +639,7 @@ class DatasetStrategy {
|
|
|
640
639
|
}
|
|
641
640
|
}
|
|
642
641
|
|
|
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
|
-
|
|
752
642
|
class DataUnitDataLoader {
|
|
753
|
-
constructor() { }
|
|
754
643
|
static async debounce(dataUnit, callBack) {
|
|
755
644
|
const duName = dataUnit.name;
|
|
756
645
|
if (DataUnitDataLoader._debouncingTimeouts[duName]) {
|
|
@@ -796,67 +685,25 @@ class DataUnitDataLoader {
|
|
|
796
685
|
}
|
|
797
686
|
static async callLoader(dataUnit, request, requestLoadingInfo, dataLoader) {
|
|
798
687
|
if (dataLoader == undefined) {
|
|
688
|
+
//dataLoader = new DataUnitStrategy();
|
|
799
689
|
dataLoader = new DatasetStrategy();
|
|
800
690
|
}
|
|
801
691
|
const result = await dataLoader.load(dataUnit, request, requestLoadingInfo);
|
|
802
|
-
const responseLoadingInfo = result
|
|
803
|
-
if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo))
|
|
692
|
+
const { records, loadingInfo: responseLoadingInfo } = result;
|
|
693
|
+
if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo)) {
|
|
804
694
|
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 });
|
|
820
695
|
}
|
|
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) {
|
|
829
696
|
const recreateCache = !dataLoader.canSlice() || responseLoadingInfo.count === 0;
|
|
830
697
|
PreloadManager.cacheRecords(dataUnit, records, recreateCache, responseLoadingInfo.loadingInProgress);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
.
|
|
835
|
-
|
|
698
|
+
if (PreloadManager.isCacheEnabled(dataUnit) && responseLoadingInfo.loadingInProgress) {
|
|
699
|
+
const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
|
|
700
|
+
const newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
|
|
701
|
+
this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
|
|
702
|
+
.then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
|
|
703
|
+
.catch(reason => console.error(reason));
|
|
704
|
+
}
|
|
836
705
|
return Promise.resolve(result);
|
|
837
706
|
}
|
|
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
|
-
}
|
|
860
707
|
static afterLoadingPage(dataUnit, loadingInfo) {
|
|
861
708
|
PreloadManager.setLoadingStatus(dataUnit, loadingInfo.loadingInProgress);
|
|
862
709
|
const dataUnitPagination = dataUnit.getPaginationInfo();
|
|
@@ -896,7 +743,7 @@ class DataUnitDataLoader {
|
|
|
896
743
|
// controle de paginação voltar pra primeira página.
|
|
897
744
|
offset = 0;
|
|
898
745
|
}
|
|
899
|
-
const { total, count, loadingInProgress
|
|
746
|
+
const { total, count, loadingInProgress } = loadingInfo;
|
|
900
747
|
const firstRecord = (count === 0 || pageSize === 0) ? 0 : offset + 1;
|
|
901
748
|
const lastRecord = offset + Math.min(pageSize, limit);
|
|
902
749
|
return {
|
|
@@ -905,8 +752,7 @@ class DataUnitDataLoader {
|
|
|
905
752
|
lastRecord,
|
|
906
753
|
firstRecord,
|
|
907
754
|
currentPage: offset / limit,
|
|
908
|
-
hasMore: lastRecord < count || loadingInProgress
|
|
909
|
-
askRowsLimit
|
|
755
|
+
hasMore: lastRecord < count || loadingInProgress
|
|
910
756
|
};
|
|
911
757
|
}
|
|
912
758
|
}
|
|
@@ -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{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";
|
|
11
|
+
const pesquisaGridCss = ".sc-pesquisa-grid-h{height:100vh;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,31 +21,21 @@ 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;
|
|
26
24
|
this._inMemoryLoader = undefined;
|
|
27
25
|
this._dataunit = undefined;
|
|
26
|
+
this._gridConfig = undefined;
|
|
28
27
|
}
|
|
29
28
|
observeDataSource(newValue) {
|
|
30
29
|
if (!this._inMemoryLoader || !this._dataunit || !newValue)
|
|
31
30
|
return;
|
|
32
31
|
this._inMemoryLoader.records = [...newValue];
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
async componentWillLoad() {
|
|
35
34
|
this.initializeDataUnit();
|
|
36
|
-
}
|
|
37
|
-
async observeShouldLoadConfig(newValue) {
|
|
38
|
-
if (!newValue || this._gridConfig)
|
|
39
|
-
return;
|
|
40
|
-
await this.loadGridConfig();
|
|
41
|
-
}
|
|
42
|
-
async loadGridConfig() {
|
|
43
35
|
this._gridConfig = await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName);
|
|
44
36
|
}
|
|
45
37
|
initializeDataUnit() {
|
|
46
38
|
var _a;
|
|
47
|
-
if (!this.metadata)
|
|
48
|
-
return;
|
|
49
39
|
this._inMemoryLoader = new InMemoryLoader(this.metadata, (_a = this.dataSource) !== null && _a !== void 0 ? _a : []);
|
|
50
40
|
this._dataunit = this._inMemoryLoader.dataUnit;
|
|
51
41
|
this._dataunit.pageSize = 0;
|
|
@@ -63,14 +53,10 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
63
53
|
await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName, columns);
|
|
64
54
|
}
|
|
65
55
|
render() {
|
|
66
|
-
if (!this.metadata || !this._dataunit)
|
|
67
|
-
return;
|
|
68
56
|
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) })));
|
|
69
57
|
}
|
|
70
58
|
static get watchers() { return {
|
|
71
|
-
"dataSource": ["observeDataSource"]
|
|
72
|
-
"metadata": ["observeMetadata"],
|
|
73
|
-
"shouldLoadConfig": ["observeShouldLoadConfig"]
|
|
59
|
+
"dataSource": ["observeDataSource"]
|
|
74
60
|
}; }
|
|
75
61
|
static get style() { return pesquisaGridCss; }
|
|
76
62
|
}, [2, "pesquisa-grid", {
|
|
@@ -79,10 +65,9 @@ const PesquisaGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
79
65
|
"pkField": [1, "pk-field"],
|
|
80
66
|
"descriptionField": [1, "description-field"],
|
|
81
67
|
"entityName": [1, "entity-name"],
|
|
82
|
-
"shouldLoadConfig": [4, "should-load-config"],
|
|
83
|
-
"_gridConfig": [32],
|
|
84
68
|
"_inMemoryLoader": [32],
|
|
85
|
-
"_dataunit": [32]
|
|
69
|
+
"_dataunit": [32],
|
|
70
|
+
"_gridConfig": [32]
|
|
86
71
|
}]);
|
|
87
72
|
function defineCustomElement() {
|
|
88
73
|
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;min-height:var(--snk-pesquisa--tree__min-height)
|
|
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;display:inline-block;min-height:var(--snk-pesquisa--tree__min-height)}.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,20 +11,12 @@ 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;
|
|
15
14
|
this.items = [];
|
|
16
15
|
}
|
|
17
16
|
async applyFilter() {
|
|
18
17
|
await this._tree.applyFilter(this.argument);
|
|
19
18
|
}
|
|
20
|
-
async observeShouldLoadTree(newValue) {
|
|
21
|
-
if (!newValue || this.items.length > 0)
|
|
22
|
-
return;
|
|
23
|
-
await this.loadTree();
|
|
24
|
-
}
|
|
25
19
|
async loadTree() {
|
|
26
|
-
if (!this.shouldLoadTree)
|
|
27
|
-
return;
|
|
28
20
|
if (!this.treeLoader || typeof this.treeLoader !== 'function')
|
|
29
21
|
return;
|
|
30
22
|
const response = await this.treeLoader((this.argument || '').trim());
|
|
@@ -53,24 +45,23 @@ const PesquisaTree = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
53
45
|
};
|
|
54
46
|
this.pesquisaTreeSelectItem.emit(option);
|
|
55
47
|
}
|
|
56
|
-
|
|
48
|
+
async componentWillLoad() {
|
|
49
|
+
await this.loadTree();
|
|
50
|
+
}
|
|
51
|
+
renderEmptyMessate() {
|
|
57
52
|
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...")));
|
|
58
53
|
}
|
|
59
54
|
render() {
|
|
60
55
|
var _a;
|
|
61
56
|
return (h(Host, null, !((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) ?
|
|
62
|
-
this.
|
|
57
|
+
this.renderEmptyMessate() :
|
|
63
58
|
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 }))));
|
|
64
59
|
}
|
|
65
|
-
static get watchers() { return {
|
|
66
|
-
"shouldLoadTree": ["observeShouldLoadTree"]
|
|
67
|
-
}; }
|
|
68
60
|
static get style() { return pesquisaTreeCss; }
|
|
69
61
|
}, [2, "pesquisa-tree", {
|
|
70
62
|
"treeLoader": [16],
|
|
71
63
|
"argument": [1025],
|
|
72
64
|
"allowsNonAnalytic": [4, "allows-non-analytic"],
|
|
73
|
-
"shouldLoadTree": [4, "should-load-tree"],
|
|
74
65
|
"items": [32],
|
|
75
66
|
"applyFilter": [64]
|
|
76
67
|
}]);
|
|
@@ -1,16 +1,17 @@
|
|
|
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
|
|
3
|
+
import { a as PesquisaFetcher, d as buildGridMetadata } 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';
|
|
10
11
|
import { d as defineCustomElement$2 } from './pesquisa-grid2.js';
|
|
11
12
|
import { d as defineCustomElement$1 } from './pesquisa-tree2.js';
|
|
12
13
|
|
|
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--medium, 12px);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)
|
|
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--medium, 12px);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)}.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.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)}";
|
|
14
15
|
|
|
15
16
|
const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
17
|
constructor() {
|
|
@@ -30,7 +31,6 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
30
31
|
this._itemList = undefined;
|
|
31
32
|
this._startLoading = false;
|
|
32
33
|
this._presentationMode = "list";
|
|
33
|
-
this._currentView = undefined;
|
|
34
34
|
this.searchLoader = undefined;
|
|
35
35
|
this.treeLoader = undefined;
|
|
36
36
|
this.selectItem = undefined;
|
|
@@ -333,29 +333,25 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
333
333
|
}
|
|
334
334
|
async componentDidLoad() {
|
|
335
335
|
ElementIDUtils.addIDInfo(this._element);
|
|
336
|
-
await this.chooseViewMode();
|
|
337
336
|
}
|
|
338
|
-
async
|
|
337
|
+
async onClickList() {
|
|
339
338
|
this._presentationMode = this._presentationMode === 'list' ? 'table' : 'list';
|
|
340
|
-
await this.chooseViewMode();
|
|
341
339
|
await this.pesquisaFetcher.savePresentationConfig(this.entityName, this._presentationMode);
|
|
342
340
|
}
|
|
343
|
-
|
|
344
|
-
var _a
|
|
345
|
-
|
|
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;
|
|
341
|
+
enableListButton() {
|
|
342
|
+
var _a;
|
|
343
|
+
return ((_a = this._itemList) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
353
344
|
}
|
|
354
345
|
//Os limites de exibição são diferentes para lista e grade
|
|
355
346
|
hideLimitMessage() {
|
|
356
347
|
if (!this._itemList)
|
|
357
348
|
return true;
|
|
358
|
-
|
|
349
|
+
if (this._presentationMode === "list") {
|
|
350
|
+
if (this.isHierarchyEntity)
|
|
351
|
+
return true;
|
|
352
|
+
return this._itemList.length <= 100;
|
|
353
|
+
}
|
|
354
|
+
return this._itemList.length <= 150;
|
|
359
355
|
}
|
|
360
356
|
hideRecordsMessage() {
|
|
361
357
|
return (this._presentationMode === "list" && this.isHierarchyEntity);
|
|
@@ -378,13 +374,30 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
378
374
|
title: 'Modo lista',
|
|
379
375
|
};
|
|
380
376
|
}
|
|
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
|
+
}
|
|
381
396
|
render() {
|
|
382
|
-
var _a
|
|
397
|
+
var _a;
|
|
383
398
|
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)
|
|
384
399
|
? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
|
|
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.
|
|
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) })))))));
|
|
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.onClickList(), enabled: this.enableListButton() })), h("div", { class: "snk-pesquisa__records-label" }, 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" }, this.renderContent()))));
|
|
388
401
|
}
|
|
389
402
|
get _element() { return this; }
|
|
390
403
|
static get watchers() { return {
|
|
@@ -401,8 +414,7 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
401
414
|
"allowsNonAnalytic": [4, "allows-non-analytic"],
|
|
402
415
|
"_itemList": [32],
|
|
403
416
|
"_startLoading": [32],
|
|
404
|
-
"_presentationMode": [32]
|
|
405
|
-
"_currentView": [32]
|
|
417
|
+
"_presentationMode": [32]
|
|
406
418
|
}]);
|
|
407
419
|
function defineCustomElement() {
|
|
408
420
|
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,
|
|
2
|
+
import { Action, LockManager, LockManagerOperation, 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,14 +300,8 @@ 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
|
-
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
throw err;
|
|
309
|
-
}
|
|
310
|
-
}).finally(() => {
|
|
303
|
+
this.dataUnit.saveData()
|
|
304
|
+
.finally(() => {
|
|
311
305
|
this._isWaitingForSave = false;
|
|
312
306
|
});
|
|
313
307
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher-5221b992.js';
|
|
2
|
-
import './pesquisa-fetcher-
|
|
2
|
+
import './pesquisa-fetcher-3b206fe3.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-8dd93d8b.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';
|