Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf94b94

Browse files
committed
Adds ability to add custom tags for multiselect component
1 parentd4ac9e3 commitcf94b94

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
letMultiSelectBasicComp=(function(){
@@ -35,6 +35,10 @@ let MultiSelectBasicComp = (function () {
3535
validateState,
3636
handleChange,
3737
]=useSelectInputValidate(props);
38+
39+
constremoveIllegalEntries=()=>{
40+
returnprops.value.value.filter?.((v)=>valueSet.has(v))
41+
}
3842

3943
returnprops.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)returnfalse;
274+
returnString(option.label??option.value??"").toLowerCase().includes(input.toLowerCase());
275+
}}
274276
popupRender={(originNode:ReactNode)=>(
275277
<DropdownStyled$style={props.childrenInputFieldStyleasChildrenMultiSelectStyleType}>
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
exportconstSelectInputValidationChildren={
2020
required:BoolControl,
2121
showValidationWhenEmpty:BoolControl,
22+
allowCustomTags:BoolControl,
2223
customRule:CustomRuleControl,
2324
};
2425
typeValidationComp=RecordConstructorToComp<typeofSelectInputValidationChildren>;
@@ -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)

[8]ページ先頭

©2009-2025 Movatter.jp