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

Commit c6af021

Browse files
committed
inline support finished
1 parent 5715e01 commit c6af021

File tree

6 files changed

+46
-7
lines changed

6 files changed

+46
-7
lines changed

src/cdm/RowSelectModel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ActionType } from "react-table";
22
import NoteInfo from "services/NoteInfo";
3+
import { TableDataType } from "cdm/FolderModel";
34

45
export type RowSelectOption = {
56
backgroundColor: string,
@@ -11,4 +12,5 @@ export type PopperProps = {
1112
column: any;
1213
columns: any;
1314
note: NoteInfo;
15+
state: TableDataType;
1416
};

src/components/Cell.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export default function DefaultCell(cellProperties: Cell) {
122122
column={cellProperties.column}
123123
columns={columns}
124124
note={note}
125+
state={(cellProperties as any).initialState}
125126
/>
126127
</CellContext.Provider>
127128
);

src/components/HeaderMenu.tsx

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import React, { useContext, useEffect, useState } from "react";
1919
import { ActionType } from "react-table";
2020
import { usePopper } from "react-popper";
2121
import { HeaderContext } from "components/contexts/HeaderContext";
22+
import { Checkbox, FormControlLabel, FormGroup } from "@material-ui/core";
2223
type HeaderMenuProps = {
2324
dispatch: (action: ActionType) => void;
2425
setSortBy: any;
@@ -199,6 +200,15 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
199200
strategy: "fixed",
200201
});
201202

203+
const settingsPopper = usePopper(
204+
settingsReferenceElement,
205+
settingsPopperElement,
206+
{
207+
placement: "right",
208+
strategy: "fixed",
209+
}
210+
);
211+
202212
function persistLabelChange() {
203213
dispatch({
204214
type: ActionTypes.UPDATE_COLUMN_LABEL,
@@ -294,7 +304,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
294304
Property Type
295305
</span>
296306
</div>
297-
{/** Edit header label section */}
307+
{/** Type of column section */}
298308
<div style={{ padding: "4px 0px" }}>
299309
<button
300310
className="sort-button"
@@ -336,6 +346,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
336346
</div>
337347
)}
338348
</div>
349+
{/** Action buttons section */}
339350
<div
340351
style={{
341352
borderTop: `2px solid ${StyleVariables.BACKGROUND_DIVIDER}`,
@@ -362,7 +373,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
362373
padding: "4px 0px",
363374
}}
364375
>
365-
{/** Column settings */}
376+
{/** Column settings section */}
366377
<div style={{ padding: "4px 0px" }}>
367378
<button
368379
className="sort-button"
@@ -376,7 +387,31 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
376387
</span>
377388
<span>Settings</span>
378389
</button>
379-
{showSettings && <span>pruebas</span>}
390+
{showSettings && (
391+
<div
392+
className="shadow-5 border-radius-m"
393+
ref={setSettingsPopperElement}
394+
onMouseEnter={() => setShowSettings(true)}
395+
onMouseLeave={() => setShowSettings(false)}
396+
{...settingsPopper.attributes.popper}
397+
style={{
398+
...settingsPopper.styles.popper,
399+
width: 200,
400+
backgroundColor: StyleVariables.BACKGROUND_SECONDARY,
401+
zIndex: 4,
402+
padding: "4px 0px",
403+
}}
404+
>
405+
<FormGroup>
406+
<FormControlLabel
407+
control={
408+
<Checkbox checked={headerMenuProps.column.isInline} />
409+
}
410+
label="Inline"
411+
/>
412+
</FormGroup>
413+
</div>
414+
)}
380415
</div>
381416
</div>
382417
</div>

src/components/portals/PopperSelectPortal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { PopperProps } from "cdm/RowSelectModel";
99
import { CellContext } from "components/contexts/CellContext";
1010

1111
const PopperSelectPortal = (popperProps: PopperProps) => {
12-
const { dispatch, row, column, columns, note } = popperProps;
12+
const { dispatch, row, column, columns, note, state } = popperProps;
1313
/** state of cell value */
1414
const { value, setValue } = useContext(CellContext);
1515
// Selector reference state
@@ -41,6 +41,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
4141
value: option.label,
4242
row: row,
4343
columnId: column.id,
44+
state: state,
4445
});
4546
}
4647

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
342342
...state.columns.slice(deleteIndex + 1, state.columns.length),
343343
],
344344
};
345-
case ActionTypes.UPDATE_OPTION_CELL: // save on disk
345+
case ActionTypes.UPDATE_OPTION_CELL:
346346
// check if this column is configured as a group folder
347347
if (dbconfig.group_folder_column === action.key) {
348348
moveFile(`${state.view.file.parent.path}/${action.value}`, action);

src/helpers/VaultManagement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ export async function moveFile(folderPath: string, action: ActionType): Promise<
248248
UpdateRowOptions.COLUMN_VALUE
249249
);
250250
try {
251-
createFolder(folderPath);
251+
await createFolder(folderPath);
252252
} catch (error) {
253253
LOGGER.error(` moveFile Error: ${error.message} `);
254254
// Handle error
255255
throw error;
256256
}
257-
const filePath = `${folderPath} /${action.file.name}`;
257+
const filePath = `${folderPath}/${action.file.name}`;
258258
await app.fileManager.renameFile(action.file, filePath);
259259
}
260260

0 commit comments

Comments
 (0)