Skip to content

Commit

Permalink
feat(tree-select): 添加复选搜索,input框最大长的控制
Browse files Browse the repository at this point in the history
  • Loading branch information
huskylengcb authored and jack0pan committed Jun 7, 2021
1 parent 096064c commit ad583c1
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 116 deletions.
5 changes: 5 additions & 0 deletions src/components/tree-select/TreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class TreeSelect<T> extends React.Component<TreeSelectProps<T>> {
className,
treeCheckable,
multiple,
maxTagTextLength,
maxTagCount,
listHeight = 368,
listItemHeight = 26,
notFoundContent,
Expand Down Expand Up @@ -123,13 +125,16 @@ class TreeSelect<T> extends React.Component<TreeSelectProps<T>> {
prefixCls={prefixCls}
className={mergedClassName}
listHeight={listHeight}
maxTagTextLength={maxTagTextLength}
maxTagCount={maxTagCount}
listItemHeight={listItemHeight}
treeCheckable={treeCheckable ? <span className={`${prefixCls}-tree-checkbox-inner`} /> : treeCheckable}
inputIcon={suffixIcon}
removeIcon={removeIcon}
clearIcon={clearIcon}
switcherIcon={(nodeProps: GioTreeNodeProps) => renderSwitcherIcon(treePrefixCls, switcherIcon, nodeProps)}
showTreeIcon={false}
showSearch
notFoundContent={mergedNotFound}
getPopupContainer={getPopupContainer || getContextPopupContainer}
treeMotion={null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ exports[`Testing tree select \`multiple\` will alway be \`true\` when \`treeChec
initialize {
"0": Object {
"attribs": Object {
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow",
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow gio-select-show-search",
},
"children": Array [
Object {
Expand Down Expand Up @@ -1900,7 +1900,7 @@ exports[`Testing tree select not found work 1`] = `
initialize {
"0": Object {
"attribs": Object {
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow",
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow gio-select-show-search",
},
"children": Array [
Object {
Expand Down Expand Up @@ -2830,7 +2830,7 @@ exports[`Testing tree select should \`treeIcon\` work 1`] = `
initialize {
"0": Object {
"attribs": Object {
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow gio-select-open",
"class": "gio-select gio-tree-select gio-select-single gio-select-show-arrow gio-select-open gio-select-show-search",
},
"children": Array [
Object {
Expand All @@ -2854,11 +2854,8 @@ initialize {
"autocomplete": "off",
"class": "gio-select-selection-search-input",
"id": "rc_select_TEST_OR_SSR",
"readonly": "",
"role": "combobox",
"style": "opacity: 0;",
"type": "search",
"unselectable": "on",
"value": "",
},
"children": Array [],
Expand All @@ -2878,11 +2875,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
"x-attribsPrefix": Object {
Expand All @@ -2895,11 +2889,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
},
Expand Down Expand Up @@ -2959,11 +2950,8 @@ initialize {
"autocomplete": "off",
"class": "gio-select-selection-search-input",
"id": "rc_select_TEST_OR_SSR",
"readonly": "",
"role": "combobox",
"style": "opacity: 0;",
"type": "search",
"unselectable": "on",
"value": "",
},
"children": Array [],
Expand All @@ -2983,11 +2971,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
"x-attribsPrefix": Object {
Expand All @@ -3000,11 +2985,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
},
Expand Down Expand Up @@ -3525,11 +3507,8 @@ initialize {
"autocomplete": "off",
"class": "gio-select-selection-search-input",
"id": "rc_select_TEST_OR_SSR",
"readonly": "",
"role": "combobox",
"style": "opacity: 0;",
"type": "search",
"unselectable": "on",
"value": "",
},
"children": Array [],
Expand All @@ -3549,11 +3528,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
"x-attribsPrefix": Object {
Expand All @@ -3566,11 +3542,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
},
Expand Down Expand Up @@ -3630,11 +3603,8 @@ initialize {
"autocomplete": "off",
"class": "gio-select-selection-search-input",
"id": "rc_select_TEST_OR_SSR",
"readonly": "",
"role": "combobox",
"style": "opacity: 0;",
"type": "search",
"unselectable": "on",
"value": "",
},
"children": Array [],
Expand All @@ -3654,11 +3624,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
"x-attribsPrefix": Object {
Expand All @@ -3671,11 +3638,8 @@ initialize {
"autocomplete": undefined,
"class": undefined,
"id": undefined,
"readonly": undefined,
"role": undefined,
"style": undefined,
"type": undefined,
"unselectable": undefined,
"value": undefined,
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/tree-select/__tests__/tree-select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ describe('Testing tree select', () => {
listItemHeight={30}
suffixIcon={<MoreOutlined />}
showSearch
maxTagTextLength={6}
maxTagCount={3}
menuItemSelectedIcon={<MoreOutlined />}
/>
);
Expand Down
Loading

1 comment on commit ad583c1

@vercel
Copy link

@vercel vercel bot commented on ad583c1 Jun 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.