Skip to content

Commit

Permalink
* picker: add exceedLimitHint to picker.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Sep 27, 2024
1 parent c6f3bad commit 4223581
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/picker/src/component/picker-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class PickerMenu extends PickPop<PickerState, PickerMenuProps> {
}

protected _getMenuProps(props: RenderableProps<PickerMenuProps>): SearchMenuOptions {
const {menu, tree, state, checkbox, header, footer, noMatchHint, maxItemsCount} = props;
const {menu, tree, state, checkbox, header, footer, noMatchHint, maxItemsCount, exceedLimitHint} = props;
const {items, search} = state;

return mergeProps({
Expand All @@ -176,6 +176,7 @@ export class PickerMenu extends PickPop<PickerState, PickerMenuProps> {
defaultNestedShow: true,
activeOnHover: true,
search: search,
exceedLimitHint,
onClickItem: this._handleItemClick,
nestedToggle: '.nested-toggle-icon,.item-icon',
checkbox,
Expand Down
1 change: 1 addition & 0 deletions lib/picker/src/component/picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ export class Picker<S extends PickerState = PickerState, O extends PickerOptions
footer: this._renderToolbar(),
valueList: this.valueList,
noMatchHint: state.loading ? i18n.getLang('loadingHint') : (props.searchEmptyHint ?? i18n.getLang('searchEmptyHint')),
exceedLimitHint: props.exceedLimitHint ?? i18n.getLang('exceedLimitHint'),
onDeselect: this.deselect,
onSelect: this.select,
onClear: this.clear,
Expand Down
3 changes: 3 additions & 0 deletions lib/picker/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ i18n.addLang({
cancelSelect: '取消选择',
searchEmptyHint: '无匹配选项',
loadingHint: '正在加载...',
exceedLimitHint: '还有 {0} 个选项没有显示,可尝试搜索来查找',
},
'zh_tw': {
selectAll: '全選',
cancelSelect: '取消選擇',
searchEmptyHint: '無匹配選項',
loadingHint: '正在載入...',
exceedLimitHint: '還有 {0} 個選項沒有顯示,可嘗試搜索來查找',
},
en: {
selectAll: 'Select All',
cancelSelect: 'Cancel Select',
searchEmptyHint: 'No matching options',
loadingHint: 'Loading...',
exceedLimitHint: 'There are {0} items not displayed, try searching to find',
},
});
1 change: 1 addition & 0 deletions lib/picker/src/types/picker-menu-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface PickerMenuProps<S extends PickerState = PickerState> extends Pi
footer?: CustomContentType;
noMatchHint?: string;
maxItemsCount?: number;
exceedLimitHint?: string;
picker?: Picker;

onSelect: (values: string | string[]) => void;
Expand Down
1 change: 1 addition & 0 deletions lib/picker/src/types/picker-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface PickerOptions<S extends PickerState = PickerState> extends Pick
checkbox?: MenuOptions['checkbox'];
items: MenuOptions['items'];
maxItemsCount?: number;
exceedLimitHint?: string;
toolbar?: ToolbarSetting | boolean;
cache?: boolean;
searchDelay?: number;
Expand Down

0 comments on commit 4223581

Please sign in to comment.