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

Commit 5fb9351

Browse files
committed
Merge branch 'master' into imed-docu-branch
2 parents 2849148 + 3d337c0 commit 5fb9351

File tree

18 files changed

+175
-115
lines changed

18 files changed

+175
-115
lines changed

docs/docs/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 2.3.6
2+
*Published on 2022/09/07*
3+
### Improved
4+
- The tab title bar with Obsidian 0.16 is optional, so the settings of the ddbb where moved to the bar of the plugin itself [ISSUE#330](https://github.com/RafaelGB/obsidian-db-folder/issues/330)
5+
### No longer broken
6+
- render of checkbox fixed [ISSUE#334](https://github.com/RafaelGB/obsidian-db-folder/issues/334)
7+
- order of multisort is persisted [ISSUE#324](https://github.com/RafaelGB/obsidian-db-folder/issues/324)
18
# 2.3.5
29
*Published on 2022/09/05*
310
### Shiny new things

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.3.5",
4+
"version": "2.3.6",
55
"minAppVersion": "0.15.9",
66
"description": "Folder with the capability to store and retrieve data from a folder like database",
77
"author": "RafaelGB",

manifest.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.3.5",
4+
"version": "2.3.6",
55
"minAppVersion": "0.15.9",
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.3.5",
3+
"version": "2.3.6",
44
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {

src/cdm/FolderModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export type BaseColumn = {
5454
isMetadata?: boolean;
5555
isSorted?: boolean;
5656
isSortedDesc?: boolean;
57+
sortIndex?: number;
5758
isHidden?: boolean;
5859
skipPersist?: boolean;
5960
isDragDisabled?: boolean;

src/cdm/TableStateInterface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface DataState {
3737
rows: RowDataType[];
3838
actions: {
3939
addRow: (filename: string, columns: TableColumn[], ddbbConfig: LocalSettings) => void;
40-
updateCell: (rowIndex: number, column: TableColumn, value: Literal, columns: TableColumn[], ddbbConfig: LocalSettings, isMovingFile?: boolean) => void;
40+
updateCell: (rowIndex: number, column: TableColumn, value: Literal, columns: TableColumn[], ddbbConfig: LocalSettings, isMovingFile?: boolean) => Promise<void>;
4141
parseDataOfColumn: (column: TableColumn, input: string, ddbbConfig: LocalSettings) => void;
4242
updateDataAfterLabelChange: (column: TableColumn, label: string, columns: TableColumn[], ddbbConfig: LocalSettings) => Promise<void>;
4343
removeRow: (row: RowDataType) => Promise<void>;

src/components/CsvButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Button from "@mui/material/Button";
21
import { CsvButtonProps } from "cdm/MenuBarModel";
32
import {
43
normalizeColumnsToCsvHeader,
54
normalizeRowsToCsvData,
65
} from "parsers/NormalizeRowsToCSV";
76
import React from "react";
87
import { CSVLink } from "react-csv";
9-
import DownloadIcon from "components/img/DownloadIcon";
8+
import DownloadIcon from "@mui/icons-material/Download";
9+
import { MenuButtonStyle } from "components/styles/NavBarStyles";
1010

1111
const CsvButton = (CsvButtonProps: CsvButtonProps) => {
1212
const { columns, rows, name } = CsvButtonProps;
@@ -35,7 +35,7 @@ const CsvButton = (CsvButtonProps: CsvButtonProps) => {
3535
ref={csvLink}
3636
target="_blank"
3737
>
38-
<DownloadIcon />
38+
<DownloadIcon {...MenuButtonStyle} />
3939
Download CSV
4040
</CSVLink>
4141
</>

src/components/NavBar.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ import MenuIcon from "components/img/MenuIcon";
44
import { NavBarProps } from "cdm/MenuBarModel";
55
import GlobalFilter from "components/reducers/GlobalFilter";
66
import PaginationTable from "components/PaginationTable";
7-
import { NavBarConfig, StyleVariables } from "helpers/Constants";
7+
import { InputType, NavBarConfig, StyleVariables } from "helpers/Constants";
88
import AppBar from "@mui/material/AppBar";
99
import Box from "@mui/material/Box";
1010
import IconButton from "@mui/material/IconButton";
11+
import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile";
12+
import SettingsIcon from "@mui/icons-material/Settings";
1113
import Menu from "@mui/material/Menu";
1214
import MenuItem from "@mui/material/MenuItem";
15+
1316
import Toolbar from "@mui/material/Toolbar";
1417
import { c } from "helpers/StylesHelper";
1518
import Typography from "@mui/material/Typography";
1619
import DataviewFilters from "components/reducers/DataviewFilters";
20+
import { MenuButtonStyle } from "components/styles/NavBarStyles";
21+
import { SettingsModal } from "Settings";
1722

1823
export function NavBar(navBarProps: NavBarProps) {
1924
const { table } = navBarProps;
@@ -29,6 +34,28 @@ export function NavBar(navBarProps: NavBarProps) {
2934
setAnchorEl(event.currentTarget);
3035
};
3136

37+
const handleSettingsClick = () => {
38+
setAnchorEl(null);
39+
new SettingsModal(
40+
view,
41+
{
42+
onSettingsChange: (settings) => {
43+
/**
44+
* Settings are saved into the database file, so we don't need to do anything here.
45+
*/
46+
},
47+
},
48+
view.plugin.settings
49+
).open();
50+
};
51+
52+
const handleOpenAsMarkdownClick = () => {
53+
setAnchorEl(null);
54+
view.plugin.databaseFileModes[(view.leaf as any).id || view.file.path] =
55+
InputType.MARKDOWN;
56+
view.plugin.setMarkdownView(view.leaf);
57+
};
58+
3259
return (
3360
<Box sx={{ flexGrow: 1 }}>
3461
<AppBar
@@ -71,7 +98,15 @@ export function NavBar(navBarProps: NavBarProps) {
7198
"aria-labelledby": "long-button",
7299
}}
73100
>
74-
<MenuItem>
101+
<MenuItem onClick={handleSettingsClick} disableRipple>
102+
<SettingsIcon {...MenuButtonStyle} />
103+
Settings
104+
</MenuItem>
105+
<MenuItem onClick={handleOpenAsMarkdownClick} disableRipple>
106+
<InsertDriveFileIcon {...MenuButtonStyle} />
107+
Open as Markdown
108+
</MenuItem>
109+
<MenuItem disableRipple>
75110
{/* CSV buttton download */}
76111
<CsvButton
77112
columns={columns}

src/components/cellTypes/CheckboxCell.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
import React, { useState } from "react";
1+
import React from "react";
22
import { TableColumn } from "cdm/FolderModel";
33
import { c } from "helpers/StylesHelper";
44
import { CellComponentProps } from "cdm/ComponentsModel";
55

66
function CheckboxCell(props: CellComponentProps) {
77
const { defaultCell } = props;
88
const { row, column, table } = defaultCell;
9-
const tableColumn = column.columnDef as TableColumn;
9+
const { tableState } = table.options.meta;
1010

11-
const dataActions = table.options.meta.tableState.data(
12-
(state) => state.actions
13-
);
11+
const dataActions = tableState.data((state) => state.actions);
1412

15-
const checkboxCell = table.options.meta.tableState.data(
16-
(state) => state.rows[row.index]
17-
);
13+
const checkboxRow = tableState.data((state) => state.rows[row.index]);
1814

19-
const columnsInfo = table.options.meta.tableState.columns(
20-
(state) => state.info
21-
);
15+
const columnsInfo = tableState.columns((state) => state.info);
2216

23-
const configInfo = table.options.meta.tableState.configState(
24-
(state) => state.info
25-
);
17+
const configInfo = tableState.configState((state) => state.info);
2618

2719
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
28-
const newValue = event.target.checked ? 1 : 0;
20+
const newValue = event.target.checked;
2921
// save on disk
3022
dataActions.updateCell(
3123
row.index,
@@ -35,12 +27,12 @@ function CheckboxCell(props: CellComponentProps) {
3527
configInfo.getLocalSettings()
3628
);
3729
};
38-
3930
return (
40-
<div className={`${c("checkbox")}`}>
31+
<div key={`checkbox-div-${row.index}`} className={`${c("checkbox")}`}>
4132
<input
4233
type="checkbox"
43-
checked={Boolean(checkboxCell[tableColumn.key])}
34+
checked={checkboxRow[column.id] as boolean}
35+
key={`checkbox-input-${row.index}`}
4436
onChange={handleChange}
4537
/>
4638
</div>

src/components/cellTypes/NumberCell.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { CellComponentProps } from "cdm/ComponentsModel";
22
import { TableColumn } from "cdm/FolderModel";
3-
import { Literal } from "obsidian-dataview";
43
import React, {
54
ChangeEventHandler,
65
KeyboardEventHandler,
7-
useEffect,
86
useState,
97
} from "react";
108

0 commit comments

Comments
 (0)