@masterkeymaterial/ui 0.2.17 → 0.2.19
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.
|
@@ -302,6 +302,11 @@ class LibUtil {
|
|
|
302
302
|
LOG(1, "⚠️ JSON Inválido: Não foi possível formatar o JSON.");
|
|
303
303
|
return texto;
|
|
304
304
|
}
|
|
305
|
+
if (!retorno) {
|
|
306
|
+
console.log("⚠️ JSON Vazio: O JSON é vazio ou nulo.", texto);
|
|
307
|
+
return texto;
|
|
308
|
+
}
|
|
309
|
+
;
|
|
305
310
|
if (colorir) {
|
|
306
311
|
let keyNameStart = '<span class="json-key">';
|
|
307
312
|
let nullStart = '<span class="json-null">';
|
|
@@ -6800,7 +6805,7 @@ class MkGrid {
|
|
|
6800
6805
|
colunasExibir = signal([], ...(ngDevMode ? [{ debugName: "colunasExibir" }] : /* istanbul ignore next */ []));
|
|
6801
6806
|
gridTemplateColumns = signal('auto', ...(ngDevMode ? [{ debugName: "gridTemplateColumns" }] : /* istanbul ignore next */ []));
|
|
6802
6807
|
inputSearchText = signal('', ...(ngDevMode ? [{ debugName: "inputSearchText" }] : /* istanbul ignore next */ []));
|
|
6803
|
-
|
|
6808
|
+
selectedPrimaryKeys = signal([], ...(ngDevMode ? [{ debugName: "selectedPrimaryKeys" }] : /* istanbul ignore next */ []));
|
|
6804
6809
|
gruposColapsed = signal([], ...(ngDevMode ? [{ debugName: "gruposColapsed" }] : /* istanbul ignore next */ []));
|
|
6805
6810
|
isAgrupado = signal(false, ...(ngDevMode ? [{ debugName: "isAgrupado" }] : /* istanbul ignore next */ []));
|
|
6806
6811
|
isAgrupadoLimpo = signal(false, ...(ngDevMode ? [{ debugName: "isAgrupadoLimpo" }] : /* istanbul ignore next */ []));
|
|
@@ -6912,24 +6917,25 @@ class MkGrid {
|
|
|
6912
6917
|
}, 0);
|
|
6913
6918
|
}
|
|
6914
6919
|
iniciarSelectedRows(lista) {
|
|
6915
|
-
let
|
|
6916
|
-
if (!
|
|
6920
|
+
let listaSelecionados = this.config().startSelected;
|
|
6921
|
+
if (!listaSelecionados || !lista) {
|
|
6917
6922
|
this.clearSelections();
|
|
6918
6923
|
return;
|
|
6919
6924
|
}
|
|
6920
|
-
let
|
|
6925
|
+
let idSelecionados = lista
|
|
6921
6926
|
.map(item => LibUtil.getV(this.config().primarykey, item)?.toString() ?? '')
|
|
6922
|
-
.filter(id => id != '')
|
|
6923
|
-
|
|
6927
|
+
.filter(id => id != '')
|
|
6928
|
+
.filter(id => listaSelecionados.includes(id));
|
|
6929
|
+
if (idSelecionados.length === 0) {
|
|
6924
6930
|
this.todosSelecionados.set(false);
|
|
6925
6931
|
}
|
|
6926
|
-
else if (lista.length > 0 &&
|
|
6932
|
+
else if (lista.length > 0 && idSelecionados.length === lista.length) {
|
|
6927
6933
|
this.todosSelecionados.set(true);
|
|
6928
6934
|
}
|
|
6929
6935
|
else {
|
|
6930
6936
|
this.todosSelecionados.set(false);
|
|
6931
6937
|
}
|
|
6932
|
-
this.
|
|
6938
|
+
this.selectedPrimaryKeys.set(idSelecionados);
|
|
6933
6939
|
}
|
|
6934
6940
|
definirColunas() {
|
|
6935
6941
|
let colunasInicialConfig = this.config().colunas.map((col, index) => {
|
|
@@ -6987,7 +6993,7 @@ class MkGrid {
|
|
|
6987
6993
|
inativo: this.config().InativeRule(o),
|
|
6988
6994
|
isSelectionDisabled: this.config().SelectionDisabledRule ? this.config().SelectionDisabledRule(o) : false,
|
|
6989
6995
|
groupName: propriedadeAgrupada ? LibUtil.getV(propriedadeAgrupada, o) : '',
|
|
6990
|
-
selecionado: this.
|
|
6996
|
+
selecionado: this.selectedPrimaryKeys().includes(id),
|
|
6991
6997
|
hue: this.config().backgroundHue ? this.config().backgroundHue?.(o) : undefined,
|
|
6992
6998
|
actions: this.config().actionsLine.map(a => {
|
|
6993
6999
|
if (a.showAction == true)
|
|
@@ -7191,7 +7197,7 @@ class MkGrid {
|
|
|
7191
7197
|
paginaAtual: this.paginacaoSignal().paginaAtual,
|
|
7192
7198
|
itensPorPagina: this.itensPorPagina(),
|
|
7193
7199
|
},
|
|
7194
|
-
selecionados: this.
|
|
7200
|
+
selecionados: this.selectedPrimaryKeys(),
|
|
7195
7201
|
tempoRequisicao: this.config().timeRequest,
|
|
7196
7202
|
totais: {
|
|
7197
7203
|
totalDefinida: this.lista()?.length ?? 0,
|
|
@@ -7322,7 +7328,7 @@ class MkGrid {
|
|
|
7322
7328
|
let listaOrdenada = this.listaOrdenada();
|
|
7323
7329
|
if (!todosSelecionados) {
|
|
7324
7330
|
for (const linha of listaOrdenada) {
|
|
7325
|
-
if (this.
|
|
7331
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7326
7332
|
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7327
7333
|
}
|
|
7328
7334
|
}
|
|
@@ -7340,7 +7346,7 @@ class MkGrid {
|
|
|
7340
7346
|
return;
|
|
7341
7347
|
if (!linha.dados)
|
|
7342
7348
|
return;
|
|
7343
|
-
if (this.
|
|
7349
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7344
7350
|
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7345
7351
|
}
|
|
7346
7352
|
else {
|
|
@@ -7348,31 +7354,31 @@ class MkGrid {
|
|
|
7348
7354
|
}
|
|
7349
7355
|
}
|
|
7350
7356
|
clearSelections() {
|
|
7351
|
-
this.
|
|
7357
|
+
this.selectedPrimaryKeys.set([]);
|
|
7352
7358
|
}
|
|
7353
7359
|
async selecionarLinha(id, dados) {
|
|
7354
|
-
if (this.
|
|
7360
|
+
if (this.selectedPrimaryKeys().includes(id))
|
|
7355
7361
|
return;
|
|
7356
7362
|
if (this.config().selectionMode == 'single') {
|
|
7357
|
-
this.
|
|
7363
|
+
this.selectedPrimaryKeys.set([id]);
|
|
7358
7364
|
}
|
|
7359
7365
|
else {
|
|
7360
|
-
this.
|
|
7366
|
+
this.selectedPrimaryKeys.set([...this.selectedPrimaryKeys(), id]);
|
|
7361
7367
|
}
|
|
7362
|
-
await this.config().onSelected?.(dados, this.
|
|
7363
|
-
await this.config().onSelectionChanged?.(dados, this.
|
|
7368
|
+
await this.config().onSelected?.(dados, this.selectedPrimaryKeys());
|
|
7369
|
+
await this.config().onSelectionChanged?.(dados, this.selectedPrimaryKeys());
|
|
7364
7370
|
}
|
|
7365
7371
|
async desselecionarLinha(id, dados) {
|
|
7366
|
-
if (!this.
|
|
7372
|
+
if (!this.selectedPrimaryKeys().includes(id))
|
|
7367
7373
|
return;
|
|
7368
7374
|
if (this.config().selectionMode == 'single') {
|
|
7369
|
-
this.
|
|
7375
|
+
this.selectedPrimaryKeys.set([]);
|
|
7370
7376
|
}
|
|
7371
7377
|
else {
|
|
7372
|
-
this.
|
|
7378
|
+
this.selectedPrimaryKeys.set(this.selectedPrimaryKeys().filter(i => i !== id));
|
|
7373
7379
|
}
|
|
7374
|
-
await this.config().onUnselected?.(dados, this.
|
|
7375
|
-
await this.config().onSelectionChanged?.(dados, this.
|
|
7380
|
+
await this.config().onUnselected?.(dados, this.selectedPrimaryKeys());
|
|
7381
|
+
await this.config().onSelectionChanged?.(dados, this.selectedPrimaryKeys());
|
|
7376
7382
|
}
|
|
7377
7383
|
onClickGroup(dadosDaLinha) {
|
|
7378
7384
|
this.gruposColapsed.update(g => {
|