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

Commit e36795f

Browse files
committed
starting
1 parent 05e3a3d commit e36795f

File tree

6 files changed

+176
-46
lines changed

6 files changed

+176
-46
lines changed

TestVault/template/database.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
3+
database-plugin: basic
4+
5+
---
6+
7+
<%%
8+
name: new database
9+
description: new description
10+
columns:
11+
__file__:
12+
key: __file__
13+
input: markdown
14+
label: File
15+
accessor: __file__
16+
isMetadata: true
17+
skipPersist: false
18+
csvCandidate: true
19+
position: 1
20+
config:
21+
text_column:
22+
input: text
23+
accessor: text_column
24+
key: text_column
25+
label: text column
26+
position: 2
27+
config:
28+
isInline: false
29+
media_height: 100
30+
media_width: 100
31+
enable_media_view: false
32+
selected_column:
33+
input: select
34+
accessor: selected_column
35+
key: selected_column
36+
label: selected column
37+
position: 3
38+
options:
39+
config:
40+
isInline: false
41+
media_height: 100
42+
media_width: 100
43+
enable_media_view: false
44+
number_column:
45+
input: number
46+
accessor: number_column
47+
key: number_column
48+
label: number column
49+
position: 4
50+
config:
51+
isInline: false
52+
media_height: 100
53+
media_width: 100
54+
enable_media_view: false
55+
Datetime_column:
56+
input: calendar_time
57+
accessor: Datetime_column
58+
key: Datetime_column
59+
label: Datetime column
60+
position: 6
61+
config:
62+
enable_media_view: true
63+
media_width: 100
64+
media_height: 100
65+
isInline: false
66+
source_data: current_folder
67+
Date_column:
68+
input: calendar
69+
accessor: Date_column
70+
key: Date_column
71+
label: Date column
72+
position: 5
73+
config:
74+
enable_media_view: true
75+
media_width: 100
76+
media_height: 100
77+
isInline: false
78+
source_data: current_folder
79+
__created__:
80+
key: __created__
81+
input: calendar_time
82+
label: Created
83+
accessor: __created__
84+
isMetadata: true
85+
skipPersist: false
86+
csvCandidate: true
87+
position: 8
88+
config:
89+
__modified__:
90+
key: __modified__
91+
input: calendar_time
92+
label: Modified
93+
accessor: __modified__
94+
isMetadata: true
95+
skipPersist: false
96+
csvCandidate: true
97+
position: 9
98+
config:
99+
checkbox_column:
100+
input: checkbox
101+
accessor: checkbox_column
102+
key: checkbox_column
103+
label: checkbox column
104+
position: 7
105+
config:
106+
enable_media_view: true
107+
media_width: 100
108+
media_height: 100
109+
isInline: false
110+
source_data: current_folder
111+
config:
112+
enable_show_state: false
113+
group_folder_column:
114+
remove_field_when_delete_column: true
115+
show_metadata_created: true
116+
show_metadata_modified: true
117+
source_data: current_folder
118+
source_form_result:
119+
show_metadata_tasks: true
120+
filters:
121+
%%>

TestVault/template/test1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

TestVault/template/test2.md

Whitespace-only changes.

TestVault/template/test3.md

Whitespace-only changes.

TestVault/template/test4.md

Whitespace-only changes.

src/components/Table.tsx

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import { TableDataType, RowDataType, TableColumn } from "cdm/FolderModel";
1414
import { DatabaseView } from "DatabaseView";
1515
import StateManager from "StateManager";
1616
import { getNormalizedPath } from "helpers/VaultManagement";
17-
import { ActionTypes, DatabaseCore, MetadataColumns } from "helpers/Constants";
17+
import {
18+
ActionTypes,
19+
DatabaseCore,
20+
DataTypes,
21+
MetadataColumns,
22+
} from "helpers/Constants";
1823
import PlusIcon from "components/img/Plus";
1924
import { LOGGER } from "services/Logger";
2025
import DefaultCell from "components/Cell";
@@ -258,6 +263,7 @@ export function Table(initialState: TableDataType) {
258263
<DragDropContext
259264
key={`DragDropContext-${i}`}
260265
onDragStart={() => {
266+
console.log(headerGroup.headers);
261267
currentColOrder.current = allColumns.map((o: Column) => o.id);
262268
}}
263269
onDragUpdate={(dragUpdateObj, b) => {
@@ -306,51 +312,53 @@ export function Table(initialState: TableDataType) {
306312
ref={provided.innerRef}
307313
className={`${c("tr header-group")}`}
308314
>
309-
{headerGroup.headers.map((column, index) => (
310-
<Draggable
311-
key={`Draggable-${column.id}`}
312-
draggableId={`${column.id}`}
313-
index={index}
314-
isDragDisabled={(column as any).skipPersist}
315-
disableInteractiveElementBlocking={
316-
(column as any).skipPersist
317-
}
318-
>
319-
{(provided, snapshot) => {
320-
const tableCellBaseProps = {
321-
...provided.draggableProps,
322-
...provided.dragHandleProps,
323-
...column.getHeaderProps({
324-
style: {
325-
width: `${
326-
columnsWidthState.widthRecord[column.id]
327-
}px`,
328-
...getDndItemStyle(
329-
snapshot.isDragging,
330-
provided.draggableProps.style
331-
),
332-
},
333-
}),
334-
className: `${c("th noselect")} header`,
335-
key: `div-Draggable-${column.id}`,
336-
// {...extraProps}
337-
ref: provided.innerRef,
338-
};
339-
return (
340-
<div {...tableCellBaseProps}>
341-
<HeaderContext.Provider
342-
value={{
343-
columnWidthState: columnsWidthState,
344-
setColumnWidthState: setColumnsWidthState,
345-
}}
346-
>
347-
{column.render("Header")}
348-
</HeaderContext.Provider>
349-
</div>
350-
);
351-
}}
352-
</Draggable>
353-
))}
315+
{headerGroup.headers
316+
.filter((o: any) => o.key !== MetadataColumns.ADD_COLUMN)
317+
.map((column, index) => (
318+
<Draggable
319+
key={`Draggable-${column.id}`}
320+
draggableId={`${column.id}`}
321+
index={index}
322+
isDragDisabled={(column as any).skipPersist}
323+
disableInteractiveElementBlocking={
324+
(column as any).skipPersist
325+
}
326+
>
327+
{(provided, snapshot) => {
328+
const tableCellBaseProps = {
329+
...provided.draggableProps,
330+
...provided.dragHandleProps,
331+
...column.getHeaderProps({
332+
style: {
333+
width: `${
334+
columnsWidthState.widthRecord[column.id]
335+
}px`,
336+
...getDndItemStyle(
337+
snapshot.isDragging,
338+
provided.draggableProps.style
339+
),
340+
},
341+
}),
342+
className: `${c("th noselect")} header`,
343+
key: `div-Draggable-${column.id}`,
344+
// {...extraProps}
345+
ref: provided.innerRef,
346+
};
347+
return (
348+
<div {...tableCellBaseProps}>
349+
<HeaderContext.Provider
350+
value={{
351+
columnWidthState: columnsWidthState,
352+
setColumnWidthState: setColumnsWidthState,
353+
}}
354+
>
355+
{column.render("Header")}
356+
</HeaderContext.Provider>
357+
</div>
358+
);
359+
}}
360+
</Draggable>
361+
))}
354362
{provided.placeholder}
355363
</div>
356364
)}

0 commit comments

Comments
 (0)