ngx-sp-infra 6.7.8 → 6.7.9
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.
|
@@ -9966,7 +9966,6 @@ class SearchInputComponent {
|
|
|
9966
9966
|
const routeToUse = (item.RotaV6 && item.RotaV6 !== '') ? item.RotaV6 : item.RotaOS;
|
|
9967
9967
|
const targetRoute = this.formatBaseURL(item, routeToUse);
|
|
9968
9968
|
// For debugging: log the computed URL. Navigation is intentionally commented out.
|
|
9969
|
-
console.log('Computed targetRoute:', targetRoute);
|
|
9970
9969
|
window.location.assign(targetRoute);
|
|
9971
9970
|
}
|
|
9972
9971
|
highlightList(pesquisa) {
|
|
@@ -10038,8 +10037,6 @@ class SearchInputComponent {
|
|
|
10038
10037
|
// Fallback: if route is empty or not matched, return current origin
|
|
10039
10038
|
finalURL = `${protocol}//${host}`;
|
|
10040
10039
|
}
|
|
10041
|
-
console.log('[formatBaseURL] route:', routeStr);
|
|
10042
|
-
console.log('[formatBaseURL] finalURL:', finalURL);
|
|
10043
10040
|
return finalURL;
|
|
10044
10041
|
}
|
|
10045
10042
|
// #region PESQUISA
|
|
@@ -12063,6 +12060,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
12063
12060
|
|
|
12064
12061
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12065
12062
|
class TableSelectionService {
|
|
12063
|
+
// ...existing code...
|
|
12064
|
+
/** Verifica se um item está selecionado usando múltiplas colunas como chave composta. */
|
|
12065
|
+
isSelecionadoPorItem(item, idColumnNames = ["id"]) {
|
|
12066
|
+
const key = this.makeCompositeKeyFromItem(item, idColumnNames);
|
|
12067
|
+
return this.selecaoMap.get(key) === true;
|
|
12068
|
+
}
|
|
12066
12069
|
get selecaoGeral() { return this._selecaoGeral; }
|
|
12067
12070
|
set selecaoGeral(value) { this._selecaoGeral = value; }
|
|
12068
12071
|
// #endregion PUBLIC
|
|
@@ -12097,28 +12100,85 @@ class TableSelectionService {
|
|
|
12097
12100
|
quantidadeSelecionados() {
|
|
12098
12101
|
return Array.from(this.selecaoMap).filter(item => item[1] === true).length;
|
|
12099
12102
|
}
|
|
12100
|
-
initSelecao(list,
|
|
12101
|
-
if (
|
|
12102
|
-
|
|
12103
|
-
|
|
12103
|
+
initSelecao(list, columns) {
|
|
12104
|
+
if (Array.isArray(columns)) {
|
|
12105
|
+
if (list) {
|
|
12106
|
+
list.forEach(item => {
|
|
12107
|
+
const key = this.makeCompositeKeyFromItem(item, columns);
|
|
12108
|
+
this.selecaoMap.set(key, false);
|
|
12109
|
+
});
|
|
12110
|
+
return this.selecaoMap;
|
|
12111
|
+
}
|
|
12112
|
+
return new Map();
|
|
12104
12113
|
}
|
|
12105
|
-
|
|
12114
|
+
else if (typeof columns === 'string') {
|
|
12115
|
+
if (list) {
|
|
12116
|
+
list.forEach(item => { this.selecaoMap.set(item[columns], false); });
|
|
12117
|
+
this.selecaoGeral = false;
|
|
12118
|
+
return this.selecaoMap;
|
|
12119
|
+
}
|
|
12120
|
+
return new Map();
|
|
12121
|
+
}
|
|
12122
|
+
throw new Error("Nenhuma sobrecarga aceita os argumentos informados para o método: 'initSelecao'.");
|
|
12106
12123
|
}
|
|
12107
|
-
inverterSelecao(id) {
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12124
|
+
inverterSelecao(id, item, columns) {
|
|
12125
|
+
if (!!id) {
|
|
12126
|
+
const selecionado = this.selecaoMap.get(id) || false;
|
|
12127
|
+
this.selecaoMap.set(id, !selecionado);
|
|
12128
|
+
const todosSelecionados = Array.from(this.selecaoMap.values()).every(item => item);
|
|
12129
|
+
if (todosSelecionados) {
|
|
12130
|
+
this.selecaoGeral = true;
|
|
12131
|
+
}
|
|
12132
|
+
else {
|
|
12133
|
+
this.selecaoGeral = false;
|
|
12134
|
+
}
|
|
12135
|
+
return;
|
|
12113
12136
|
}
|
|
12114
|
-
else {
|
|
12115
|
-
this.
|
|
12137
|
+
else if (!!item && !!columns) {
|
|
12138
|
+
const key = this.makeCompositeKeyFromItem(item, columns);
|
|
12139
|
+
const selecionado = this.selecaoMap.get(key) || false;
|
|
12140
|
+
this.selecaoMap.set(key, !selecionado);
|
|
12141
|
+
const todosSelecionados = Array.from(this.selecaoMap.values()).every(v => v);
|
|
12142
|
+
this.selecaoGeral = todosSelecionados;
|
|
12143
|
+
return;
|
|
12116
12144
|
}
|
|
12145
|
+
throw new Error("Nenhuma sobrecarga aceita os argumentos informados para o método: 'inverterSelecao'.");
|
|
12117
12146
|
}
|
|
12118
|
-
definirSelecaoTotal(list, selecao,
|
|
12119
|
-
if (
|
|
12120
|
-
|
|
12147
|
+
definirSelecaoTotal(list, selecao, columns) {
|
|
12148
|
+
if (typeof columns === 'string') {
|
|
12149
|
+
if (list) {
|
|
12150
|
+
list.forEach(item => { this.selecaoMap.set(item[columns], selecao ?? false); });
|
|
12151
|
+
}
|
|
12152
|
+
this.selecaoGeral = selecao ?? false;
|
|
12153
|
+
return;
|
|
12154
|
+
}
|
|
12155
|
+
else if (Array.isArray(columns)) {
|
|
12156
|
+
if (list) {
|
|
12157
|
+
list.forEach(item => {
|
|
12158
|
+
const key = this.makeCompositeKeyFromItem(item, columns);
|
|
12159
|
+
this.selecaoMap.set(key, selecao ?? false);
|
|
12160
|
+
});
|
|
12161
|
+
}
|
|
12162
|
+
this.selecaoGeral = selecao ?? false;
|
|
12163
|
+
return;
|
|
12121
12164
|
}
|
|
12165
|
+
throw new Error("Nenhuma sobrecarga aceita os argumentos informados para o método: 'definirSelecaoTotal'.");
|
|
12166
|
+
}
|
|
12167
|
+
// #endregion Definir seleção total
|
|
12168
|
+
// #region Composite Key Support
|
|
12169
|
+
/**
|
|
12170
|
+
* Gera uma chave estável a partir de um objeto e de uma lista de colunas.
|
|
12171
|
+
* A chave é criada concatenando os valores das colunas com um separador estável.
|
|
12172
|
+
*/
|
|
12173
|
+
makeCompositeKeyFromItem(item, columns) {
|
|
12174
|
+
const values = columns.map(col => {
|
|
12175
|
+
// suporta caminhos tipo 'a.b.c'
|
|
12176
|
+
const parts = col.split('.');
|
|
12177
|
+
const value = parts.reduce((acc, p) => acc ? acc[p] : undefined, item);
|
|
12178
|
+
return value === undefined || value === null ? '' : String(value);
|
|
12179
|
+
});
|
|
12180
|
+
// use JSON.stringify para evitar colisões simples e manter previsibilidade
|
|
12181
|
+
return JSON.stringify(values);
|
|
12122
12182
|
}
|
|
12123
12183
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
12124
12184
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableSelectionService, providedIn: 'any' }); }
|