nf-conditions
Condition groups use OR between groups and AND between their rules. Supports add/remove, condition/rule limits, nested validation paths and all nf-rules options.
Examples
Add conditions
Loading example…
Add conditions
Restore conditions
Loading example…
Restore conditions
Custom external form
Loading example…
Custom external form
Props
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
|---|---|---|---|---|
conditions | Condition data for display and retrieval; each entry contains a rules array. | { key?: string; rules?: RuleItem[] }[] | — | undefined |
conditionLimit | Maximum number of entries; 0 means unlimited. | number | — | 0 |
hiddenConditionAdd | Hide the add action. | boolean | — | false |
hiddenConditionReduce | Hide the remove action. | boolean | — | false |
conditionsKey | Custom data field name. | string | — | 'conditions' |
initAddRuleData | Initialize a rule when a condition group is added. | boolean | — | true |
conditionDesc | Customize the “Condition” text. | string | — | Condition |
addConditionDesc | Customize the “+ Add condition” text. | string | — | + Add condition |
deleteConditionDesc | Customize the “- Delete condition” text. | string | — | - Delete condition |
outLogicMergeDesc | Customize the “or” text. | string | — | or |
rules | Compatibility prop; place each group’s rules in its rulesKey field under conditions. | RuleItem[] | — | undefined |
showRuleTypes | Allowed rule types: enum values, original Chinese names or localized labels; an empty array allows all. | (string | number)[] | — | [] |
defaultAddData | Default data object when adding a rule. | RuleItem | — | undefined |
defaultAddType | Default rule type when adding a rule. | string | number | — | undefined |
initAddData | Initialize an entry when data is absent or empty. | boolean | — | true |
size | Control size; mini maps to small and medium to default. | string | mini / small / medium / default / large | 'mini' |
tag | Custom form container tag; use div inside an external form to avoid nested forms. | string | — | 'el-form' |
validPrefix | Custom prefix for form validation paths. | string | — | '' |
rulesKey | Custom data field name. | string | — | 'rules' |
limit | Maximum number of entries; 0 means unlimited. | number | — | 0 |
disabled | Whether to disable the component. | boolean | — | false |
conditionDisabled | Disable the rule-type selector. | boolean | — | false |
hiddenAdd | Hide the add action. | boolean | — | false |
hiddenReduce | Hide the remove action. | boolean | — | false |
disables | Disable controls by rule type; array entries follow the controls in that rule. | Record<string, boolean[]> | — | undefined |
showMessage | Whether to show validation error messages. | boolean | — | true |
inlineMessage | Display validation messages inline. | boolean | — | false |
statusIcon | Whether to show validation status icons. | boolean | — | false |
规则类型 | Customize enum values for 规则类型; defaults to the exported enum with the same name. | Record<string, string | number> | — | 规则类型 |
规则类型下拉 | Customize 规则类型下拉 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
规则类型下拉合并策略 | Merge strategy for 规则类型下拉: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
操作类型 | Customize enum values for 操作类型; defaults to the exported enum with the same name. | Record<string, string | number> | — | 操作类型 |
操作类型下拉 | Customize 操作类型下拉 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
操作类型下拉合并策略 | Merge strategy for 操作类型下拉: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
计算类型 | Customize enum values for 计算类型; defaults to the exported enum with the same name. | Record<string, string | number> | — | 计算类型 |
计算类型下拉 | Customize 计算类型下拉 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
计算类型下拉合并策略 | Merge strategy for 计算类型下拉: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
日期类型 | Customize enum values for 日期类型; defaults to the exported enum with the same name. | Record<string, string | number> | — | 日期类型 |
日期类型下拉 | Customize 日期类型下拉 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
日期类型下拉合并策略 | Merge strategy for 日期类型下拉: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
外呼状态 | Customize enum values for 外呼状态; defaults to the exported enum with the same name. | Record<string, string | number> | — | 外呼状态 |
外呼状态下拉 | Customize 外呼状态下拉 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
外呼状态下拉合并策略 | Merge strategy for 外呼状态下拉: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
意向标签集合 | Customize 意向标签集合 data for localization or custom dropdown options. | DropDownItem[] | — | undefined |
意向标签集合合并策略 | Merge strategy for 意向标签集合: income uses incoming items; incomePatch patches matching incoming values with defaults; defaultPatch patches matching defaults with incoming values. | MergeStrategy | income / incomePatch / defaultPatch | 'defaultPatch' |
logicMergeDesc | Customize the “and” text. | string | — | and |
placeholder | Customize the “Please select” text. | string | — | Please select |
numberRequireDesc | Customize the “Please enter a number” text. | string | — | Please enter a number |
commonLenLimitDesc | Customize the “Total length cannot exceed 2000 Chinese characters” text. | string | — | Total length cannot exceed 2000 Chinese characters |
placeEnter | Customize the “Please enter” text. | string | — | Please enter |
prohibitEmptyDesc | Customize the “Cannot be empty” text. | string | — | Cannot be empty |
paramsLenLimitDesc | Customize the “Up to 50 English characters” text. | string | — | Up to 50 English characters |
splitDesc | Customize the “Separate multiple entries with #” text. | string | — | Separate multiple entries with # |
times | Customize the “times” text. | string | — | times |
second | Customize the “s” text. | string | — | s |
startPlaceholderDate | Customize the “Start date” text. | string | — | Start date |
endPlaceholderDate | Customize the “End date” text. | string | — | End date |
startPlaceholderTime | Customize the “Start time” text. | string | — | Start time |
endPlaceholderTime | Customize the “End time” text. | string | — | End time |
timePickerPlaceholder | Customize the “Select time range” text. | string | — | Select time range |
datePickerPlaceholder | Customize the “Select date range” text. | string | — | Select date range |
rangeSeparatorDesc | Customize the “→” text. | string | — | → |
Events
| Event | Description | Payload |
|---|---|---|
onRuleChange | Fires when collected condition data changes. | (conditions: ConditionItem[]) |
ruleChange | Fires when collected condition data changes. | (conditions: ConditionItem[]) |
addRule | Fires when a rule is added; returns the added object. | (rule: RuleItem) |
reduceRule | Fires when a rule is removed; returns the removed object. | (rule: RuleItem) |
addCondition | Fires when a condition is added; returns the added object. | (condition: ConditionItem) |
reduceCondition | Fires when a condition is removed; returns the removed object. | (condition: ConditionItem) |
Slots
No custom slots.
Exposed methods and state
plannfConditionsFormconditionContainernfRulesaddCondition()removeCondition(index)initPlan()getCondition()
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.
