docs(changeset): Possible selection fixes
This commit is contained in:
parent
b514c906c8
commit
7c1d47819a
5
.changeset/major-beans-guess.md
Normal file
5
.changeset/major-beans-guess.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@warkypublic/oranguru': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Possible selection fixes
|
||||||
@ -238,9 +238,9 @@ export const GridlerDataGrid = () => {
|
|||||||
JSON.stringify(currentSelection?.current) !== JSON.stringify(selection.current)
|
JSON.stringify(currentSelection?.current) !== JSON.stringify(selection.current)
|
||||||
) {
|
) {
|
||||||
setState('_gridSelection', { ...selection, rows });
|
setState('_gridSelection', { ...selection, rows });
|
||||||
if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) {
|
//if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) {
|
||||||
setState('_gridSelectionRows', rows);
|
setState('_gridSelectionRows', rows);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log('Selection', selection);
|
//console.log('Selection', selection);
|
||||||
|
|||||||
@ -282,7 +282,12 @@ export const Computer = React.memo(() => {
|
|||||||
const firstRow = firstBuffer?.[keyField];
|
const firstRow = firstBuffer?.[keyField];
|
||||||
const currentValues = getState('values') ?? [];
|
const currentValues = getState('values') ?? [];
|
||||||
|
|
||||||
if (firstRow && firstRow > 0 && (currentValues.length ?? 0) === 0) {
|
if (
|
||||||
|
!(values && values.length > 0) &&
|
||||||
|
firstRow &&
|
||||||
|
firstRow > 0 &&
|
||||||
|
(currentValues.length ?? 0) === 0
|
||||||
|
) {
|
||||||
const values = [firstBuffer, ...(currentValues as Array<Record<string, unknown>>)];
|
const values = [firstBuffer, ...(currentValues as Array<Record<string, unknown>>)];
|
||||||
|
|
||||||
const onChange = getState('onChange');
|
const onChange = getState('onChange');
|
||||||
@ -340,10 +345,12 @@ export const Computer = React.memo(() => {
|
|||||||
if (selectedRowKey) {
|
if (selectedRowKey) {
|
||||||
const onChange = getState('onChange');
|
const onChange = getState('onChange');
|
||||||
const selected = [{ [getState('keyField') ?? 'id']: selectedRowKey }];
|
const selected = [{ [getState('keyField') ?? 'id']: selectedRowKey }];
|
||||||
if (onChange) {
|
if (JSON.stringify(getState('values')) !== JSON.stringify(selected)) {
|
||||||
onChange(selected);
|
if (onChange) {
|
||||||
} else {
|
onChange(selected);
|
||||||
setState('values', selected);
|
} else {
|
||||||
|
setState('values', selected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -463,13 +463,10 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat
|
|||||||
const [col, row] = cell;
|
const [col, row] = cell;
|
||||||
if (state.glideProps?.onCellClicked) {
|
if (state.glideProps?.onCellClicked) {
|
||||||
state.glideProps?.onCellClicked?.(cell, event);
|
state.glideProps?.onCellClicked?.(cell, event);
|
||||||
} else {
|
}
|
||||||
if (state.values?.length) {
|
if (state.values?.length) {
|
||||||
if (state.onChange) {
|
if (state.onChange) {
|
||||||
state.onChange(state.values);
|
state.onChange(state.values);
|
||||||
} else {
|
|
||||||
state.setState('values', state.values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user