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
|
# @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
|
## 0.0.20
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@warkypublic/oranguru",
|
"name": "@warkypublic/oranguru",
|
||||||
"author": "Warky Devs",
|
"author": "Warky Devs",
|
||||||
"version": "0.0.20",
|
"version": "0.0.22",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -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