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

Commit 0ef9b24

Browse files
committed
Merge branch '378-fr-column-option-to-wrap-content'
2 parents e9e699a + cfb959b commit 0ef9b24

File tree

16 files changed

+94
-69
lines changed

16 files changed

+94
-69
lines changed

src/cdm/FolderModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface ConfigColumn {
4040
media_height: number;
4141
isInline: boolean;
4242
content_alignment?: string;
43+
wrap_content?: boolean;
4344
task_hide_completed?: boolean;
4445
formula_query?: string;
4546
persist_formula?: boolean;

src/components/cellTypes/FormulaCell.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ const FormulaCell = (mdProps: CellComponentProps) => {
4646
return (
4747
<span
4848
ref={formulaRef}
49-
className={`${c(
50-
"md_cell " + getAlignmentClassname(tableColumn.config.content_alignment)
51-
)}`}
49+
className={`${c("md_cell " + getAlignmentClassname(tableColumn.config))}`}
5250
key={`formula_${cell.id}`}
5351
/>
5452
);

src/components/cellTypes/NumberCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ const NumberCell = (props: CellComponentProps) => {
7070
onChange={handleOnChange}
7171
onKeyDown={handleKeyDown}
7272
onBlur={handleOnBlur}
73-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
73+
className={c(getAlignmentClassname(tableColumn.config))}
7474
/>
7575
) : (
7676
<span
77-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
77+
className={c(getAlignmentClassname(tableColumn.config))}
7878
onClick={handleEditableOnclick}
7979
style={{ width: column.getSize() }}
8080
>

src/components/cellTypes/TextCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const TextCell = (props: CellComponentProps) => {
7373
ref={containerCellRef}
7474
onClick={handleEditableOnclick}
7575
style={{ width: column.getSize() }}
76-
className={c(getAlignmentClassname(tableColumn.config.content_alignment))}
76+
className={c(getAlignmentClassname(tableColumn.config))}
7777
/>
7878
);
7979
};

src/components/modals/columnSettings/ColumnSections.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { SelectedColumnOptionsHandler } from "components/modals/columnSettings/h
77
import { HideCompletedTaskToggleHandler } from "components/modals/columnSettings/handlers/tasks/HideCompletedTaskToggleHandler";
88
import { LinkAliasToggleHandler } from "components/modals/columnSettings/handlers/media/LinkAliasToggleHandler";
99
import { FormulaInputHandler } from "components/modals/columnSettings/handlers/automations/FormulaInputHandler";
10-
import { AlignmentSelectorHandler } from "components/modals/columnSettings/handlers/AlignmentSelectorHandler";
10+
import { AlignmentSelectorHandler } from "components/modals/columnSettings/handlers/styles/AlignmentSelectorHandler";
11+
import { ToggleWrapContentHandler } from "components/modals/columnSettings/handlers/styles/ToggleWrapContentHandler";
1112
import { InputType } from "helpers/Constants";
1213
import { AbstractChain } from "patterns/AbstractFactoryChain";
1314
import { AbstractHandler } from "patterns/AbstractHandler";
@@ -31,6 +32,7 @@ class StyleSetttingsSection extends AbstractChain<ColumnSettingsHandlerResponse>
3132
case InputType.NUMBER:
3233
case InputType.FORMULA:
3334
particularHandlers.push(new AlignmentSelectorHandler());
35+
particularHandlers.push(new ToggleWrapContentHandler());
3436
break;
3537
default:
3638
// do nothing

src/components/modals/columnSettings/handlers/AlignmentSelectorHandler.tsx renamed to src/components/modals/columnSettings/handlers/styles/AlignmentSelectorHandler.tsx

File renamed without changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { add_toggle } from "settings/SettingsComponents";
2+
import { ColumnSettingsHandlerResponse } from "cdm/ModalsModel";
3+
import { AbstractHandlerClass } from "patterns/AbstractHandler";
4+
export class ToggleWrapContentHandler extends AbstractHandlerClass<ColumnSettingsHandlerResponse> {
5+
settingTitle: string = "Wrap content";
6+
handle(
7+
columnHandlerResponse: ColumnSettingsHandlerResponse
8+
): ColumnSettingsHandlerResponse {
9+
const { column, containerEl, columnSettingsManager } =
10+
columnHandlerResponse;
11+
const { view } = columnSettingsManager.modal;
12+
const wrap_content_togle_promise = async (value: boolean): Promise<void> => {
13+
// Persist value
14+
await view.diskConfig.updateColumnConfig(column.key, {
15+
wrap_content: value,
16+
});
17+
columnSettingsManager.modal.enableReset = true;
18+
};
19+
add_toggle(
20+
containerEl,
21+
this.settingTitle,
22+
"Wrap content of the cells in the column",
23+
column.config.wrap_content,
24+
wrap_content_togle_promise
25+
);
26+
return this.goNext(columnHandlerResponse);
27+
}
28+
}

src/components/portals/SelectPortal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ const SelectPortal = (popperProps: CellComponentProps) => {
9494
menuPortalTarget={activeDocument.body}
9595
menuPlacement="auto"
9696
menuShouldBlockScroll={true}
97-
className="react-select-container"
97+
className={`react-select-container ${c(
98+
"tags-container text-align-center"
99+
)}`}
98100
classNamePrefix="react-select"
99101
key={`${tableColumn.key}-select-open`}
100102
/>
@@ -109,7 +111,7 @@ const SelectPortal = (popperProps: CellComponentProps) => {
109111
) : (
110112
/* Current value of the select */
111113
<div
112-
className="cell-padding d-flex cursor-default align-items-center flex-1"
114+
className={`${c("text-align-center")}`}
113115
onClick={() => setShowSelect(true)}
114116
style={{ width: column.getSize() }}
115117
>

src/components/portals/TagsPortal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ const TagsPortal = (tagsProps: CellComponentProps) => {
107107
onBlur={() => setShowSelectTags(false)}
108108
onChange={handleOnChange}
109109
menuPortalTarget={activeDocument.body}
110+
className={`react-select-container ${c(
111+
"tags-container text-align-center"
112+
)}`}
113+
classNamePrefix="react-select"
110114
menuPlacement="auto"
111115
menuShouldBlockScroll={true}
112-
className="react-select-container"
113-
classNamePrefix="react-select"
114116
/>
115117
</div>
116118
);
@@ -121,9 +123,7 @@ const TagsPortal = (tagsProps: CellComponentProps) => {
121123
? TagsForm()
122124
: tagsState && (
123125
<div
124-
className={
125-
c("tags-container") + " cell-padding d-flex flex-wrap-wrap"
126-
}
126+
className={c("tags-container text-align-center")}
127127
onClick={() => setShowSelectTags(true)}
128128
style={{ width: column.getSize() }}
129129
>

src/components/styles/TextAlignmentSelector.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from "react";
22
import FormatAlignLeftIcon from "@mui/icons-material/FormatAlignLeft";
33
import FormatAlignCenterIcon from "@mui/icons-material/FormatAlignCenter";
44
import FormatAlignRightIcon from "@mui/icons-material/FormatAlignRight";
5+
import FormatAlignJustifyIcon from "@mui/icons-material/FormatAlignJustify";
56
import Stack from "@mui/material/Stack";
67
import ToggleButton from "@mui/material/ToggleButton";
78
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
@@ -71,6 +72,18 @@ export default function TextAlignmentSelector(props: TextAlignmentProps) {
7172
>
7273
<FormatAlignRightIcon />
7374
</ToggleButton>
75+
<ToggleButton
76+
value={COLUMN_ALIGNMENT_OPTIONS.JUSTIFY}
77+
aria-label="justified"
78+
sx={{
79+
color: StyleVariables.TEXT_NORMAL,
80+
"&.Mui-selected, &.Mui-selected:hover": {
81+
color: StyleVariables.TEXT_ACCENT,
82+
},
83+
}}
84+
>
85+
<FormatAlignJustifyIcon />
86+
</ToggleButton>
7487
</ToggleButtonGroup>
7588
</Stack>
7689
);

0 commit comments

Comments
 (0)