﻿# nf-search-form {#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 {#all-controls}

### Complete usage showcase
```vue
<script setup lang="ts">
import { NfSearchForm } from '@94ai-plus/common-ui'
import { ElInput, ElButton, ElSelect, ElOption } from 'element-plus'
import { Search, Calendar } from '@element-plus/icons-vue'

import { ref } from 'vue'
const EXCHANGE_KEY_TYPE = {range:1,split:2}

const nfSearchFormRef = ref()

const columns = ref(6)
const inline = ref(true)
const labelPosition = ref('top')
const changeLabelPosition = (val) => {
  labelPosition.value = val
}

const isCollapseChange = (collapse) => {
   console.log(collapse)
}

const rules = ref({
   normalInputBox: [
    { required: true, message: 'Support verification', trigger: 'change' },
    { min: 3, max: 5, message: 'The length is 3 Arrive 5 characters', trigger: 'change' }
  ],
})

const btnItemList = ref([
  'search',
  'export',
  'reset',
  {
    name: 'Custom configuration button',
    onClick(formData) {
      console.log('Clicked the custom button', formData);
    }
  },
  {
    name: 'Dynamic display buttonshow(formData)',
    show(formData) {
      return formData.showKey === '3'
    }
  }
]);

const submitForm = (formName) => {
  nfSearchFormRef.value?.onNfSearchFormValidate()
};
const resetForm = (formName) => {
  nfSearchFormRef.value?.resetNfSearchFormModel();
};

const testPage = async ({pageNo = 1, pageSize = 10, keyword = ''}) => {
  await new Promise(resolve => setTimeout(resolve, 150))
  const all = Array.from({length:100}, (_,value)=>({value:String(value), label:String(value)})).filter(row=>row.label.includes(keyword))
  return {records:all.slice((pageNo-1)*pageSize,pageNo*pageSize),total:all.length}
}
const searchOption = ref([
  {
    label: 'Ordinary input box',
    prop: 'normalInputBox',
    element: 'el-input',
    width: '200px',
    category: 'Category one',
    isShowColon: true
  },
  {
    label: 'Input boxappend',
    prop: 'normalInputBox2',
    element: 'el-input',
    width: '200px',
    category: 'Category one',
    isShowColon: true,
    append: 'Yuan'
  },
  {
    label: 'Input boxprepend',
    prop: 'normalInputBox3',
    element: 'el-input',
    width: '200px',
    category: 'Category one',
    isShowColon: true,
    prepend: 'beforeprepend'
  },
  {
    label: 'Number input box',
    prop: 'numberInputBox',
    element: 'el-input-number',
    width: '200px',
    category: 'Category one'
  },
  {
    label: 'Normal drop-down',
    prop: 'normalDropdown',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'Give me some advice', value: '1' },
      { label: 'After-sales issues', value: '2' }
    ],
    category: 'Category one'
  },
  {
    label: 'Dynamic displayshow(formData)',
    prop: 'showKey',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'Show your companyform-item', value: '1' },
      { label: 'Show related tasksform-item', value: '2' },
      { label: 'show"Dynamic display button"', value: '3' },
    ],
    category: 'Category one'
  },
  {
    label: 'Owned company',
    prop: 'companyId',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'enterprise1', value: '1' },
      { label: 'enterprise2', value: '2' }
    ],
    show(formData) {
      return formData.showKey === '1'
    },
    category: 'Category one'
  },
  {
    label: 'Task',
    prop: 'taskId',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'Task1', value: '1' },
      { label: 'Task2', value: '2' }
    ],
    show(formData) {
      return formData.showKey === '2'
    },
    category: 'Category one'
  },
  {
    label: 'changePropsdrop down',
    prop: 'changePropsKey',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'changeProps1', value: 1 },
      { label: 'changeProps2', value: 2 }
    ],
    changeProps: ['getOptionsKey'],
    category: 'Category one'
  },
  {
    label: 'getOptionsdrop down',
    prop: 'getOptionsKey',
    element: 'el-select',
    'data-key': 'value',
    getOptions(callback, formData) {

      setTimeout(() => {
        callback([
          { label: 'getOptions1', value: '1' },
          { label: 'getOptions2', value: '2' }
        ])
      }, 150)
    },
    category: 'Category one'
  },
  {
    label: 'Date range configuration (exchangeKey）',
    prop: 'exchangeTime',
    type: 'daterange',
    element: 'el-date-picker',
    category: 'Category 2',
    exchangeKey: { type: EXCHANGE_KEY_TYPE.range, value: ['beginTime', 'endTime'] },
  },
  {
    label: 'Select all drop down',
    prop: 'multipleDropdown',
    element: 'nf-virtual-select',
    multiple: true,
    selectAll: true,
    selectAllText: 'I want them all',
    'data-key': 'value',
    options: [{
      value: 'Options1',
      label: 'golden cake'
    }, {
      value: 'Options2',
      label: 'double skin milk'
    }, {
      value: 'Options3',
      label: 'Oyster Omelette'
    }, {
      value: 'Options4',
      label: 'Dragon Beard Noodles'
    }, {
      value: 'Options5',
      label: 'Peking duck'
    }, {
      value: 'Options6',
      label: 'Dry Fried Beef River'
    }, {
      value: 'Options7',
      label: 'Tingzi porridge'
    }, {
      value: 'Options8',
      label: 'Fried dough sticks'
    }, {
      value: 'Options9',
      label: 'Sticky Rice Chicken'
    }],
    category: 'Category one'
  },
  {
    label: 'Virtual drop-down',
    prop: 'virtualDropdown',
    element: 'el-select',
    'data-key': 'value',
    virtualList: true,
    options: [
      { label: 'Give me some advice', value: '1' },
      { label: 'After-sales issues', value: '2' }
    ],
    category: 'Category one'
  },
  {
    label: 'Paginated virtual drop-down',
    prop: 'pageVirtualDropdown',
    element: 'nf-lazy-select',
    'data-key': 'value',
    virtualList: true,
    request: testPage,
    category: 'Category one'
  },
  {
    label: 'Multiple choice shuttle',
    prop: 'multipleChoiceShuttle',
    element: 'nf-transfer-select',
    initValue: [],
    options:[{
      value: 'Options1',
      label: 'golden cake'
    }, {
      value: 'Options2',
      label: 'double skin milk'
    }, {
      value: 'Options3',
      label: 'Oyster Omelette'
    }, {
      value: 'Options4',
      label: 'Dragon Beard Noodles'
    }, {
      value: 'Options5',
      label: 'Peking duck'
    }],
    category: 'Category one'
  },
  {
    label: 'Cascade',
    prop: 'elCascader',
    element: 'el-cascader',
    'popper-class': 'nf-search-form-demo',
    options: [{
          value: 'zhinan',
          label: 'Guide',
          children: [{
            value: 'shejiyuanze',
            label: 'design principles',
            children: [{
              value: 'yizhi',
              label: 'consistent'
            }]
          }, {
            value: 'daohang',
            label: 'Navigation',
            children: [{
              value: 'cexiangdaohang',
              label: 'side navigation'
            }]
          }]
        }, {
          value: 'zujian',
          label: 'components',
          children: [{
            value: 'basic',
            label: 'Basic',
            children: [{
              value: 'layout',
              label: 'Layout Layout'
            }]
          }]
        }, {
          value: 'ziyuan',
          label: 'Resources',
          children: [{
            value: 'axure',
            label: 'Axure Components'
          }]
        }],
    category: 'Category one'
  },
   {
    label: 'any point in time',
    prop: 'anyPointInTime',
    element: 'el-time-picker',
    'picker-options': {
      start: '08:30',
      step: '00:10',
      end: '18:30'
    },
    category: 'Category 2'
  },
 {
    label: 'any time interval',
    prop: 'anyTimeInterval',
    element: 'el-time-picker',
    'is-range': true,
    'picker-options': {
      start: '08:30',
      step: '00:10',
      end: '18:30'
    },
    category: 'Category 2'
  },
 {
    label: 'Year selection',
    prop: 'year',
    type: 'year',
    element: 'el-date-picker',
    category: 'Category 2'
  },
   {
    label: 'half year option',
    prop: 'halfyear',
    element: 'nf-half-year-picker',
    category: 'Category 2'
  },
  {
    label: 'quarter selection',
    prop: 'quarter',
    element: 'el-date-picker',
    type: 'quarter',
    category: 'Category 2'
  },
 {
    label: 'Month selection',
    prop: 'month',
    type: 'month',
    element: 'el-date-picker',
    category: 'Category 2'
  },
 {
    label: 'Week number selection',
    prop: 'week',
    type: 'week',
    element: 'el-date-picker',
    category: 'Category 2'
  },
 {
    label: 'date selection',
    prop: 'date',
    type: 'date',
    element: 'el-date-picker',
    category: 'Category 2'
  },
  {
    label: 'date range',
    prop: 'daterange',
    type: 'daterange',
    element: 'el-date-picker',
    category: 'Category 2'
  },
   {
    label: 'Weekly interval',
    prop: 'weekrange',
    element: 'nf-week-range-picker',
    category: 'Category 2'
  },
 {
    label: 'month range',
    prop: 'monthrange',
    type: 'monthrange',
    element: 'el-date-picker',
    category: 'Category 2'
},
  {
    label: 'Quarterly range',
    prop: 'quarterrange',
    element: 'el-date-picker',
    type: 'quarterrange',
    category: 'Category 2'
  },
   {
    label: 'half-year interval',
    prop: 'halfyearrrange',
    element: 'nf-half-year-range-picker',
    category: 'Category 2'
  },
    {
    label: 'annual range',
    prop: 'yearrrange',
    element: 'el-date-picker',
    type: 'yearrange',
    category: 'Category 2'
  },
  {
    label: 'date and time',
    prop: 'datetime',
    type: 'datetime',
    element: 'el-date-picker',
    category: 'Category 2'
  },
  {
    label: 'Date and time range',
    prop: 'datetimerange',
    type: 'datetimerange',
    element: 'el-date-picker',
    category: 'Category 2'
  },
  {
    label: 'fixed time',
    prop: 'fixedtime',
    element: 'el-time-select',
    'picker-options': {
      start: '08:30',
      step: '00:10',
      end: '18:30'
    },
    category: 'Category three'
  },
 {
    label: 'fixed time interval',
    prop: 'fixedTimeInterval',
    element: 'el-time-select',
    type: 'datetimerange',
    'picker-options': {
      start: '08:30',
      step: '00:10',
      end: '18:30'
    },
    category: 'Category three'
  },
  {
    label: 'Number interval',
    prop: 'numberRange',
    element: 'number-range',
    initValue: [],
    min: 0,
    category: 'Category three',
    class: 'number-range-box',
    width: 334,
    inputSlot: {
      append: 'repeatCountAppend',
      doubleAppend: 'doubleRepeatCountAppend',
      doubleSegment: 'doubleRepeatCountAppendSegment',
    },
    tag: 'el-input',
    events: {
       input: (val) => {
          let flag = false
          const val0 = val[0]?.replace(/[^0-9]/g, '')
          const val1 = val[1]?.replace(/[^0-9]/g, '')
          if (val[0] && val0 != val[0]) {
            flag = true
          }
          if (val[1] && val1 != val[1]) {
            flag = true
          }
          if (flag) nfSearchFormRef.value?.setNfSearchFormModel({numberRange:[val0,val1]})
        }
    }
  },
  {
    label: 'Customizeslot',
    prop: 'custumSlot',
    slot: 'custumSlot',
    category: 'Category four',
  },
])

const searchForm = ref({
  custumSlot: ''
})

const searchFn = (data) => {
  console.log(data)
  searchForm.value = {
    ...searchForm.value,
    ...data
  }
}
const resetFieldsFn = () => {
  searchForm.value.custumSlot = ''
}
const exportFn = (data) => {
  console.log(data)
}

</script>

<template>
<div class='nf-search-form-demo1 nf-search-form-demo-all'>

    <nf-search-form
        :form-options="searchOption"
        :rules='rules'

        :columns='columns'
        @isCollapseChange="isCollapseChange"

        :btn-items="btnItemList"
        @onSearch="searchFn"
        @onExport="exportFn"
        @onResetFields='resetFieldsFn'

        :closable='true'
        storage-key='nf-search-form-test1-en'
        :column-edit='true'
        check-mode='dialog'

        :inline='inline'
        :label-position='labelPosition'
        btn-model='inline'
        btn-box-label='Custom buttonslotcustomized content + Default button:'

        ref='nfSearchFormRef'
     >

        <template #repeatCountAppend><span >Not</span></template>
        <template #doubleRepeatCountAppend><span >In</span></template>
        <template #doubleRepeatCountAppendSegment><span>→</span></template>

       <template #custumSlot="{formData}"><el-input

         v-model="formData.custumSlot"
         placeholder='Please enter'
         clearable
         :prefix-icon="Search"
         :suffix-icon="Calendar"
         style='display:inline-block;width: 100%'
       /></template>

       <template #btnBox><span  style='align-self: self-start;margin-right: 10px;'>
         <div>
             <el-button size="small" @click='inline=!inline'>Switch block level</el-button>
             <el-button size="small" @click='columns++'>Increase the number of folds</el-button>
             <el-button size="small" @click='columns=Math.max(1,columns-1)'>Reduce the number of folds</el-button>
         </div>
         <div>
             <el-button size="small" @click='changeLabelPosition("top")'>Form item prefix upwards</el-button>
             <el-button size="small" @click='changeLabelPosition("right")'>Form item prefix to the right</el-button>
         </div>
         <div>
             <el-button size="small" @click='changeLabelPosition("left")'>Form item prefix left</el-button>
            <el-button size="small" type="primary" @click="submitForm()">form validation</el-button>
            <el-button size="small" @click="resetForm()">reset checksum</el-button>
         </div>
       </span></template>
    </nf-search-form>
  </div>

<pre class="search-result" aria-live="polite">{{ JSON.stringify(searchForm, null, 2) }}</pre>
</template>

<style scoped>
.search-result {max-height:240px;overflow:auto;white-space:pre-wrap}
:deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0 16px}
:deep(.nf-search-form-item) {max-width:100%;margin-right:0}
:deep(.el-form-item__content) {min-width:0;flex-wrap:wrap;gap:8px}
:deep(.el-divider--horizontal) {margin:40px 0} :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
@media(max-width:600px){:deep(.nf-search-form-control){max-width:100%!important} :deep(.el-form-item){flex-direction:column;align-items:stretch} :deep(.el-form-item__label){width:auto!important;justify-content:flex-start}}

</style>
```

## Block / inline form layouts {#basic}

### Block / inline form layouts
```vue
<script setup lang="ts">
import { NfSearchForm } from '@94ai-plus/common-ui'
import { ElDivider } from 'element-plus'
import { Search, Calendar } from '@element-plus/icons-vue'

import { ref } from 'vue';

function deepClone(source) {
  if (!source && typeof source !== 'object') {
    throw new Error('error arguments shallowClone')
  }
  const targetObj: Record<string, any> | Record<string, any>[] = source.constructor === Array ? [] : {}
  Object.keys(source).forEach((keys) => {
    if (source[keys] && typeof source[keys] === 'object') {
      targetObj[keys] = source[keys].constructor === Array ? [] : {}
      targetObj[keys] = deepClone(source[keys])
    } else {
      targetObj[keys] = source[keys]
    }
  })
  return targetObj
}

const searchForm = ref({})

const searchFn = (data) => {
  searchForm.value = {
    ...searchForm.value,
    ...data
  }
}
const resetFieldsFn = () => {
  searchForm.value.custumSlot = ''
}
const exportFn = (data) => {
  console.log(data)
}

const searchOption2 = ref([
  {
    label: 'Ordinary input box',
    prop: 'normalInputBox',
    element: 'el-input',
    width: '200px',
    category: 'Category one'
  },
  {
    label: 'Number input box',
    prop: 'numberInputBox',
    element: 'el-input-number',
    width: '200px',
    category: 'Category one'
  },
  {
    label: 'Normal drop-down',
    prop: 'normalDropdown',
    element: 'el-select',
    'data-key': 'value',
    options: [
      { label: 'Give me some advice', value: '1' },
      { label: 'After-sales issues', value: '2' }
    ],
    category: 'Category one'
  },
  {
    label: 'Virtual drop-down',
    prop: 'virtualDropdown',
    element: 'el-select',
    'data-key': 'value',
    virtualList: true,
    options: [
      { label: 'Give me some advice', value: '1' },
      { label: 'After-sales issues', value: '2' }
    ],
    category: 'Category one'
  },
])

const searchOption5 = ref(deepClone(searchOption2.value));
const searchOption6 = ref(deepClone(searchOption2.value));
const searchOption7 = ref(deepClone(searchOption2.value));
const searchOption8 = ref(deepClone(searchOption2.value));
const searchOption9 = ref(deepClone(searchOption2.value));

</script>

<template>
<div class='nf-search-form-demo2'>
    <div class='nf-search-form-demo-inline-inline'>
      <nf-search-form
        storage-key='nf-search-form-test2-en'
        :columns='2'
        :form-options="searchOption2"
        :btn-items="['search', 'export', 'reset']"
        @onSearch="searchFn"
        @onExport="exportFn"
        @onResetFields='resetFieldsFn'
        label-position='right'
        :column-edit='true'
      />
     </div>

     <el-divider>Action buttonblockMode: toplabel inlinemode </el-divider>

     <el-divider>Action buttonblockMode: belowlabel blockmode </el-divider>

      <div class='nf-search-form-demo-inline-inline'>
         <nf-search-form
          storage-key='nf-search-form-test3-en'
          :columns='2'
          :form-options="searchOption5"
          :btn-items="['search', 'export', 'reset']"
          @onSearch="searchFn"
          @onExport="exportFn"
          @onResetFields='resetFieldsFn'
          :column-edit='true'
        />
      </div>

     <el-divider>Action buttonblockMode: topform inlinemode </el-divider>

     <el-divider>Action buttonblockMode: belowform blockmode </el-divider>

      <div class='nf-search-form-demo-inline-inline'>
         <nf-search-form
          storage-key='nf-search-form-test4-en'
          :columns='2'
          :form-options="searchOption6"
          :btn-items="['search', 'export', 'reset']"
          @onSearch="searchFn"
          @onExport="exportFn"
          :inline='false'
          @onResetFields='resetFieldsFn'
          :column-edit='true'
        />
      </div>

     <el-divider style='font-weight: 700;'>The above operation buttonsblockmode(blockModal default buttons and custom buttonsslot independent line) </el-divider>

     <br />

     <el-divider style='font-weight: 700;'>The following action buttonsinlinemode (inlineModal default buttons and custom buttonsslot extra as lastform-itempackage)</el-divider>

    <div class='nf-search-form-demo-inline-inline'>
       <nf-search-form
         storage-key='nf-search-form-test5-en'
        :columns='3'
        :form-options="searchOption7"
        :btn-items="['search', 'export', 'reset']"
        @onSearch="searchFn"
        @onExport="exportFn"
        @onResetFields='resetFieldsFn'
        btn-model='inline'
        label-position='right'
        :column-edit='true'
      />
    </div>

     <el-divider>Action buttoninlineMode: toplabel inlinemode </el-divider>

     <el-divider>Action buttoninlineMode: belowlabel blockmode </el-divider>

    <div class='nf-search-form-demo-inline-block'>
      <nf-search-form
         storage-key='nf-search-form-test6-en'
        :columns='3'
        :form-options="searchOption8"
        :btn-items="['search', 'export', 'reset']"
        @onSearch="searchFn"
        @onExport="exportFn"
        @onResetFields='resetFieldsFn'
        btn-model='inline'
        :column-edit='true'
      />
    </div>

     <el-divider>Action buttoninlineMode: topform inlinemode </el-divider>

     <el-divider>Action buttoninlineMode: belowform blockmode </el-divider>

     <div class='nf-search-form-demo-inline-block'>
      <nf-search-form
         storage-key='nf-search-form-test7-en'
        :columns='3'
        :form-options="searchOption9"
        :btn-items="['search', 'export', 'reset']"
        @onSearch="searchFn"
        @onExport="exportFn"
        @onResetFields='resetFieldsFn'
        btn-model='inline'
        :inline='false'
        :column-edit='true'
      />
    </div>
  </div>

<pre class="search-result" aria-live="polite">{{ JSON.stringify(searchForm, null, 2) }}</pre>
</template>

<style scoped>
.search-result {max-height:240px;overflow:auto;white-space:pre-wrap}
:deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0 16px}
:deep(.nf-search-form-item) {max-width:100%;margin-right:0}
:deep(.el-form-item__content) {min-width:0;flex-wrap:wrap;gap:8px}
:deep(.el-divider--horizontal) {margin:40px 0} :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
@media(max-width:600px){:deep(.nf-search-form-control){max-width:100%!important} :deep(.el-form-item){flex-direction:column;align-items:stretch} :deep(.el-form-item__label){width:auto!important;justify-content:flex-start}}

</style>
```

## Simplest usage {#linked}

### Simplest usage
```vue
<script setup lang="ts">
import { NfSearchForm } from '@94ai-plus/common-ui'
import { ElDivider } from 'element-plus'
import { Search, Calendar } from '@element-plus/icons-vue'

import { ref } from 'vue';

function deepClone(source) {
  if (!source && typeof source !== 'object') {
    throw new Error('error arguments shallowClone')
  }
  const targetObj: Record<string, any> | Record<string, any>[] = source.constructor === Array ? [] : {}
  Object.keys(source).forEach((keys) => {
    if (source[keys] && typeof source[keys] === 'object') {
      targetObj[keys] = source[keys].constructor === Array ? [] : {}
      targetObj[keys] = deepClone(source[keys])
    } else {
      targetObj[keys] = source[keys]
    }
  })
  return targetObj
}

const searchForm = ref({})

const searchFn = (data) => {

  searchForm.value = {
    ...searchForm.value,
    ...data
  }
}

const searchOption3 = ref([
  {
    label: 'Ordinary input box',
    prop: 'normalInputBox',
    element: 'el-input',
    width: '200px',
    category: 'Category one'
  },
  {
    label: 'Number input box',
    prop: 'numberInputBox',
    element: 'el-input-number',
    width: '200px',
    category: 'Category one'
  },
])
const searchOption4 = [...searchOption3.value, {
    label: 'Number input box',
    prop: 'numberInputBox2',
    element: 'el-input-number',
    width: '200px',
    category: 'Category one'
}]

const searchOption12 = ref(deepClone(searchOption3.value))
const searchOption13 = ref(deepClone(searchOption3.value))
const searchOption14 = ref(deepClone(searchOption3.value))
const searchOption15 = ref(deepClone(searchOption3.value))
const searchOption16 = ref(deepClone(searchOption3.value))

const searchOption17 = ref(deepClone(searchOption4))

</script>

<template>
<div class='nf-search-form-demo3'>
       <div class='nf-search-form-demo-inline-inline'>
        <nf-search-form
          storage-key='nf-search-form-test8-en'
          :form-options="searchOption3"
          @onSearch="searchFn"
          :btn-items="['search']"
          btn-model='inline'
          label-position='left'
          :column-edit='true'
          check-mode='dialog'
        />
     </div>
     <el-divider>No folds on top + (btn-model=inline) + (form=inline) + (labelPosition=left)</el-divider>
     <div class='nf-search-form-demo-inline-inline'>
        <nf-search-form
          storage-key='nf-search-form-test9-en'
          :form-options="searchOption12"
           @onSearch="searchFn"
          :btn-items="['search']"
           btn-model='inline'
           :column-edit='true'
           check-mode='dialog'
        />
     </div>
     <el-divider>No folds on top + (btn-model=inline) + (form=inline) + (labelPosition=top)</el-divider>
      <div class='nf-search-form-demo-inline-inline'>
        <nf-search-form
          storage-key='nf-search-form-test10-en'
          :columns='2'
          :form-options="searchOption13"
          @onSearch="searchFn"
          :btn-items="['search']"
          btn-model='inline'
          label-position='left'
          :column-edit='true'
           check-mode='dialog'
        />
     </div>
     <el-divider>There are folds on top + (btn-model=inline) + (form=inline) + (labelPosition=left)</el-divider>
     <div class='nf-search-form-demo-inline-inline'>
        <nf-search-form
          storage-key='nf-search-form-test11-en'
          :columns='2'
          :form-options="searchOption14"
          @onSearch="searchFn"
          :btn-items="['search']"
           btn-model='inline'
           :column-edit='true'
           check-mode='dialog'
        />
     </div>
     <el-divider>There are folds on top + (btn-model=inline) + (form=inline) + (labelPosition=top)</el-divider>
     <div style='display: flex'>
       <nf-search-form
         storage-key='nf-search-form-test12-en'
        :form-options="searchOption15"
        @onSearch="searchFn"
        :btn-items="['search']"
        btn-model='inline'
        :inline='false'
        :column-edit='true'
         check-mode='dialog'
       />
       <nf-search-form
         storage-key='nf-search-form-test13-en'
        :form-options="searchOption4"
        @onSearch="searchFn"
        :btn-items="['search']"
        label-position="right"
        btn-model='inline'
        :inline='false'
        :column-edit='true'
        check-mode='dialog'
       />
     </div>
     <el-divider>No folds on top + (btn-model=inline) + (form=block) + (labelPosition=top/right)</el-divider>
     <br />
     <el-divider>There are folds below + (btn-model=inline) + (form=block) + (labelPosition=top/right)</el-divider>
      <div style='display: flex'>
       <nf-search-form
        storage-key='nf-search-form-test14-en'
       :columns='2'
        :form-options="searchOption16"
        @onSearch="searchFn"
        :btn-items="['search']"
        btn-model='inline'
        :inline='false'
        :column-edit='true'
        check-mode='dialog'
       />
       <nf-search-form
         storage-key='nf-search-form-test15-en'
        :columns='3'
        :form-options="searchOption17"
        @onSearch="searchFn"
        :btn-items="['search']"
        label-position="right"
        btn-model='inline'
        :inline='false'
        :column-edit='true'
        check-mode='dialog'
       />
     </div>
  </div>

<pre class="search-result" aria-live="polite">{{ JSON.stringify(searchForm, null, 2) }}</pre>
</template>

<style scoped>
.search-result {max-height:240px;overflow:auto;white-space:pre-wrap}
:deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0 16px}
:deep(.nf-search-form-item) {max-width:100%;margin-right:0}
:deep(.el-form-item__content) {min-width:0;flex-wrap:wrap;gap:8px}
:deep(.el-divider--horizontal) {margin:40px 0} :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
@media(max-width:600px){:deep(.nf-search-form-control){max-width:100%!important} :deep(.el-form-item){flex-direction:column;align-items:stretch} :deep(.el-form-item__label){width:auto!important;justify-content:flex-start}}

</style>
```

## NfSearchFormItemOption {#item-options}

| parameters | Description | Type |
| --- | --- | --- |
| prop | Field path, associated form data. | string |
| label | Field labels can be dynamically calculated based on form data. | string / Function |
| element / component | Built-in names or custom Vue 3 components. | string / Component |
| initValue | Field initial value. | unknown |
| options | Static options. | object[] |
| getOptions | Asynchronous option callback, done returns list; supports Promise. | (done, model) =&gt; void / Promise |
| changeProps | Dependent fields that are reloaded after the current value changes. | string[] |
| exchangeKey | Submit data conversion; type=1 splits the interval, type=2 splits the string. | { type: number; value: string / string[] } |
| show | Dynamic display; when false, the field is not rendered. | boolean / Function |
| hidden | Always shown but does not participate in collapse. | boolean |
| destroy / destory | Dynamically destroy fields, compatible with old spellings. | boolean / Function |
| initHidden | It is not displayed initially and can be restored in field settings. | boolean |
| slot / labelSlot / tooltip.slot | Field content, label, and prompt slot name. | string |
| inputSlot | Input box and slot mapping at both ends of the interval. | object |
| events | Input control event; change receives the current value, retained parameters, and form data. | object |
| rules / required | Field validation rules and required status. | object / boolean |
| width / labelWidth | Content and label width. | string / number |
| category | Group name in field settings. | string |

## Attribute {#props}

| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| formOptions | [json data] Rendering form frame data | NfSearchFormItemOption[] | — | [] |
| columns | Fold 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 icon | string | — | 'icon-xiangshang2' |
| downIcon | [Collapse function] Button to close icon | string | — | '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 not | boolean | — | false |
| expandBtnIcon | Expand button icon | string | — | — |
| expandBtnType | Expand button type | string | — | default |
| expandBtnPlain | Expand button plain | boolean | — | false |
| expandBtnSize | Expand button size | string | mini/small/medium | — |
| expandBtnRound | Expand button round | boolean | — | false |
| expandBtnCircle | Expand buttoncircle | boolean | — | false |
| expandBtnLoading | Expand button loading | boolean | — | false |
| expandBtnDisabled | Expand buttondisabled | boolean | — | false |
| expandBtnTooltipDesc | Expand button tooltip description | string | — | Follow language pack |
| shrinkBtnTooltipDesc | Collapse button tooltip description | string | — | Follow language pack |
| defaultFormData | Initialize the form data object; Vue 3 two-way binding uses v-model. | object | — | {} |
| rules | [Form function] Verification rules | object | — | 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 label | string | — | undefined |
| hideRequiredAsterisk | [Form function] Whether to hide the red asterisk next to the label of required fields | boolean | — | false |
| showMessage | [Form function] Whether to display verification error information | boolean | — | true |
| inlineMessage | [Form function] Whether to display verification information inline | boolean | — | false |
| statusIcon | [Form function] Whether to display the verification result feedback icon in the input box | boolean | — | false |
| validateOnRuleChange | [Form function] Whether to trigger a verification immediately after the rules attribute is changed | boolean | — | true |
| size | Form and button sizes; compatible with mini→small, medium→default. | string | mini/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 wraps | string | block/inline | 'block' |
| labelPosition | [Form function] Label position | string | — | 'top' |
| inline | 【Form function】Inline | boolean | — | true |
| btnBoxLabel | Customize the label of the button slot | string | — | '' |
| closable | Whether to display [Control form column item hidden icon], used to control hidden form column item | boolean | — | false |
| columnEdit | Whether to display the [Column Edit Button] to enable displaying and hiding form column items | boolean | — | false |
| checkMode | Set the interactive mode of the column editing function | string | dialog/drawer | 'drawer' |
| storageKey | The IndexedDB cache key set by the field; multiple instances of the same page should use independent keys. | string | - | nf-search-form-columns-cached-key-${routeName} |
| priority | Cache echo priority, handle the echo relationship between item.initHidden, form.showColumn and IndexedDB.cache | string | cached/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 |
| checkBtnIcon | Column edit button icon | string | - | - |
| checkBtnType | Column edit button type | string | - | - |
| checkBtnPlain | Column edit button plain | boolean | - | true |
| checkBtnSize | Column edit button size | mini/small/medium | - | — |
| checkBtnRound | column edit button round | boolean | - | false |
| checkBtnCircle | Column edit button circle | boolean | - | false |
| checkBtnLoading | Column edit button loading | boolean | - | false |
| checkBtnDisabled | Column edit button disabled | boolean | - | false |
| checkBtnClass | Column edit button class | string | - | - |
| columnDisplayBtnText | Column edit button tooltip text | string | - | Follow language pack |
| moreDialogTitle | Column editing dialog/drawer mode-&gt;pop-up box title | string | — | Follow language pack |
| columnCheckCancelButtonText | Column edit dialog/drawer mode cancel button text | string | - | 'Cancel' |
| columnCheckConfirmButtonText | Column editing dialog/drawer mode determine button text | string | - | 'OK' |
| columnCheckBasicFieldDesc | Default category title | string | - | Follow language pack |
| columnCheckTabs | Column editing drawer mode-&gt;Control the data of rendering tabs | ITabItem[] | - | - |
| columnCheckCurrentTab | Column editing drawer mode -&gt; currently displayed tab name | string | - | - |
| selectEmptyWarningTips | Set 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 |
| columnCheckSearchPlaceholder | Column editing drawer mode-&gt;search box placeholder | string | - | 'Search' |
| columnCheckFixedLeftDesc | Compatible fields; search form field settings do not provide fixed column functionality. | string | - | Follow language pack |
| columnCheckClearDesc | Column editing drawer mode -&gt; clear description | string | - | Follow language pack |
| columnCheckNoFixedDesc | Compatible fields; search form field settings do not provide fixed column functionality. | string | - | Follow language pack |
| columnCheckGetCheckedLengthDesc | Column editing drawer mode-&gt;selected description | (length) =&gt; string | - | (length) =&gt; 'selected (' + length + '）' |
| columnCheckGetAllCheckDesc | Column editing drawer mode-&gt;select all description | (length) =&gt; string | - | (length) =&gt; 'Select all (' + length + '） |
| moreDialogWidth | Column editing dialog mode-&gt;pop-up box | string | — | '600px' |
| modalAppendToBody | Column editing dialog mode -&gt; 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 |
| modal | Column editing dialog mode-&gt;Does the pop-up box require a mask layer? | boolean | — | true |
| fullscreen | Column editing dialog mode -&gt; Whether the pop-up box is a full-screen Dialog | boolean | — | false |
| top | Column editing dialog mode-&gt;margin-top value in pop-up dialog CSS | string | — | '15vh' |
| appendToBody | Column editing dialog mode -&gt; Whether the pop-up Dialog itself is inserted into the body element. Nested Dialog must specify this attribute and set the value to true | boolean | — | false |
| lockScroll | Column editing dialog mode -&gt; Whether the pop-up box locks the body scroll when the Dialog appears | boolean | — | true |
| customClass | Column editing dialog mode-&gt;Custom class name of pop-up Dialog | string | — | ' |
| closeOnlickModal | Column editing dialog mode -&gt; Whether the pop-up box can close the Dialog by clicking modal | boolean | — | true |
| closeOnPressEscape | Column editing dialog mode -&gt; Whether the pop-up box can close the Dialog by pressing ESC | boolean | — | true |
| showClose | Column editing dialog mode -&gt; whether the pop-up box displays a close button | boolean | — | true |
| beforeClose | Column editing dialog mode -&gt; callback before the pop-up box is closed, which will suspend the closing of the Dialog | Function | — | undefined |
| center | Column editing dialog mode -&gt; Whether the pop-up box uses a centered layout for the head and bottom | boolean | — | false |
| destroyOnClose | Column editing dialog mode-&gt;Destroy the elements in the Dialog when the pop-up box is closed | boolean | — | false |
| btnItems | 【Default Button】Shows the default buttons | string[]/IBtnItems[] / 'search'、'export'、'reset'、'' | — | '' |
| reverseBtnSlot | [Default Button] Reverse the order of custom button slots and default buttons | boolean | — | false |
| exportBtnIcon | [Export button] icon | string | — | '' |
| exportBtnType | [Export button] type | string | — | 'primary' |
| exportBtnPlain | [Export button] Hollow out | boolean | — | true |
| exportBtnSize | [Export Button] Size | mini/small/medium | — | — |
| exportBtnRound | [Export button] Rounded corners | boolean | — | false |
| exportBtnCircle | [Export Button] Circle | boolean | — | false |
| exportBtnLoading | 【Export button】Loading | boolean | — | false |
| exportBtnDisabled | [Export button] disabled | boolean | — | false |
| exportBtnText | [Export button] text | string | — | Follow language pack |
| exportBtnClass | [Export button] class name | string | — | '' |
| queryBtnIcon | [Query button] icon | string | — | '' |
| queryBtnType | [Query Button] Type | string | — | 'primary' |
| queryBtnPlain | [Query Button] Hollow | boolean | — | true |
| queryBtnSize | 【Query Button】Dimensions | mini/small/medium | — | — |
| queryBtnRound | [Query Button] Rounded Corners | boolean | — | false |
| queryBtnCircle | [Query Button] Circle | boolean | — | false |
| queryBtnLoading | 【Query Button】Loading | boolean | — | false |
| queryBtnDisabled | [Query Button] Disabled | boolean | — | false |
| queryBtnText | 【Query Button】Text | string | — | Follow language pack |
| queryBtnClass | [Query button] Class name | string | — | '' |
| resetBtnIcon | [Reset button] icon | string | — | '' |
| resetBtnType | [Reset Button] Type | string | — | 'default' |
| resetBtnPlain | 【Reset Button】Skeleton | boolean | — | true |
| resetBtnSize | [Reset Button] Size | mini/small/medium | — | — |
| resetBtnRound | [Reset Button] Rounded corners | boolean | — | false |
| resetBtnCircle | [Reset Button] Round | boolean | — | false |
| resetBtnLoading | 【Reset Button】Loading | boolean | — | false |
| resetBtnDisabled | [Reset Button] Disabled | boolean | — | false |
| resetBtnText | [Reset button] text | string | — | Follow language pack |
| resetBtnClass | [Reset button] class name | string | — | '' |
| modelValue | Form data; use v-model two-way binding. | SearchFormModel | — | undefined |
| requiredValidate | Whether to verify before querying and exporting. | boolean | — | false |
| components | Extended form control mapping. | Record&lt;string, Component&gt; | — | undefined |
| viewIdentity | View or user configuration ID. | string | — | undefined |
| isMvc | Use external data schema. | boolean | — | false |

## Attribute IBtnItems {#button-options}

| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| btnType | [Button type] ('search', 'export', 'reset', '', undefined) | string | Optional | undefined |
| name | Button name | string | Optional | undefined |
| type | nf-button attribute | - | Optional | Attribute.queryBtnType |
| icon | nf-button attribute | - | Optional | Attribute.queryBtnIcon |
| plain | nf-button attribute | - | Optional | Attribute.queryBtnPlain |
| size | nf-button attribute | - | Optional | Attribute.size |
| round | nf-button attribute | - | Optional | Attribute.queryBtnRound |
| circle | nf-button attribute | - | Optional | Attribute.queryBtnCircle |
| loading | nf-button attribute | - | Optional | Attribute.queryBtnLoading |
| disabled | nf-button attribute | - | Optional | Attribute.queryBtnDisabled |
| class | className | string、object | Optional | undefined |
| validate | Whether to trigger the onClick event after verifying the form | boolean | Optional | false |
| onClick | click event | (formData: Current form data) =&gt; void | Optional | undefined |
| show | Whether to display | (formData: Current form data) =&gt; boolean | Optional | undefined |

## Event {#events}

| event name | Description | callback parameters |
| --- | --- | --- |
| open | Column editing dialog mode -&gt; callback for popup opening | — |
| opened | Column editing dialog mode -&gt; callback at the end of pop-up opening animation | — |
| close | Column editing dialog mode-&gt;callback for popup closing | — |
| closed | Column editing dialog mode -&gt; callback at the end of the pop-up closing animation | — |
| changeTab | Column editing drawer mode-&gt;switch multiple drawer tabs | name |
| cancel | Column editing drawer mode -&gt; close drawer | Event |
| onSearch | Fired when a query is clicked or a query method is called, and the data has been converted by exchangeKey. | (data, refresh: boolean) |
| onExport | Export callback, passing in the converted form data. | data: SearchFormModel |
| onResetFields | Fires after resetting the form. | — |
| onChange | Form data changes. | model: SearchFormModel |
| itemsChange | Field display list changes. | items: string[] |
| update:modelValue | for v-model. | model: SearchFormModel |
| update:showItems | for v-model:showItems. | items: string[] |
| isCollapseChange | The form expansion state changes; true means expansion. | expanded: boolean |
| options-error | Asynchronous options loading failed. | (error, prop: string) |

## Slot {#slots}

| Name | Description |
| --- | --- |
| btnBox | Compatible with ai-search-form extended operation button |
| dialogTitle | Column editing dialog mode-&gt;pop-up box title |
| dialogFooter | Column editing dialog mode-&gt;pop-up footer |
| columCheckTitle | Column editing drawer mode-&gt;pop-up title |
| columCheckFooter | Column editing drawer mode-&gt;pop-up footer |
| NfSearchFormItemOption.tooltip.slot | Customize the icon tooltip of each SearchFormItem |
| NfSearchFormItemOption.slot | Customize each SearchFormItem |
| NfSearchFormItemOption.inputSlot | Customize prepend/append/prefix/suffix and slots at both ends of the digital range. |
| NfSearchFormItemOption.labelSlot | Customize field labels. |

## Expose {#methods}

| Name | Type | Description |
| --- | --- | --- |
| localShowItems | string[] | Column props displayed by column editing |
| getFormData | Function | Get real-time data from the form (deep copy) |
| syncLocalShowColumnToCookies | Function | Column editing sync component to IndexedDB |
| syncCookiesToLocalShowColumn | Function | Column editor synchronizes IndexedDB to component localShowItems |
| syncShowItemToInitHidden | Function | showItems synchronizes props.formOptions[i].initHidden |
| hiddenNfSearchFormItemOptionField | Function | Column editing hides a form column |
| refreshNfSearchFormModel | Function | Refresh form data mode after column edit operation |
| renderSearchFormItemOptions | NfSearchFormItemOption[] | Render form items |
| resetNfSearchFormModel | Function | reset |
| onNfSearchFormValidate | Function | Verify |
| onNfSearchFormSearch | Function | Search |
| onNfSearchFormExport | Function | Export |
| nfSearchFormModel | Record | form data |
| nfSearchFormRef | Ref | form ref |
| columnCheckNfDrawer | Ref | Column editor nf-drawer ref |
| configNfSearchItemVisibleDialog | Boolean | Column editing controls dialog/drawer display/hide |
| syncCookiesToTableColumn | Function | syncCookiesToLocalShowColumn |
| setNfSearchFormModel(model) | Function | Combine form values by field path. |
| clearColumnEditCached() | Function | Clear field settings cache. |
| clearDragCached() | Function | Clear drag cache. |

## Instructions for use {#configuration-notes}

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.
