nf-rules
Rule editor for intention/personal/custom tags, reply keywords, import/call/current time, duration, dialogue rounds, call count, parameters and call status. Chinese enum exports, remapping, merge strategies, per-field disabling and form validation are retained.
Examples
Add rules
Restore rules
Disabled items
Custom enums
Custom external form
Props
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
|---|---|---|---|---|
rules | Rule data for display and retrieval; keep the array mutable. | 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 |
|---|---|---|
onChange | Fires when collected rule data changes. | (plan: Record<string, RuleItem[]>) |
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) |
Slots
No custom slots.
Exposed methods and state
plannfRulesFormruleContainerintentsruleTypesPlaceoperatorTypesPlacecalculationMethodPlacedateOptionsTypePlaceoutboundCallStatusPlaceshowRuleTypesPlaceintentsOperatorTypescommonOperatorTypesruleMapdisablesRecordaddRule(type?)removeRule(index)getRule(type, subType?)changeRule(type, index, subType?)operatorSelectChange(type, index, operator?)
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.
tag="div" + validPrefix integrates into a parent Element Plus Form. Date/time ranges accept Date arrays. Numeric zero is valid. Dropdown merge strategies do not mutate incoming arrays.
