Skip to content

Commit 1daf513

Browse files
Merge pull request #1801 from kamalqureshi/custom_tag_multiselect
Custom Tags for Multiselect
2 parents d4ac9e3 + cf94b94 commit 1daf513

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

client/packages/lowcoder/src/comps/comps/selectInputComp/multiSelectComp.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { SelectInputInvalidConfig, useSelectInputValidate } from "./selectInputC
1414

1515
import { PaddingControl } from "../../controls/paddingControl";
1616
import { MarginControl } from "../../controls/marginControl";
17-
import { migrateOldData, withDefault } from "comps/generators/simpleGenerators";
17+
import { migrateOldData } from "comps/generators/simpleGenerators";
1818
import { fixOldInputCompData } from "../textInputComp/textInputConstants";
1919

2020
let MultiSelectBasicComp = (function () {
@@ -35,6 +35,10 @@ let MultiSelectBasicComp = (function () {
3535
validateState,
3636
handleChange,
3737
] = useSelectInputValidate(props);
38+
39+
const removeIllegalEntries = () => {
40+
return props.value.value.filter?.((v) => valueSet.has(v))
41+
}
3842

3943
return props.label({
4044
required: props.required,
@@ -45,8 +49,8 @@ let MultiSelectBasicComp = (function () {
4549
children: (
4650
<SelectUIView
4751
{...props}
48-
mode={"multiple"}
49-
value={props.value.value.filter?.((v) => valueSet.has(v))}
52+
mode={props.allowCustomTags ? "tags" : "multiple"}
53+
value={props.allowCustomTags ? props.value.value : removeIllegalEntries()}
5054
onChange={handleChange}
5155
dispatch={dispatch}
5256
/>

client/packages/lowcoder/src/comps/comps/selectInputComp/selectCompConstants.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export const getStyle = (
7676
padding: ${style.padding};
7777
height: auto;
7878
}
79-
.ant-select-selection-search {
79+
.ant-select-selection-search {
80+
min-width: 50px;
8081
padding: ${style.padding};
8182
}
8283
.ant-select-selection-search-input,
@@ -268,9 +269,10 @@ export const SelectUIView = (
268269
placeholder={props.placeholder}
269270
value={props.value}
270271
showSearch={props.showSearch}
271-
filterOption={(input, option) =>
272-
option?.label.toLowerCase().includes(input.toLowerCase())
273-
}
272+
filterOption={(input, option) => {
273+
if (!option) return false;
274+
return String(option.label ?? option.value ?? "").toLowerCase().includes(input.toLowerCase());
275+
}}
274276
popupRender={(originNode: ReactNode) => (
275277
<DropdownStyled $style={props.childrenInputFieldStyle as ChildrenMultiSelectStyleType}>
276278
{originNode}

client/packages/lowcoder/src/comps/comps/selectInputComp/selectInputConstants.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { blurMethod, focusWithOptions } from "comps/utils/methodUtils";
1919
export const SelectInputValidationChildren = {
2020
required: BoolControl,
2121
showValidationWhenEmpty: BoolControl,
22+
allowCustomTags: BoolControl,
2223
customRule: CustomRuleControl,
2324
};
2425
type ValidationComp = RecordConstructorToComp<typeof SelectInputValidationChildren>;
@@ -126,6 +127,9 @@ export const SelectInputValidationSection = (children: ValidationComp) => (
126127
{children.showValidationWhenEmpty.propertyView({
127128
label: trans("prop.showEmptyValidation"),
128129
})}
130+
{children.allowCustomTags.propertyView({
131+
label: trans("prop.customTags")
132+
})}
129133
{children.customRule.propertyView({})}
130134
</Section>
131135
);

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export const en = {
234234
"verticalGridCells": "Vertical Grid Cells",
235235
"timeZone": "TimeZone",
236236
"pickerMode": "Picker Mode",
237+
"customTags": "Custom Tags"
237238
},
238239
"autoHeightProp": {
239240
"auto": "Auto",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy