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

Commit 6072ee4

Browse files
committed
Merge branch '121-fr-remove-all-values-of-notes-with-an-option-is-removed-tags-too'
2 parents 66d45e0 + ee594d7 commit 6072ee4

File tree

10 files changed

+57
-41
lines changed

10 files changed

+57
-41
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"author": "Rafael Gomez Bermejo",
1919
"license": "MIT",
2020
"devDependencies": {
21-
"@faker-js/faker": "7.4.0",
21+
"@faker-js/faker": "7.5.0",
2222
"@rollup/plugin-commonjs": "22.0.2",
2323
"@rollup/plugin-json": "4.1.0",
2424
"@rollup/plugin-node-resolve": "13.3.0",
25-
"@rollup/plugin-typescript": "8.3.4",
25+
"@rollup/plugin-typescript": "8.4.0",
2626
"@testing-library/jest-dom": "5.16.5",
2727
"@testing-library/react": "13.3.0",
2828
"@types/jest": "28.1.8",
@@ -49,15 +49,15 @@
4949
},
5050
"dependencies": {
5151
"@emotion/styled": "11.10.0",
52-
"@mui/icons-material": "5.10.2",
53-
"@mui/material": "5.10.2",
52+
"@mui/icons-material": "5.10.3",
53+
"@mui/material": "5.10.3",
5454
"@popperjs/core": "2.11.6",
5555
"@tanstack/match-sorter-utils": "8.1.1",
5656
"@tanstack/react-table": "8.5.11",
5757
"luxon": "3.0.1",
5858
"fuse.js": "6.6.2",
5959
"monkey-around": "2.3.0",
60-
"obsidian-dataview": "0.5.42",
60+
"obsidian-dataview": "0.5.43",
6161
"react": "18.2.0",
6262
"react-color": "2.19.3",
6363
"react-csv": "2.2.2",

src/cdm/TableStateInterface.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export interface ConfigState {
2727
alterFilters: (filters: Partial<FilterSettings>) => void;
2828
alterConfig: (config: Partial<LocalSettings>) => void;
2929
}
30+
info: {
31+
getLocalSettings: () => LocalSettings;
32+
}
3033
}
3134

3235
export interface DataState {
@@ -57,6 +60,7 @@ export interface ColumnsState {
5760
alterIsHidden: (column: TableColumn, isHidden: boolean) => void;
5861
}
5962
info: {
63+
getAllColumns: () => TableColumn[];
6064
getValueOfAllColumnsAsociatedWith: <K extends keyof TableColumn>(key: K) => TableColumn[K][];
6165
getVisibilityRecord: () => Record<string, boolean>;
6266
}

src/components/RowContextMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const rowContextMenuColumn: TableColumn = {
5959
aria-controls={open ? `row-context-button-${row.id}` : undefined}
6060
aria-expanded={open ? "true" : undefined}
6161
aria-haspopup="true"
62+
sx={{ border: 0, borderRadius: 0 }}
6263
onClick={handleClick}
6364
key={`row-context-button-${row.id}`}
6465
>

src/components/cellTypes/CheckboxCell.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,25 @@ function CheckboxCell(props: CellComponentProps) {
88
const { row, column, table } = defaultCell;
99
const tableColumn = column.columnDef as TableColumn;
1010

11-
const [rows, dataActions] = table.options.meta.tableState.data((state) => [
12-
state.rows,
13-
state.actions,
14-
]);
15-
const columns = table.options.meta.tableState.columns(
16-
(state) => state.columns
11+
const dataActions = table.options.meta.tableState.data(
12+
(state) => state.actions
1713
);
18-
const ddbbConfig = table.options.meta.tableState.configState(
19-
(state) => state.ddbbConfig
14+
15+
const checkboxCell = table.options.meta.tableState.data(
16+
(state) => state.rows[row.index]
17+
);
18+
19+
const columnsInfo = table.options.meta.tableState.columns(
20+
(state) => state.info
2021
);
22+
23+
const configInfo = table.options.meta.tableState.configState(
24+
(state) => state.info
25+
);
26+
2127
/** state of cell value */
2228
const [checked, setChecked] = useState(
23-
Boolean(rows[row.index][tableColumn.key])
29+
Boolean(checkboxCell[tableColumn.key])
2430
);
2531
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
2632
const newValue = event.target.checked ? 1 : 0;
@@ -29,8 +35,8 @@ function CheckboxCell(props: CellComponentProps) {
2935
row.index,
3036
column.columnDef as TableColumn,
3137
newValue,
32-
columns,
33-
ddbbConfig
38+
columnsInfo.getAllColumns(),
39+
configInfo.getLocalSettings()
3440
);
3541
setChecked(event.target.checked);
3642
};

src/components/cellTypes/EditorCell.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ const EditorCell = (props: EditorCellComponentProps) => {
1111
/** Ref to cell container */
1212
const editableMdRef = useRef<HTMLInputElement>();
1313
/** Columns information */
14-
const columns = table.options.meta.tableState.columns(
15-
(state) => state.columns
14+
const columnsInfo = table.options.meta.tableState.columns(
15+
(state) => state.info
1616
);
1717
const dataActions = table.options.meta.tableState.data(
1818
(state) => state.actions
1919
);
20-
const ddbbConfig = table.options.meta.tableState.configState(
21-
(state) => state.ddbbConfig
20+
const configInfo = table.options.meta.tableState.configState(
21+
(state) => state.info
2222
);
2323

2424
const [editorValue, setEditorValue] = useState(cellValue);
@@ -48,8 +48,8 @@ const EditorCell = (props: EditorCellComponentProps) => {
4848
row.index,
4949
column.columnDef as TableColumn,
5050
changedValue.trim(),
51-
columns,
52-
ddbbConfig
51+
columnsInfo.getAllColumns(),
52+
configInfo.getLocalSettings()
5353
);
5454
};
5555

src/components/cellTypes/NumberCell.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const NumberCell = (props: CellComponentProps) => {
77
const { cell, row, column, table } = defaultCell;
88

99
/** Columns information */
10-
const columns = table.options.meta.tableState.columns(
11-
(state) => state.columns
10+
const columnsInfo = table.options.meta.tableState.columns(
11+
(state) => state.info
1212
);
1313
const dataActions = table.options.meta.tableState.data(
1414
(state) => state.actions
1515
);
16-
const ddbbConfig = table.options.meta.tableState.configState(
17-
(state) => state.ddbbConfig
16+
const configInfo = table.options.meta.tableState.configState(
17+
(state) => state.info
1818
);
1919

2020
const [cellValue, setCellValue] = useState(cell.getValue());
@@ -49,8 +49,8 @@ const NumberCell = (props: CellComponentProps) => {
4949
row.index,
5050
column.columnDef as TableColumn,
5151
changedValue,
52-
columns,
53-
ddbbConfig
52+
columnsInfo.getAllColumns(),
53+
configInfo.getLocalSettings()
5454
);
5555
}
5656

src/components/portals/CalendarPortal.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ import { TableColumn } from "cdm/FolderModel";
99
const CalendarPortal = (calendarProps: CellComponentProps) => {
1010
const { defaultCell } = calendarProps;
1111
const { row, column, table } = defaultCell;
12+
const { tableState } = table.options.meta;
1213
const tableColumn = column.columnDef as TableColumn;
13-
const [rows, dataActions] = table.options.meta.tableState.data((state) => [
14-
state.rows,
15-
state.actions,
16-
]);
17-
const columns = table.options.meta.tableState.columns(
18-
(state) => state.columns
19-
);
20-
const ddbbConfig = table.options.meta.tableState.configState(
21-
(state) => state.ddbbConfig
22-
);
14+
const dataActions = tableState.data((state) => state.actions);
15+
16+
const calendarPortalRow = tableState.data((state) => state.rows[row.index]);
17+
18+
const columns = tableState.columns((state) => state.columns);
19+
const ddbbConfig = tableState.configState((state) => state.ddbbConfig);
2320

2421
/** state of cell value */
2522
const [showDatePicker, setShowDatePicker] = useState(false);
2623
const [calendarValue, setCalendarValue] = useState(
27-
rows[row.index][tableColumn.key]
24+
calendarPortalRow[tableColumn.key]
2825
);
2926

3027
function handleSpanOnClick(event: any) {

src/stateManagement/columns/handlers/InfoColumnFunctions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export default class InfoColumnFunctions extends AbstractTableAction<ColumnsStat
1717
return visibilityRecord;
1818
};
1919

20+
implementation.info.getAllColumns = () => {
21+
return get().columns;
22+
}
23+
2024
response.implementation = implementation;
2125
return this.goNext(response);
2226
}

src/stateManagement/useColumnsStore.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function mockColumnsState(): ColumnsState {
4040
info: {
4141
getValueOfAllColumnsAsociatedWith: null,
4242
getVisibilityRecord: null,
43+
getAllColumns: null,
4344
},
4445
};
4546
}

src/stateManagement/useConfigStore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const useConfigStore = (view: DatabaseView) => {
77
const { global_settings } = view.plugin.settings;
88
const { config, filters } = view.diskConfig.yaml;
99
return create<ConfigState>()(
10-
(set) => ({
10+
(set, get) => ({
1111
ddbbConfig: config,
1212
filters: filters,
1313
global: global_settings,
@@ -22,7 +22,10 @@ const useConfigStore = (view: DatabaseView) => {
2222
view.diskConfig.updateConfig(alteredConfig);
2323
return ({ ddbbConfig: { ...state.ddbbConfig, ...alteredConfig } });
2424
}),
25-
}
25+
},
26+
info: {
27+
getLocalSettings: () => get().ddbbConfig,
28+
},
2629
})
2730
);
2831
}

0 commit comments

Comments
 (0)