| 19 | } |
| 20 | |
| 21 | export default function RuleContext(handle, rule, defaultValue) { |
| 22 | const id = unique(); |
| 23 | const isInput = !!rule.field; |
| 24 | extend(this, { |
| 25 | id, |
| 26 | ref: id, |
| 27 | wrapRef: id + 'fi', |
| 28 | rule, |
| 29 | origin: rule.__origin__ || rule, |
| 30 | name: rule.name, |
| 31 | pending: {}, |
| 32 | none: false, |
| 33 | watch: [], |
| 34 | linkOn: [], |
| 35 | root: [], |
| 36 | ctrlRule: [], |
| 37 | children: [], |
| 38 | parent: null, |
| 39 | group: rule.subRule ? this : null, |
| 40 | cacheConfig: null, |
| 41 | prop: {...rule}, |
| 42 | computed: {}, |
| 43 | payload: {}, |
| 44 | refRule: {}, |
| 45 | input: isInput, |
| 46 | el: undefined, |
| 47 | exportEl: undefined, |
| 48 | defaultValue: isInput ? deepCopy(defaultValue) : undefined, |
| 49 | field: rule.field || undefined |
| 50 | }) |
| 51 | |
| 52 | this.updateKey(); |
| 53 | bind(this); |
| 54 | this.update(handle, true); |
| 55 | } |
| 56 | |
| 57 | extend(RuleContext.prototype, { |
| 58 | getParentGroup() { |