fix(Cascader):fix trigger slot without keyboard event
parent
35c1ad9c80
commit
46c65e650e
|
@ -438,6 +438,7 @@ export default defineComponent({
|
||||||
|
|
||||||
// KeyDown
|
// KeyDown
|
||||||
const onInternalKeyDown: KeyboardEventHandler = (event, ...rest) => {
|
const onInternalKeyDown: KeyboardEventHandler = (event, ...rest) => {
|
||||||
|
event.preventDefault();
|
||||||
const clearLock = getClearLock();
|
const clearLock = getClearLock();
|
||||||
const { which } = event;
|
const { which } = event;
|
||||||
|
|
||||||
|
@ -809,68 +810,76 @@ export default defineComponent({
|
||||||
|
|
||||||
// >>> Selector
|
// >>> Selector
|
||||||
const selectorNode = (
|
const selectorNode = (
|
||||||
<SelectTrigger
|
<div
|
||||||
ref={triggerRef}
|
{...domProps}
|
||||||
disabled={disabled}
|
class={mergedClassName}
|
||||||
prefixCls={prefixCls}
|
onMousedown={onInternalMouseDown}
|
||||||
visible={triggerOpen.value}
|
onKeydown={onInternalKeyDown}
|
||||||
popupElement={optionList}
|
onKeyup={onInternalKeyUp}
|
||||||
containerWidth={containerWidth.value}
|
>
|
||||||
animation={animation}
|
<SelectTrigger
|
||||||
transitionName={transitionName}
|
ref={triggerRef}
|
||||||
dropdownStyle={dropdownStyle}
|
disabled={disabled}
|
||||||
dropdownClassName={dropdownClassName}
|
prefixCls={prefixCls}
|
||||||
direction={direction}
|
visible={triggerOpen.value}
|
||||||
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
|
popupElement={optionList}
|
||||||
dropdownRender={dropdownRender}
|
containerWidth={containerWidth.value}
|
||||||
dropdownAlign={dropdownAlign}
|
animation={animation}
|
||||||
placement={placement}
|
transitionName={transitionName}
|
||||||
getPopupContainer={getPopupContainer}
|
dropdownStyle={dropdownStyle}
|
||||||
empty={emptyOptions}
|
dropdownClassName={dropdownClassName}
|
||||||
getTriggerDOMNode={() => selectorDomRef.current}
|
direction={direction}
|
||||||
onPopupVisibleChange={onTriggerVisibleChange}
|
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
|
||||||
onPopupMouseEnter={onPopupMouseEnter}
|
dropdownRender={dropdownRender}
|
||||||
onPopupFocusin={onPopupFocusin}
|
dropdownAlign={dropdownAlign}
|
||||||
onPopupFocusout={onPopupFocusout}
|
placement={placement}
|
||||||
v-slots={{
|
getPopupContainer={getPopupContainer}
|
||||||
default: () => {
|
empty={emptyOptions}
|
||||||
return customizeRawInputElement ? (
|
getTriggerDOMNode={() => selectorDomRef.current}
|
||||||
isValidElement(customizeRawInputElement) &&
|
onPopupVisibleChange={onTriggerVisibleChange}
|
||||||
cloneElement(
|
onPopupMouseEnter={onPopupMouseEnter}
|
||||||
customizeRawInputElement,
|
onPopupFocusin={onPopupFocusin}
|
||||||
{
|
onPopupFocusout={onPopupFocusout}
|
||||||
ref: selectorDomRef,
|
v-slots={{
|
||||||
},
|
default: () => {
|
||||||
false,
|
return customizeRawInputElement ? (
|
||||||
true,
|
isValidElement(customizeRawInputElement) &&
|
||||||
)
|
cloneElement(
|
||||||
) : (
|
customizeRawInputElement,
|
||||||
<Selector
|
{
|
||||||
{...props}
|
ref: selectorDomRef,
|
||||||
domRef={selectorDomRef}
|
},
|
||||||
prefixCls={prefixCls}
|
false,
|
||||||
inputElement={customizeInputElement}
|
true,
|
||||||
ref={selectorRef}
|
)
|
||||||
id={id}
|
) : (
|
||||||
showSearch={mergedShowSearch.value}
|
<Selector
|
||||||
mode={mode}
|
{...props}
|
||||||
activeDescendantId={activeDescendantId}
|
domRef={selectorDomRef}
|
||||||
tagRender={tagRender}
|
prefixCls={prefixCls}
|
||||||
optionLabelRender={optionLabelRender}
|
inputElement={customizeInputElement}
|
||||||
values={displayValues}
|
ref={selectorRef}
|
||||||
open={mergedOpen.value}
|
id={id}
|
||||||
onToggleOpen={onToggleOpen}
|
showSearch={mergedShowSearch.value}
|
||||||
activeValue={activeValue}
|
mode={mode}
|
||||||
searchValue={mergedSearchValue.value}
|
activeDescendantId={activeDescendantId}
|
||||||
onSearch={onInternalSearch}
|
tagRender={tagRender}
|
||||||
onSearchSubmit={onInternalSearchSubmit}
|
optionLabelRender={optionLabelRender}
|
||||||
onRemove={onSelectorRemove}
|
values={displayValues}
|
||||||
tokenWithEnter={tokenWithEnter.value}
|
open={mergedOpen.value}
|
||||||
/>
|
onToggleOpen={onToggleOpen}
|
||||||
);
|
activeValue={activeValue}
|
||||||
},
|
searchValue={mergedSearchValue.value}
|
||||||
}}
|
onSearch={onInternalSearch}
|
||||||
></SelectTrigger>
|
onSearchSubmit={onInternalSearchSubmit}
|
||||||
|
onRemove={onSelectorRemove}
|
||||||
|
tokenWithEnter={tokenWithEnter.value}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
></SelectTrigger>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
// >>> Render
|
// >>> Render
|
||||||
let renderNode: VueNode;
|
let renderNode: VueNode;
|
||||||
|
@ -910,7 +919,6 @@ export default defineComponent({
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{selectorNode}
|
{selectorNode}
|
||||||
|
|
||||||
{arrowNode}
|
{arrowNode}
|
||||||
{clearNode}
|
{clearNode}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue