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

Commit 932e6b2

Browse files
committed
Merge branch '323-select-column-tag-column-organization'
2 parents 136904a + ef830c0 commit 932e6b2

File tree

6 files changed

+53
-35
lines changed

6 files changed

+53
-35
lines changed

src/components/portals/PopperSelectPortal.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,21 @@ const PopperSelectPortal = (popperProps: CellComponentProps) => {
142142
className="d-flex flex-wrap-wrap"
143143
style={{ marginTop: "-0.5rem" }}
144144
>
145-
{tableColumn.options.map((option: any) => (
146-
<div
147-
key={option.label}
148-
className="cursor-pointer"
149-
style={{ marginRight: "0.5rem", marginTop: "0.5rem" }}
150-
onClick={() => handleOptionClick(option)}
151-
>
152-
<Relationship
153-
value={option.label}
154-
backgroundColor={option.backgroundColor}
155-
/>
156-
</div>
157-
))}
145+
{tableColumn.options
146+
.sort((a, b) => a.label.localeCompare(b.label))
147+
.map((option) => (
148+
<div
149+
key={option.label}
150+
className="cursor-pointer"
151+
style={{ marginRight: "0.5rem", marginTop: "0.5rem" }}
152+
onClick={() => handleOptionClick(option)}
153+
>
154+
<Relationship
155+
value={option.label}
156+
backgroundColor={option.backgroundColor}
157+
/>
158+
</div>
159+
))}
158160
{showAdd && (
159161
<div
160162
style={{

src/components/portals/TagsPortal.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ const TagsPortal = (tagsProps: CellComponentProps) => {
6161
color: getColor(tag),
6262
}));
6363

64-
const multiOptions = tableColumn.options.map((option: RowSelectOption) => ({
65-
value: option.label,
66-
label: option.label,
67-
color: option.backgroundColor,
68-
}));
64+
const multiOptions = tableColumn.options
65+
.sort((a, b) => a.label.localeCompare(b.label))
66+
.map((option: RowSelectOption) => ({
67+
value: option.label,
68+
label: option.label,
69+
color: option.backgroundColor,
70+
}));
71+
6972
const handleOnChange = (
7073
newValue: OnChangeValue<any, true>,
7174
actionMeta: ActionMeta<RowSelectOption>
@@ -125,15 +128,17 @@ const TagsPortal = (tagsProps: CellComponentProps) => {
125128
onClick={() => setShowSelectTags(true)}
126129
style={{ width: column.getSize() }}
127130
>
128-
{tagsState.map((tag: string) => (
129-
<div key={`key-${tag}`}>
130-
<Relationship
131-
key={`key-Relationship-${tag}`}
132-
value={tag}
133-
backgroundColor={getColor(tag)}
134-
/>
135-
</div>
136-
))}
131+
{tagsState
132+
.sort((a: string, b: string) => a.localeCompare(b))
133+
.map((tag: string) => (
134+
<div key={`key-${tag}`}>
135+
<Relationship
136+
key={`key-Relationship-${tag}`}
137+
value={tag}
138+
backgroundColor={getColor(tag)}
139+
/>
140+
</div>
141+
))}
137142
</div>
138143
)}
139144
</>

src/lang/locale/en.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ export default {
1616
'toolbar_menu_aria_label': 'Open table options',
1717
'toolbar_menu_export_csv': 'Export CSV',
1818
'toolbar_menu_import_csv': 'Import CSV',
19+
/** SOURCE OPTIONS */
20+
'current_folder': "Current folder",
21+
"tag": "Tag",
22+
"outgoing_link": "Outgoing link",
23+
"incoming_link": "Incoming link",
24+
"query": "Dataview query",
1925
};

src/lang/locale/es.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ export default {
1616
'toolbar_menu_aria_label': 'Abrir opciones de tabla',
1717
'toolbar_menu_export_csv': 'Exportar CSV',
1818
'toolbar_menu_import_csv': 'Importar CSV',
19+
/** SOURCE OPTIONS */
20+
'current_folder': "Carpeta actual",
21+
"tag": "Etiqueta",
22+
"outgoing_link": "Enlace saliente",
23+
"incoming_link": "Enlace entrante",
24+
"query": "Consulta de Dataview",
1925
};

src/services/EditEngineService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class EditEngine {
4646
await inlineColumnEdit();
4747
return;
4848
}
49-
rowFields.frontmatter[columnId] = DataviewService.parseLiteral(newValue, InputType.MARKDOWN, ddbbConfig);
49+
rowFields.frontmatter[columnId] = newValue;
5050
await persistFrontmatter();
5151
await inlineRemoveColumn();
5252
}

src/settings/handlers/source/SourceDropDownHandler.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { SourceDataTypes } from "helpers/Constants";
2+
import { t } from "lang/helpers";
23
import { AbstractSettingsHandler, SettingHandlerResponse } from "settings/handlers/AbstractSettingHandler";
34
import { add_dropdown } from "settings/SettingsComponents";
45

56
export class SourceDropDownHandler extends AbstractSettingsHandler {
67
settingTitle: string = 'Select the source of database data';
78
handle(settingHandlerResponse: SettingHandlerResponse): SettingHandlerResponse {
89
const { settingsManager, containerEl, view } = settingHandlerResponse;
10+
const sourceOptions: Record<string, string> = {};
11+
Object.entries(SourceDataTypes).forEach(([key, value]) => {
12+
sourceOptions[value] = t(value);
13+
});
914
const source_dropdown_promise = async (value: string): Promise<void> => {
1015
// update settings
1116
view.diskConfig.updateConfig({ source_data: value });
@@ -18,13 +23,7 @@ export class SourceDropDownHandler extends AbstractSettingsHandler {
1823
this.settingTitle,
1924
'Select from which source you want to get the data to be displayed in the table.',
2025
view.diskConfig.yaml.config.source_data,
21-
{
22-
current_folder: SourceDataTypes.CURRENT_FOLDER,
23-
tag: SourceDataTypes.TAG,
24-
outgoing_link: SourceDataTypes.OUTGOING_LINK,
25-
incoming_link: SourceDataTypes.INCOMING_LINK,
26-
query: SourceDataTypes.QUERY,
27-
},
26+
sourceOptions,
2827
source_dropdown_promise
2928
);
3029
return this.goNext(settingHandlerResponse);

0 commit comments

Comments
 (0)