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

nf-search-form ​

Configuration-driven search form with linked options, validation, query/export and field settings.

Field visibility and order use the nf-search-form object store in the common-ui-plus IndexedDB database, isolated by storageKey. Settings are restored asynchronously; save, clear and legacy *Cookies* synchronization methods support await. If IndexedDB is unavailable, only the current instance state is retained, without a localStorage fallback or automatic migration of old caches. The table’s embedded search form follows the same behavior, isolated by searchFormStorageKey.

ts
import NfSearchForm from '@94ai-plus/nf-search-form'
import type { NfSearchFormItemOption, SearchFormInstance } from '@94ai-plus/nf-search-form'
import '@94ai-plus/nf-search-form/style.css'

Complete usage showcase ​

Loading example…
Complete usage showcase

Block / inline form layouts ​

Loading example…
Block / inline form layouts

Simplest usage ​

Loading example…
Simplest usage

NfSearchFormItemOption ​

parametersDescriptionType
propField path, associated form data.string
labelField labels can be dynamically calculated based on form data.string / Function
element / componentBuilt-in names or custom Vue 3 components.string / Component
initValueField initial value.unknown
optionsStatic options.object[]
getOptionsAsynchronous option callback, done returns list; supports Promise.(done, model) => void / Promise
changePropsDependent fields that are reloaded after the current value changes.string[]
exchangeKeySubmit data conversion; type=1 splits the interval, type=2 splits the string.
showDynamic display; when false, the field is not rendered.boolean / Function
hiddenAlways shown but does not participate in collapse.boolean
destroy / destoryDynamically destroy fields, compatible with old spellings.boolean / Function
initHiddenIt is not displayed initially and can be restored in field settings.boolean
slot / labelSlot / tooltip.slotField content, label, and prompt slot name.string
inputSlotInput box and slot mapping at both ends of the interval.object
eventsInput control event; change receives the current value, retained parameters, and form data.object
rules / requiredField validation rules and required status.object / boolean
width / labelWidthContent and label width.string / number
categoryGroup name in field settings.string

Attribute ​

parametersDescriptionTypeOptional valueDefault value
formOptions[json data] Rendering form frame dataNfSearchFormItemOption[]—[]
columnsFold when the specified number of form items is exceeded; if not set, it will be detected based on the width of the container.number—3
upIcon[Collapse function] button expand iconstring—'icon-xiangshang2'
downIcon[Collapse function] Button to close iconstring—'icon-xiangxia2'
showBtn[Folding function] button is displayed and hidden, and the folding function can be turned on and off.boolean—true
isCollapse[Folding function] Initialize whether to expand or notboolean—false
expandBtnIconExpand button iconstring——
expandBtnTypeExpand button typestring—default
expandBtnPlainExpand button plainboolean—false
expandBtnSizeExpand button sizestringmini/small/medium—
expandBtnRoundExpand button roundboolean—false
expandBtnCircleExpand buttoncircleboolean—false
expandBtnLoadingExpand button loadingboolean—false
expandBtnDisabledExpand buttondisabledboolean—false
expandBtnTooltipDescExpand button tooltip descriptionstring—Follow language pack
shrinkBtnTooltipDescCollapse button tooltip descriptionstring—Follow language pack
defaultFormDataInitialize the form data object; Vue 3 two-way binding uses v-model.object—{}
rules[Form function] Verification rulesobject—undefined
labelWidth[Form function] The width of the form field label, such as '50px'. Form-item elements that are direct children of Form inherit this value. Support auto.number / string—150
itemWidth[Form function] Customize the width of each search form item content to achieve alignment of form items. If you need to make a separate custom width, just pass in the width for each item of form-options.number—227
labelSuffix[Form function] Suffix of field labelstring—undefined
hideRequiredAsterisk[Form function] Whether to hide the red asterisk next to the label of required fieldsboolean—false
showMessage[Form function] Whether to display verification error informationboolean—true
inlineMessage[Form function] Whether to display verification information inlineboolean—false
statusIcon[Form function] Whether to display the verification result feedback icon in the input boxboolean—false
validateOnRuleChange[Form function] Whether to trigger a verification immediately after the rules attribute is changedboolean—true
sizeForm and button sizes; compatible with mini→small, medium→default.stringmini/small/medium'mini'
disabled[Form Function] Whether to disable all components in the form. If set to true, the disabled attribute on components within the form will no longer take effect.boolean—false
btnModel[Form function] Whether the operation button wrapsstringblock/inline'block'
labelPosition[Form function] Label positionstring—'top'
inline【Form function】Inlineboolean—true
btnBoxLabelCustomize the label of the button slotstring—''
closableWhether to display [Control form column item hidden icon], used to control hidden form column itemboolean—false
columnEditWhether to display the [Column Edit Button] to enable displaying and hiding form column itemsboolean—false
checkModeSet the interactive mode of the column editing functionstringdialog/drawer'drawer'
storageKeyThe IndexedDB cache key set by the field; multiple instances of the same page should use independent keys.string-nf-search-form-columns-cached-key-$
priorityCache echo priority, handle the echo relationship between item.initHidden, form.showColumn and IndexedDB.cachestringcached/value'cached'
showItems[json data] A collection of rendered form column item prop attributes, used to initialize and control which form column items are displayed and hidden. [] will all be displayed, and can be used in conjunction with initHidden of columns.string[]—undefined
checkBtnIconColumn edit button iconstring--
checkBtnTypeColumn edit button typestring--
checkBtnPlainColumn edit button plainboolean-true
checkBtnSizeColumn edit button sizemini/small/medium-—
checkBtnRoundcolumn edit button roundboolean-false
checkBtnCircleColumn edit button circleboolean-false
checkBtnLoadingColumn edit button loadingboolean-false
checkBtnDisabledColumn edit button disabledboolean-false
checkBtnClassColumn edit button classstring--
columnDisplayBtnTextColumn edit button tooltip textstring-Follow language pack
moreDialogTitleColumn editing dialog/drawer mode->pop-up box titlestring—Follow language pack
columnCheckCancelButtonTextColumn edit dialog/drawer mode cancel button textstring-'Cancel'
columnCheckConfirmButtonTextColumn editing dialog/drawer mode determine button textstring-'OK'
columnCheckBasicFieldDescDefault category titlestring-Follow language pack
columnCheckTabsColumn editing drawer mode->Control the data of rendering tabsITabItem[]--
columnCheckCurrentTabColumn editing drawer mode -> currently displayed tab namestring--
selectEmptyWarningTipsSet the warning prompt to clear all columns when editing columns. By default, hiding of all form column items is not allowed.string-Please select at least one option
columnCheckSearchPlaceholderColumn editing drawer mode->search box placeholderstring-'Search'
columnCheckFixedLeftDescCompatible fields; search form field settings do not provide fixed column functionality.string-Follow language pack
columnCheckClearDescColumn editing drawer mode -> clear descriptionstring-Follow language pack
columnCheckNoFixedDescCompatible fields; search form field settings do not provide fixed column functionality.string-Follow language pack
columnCheckGetCheckedLengthDescColumn editing drawer mode->selected description(length) => string-(length) => 'selected (' + length + ')'
columnCheckGetAllCheckDescColumn editing drawer mode->select all description(length) => string-(length) => 'Select all (' + length + ')
moreDialogWidthColumn editing dialog mode->pop-up boxstring—'600px'
modalAppendToBodyColumn editing dialog mode -> Whether the pop-up mask layer is inserted on the body element. If it is false, the mask layer will be inserted on the parent element of the Dialog.boolean—true
modalColumn editing dialog mode->Does the pop-up box require a mask layer?boolean—true
fullscreenColumn editing dialog mode -> Whether the pop-up box is a full-screen Dialogboolean—false
topColumn editing dialog mode->margin-top value in pop-up dialog CSSstring—'15vh'
appendToBodyColumn editing dialog mode -> Whether the pop-up Dialog itself is inserted into the body element. Nested Dialog must specify this attribute and set the value to trueboolean—false
lockScrollColumn editing dialog mode -> Whether the pop-up box locks the body scroll when the Dialog appearsboolean—true
customClassColumn editing dialog mode->Custom class name of pop-up Dialogstring—'
closeOnlickModalColumn editing dialog mode -> Whether the pop-up box can close the Dialog by clicking modalboolean—true
closeOnPressEscapeColumn editing dialog mode -> Whether the pop-up box can close the Dialog by pressing ESCboolean—true
showCloseColumn editing dialog mode -> whether the pop-up box displays a close buttonboolean—true
beforeCloseColumn editing dialog mode -> callback before the pop-up box is closed, which will suspend the closing of the DialogFunction—undefined
centerColumn editing dialog mode -> Whether the pop-up box uses a centered layout for the head and bottomboolean—false
destroyOnCloseColumn editing dialog mode->Destroy the elements in the Dialog when the pop-up box is closedboolean—false
btnItems【Default Button】Shows the default buttonsstring[]/IBtnItems[] / 'search'、'export'、'reset'、''—''
reverseBtnSlot[Default Button] Reverse the order of custom button slots and default buttonsboolean—false
exportBtnIcon[Export button] iconstring—''
exportBtnType[Export button] typestring—'primary'
exportBtnPlain[Export button] Hollow outboolean—true
exportBtnSize[Export Button] Sizemini/small/medium——
exportBtnRound[Export button] Rounded cornersboolean—false
exportBtnCircle[Export Button] Circleboolean—false
exportBtnLoading【Export button】Loadingboolean—false
exportBtnDisabled[Export button] disabledboolean—false
exportBtnText[Export button] textstring—Follow language pack
exportBtnClass[Export button] class namestring—''
queryBtnIcon[Query button] iconstring—''
queryBtnType[Query Button] Typestring—'primary'
queryBtnPlain[Query Button] Hollowboolean—true
queryBtnSize【Query Button】Dimensionsmini/small/medium——
queryBtnRound[Query Button] Rounded Cornersboolean—false
queryBtnCircle[Query Button] Circleboolean—false
queryBtnLoading【Query Button】Loadingboolean—false
queryBtnDisabled[Query Button] Disabledboolean—false
queryBtnText【Query Button】Textstring—Follow language pack
queryBtnClass[Query button] Class namestring—''
resetBtnIcon[Reset button] iconstring—''
resetBtnType[Reset Button] Typestring—'default'
resetBtnPlain【Reset Button】Skeletonboolean—true
resetBtnSize[Reset Button] Sizemini/small/medium——
resetBtnRound[Reset Button] Rounded cornersboolean—false
resetBtnCircle[Reset Button] Roundboolean—false
resetBtnLoading【Reset Button】Loadingboolean—false
resetBtnDisabled[Reset Button] Disabledboolean—false
resetBtnText[Reset button] textstring—Follow language pack
resetBtnClass[Reset button] class namestring—''
modelValueForm data; use v-model two-way binding.SearchFormModel—undefined
requiredValidateWhether to verify before querying and exporting.boolean—false
componentsExtended form control mapping.Record<string, Component>—undefined
viewIdentityView or user configuration ID.string—undefined
isMvcUse external data schema.boolean—false

Attribute IBtnItems ​

parametersDescriptionTypeOptional valueDefault value
btnType[Button type] ('search', 'export', 'reset', '', undefined)stringOptionalundefined
nameButton namestringOptionalundefined
typenf-button attribute-OptionalAttribute.queryBtnType
iconnf-button attribute-OptionalAttribute.queryBtnIcon
plainnf-button attribute-OptionalAttribute.queryBtnPlain
sizenf-button attribute-OptionalAttribute.size
roundnf-button attribute-OptionalAttribute.queryBtnRound
circlenf-button attribute-OptionalAttribute.queryBtnCircle
loadingnf-button attribute-OptionalAttribute.queryBtnLoading
disablednf-button attribute-OptionalAttribute.queryBtnDisabled
classclassNamestring、objectOptionalundefined
validateWhether to trigger the onClick event after verifying the formbooleanOptionalfalse
onClickclick event(formData: Current form data) => voidOptionalundefined
showWhether to display(formData: Current form data) => booleanOptionalundefined

Event ​

event nameDescriptioncallback parameters
openColumn editing dialog mode -> callback for popup opening—
openedColumn editing dialog mode -> callback at the end of pop-up opening animation—
closeColumn editing dialog mode->callback for popup closing—
closedColumn editing dialog mode -> callback at the end of the pop-up closing animation—
changeTabColumn editing drawer mode->switch multiple drawer tabsname
cancelColumn editing drawer mode -> close drawerEvent
onSearchFired when a query is clicked or a query method is called, and the data has been converted by exchangeKey.(data, refresh: boolean)
onExportExport callback, passing in the converted form data.data: SearchFormModel
onResetFieldsFires after resetting the form.—
onChangeForm data changes.model: SearchFormModel
itemsChangeField display list changes.items: string[]
update:modelValuefor v-model.model: SearchFormModel
update:showItemsfor v-model:showItems.items: string[]
isCollapseChangeThe form expansion state changes; true means expansion.expanded: boolean
options-errorAsynchronous options loading failed.(error, prop: string)

Slot ​

NameDescription
btnBoxCompatible with ai-search-form extended operation button
dialogTitleColumn editing dialog mode->pop-up box title
dialogFooterColumn editing dialog mode->pop-up footer
columCheckTitleColumn editing drawer mode->pop-up title
columCheckFooterColumn editing drawer mode->pop-up footer
NfSearchFormItemOption.tooltip.slotCustomize the icon tooltip of each SearchFormItem
NfSearchFormItemOption.slotCustomize each SearchFormItem
NfSearchFormItemOption.inputSlotCustomize prepend/append/prefix/suffix and slots at both ends of the digital range.
NfSearchFormItemOption.labelSlotCustomize field labels.

Expose ​

NameTypeDescription
localShowItemsstring[]Column props displayed by column editing
getFormDataFunctionGet real-time data from the form (deep copy)
syncLocalShowColumnToCookiesFunctionColumn editing sync component to IndexedDB
syncCookiesToLocalShowColumnFunctionColumn editor synchronizes IndexedDB to component localShowItems
syncShowItemToInitHiddenFunctionshowItems synchronizes props.formOptions[i].initHidden
hiddenNfSearchFormItemOptionFieldFunctionColumn editing hides a form column
refreshNfSearchFormModelFunctionRefresh form data mode after column edit operation
renderSearchFormItemOptionsNfSearchFormItemOption[]Render form items
resetNfSearchFormModelFunctionreset
onNfSearchFormValidateFunctionVerify
onNfSearchFormSearchFunctionSearch
onNfSearchFormExportFunctionExport
nfSearchFormModelRecordform data
nfSearchFormRefRefform ref
columnCheckNfDrawerRefColumn editor nf-drawer ref
configNfSearchItemVisibleDialogBooleanColumn editing controls dialog/drawer display/hide
syncCookiesToTableColumnFunctionsyncCookiesToLocalShowColumn
setNfSearchFormModel(model)FunctionCombine form values by field path.
clearColumnEditCached()FunctionClear field settings cache.
clearDragCached()FunctionClear drag cache.

Instructions for use ​

Example headers, layout combinations and feature alignment common-ui. Quarterly, half-year, and weekly intervals are demonstrated through the components extension within the example and are not part of the current built-in controls; values ​​are identified using year and period. The built-in controls use Vue 3 v-model, and the old virtual dropdown uses virtualList configuration.