@masterkeymaterial/ui 0.2.16 → 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 */ []));
|
|
@@ -6892,12 +6892,6 @@ class MkGrid {
|
|
|
6892
6892
|
this.numOrdemPrimeiroExibido.set(numeroPrimeiro);
|
|
6893
6893
|
this.numOrdemUltimoExibido.set(numeroUltimo);
|
|
6894
6894
|
});
|
|
6895
|
-
effect(() => {
|
|
6896
|
-
const isSelected = this.config().isSelected();
|
|
6897
|
-
if (isSelected === false) {
|
|
6898
|
-
this.clearSelections();
|
|
6899
|
-
}
|
|
6900
|
-
});
|
|
6901
6895
|
}
|
|
6902
6896
|
ngOnInit() {
|
|
6903
6897
|
this.filtroCollapsed.set(this.config().filterBarStartCollapsed ?? true);
|
|
@@ -6918,24 +6912,25 @@ class MkGrid {
|
|
|
6918
6912
|
}, 0);
|
|
6919
6913
|
}
|
|
6920
6914
|
iniciarSelectedRows(lista) {
|
|
6921
|
-
let
|
|
6922
|
-
if (!
|
|
6915
|
+
let listaSelecionados = this.config().startSelected;
|
|
6916
|
+
if (!listaSelecionados || !lista) {
|
|
6923
6917
|
this.clearSelections();
|
|
6924
6918
|
return;
|
|
6925
6919
|
}
|
|
6926
|
-
let
|
|
6920
|
+
let idSelecionados = lista
|
|
6927
6921
|
.map(item => LibUtil.getV(this.config().primarykey, item)?.toString() ?? '')
|
|
6928
|
-
.filter(id => id != '')
|
|
6929
|
-
|
|
6922
|
+
.filter(id => id != '')
|
|
6923
|
+
.filter(id => listaSelecionados.includes(id));
|
|
6924
|
+
if (idSelecionados.length === 0) {
|
|
6930
6925
|
this.todosSelecionados.set(false);
|
|
6931
6926
|
}
|
|
6932
|
-
else if (lista.length > 0 &&
|
|
6927
|
+
else if (lista.length > 0 && idSelecionados.length === lista.length) {
|
|
6933
6928
|
this.todosSelecionados.set(true);
|
|
6934
6929
|
}
|
|
6935
6930
|
else {
|
|
6936
6931
|
this.todosSelecionados.set(false);
|
|
6937
6932
|
}
|
|
6938
|
-
this.
|
|
6933
|
+
this.selectedPrimaryKeys.set(idSelecionados);
|
|
6939
6934
|
}
|
|
6940
6935
|
definirColunas() {
|
|
6941
6936
|
let colunasInicialConfig = this.config().colunas.map((col, index) => {
|
|
@@ -6993,7 +6988,7 @@ class MkGrid {
|
|
|
6993
6988
|
inativo: this.config().InativeRule(o),
|
|
6994
6989
|
isSelectionDisabled: this.config().SelectionDisabledRule ? this.config().SelectionDisabledRule(o) : false,
|
|
6995
6990
|
groupName: propriedadeAgrupada ? LibUtil.getV(propriedadeAgrupada, o) : '',
|
|
6996
|
-
selecionado: this.
|
|
6991
|
+
selecionado: this.selectedPrimaryKeys().includes(id),
|
|
6997
6992
|
hue: this.config().backgroundHue ? this.config().backgroundHue?.(o) : undefined,
|
|
6998
6993
|
actions: this.config().actionsLine.map(a => {
|
|
6999
6994
|
if (a.showAction == true)
|
|
@@ -7197,7 +7192,7 @@ class MkGrid {
|
|
|
7197
7192
|
paginaAtual: this.paginacaoSignal().paginaAtual,
|
|
7198
7193
|
itensPorPagina: this.itensPorPagina(),
|
|
7199
7194
|
},
|
|
7200
|
-
selecionados: this.
|
|
7195
|
+
selecionados: this.selectedPrimaryKeys(),
|
|
7201
7196
|
tempoRequisicao: this.config().timeRequest,
|
|
7202
7197
|
totais: {
|
|
7203
7198
|
totalDefinida: this.lista()?.length ?? 0,
|
|
@@ -7328,14 +7323,14 @@ class MkGrid {
|
|
|
7328
7323
|
let listaOrdenada = this.listaOrdenada();
|
|
7329
7324
|
if (!todosSelecionados) {
|
|
7330
7325
|
for (const linha of listaOrdenada) {
|
|
7331
|
-
if (this.
|
|
7326
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7332
7327
|
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7333
7328
|
}
|
|
7334
7329
|
}
|
|
7335
7330
|
}
|
|
7336
7331
|
else {
|
|
7337
7332
|
for (const linha of listaOrdenada) {
|
|
7338
|
-
await this.
|
|
7333
|
+
await this.selecionarLinha(linha.id, linha.dados);
|
|
7339
7334
|
}
|
|
7340
7335
|
}
|
|
7341
7336
|
await LibUtil.wait(100);
|
|
@@ -7346,33 +7341,39 @@ class MkGrid {
|
|
|
7346
7341
|
return;
|
|
7347
7342
|
if (!linha.dados)
|
|
7348
7343
|
return;
|
|
7349
|
-
if (this.
|
|
7350
|
-
this.desselecionarLinha(linha.id, linha.dados);
|
|
7344
|
+
if (this.selectedPrimaryKeys().includes(linha.id)) {
|
|
7345
|
+
await this.desselecionarLinha(linha.id, linha.dados);
|
|
7351
7346
|
}
|
|
7352
7347
|
else {
|
|
7353
|
-
this.
|
|
7348
|
+
await this.selecionarLinha(linha.id, linha.dados);
|
|
7354
7349
|
}
|
|
7355
7350
|
}
|
|
7356
7351
|
clearSelections() {
|
|
7357
|
-
this.
|
|
7352
|
+
this.selectedPrimaryKeys.set([]);
|
|
7358
7353
|
}
|
|
7359
|
-
async
|
|
7360
|
-
if (this.
|
|
7354
|
+
async selecionarLinha(id, dados) {
|
|
7355
|
+
if (this.selectedPrimaryKeys().includes(id))
|
|
7361
7356
|
return;
|
|
7362
7357
|
if (this.config().selectionMode == 'single') {
|
|
7363
|
-
this.
|
|
7358
|
+
this.selectedPrimaryKeys.set([id]);
|
|
7359
|
+
}
|
|
7360
|
+
else {
|
|
7361
|
+
this.selectedPrimaryKeys.set([...this.selectedPrimaryKeys(), id]);
|
|
7364
7362
|
}
|
|
7365
|
-
this.
|
|
7366
|
-
this.config().
|
|
7367
|
-
this.config().onSelectionChanged?.(dados, this.selectedRows());
|
|
7368
|
-
this.config().isSelected.set(true);
|
|
7363
|
+
await this.config().onSelected?.(dados, this.selectedPrimaryKeys());
|
|
7364
|
+
await this.config().onSelectionChanged?.(dados, this.selectedPrimaryKeys());
|
|
7369
7365
|
}
|
|
7370
7366
|
async desselecionarLinha(id, dados) {
|
|
7371
|
-
if (!this.
|
|
7367
|
+
if (!this.selectedPrimaryKeys().includes(id))
|
|
7372
7368
|
return;
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7369
|
+
if (this.config().selectionMode == 'single') {
|
|
7370
|
+
this.selectedPrimaryKeys.set([]);
|
|
7371
|
+
}
|
|
7372
|
+
else {
|
|
7373
|
+
this.selectedPrimaryKeys.set(this.selectedPrimaryKeys().filter(i => i !== id));
|
|
7374
|
+
}
|
|
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 => {
|