@masterkeymaterial/ui 0.2.17 → 0.2.18
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.
|
@@ -6800,7 +6800,7 @@ class MkGrid {
|
|
|
6800
6800
|
colunasExibir = signal([], ...(ngDevMode ? [{ debugName: "colunasExibir" }] : /* istanbul ignore next */ []));
|
|
6801
6801
|
gridTemplateColumns = signal('auto', ...(ngDevMode ? [{ debugName: "gridTemplateColumns" }] : /* istanbul ignore next */ []));
|
|
6802
6802
|
inputSearchText = signal('', ...(ngDevMode ? [{ debugName: "inputSearchText" }] : /* istanbul ignore next */ []));
|
|
6803
|
-
|
|
6803
|
+
selectedPrimaryKeys = signal([], ...(ngDevMode ? [{ debugName: "selectedPrimaryKeys" }] : /* istanbul ignore next */ []));
|
|
6804
6804
|
gruposColapsed = signal([], ...(ngDevMode ? [{ debugName: "gruposColapsed" }] : /* istanbul ignore next */ []));
|
|
6805
6805
|
isAgrupado = signal(false, ...(ngDevMode ? [{ debugName: "isAgrupado" }] : /* istanbul ignore next */ []));
|
|
6806
6806
|
isAgrupadoLimpo = signal(false, ...(ngDevMode ? [{ debugName: "isAgrupadoLimpo" }] : /* istanbul ignore next */ []));
|
|
@@ -6912,24 +6912,25 @@ class MkGrid {
|
|
|
6912
6912
|
}, 0);
|
|
6913
6913
|
}
|
|
6914
6914
|
iniciarSelectedRows(lista) {
|
|
6915
|
-
let
|
|
6916
|
-
if (!
|
|
6915
|
+
let listaSelecionados = this.config().startSelected;
|
|
6916
|
+
if (!listaSelecionados || !lista) {
|
|
6917
6917
|
this.clearSelections();
|
|
6918
6918
|
return;
|
|
6919
6919
|
}
|
|
6920
|
-
let
|
|
6920
|
+
let idSelecionados = lista
|
|
6921
6921
|
.map(item => LibUtil.getV(this.config().primarykey, item)?.toString() ?? '')
|
|
6922
|
-
.filter(id => id != '')
|
|
6923
|
-
|
|
6922
|
+
.filter(id => id != '')
|
|
6923
|
+
.filter(id => listaSelecionados.includes(id));
|
|
6924
|
+
if (idSelecionados.length === 0) {
|
|
6924
6925
|
this.todosSelecionados.set(false);
|
|
6925
6926
|
}
|
|
6926
|
-
else if (lista.length > 0 &&
|
|
6927
|
+
else if (lista.length > 0 && idSelecionados.length === lista.length) {
|
|
6927
6928
|
this.todosSelecionados.set(true);
|
|
6928
6929
|
}
|
|
6929
6930
|
else {
|
|
6930
6931
|
this.todosSelecionados.set(false);
|
|
6931
6932
|
}
|
|
6932
|
-
this.
|
|
6933
|
+
this.selectedPrimaryKeys.set(idSelecionados);
|
|
6933
6934
|
}
|
|
6934
6935
|
definirColunas() {
|
|
6935
6936
|
let colunasInicialConfig = this.config().colunas.map((col, index) => {
|
|
@@ -6987,7 +6988,7 @@ class MkGrid {
|
|
|
6987
6988
|
inativo: this.config().InativeRule(o),
|
|
6988
6989
|
isSelectionDisabled: this.config().SelectionDisabledRule ? this.config().SelectionDisabledRule(o) : false,
|
|
6989
6990
|
groupName: propriedadeAgrupada ? LibUtil.getV(propriedadeAgrupada, o) : '',
|
|
6990
|
-
selecionado: this.
|
|
6991
|
+
selecionado: this.selectedPrimaryKeys().includes(id),
|
|
6991
6992
|
hue: this.config().backgroundHue ? this.config().backgroundHue?.(o) : undefined,
|
|
6992
6993
|
actions: this.config().actionsLine.map(a => {
|
|
6993
6994
|
if (a.showAction == true)
|
|
@@ -7191,7 +7192,7 @@ class MkGrid {
|
|
|
7191
7192
|
paginaAtual: this.paginacaoSignal().paginaAtual,
|
|
7192
7193
|
itensPorPagina: this.itensPorPagina(),
|
|
7193
7194
|
},
|
|
7194
|
-
selecionados: this.
|
|
7195
|
+
selecionados: this.selectedPrimaryKeys(),
|
|
7195
7196
|
tempoRequisicao: this.config().timeRequest,
|
|
7196
7197
|
totais: {
|
|
7197
7198
|
totalDefinida: this.lista()?.length ?? 0,
|
|
@@ -7322,7 +7323,7 @@ class MkGrid {
|
|
|
7322
7323
|
let listaOrdenada = this.listaOrdenada();
|
|
7323
7324
|
if (!todosSelecionados) {
|
|
7324
7325
|
for (const linha of listaOrdenada) {
|
|
7325
|
-
if (this.
|
|
7326
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7326
7327
|
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7327
7328
|
}
|
|
7328
7329
|
}
|
|
@@ -7340,7 +7341,7 @@ class MkGrid {
|
|
|
7340
7341
|
return;
|
|
7341
7342
|
if (!linha.dados)
|
|
7342
7343
|
return;
|
|
7343
|
-
if (this.
|
|
7344
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7344
7345
|
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7345
7346
|
}
|
|
7346
7347
|
else {
|
|
@@ -7348,31 +7349,31 @@ class MkGrid {
|
|
|
7348
7349
|
}
|
|
7349
7350
|
}
|
|
7350
7351
|
clearSelections() {
|
|
7351
|
-
this.
|
|
7352
|
+
this.selectedPrimaryKeys.set([]);
|
|
7352
7353
|
}
|
|
7353
7354
|
async selecionarLinha(id, dados) {
|
|
7354
|
-
if (this.
|
|
7355
|
+
if (this.selectedPrimaryKeys().includes(id))
|
|
7355
7356
|
return;
|
|
7356
7357
|
if (this.config().selectionMode == 'single') {
|
|
7357
|
-
this.
|
|
7358
|
+
this.selectedPrimaryKeys.set([id]);
|
|
7358
7359
|
}
|
|
7359
7360
|
else {
|
|
7360
|
-
this.
|
|
7361
|
+
this.selectedPrimaryKeys.set([...this.selectedPrimaryKeys(), id]);
|
|
7361
7362
|
}
|
|
7362
|
-
await this.config().onSelected?.(dados, this.
|
|
7363
|
-
await this.config().onSelectionChanged?.(dados, this.
|
|
7363
|
+
await this.config().onSelected?.(dados, this.selectedPrimaryKeys());
|
|
7364
|
+
await this.config().onSelectionChanged?.(dados, this.selectedPrimaryKeys());
|
|
7364
7365
|
}
|
|
7365
7366
|
async desselecionarLinha(id, dados) {
|
|
7366
|
-
if (!this.
|
|
7367
|
+
if (!this.selectedPrimaryKeys().includes(id))
|
|
7367
7368
|
return;
|
|
7368
7369
|
if (this.config().selectionMode == 'single') {
|
|
7369
|
-
this.
|
|
7370
|
+
this.selectedPrimaryKeys.set([]);
|
|
7370
7371
|
}
|
|
7371
7372
|
else {
|
|
7372
|
-
this.
|
|
7373
|
+
this.selectedPrimaryKeys.set(this.selectedPrimaryKeys().filter(i => i !== id));
|
|
7373
7374
|
}
|
|
7374
|
-
await this.config().onUnselected?.(dados, this.
|
|
7375
|
-
await this.config().onSelectionChanged?.(dados, this.
|
|
7375
|
+
await this.config().onUnselected?.(dados, this.selectedPrimaryKeys());
|
|
7376
|
+
await this.config().onSelectionChanged?.(dados, this.selectedPrimaryKeys());
|
|
7376
7377
|
}
|
|
7377
7378
|
onClickGroup(dadosDaLinha) {
|
|
7378
7379
|
this.gruposColapsed.update(g => {
|