Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 3f39502

Browse files
committed
Merge branch 'depuring-zustand-changes'
2 parents 06fcedc + 604f259 commit 3f39502

File tree

7 files changed

+35
-13
lines changed

7 files changed

+35
-13
lines changed

docs/docs/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 2.1.0 (beta)
2+
### Shiny new things
3+
- The dispatcher of all events was migrated to Zustand! This means a better, more stable, and more efficient way to handle events. [Zustand](https://zustand.js.org/) is a library that provides a simple, efficient, and powerful way to manage state in React. Allowing future changes as formula columns. As PoC, this version update the value of `modified` column every time a cell is changed. [ISSUE#227](https://github.com/RafaelGB/obsidian-db-folder/issues/227)
4+
### No longer broken
5+
- qoutes inside of source query are now controlled [ISSUE#233](https://github.com/RafaelGB/obsidian-db-folder/issues/233) [jcdeichmann](https://github.com/jcdeichmann)
6+
- Fix centered images of all notes [ISSUE#231](https://github.com/RafaelGB/obsidian-db-folder/issues/231)
7+
- Fix LaTeX formulas presentation incompatibility [ISSUE#228](https://github.com/RafaelGB/obsidian-db-folder/issues/228)
8+
- now is compatible with windows pane using `activeDocument`[ISSUE#199](https://github.com/RafaelGB/obsidian-db-folder/issues/199)
19
# 2.0.1
210
### No longer broken
311
- Fixed selection problem with datetime columns introduced in 2.0.0.

manifest-beta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "dbfolder",
33
"name": "DB Folder",
4-
"version": "2.0.1",
4+
"version": "2.1.0",
55
"minAppVersion": "0.15.4",
66
"description": "Folder with the capability to store and retrieve data from a folder like database",
77
"author": "RafaelGB",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-dbfolder",
3-
"version": "2.0.1",
3+
"version": "2.1.0",
44
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {

src/cdm/FolderModel.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ export interface TableColumn extends BaseColumn {
6363
id: string;
6464
options?: RowSelectOption[];
6565
Cell?: any;
66-
getHeaderProps?: any;
67-
getResizerProps?: any;
6866
}
6967

7068
export type RowDataType = {

src/cdm/TableStateInterface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface ColumnsState {
3333
addOptionToColumn: (column: TableColumn, option: string, backgroundColor: string) => void;
3434
alterColumnType: (column: TableColumn, input: string, parsedRows?: RowDataType[]) => void;
3535
alterColumnLabel: (column: TableColumn, label: string) => void;
36+
alterColumnSize: (columnSizing: Record<string, number>) => void;
3637
}
3738
export interface ColumnSortingState {
3839
state: SortingState;

src/components/Table.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ const defaultColumn: Partial<ColumnDef<RowDataType>> = {
5757
export function Table(tableData: TableDataType) {
5858
/** Main information about the table */
5959
const { view, tableStore } = tableData;
60-
const [columns] = tableStore.columns((state) => [state.columns]);
60+
const [columns, alterColumnSize] = tableStore.columns((state) => [
61+
state.columns,
62+
state.alterColumnSize,
63+
]);
6164
const [rows, addRow] = tableStore.data((state) => [state.rows, state.addRow]);
6265
LOGGER.debug(
6366
`=> Table. number of columns: ${columns.length}. number of rows: ${rows.length}`
@@ -197,18 +200,12 @@ export function Table(tableData: TableDataType) {
197200
// setting new timeout
198201
setPersistSizingTimeout(
199202
setTimeout(() => {
200-
Object.keys(list)
201-
.filter((key) => list[key] !== undefined)
202-
.map((key) => {
203-
view.diskConfig.updateColumnProperties(key, {
204-
width: list[key],
205-
});
206-
});
203+
alterColumnSize(list);
207204
// timeout until event is triggered after user has stopped typing
208205
}, 1500)
209206
);
210207

211-
setColumnSizing(updater);
208+
setColumnSizing(list);
212209
},
213210
onColumnOrderChange: setColumnOrder,
214211
globalFilterFn: "includesString",

src/stateManagement/useColumnsStore.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@ const useColumnsStore = (view: DatabaseView) => {
156156
view.diskConfig.updateColumnKey(column.id, newKey, label);
157157
return { columns: updater.columns };
158158
}),
159+
alterColumnSize: (columnSizing: Record<string, number>) =>
160+
set((updater) => {
161+
const alteredColumns = [...updater.columns];
162+
Object.keys(columnSizing)
163+
.filter((key) => columnSizing[key] !== undefined)
164+
.map((key) => {
165+
// Persist on disk
166+
view.diskConfig.updateColumnProperties(key, {
167+
width: columnSizing[key],
168+
});
169+
// Persist on memory
170+
const indexCol = alteredColumns.findIndex(
171+
(col: TableColumn) => col.key === key
172+
);
173+
alteredColumns[indexCol].width = columnSizing[key];
174+
});
175+
return { columns: alteredColumns };
176+
}),
159177
}));
160178
};
161179
/**

0 commit comments

Comments
 (0)