For vue2 projects, use @94ai/common-ui
LLMs.md

nf-lazy-select ​

Adds asynchronous pagination, search, value echo, request aliases, cross-page selection caching, deferred initialization, loading and error events to nf-virtual-select.

Examples ​

Pagination, virtual scrolling and multiple selection ​

Loading example…
Pagination, virtual scrolling and multiple selection

Data echo ​

Loading example…
Data echo

Props ​

Descriptions preserve common-ui semantics; defaults and signatures follow the current Vue 3 implementation. Compatibility props do not enable unsupported legacy rendering.

AttributeDescriptionTypeValuesDefault
modelValue / v-model (value)Bound value; value remains compatible; prefer v-model in Vue 3SelectModelValue—undefined
emitSelectedItemOnClickget-selected-data returns values by default; true returns full recordsboolean—false
keyValueFields used for option label and value[string, string]—['label', 'value']
virtualListEnable virtual scrollingboolean—false
dataKeyUnique virtual row key: field name or functionstring | ((row: SelectOption) => string | number)—'templateId'
dataComponentCustom option component receiving source, index and extraPropsComponent—undefined
estimateSizeEstimated row height in pxnumber—34
keepsMinimum inline virtual window; dropdown virtualization is managed by SelectV2number—30
pageSizeNumber of records per requestnumber—10
keywordAliasRequest field for search keywordstring—'keyword'
pageNoAliasRequest field for page numberstring—'pageNo'
pageSizeAliasRequest field for page sizestring—'pageSize'
valueAliasInitial request field for selected valuesstring—'value'
loadingDescLoading messagestring—Locale configuration
showTipShow option tooltipboolean—true
multipleEnable multiple selectionboolean—false
disabledDisable interactionboolean—Inherited configuration
allowEmptySearchAllow requests with an empty keywordboolean—true
sizeInput size; mini / medium map to small / defaultSelectSizesmall / default / large / mini / mediumInherited configuration
collapseTagsCollapse selected tags in multiple modeboolean—multiple
multipleLimitMaximum selected items; 0 means unlimitednumber—0
placeholderInput placeholderstring—Locale configuration
noDataTextEmpty list text; can use the empty slotstring—Locale configuration
noDataImgShow NfEmpty when no databoolean—false
popperClassDropdown CSS classstring—undefined
popperAppendToBodyTeleport dropdown to body; maps to Element Plus teleportedboolean—true
startInitial inline scroll indexnumber—0
offsetInitial inline scroll offset in pxnumber—0
directionCompatibility field; currently has no effectStringverticalundefined
pageModeCompatibility field; currently has no effectboolean—undefined
topThresholdTop threshold for totop; may fire repeatedlynumber—0
bottomThresholdBottom threshold for tobottom; may fire repeatedlynumber—0
rootTagInline list root tagString—'div'
wrapTagInline list wrapper tagString—'div'
wrapClassCompatibility field; currently has no effectString—undefined
wrapStyleInline list wrapper styleCSSProperties—undefined
itemTagInline row wrapper tagString—'div'
itemClassInline row CSS classString—undefined
itemClassAddExtra row class function (index, row)(index: number, row: SelectOption) => string—undefined
itemStyleInline row styleCSSProperties—undefined
itemScopedSlotsCompatibility field; currently has no effectObject—undefined
headerTagCompatibility field; currently has no effectString—undefined
headerClassCompatibility field; currently has no effectString—undefined
headerStyleCompatibility field; currently has no effectCSSProperties—undefined
footerTagCompatibility field; currently has no effectString—undefined
footerClassCompatibility field; currently has no effectString—undefined
footerStyleCompatibility field; currently has no effectCSSProperties—undefined
optionsList of selectable optionsSelectOption[]—[]
itemOptionsConfigure list properties and events together; event names accept kebab-case or camelCaseRecord<string, unknown>—{}
tagCustom rendering tag; div or custom-select-dropdown displays an inline liststring | Component—'el-select'
selectAllShow select-all controlboolean—false
selectAllTextSelect-all labelstring—Locale configuration
clearableShow the clear selection controlboolean—true
reserveKeywordKeep the search keyword after selectionboolean—true
filterableEnable searchingboolean—true
filterMethodCustom filtering function(query: string) => void | Promise<void>—undefined
remoteUse remote filteringboolean—false
loadingLoading stateboolean—false
defaultFirstOptionSelect the first match on Enterboolean—false
allowCreateAllow new options; requires filterableboolean—false
automaticDropdownOpen non-filterable select on focusboolean—false
nameNative input namestring—undefined
keywordHighlightHighlight search keywordboolean—true
keywordLabelAliasCompatibility field; highlighting uses text nodes, without HTML injectionstring—'keywordHighlightLabel'
echoValueTopMove selected rows to top in virtual listboolean—true
widthSelector widthstring—'100%'
maxWidthMaximum selector widthstring—undefined
heightScrollable list heightstring—'245px'
extraPropsExtra props passed to custom option componentRecord<string, unknown>—undefined
headeClassCompatibility field; currently has no effectstring—undefined
beforeVisibleChangePost-visibility hook; return break to skip subsequent internal handling(visible: boolean) => void | "break" | "discard-cache" | Promise<void | "break" | "discard-cache">—undefined
placementDropdown placementSelectProps["placement"]—undefined
requestPaginated request returning records and total record count; parameters and context belowLazySelectRequest—undefined
initListLoad initially; false defers loading until focusboolean—true
initListAssigmentValueCompatibility prop; initial data does not overwrite the bound valueboolean—false
visibleChangeKeywordCachedPreserve keyword across closing and reopeningboolean—false
visibleChangeSelectListCachedPreserve searched list across closing and reopeningboolean—false

request(params, context) accepts a synchronous result or Promise. params uses the aliases above for page, page size and keyword; initial echo also includes selected values (including 0 / false). context.data is the normalized list, originData the raw records and allCachedDataList the instance cache. Return total as record count, not page count. In fetch-data, current is the current page; records is the raw response, data the accumulated normalized list and originData the accumulated raw list.

ts
type RequestParams = Record<string, string | number | boolean | (string | number | boolean)[] | undefined>
interface RequestContext {
  data: SelectOption[]
  originData: SelectOption[]
  allCachedDataList: SelectOption[]
}
type RequestResult = { records: SelectOption[]; total: number }
type LazySelectRequest = (params: RequestParams, context: RequestContext) => RequestResult | Promise<RequestResult>
interface FetchCallBackData {
  total: number
  current: number
  hasMore: boolean
  keyword: string
  records: SelectOption[]
  data: SelectOption[]
  originData: SelectOption[]
  allCachedDataList: SelectOption[]
}

Events ​

EventDescriptionArguments
update:modelValueSelection changed; update v-model(value: SelectModelValue)
update:valueSelection changed; compatibility event(value: SelectModelValue)
inputSelection changed; compatibility event(value: SelectModelValue)
changeFires when selection changes(value: SelectModelValue)
focusInput gains focus(event: FocusEvent)
blurInput loses focus(event: FocusEvent)
clearClear control activated()
remove-tagTag removed in multiple mode(value: SelectValue)
visible-changeDropdown shown: true; hidden: false(visible: boolean)
select-itemOption clicked; returns its value(value: SelectValue)
scrollList scroll; Event only, without the old range argument(event: Event)
totopList reaches top threshold(event?: Event)
tobottomList reaches bottom threshold(event?: Event)
resizedList viewport measurement(id: string | number, size: number)
fetch-dataAfter each successful request(data: FetchCallBackData)
fetch-errorRequest failed(error: unknown)
get-selected-dataSelection data; emitSelectedItemOnClick chooses values or full records(valueOrRows: SelectModelValue | SelectOption | (SelectOption | undefined)[])

Slots ​

SlotDescriptionScope
defaultBelow regular/inline list; use footer for virtual dropdown—
optionCustom option content{ row: SelectOption, item: SelectOption, index: number }
headerList header—
footerList footer—
prefixInput prefix—
emptyEmpty option list content—
loadingCustom loading state—
tagCustom selected tagsElement Plus tag slot props

Exposed methods and state ​

  • currentVal
  • nfLazySelect
  • hasMore
  • keyword
  • totalPage
  • pageNo
  • loading
  • focusThrough
  • initListFetch()
  • focusFetchHandler(init?, forceRequest?)
  • fetchHandler(params?, restart?, forceRequest?)
  • clearHandler()
  • handleSearch(keyword, matchKeywords?)
  • visibleChange(boolean)
  • cachedKeyword()
  • loadMore()
  • visibleIntersect
  • allCachedDataList
  • allCachedDataMap
  • data
  • originData
  • open()

Migration notes ​

Vue 3 uses modelValue / update:modelValue; legacy value, update:value and input remain available on selection components. The implementation uses public Element Plus APIs, not Element UI internals. mini maps to small; medium maps to default.

request(params, context) returns { records, total }. Stale requests cannot overwrite the current search. fetch-error reports failures; retry the same page. allCachedDataMap / dataMap are typed Maps.