Compare commits
4 Commits
249c283819
...
017b6445fb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
017b6445fb | ||
|
|
7c1d47819a | ||
|
|
b514c906c8 | ||
|
|
6664c988b7 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,5 +1,17 @@
|
||||
# @warkypublic/zustandsyncstore
|
||||
|
||||
## 0.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7c1d478: Possible selection fixes
|
||||
|
||||
## 0.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 6664c98: Calls onchange on cell click since selection does not change.
|
||||
|
||||
## 0.0.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@warkypublic/oranguru",
|
||||
"author": "Warky Devs",
|
||||
"version": "0.0.20",
|
||||
"version": "0.0.22",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -238,9 +238,9 @@ export const GridlerDataGrid = () => {
|
||||
JSON.stringify(currentSelection?.current) !== JSON.stringify(selection.current)
|
||||
) {
|
||||
setState('_gridSelection', { ...selection, rows });
|
||||
if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) {
|
||||
setState('_gridSelectionRows', rows);
|
||||
}
|
||||
//if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) {
|
||||
setState('_gridSelectionRows', rows);
|
||||
//}
|
||||
}
|
||||
|
||||
//console.log('Selection', selection);
|
||||
|
||||
@ -282,7 +282,12 @@ export const Computer = React.memo(() => {
|
||||
const firstRow = firstBuffer?.[keyField];
|
||||
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 onChange = getState('onChange');
|
||||
@ -340,10 +345,12 @@ export const Computer = React.memo(() => {
|
||||
if (selectedRowKey) {
|
||||
const onChange = getState('onChange');
|
||||
const selected = [{ [getState('keyField') ?? 'id']: selectedRowKey }];
|
||||
if (onChange) {
|
||||
onChange(selected);
|
||||
} else {
|
||||
setState('values', selected);
|
||||
if (JSON.stringify(getState('values')) !== JSON.stringify(selected)) {
|
||||
if (onChange) {
|
||||
onChange(selected);
|
||||
} else {
|
||||
setState('values', selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -463,13 +463,10 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat
|
||||
const [col, row] = cell;
|
||||
if (state.glideProps?.onCellClicked) {
|
||||
state.glideProps?.onCellClicked?.(cell, event);
|
||||
} else {
|
||||
if (state.values?.length) {
|
||||
if (state.onChange) {
|
||||
state.onChange(state.values);
|
||||
} else {
|
||||
state.setState('values', state.values);
|
||||
}
|
||||
}
|
||||
if (state.values?.length) {
|
||||
if (state.onChange) {
|
||||
state.onChange(state.values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user