Skip to content

Commit

Permalink
🐳 chore: update prop name
Browse files Browse the repository at this point in the history
  • Loading branch information
huangkairan committed Nov 15, 2023
1 parent 3a7d865 commit 26950f5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class Demo extends React.Component {
open
style={{ width: 300 }}
treeData={gData}
titleRender={node => node.label + 'ok'}
treeTitleRender={node => node.label + 'ok'}
/>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/OptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const OptionList: React.RefForwardingComponent<ReviseRefOptionListProps> = (_, r
onSelect,
dropdownMatchSelectWidth,
treeExpandAction,
titleRender,
treeTitleRender,
} = React.useContext(TreeSelectContext);

const {
Expand Down Expand Up @@ -242,7 +242,7 @@ const OptionList: React.RefForwardingComponent<ReviseRefOptionListProps> = (_, r
checkedKeys={mergedCheckedKeys}
selectedKeys={!checkable ? checkedKeys : []}
defaultExpandAll={treeDefaultExpandAll}
titleRender={titleRender}
titleRender={treeTitleRender}
{...treeProps}
// Proxy event out
onActiveChange={setActiveKey}
Expand Down
10 changes: 5 additions & 5 deletions src/TreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export interface TreeSelectProps<
listItemHeight?: number;
listItemScrollOffset?: number;
onDropdownVisibleChange?: (open: boolean) => void;
titleRender?: (node: ValueType) => React.ReactNode;
treeTitleRender?: (node: ValueType) => React.ReactNode;

// >>> Tree
treeLine?: boolean;
Expand Down Expand Up @@ -238,7 +238,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
showTreeIcon,
switcherIcon,
treeMotion,
titleRender,
treeTitleRender,

...restProps
} = props;
Expand Down Expand Up @@ -440,7 +440,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
// Back fill with origin label
const labeledValues = values.map(val => {
const targetItem = rawLabeledValues.find(item => item.value === val);
const label = titleRender ? titleRender(targetItem) : targetItem?.label;
const label = treeTitleRender ? treeTitleRender(targetItem) : targetItem?.label;
return {
value: val,
label,
Expand Down Expand Up @@ -674,7 +674,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
fieldNames: mergedFieldNames,
onSelect: onOptionSelect,
treeExpandAction,
titleRender,
treeTitleRender,
}),
[
virtual,
Expand All @@ -686,7 +686,7 @@ const TreeSelect = React.forwardRef<BaseSelectRef, TreeSelectProps>((props, ref)
mergedFieldNames,
onOptionSelect,
treeExpandAction,
titleRender,
treeTitleRender,
],
);

Expand Down
2 changes: 1 addition & 1 deletion src/TreeSelectContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface TreeSelectContextProps {
fieldNames: InternalFieldName;
onSelect: OnInternalSelect;
treeExpandAction?: ExpandAction;
titleRender?: (node: any) => React.ReactNode;
treeTitleRender?: (node: any) => React.ReactNode;
}

const TreeSelectContext = React.createContext<TreeSelectContextProps>(null as any);
Expand Down
2 changes: 1 addition & 1 deletion tests/Select.props.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ describe('TreeSelect.props', () => {
<div>
<TreeSelect
defaultValue={'Value 0-0'}
titleRender={node => node.value}
treeTitleRender={node => node.value}
treeData={treeData}
/>
</div>,
Expand Down

0 comments on commit 26950f5

Please sign in to comment.