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

Commit dc945e3

Browse files
committed
Merge branch 'master' into imed-docu-branch
2 parents 5fb9351 + b704a7e commit dc945e3

28 files changed

+264
-94
lines changed

docs/docs/changelog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# 2.4.0
2+
*Published on 2022/09/08*
3+
### Shiny new things
4+
- Totally renewed row context menu! Now wraps the obsidian context menu, so you can use all the plugins that add items to it(rename and delete file included as custom options too) [ISSUE#152](https://github.com/RafaelGB/obsidian-db-folder/issues/152)
5+
- Created and modified columns now is rendered as daily link note using the complete date as alias [ISSUE#144](https://github.com/RafaelGB/obsidian-db-folder/issues/144)
6+
### Improved
7+
- Global search now ignore cases [ISSUE#340](https://github.com/RafaelGB/obsidian-db-folder/issues/340)
8+
- File column is ordered alphabetically using filename instead of path with sort options [ISSUE#335](https://github.com/RafaelGB/obsidian-db-folder/issues/335)
9+
- Checkbox edition save boolean values instead of 1 or 0 [ISSUE#158](https://github.com/RafaelGB/obsidian-db-folder/issues/158)
10+
### Visual
11+
- Tasks aligned to the left properly
12+
- Open tags cell on the bottom of the table is displayed properly [ISSUE#139](https://github.com/RafaelGB/obsidian-db-folder/issues/139)
13+
### No longer broken
14+
- new yaml breaker conditions added (>)
15+
- Edit a cell in a page out of the first one does not reset the pagination anymore [ISSUE#338](https://github.com/RafaelGB/obsidian-db-folder/issues/338)
116
# 2.3.6
217
*Published on 2022/09/07*
318
### Improved

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.6",
4+
"version": "2.4.0",
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.6",
4+
"version": "2.4.0",
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-dbfolder",
3-
"version": "2.3.6",
3+
"version": "2.4.0",
44
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {
@@ -50,7 +50,7 @@
5050
"dependencies": {
5151
"@emotion/styled": "11.10.4",
5252
"@mui/icons-material": "5.10.3",
53-
"@mui/material": "5.10.3",
53+
"@mui/material": "5.10.4",
5454
"@popperjs/core": "2.11.6",
5555
"@tanstack/match-sorter-utils": "8.1.1",
5656
"@tanstack/react-table": "8.5.13",

src/cdm/TableStateInterface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export interface DataState {
4545
removeOptionForAllRows: (column: TableColumn, option: string, columns: TableColumn[],
4646
ddbbConfig: LocalSettings) => Promise<void>;
4747
dataviewRefresh: (column: TableColumn[], ddbbConfig: LocalSettings, filterConfig: FilterSettings) => void;
48+
renameFile: (rowIndex: number) => Promise<void>;
4849
}
4950
}
5051

src/components/DefaultCell.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import NumberCell from "components/cellTypes/NumberCell";
1313
import TextCell from "components/cellTypes/TextCell";
1414
import { CellContext } from "@tanstack/react-table";
1515
import { Literal } from "obsidian-dataview";
16+
import MetadataTimeCell from "./cellTypes/MetadataTimeCell";
1617

1718
export default function DefaultCell(
1819
defaultCell: CellContext<RowDataType, Literal>
@@ -46,6 +47,10 @@ export default function DefaultCell(
4647
case InputType.CALENDAR_TIME:
4748
return <CalendarTimePortal defaultCell={defaultCell} />;
4849

50+
/** Metadata options related with date/datetime */
51+
case InputType.METATADA_TIME:
52+
return <MetadataTimeCell defaultCell={defaultCell} />;
53+
4954
/** Selector option */
5055
case InputType.SELECT:
5156
return <PopperSelectPortal defaultCell={defaultCell} />;

src/components/DefaultHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default function DefaultHeader(headerProps: DatabaseHeaderProps) {
9595
propertyIcon = <CalendarIcon />;
9696
break;
9797
case InputType.CALENDAR_TIME:
98+
case InputType.METATADA_TIME:
9899
propertyIcon = <CalendarTimeIcon />;
99100
break;
100101
case InputType.MARKDOWN:

src/components/RowContextMenu.tsx

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import IconButton from "@mui/material/IconButton";
2-
import ListItemIcon from "@mui/material/ListItemIcon";
32
import { TableColumn } from "cdm/FolderModel";
43
import DragIndicatorIcon from "@mui/icons-material/DragIndicator";
5-
import DeleteIcon from "@mui/icons-material/Delete";
64
import {
75
DEFAULT_COLUMN_CONFIG,
86
InputType,
97
MetadataDatabaseColumns,
108
} from "helpers/Constants";
119
import React from "react";
12-
import Menu from "@mui/material/Menu";
13-
import MenuItem from "@mui/material/MenuItem";
10+
import { showFileMenu } from "components/obsidianArq/commands";
1411

1512
const rowContextMenuColumn: TableColumn = {
1613
...MetadataDatabaseColumns.ROW_CONTEXT_MENU,
@@ -21,32 +18,21 @@ const rowContextMenuColumn: TableColumn = {
2118
cell: ({ row, table }) => {
2219
const { tableState } = table.options.meta;
2320
const rowActions = tableState.data((state) => state.actions);
24-
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
25-
const open = Boolean(anchorEl);
26-
27-
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
28-
row.getToggleSelectedHandler()({
29-
event: {
30-
target: {
31-
checked: !row.getIsSelected(),
32-
},
33-
},
34-
});
35-
setAnchorEl(event.currentTarget);
21+
const handleDeleteRow = () => {
22+
rowActions.removeRow(row.original);
3623
};
37-
const handleMenuClose = () => {
38-
setAnchorEl(null);
39-
row.getToggleSelectedHandler()({
40-
event: {
41-
target: {
42-
checked: !row.getIsSelected(),
43-
},
44-
},
45-
});
24+
25+
const handleRenameRow = () => {
26+
rowActions.renameFile(row.index);
4627
};
4728

48-
const handleDeleteRow = () => {
49-
rowActions.removeRow(row.original);
29+
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
30+
showFileMenu(
31+
row.original.__note__.getFile(),
32+
event.nativeEvent,
33+
handleDeleteRow,
34+
handleRenameRow
35+
);
5036
};
5137

5238
return (
@@ -66,31 +52,6 @@ const rowContextMenuColumn: TableColumn = {
6652
>
6753
<DragIndicatorIcon />
6854
</IconButton>
69-
<Menu
70-
anchorEl={anchorEl}
71-
id={`row-context-menu-${row.id}`}
72-
open={open}
73-
onClose={handleMenuClose}
74-
onClick={handleMenuClose}
75-
transformOrigin={{ horizontal: "left", vertical: "top" }}
76-
anchorOrigin={{ horizontal: "left", vertical: "bottom" }}
77-
key={`row-context-Menu-${row.id}`}
78-
>
79-
<MenuItem
80-
onClick={handleDeleteRow}
81-
key={`row-context-Menu-MenuItem-Delete-${row.id}`}
82-
>
83-
<ListItemIcon
84-
key={`row-context-Menu-MenuItem-ListItemIcon-${row.id}`}
85-
>
86-
<DeleteIcon
87-
fontSize="small"
88-
key={`row-context-Menu-MenuItem-DeleteIcon-${row.id}`}
89-
/>
90-
</ListItemIcon>
91-
Delete
92-
</MenuItem>
93-
</Menu>
9455
</>
9556
);
9657
},

src/components/Table.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const defaultColumn: Partial<ColumnDef<RowDataType>> = {
5050
cell: DefaultCell,
5151
header: DefaultHeader,
5252
enableResizing: true,
53+
sortingFn: "alphanumeric",
5354
};
5455

5556
/**
@@ -252,6 +253,7 @@ export function Table(tableData: TableDataType) {
252253
debugTable: globalConfig.enable_debug_mode,
253254
debugHeaders: globalConfig.enable_debug_mode,
254255
debugColumns: globalConfig.enable_debug_mode,
256+
autoResetPageIndex: false,
255257
});
256258

257259
// Manage input of new row

src/components/cellTypes/CheckboxCell.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ function CheckboxCell(props: CellComponentProps) {
1818

1919
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
2020
const newValue = event.target.checked;
21+
console.log("newValue", newValue);
2122
// save on disk
2223
dataActions.updateCell(
2324
row.index,
2425
column.columnDef as TableColumn,
25-
newValue,
26+
newValue ? "true" : "false",
2627
columnsInfo.getAllColumns(),
2728
configInfo.getLocalSettings()
2829
);
@@ -31,7 +32,7 @@ function CheckboxCell(props: CellComponentProps) {
3132
<div key={`checkbox-div-${row.index}`} className={`${c("checkbox")}`}>
3233
<input
3334
type="checkbox"
34-
checked={checkboxRow[column.id] as boolean}
35+
checked={checkboxRow[column.id] === "true"}
3536
key={`checkbox-input-${row.index}`}
3637
onChange={handleChange}
3738
/>

0 commit comments

Comments
 (0)