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

Commit ef830c0

Browse files
committed
sort tags and selects
1 parent e704655 commit ef830c0

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
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
</>

0 commit comments

Comments
 (0)