MCPcopy Create free account
hub / github.com/DTStack/Taier / handler

Function handler

taier-ui/src/pages/editor/dataSync/index.tsx:391–418  ·  view source on GitHub ↗
(field: string[], value: any)

Source from the content-addressed store, hash-verified

389 // 监听 form 的 values 修改事件
390 useEffect(() => {
391 function handler(field: string[], value: any) {
392 visit<Root, ISchema>(
393 templateSchema,
394 (i) => !!(i.bind || i.depends),
395 (item, vNode) => {
396 if (item.bind) {
397 if (field.join('.') === item.bind?.field) {
398 const val = getPlus(
399 {
400 optionCollections: optionCollectionsRef.current,
401 },
402 item.bind.transformer,
403 value
404 );
405 form.setFieldValue(vNode.formName, val);
406 event.emit(EventKind.Changed, vNode.formName, val);
407 }
408 }
409
410 if (item.depends) {
411 if (item.depends.includes(field.join('.'))) {
412 form.setFieldValue(vNode.formName, undefined);
413 event.emit(EventKind.Changed, vNode.formName, undefined);
414 }
415 }
416 }
417 );
418 }
419 event.subscribe(EventKind.Changed, handler);
420
421 return () => {

Callers 2

renderVertexMethod · 0.50
visitFunction · 0.50

Calls 2

visitFunction · 0.90
getPlusFunction · 0.90

Tested by

no test coverage detected