MCPcopy
hub / github.com/xaboy/form-create / RuleContext

Function RuleContext

packages/core/src/factory/context.js:21–55  ·  view source on GitHub ↗
(handle, rule, defaultValue)

Source from the content-addressed store, hash-verified

19}
20
21export 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
57extend(RuleContext.prototype, {
58 getParentGroup() {

Callers

nothing calls this directly

Calls 4

deepCopyFunction · 0.90
uniqueFunction · 0.85
extendFunction · 0.85
bindFunction · 0.70

Tested by

no test coverage detected