{
48 | event.stopPropagation()
49 | }}
50 | >
51 | {!parentFixed ? (
52 |
nodeContext.remove()}>
53 | x
54 |
55 | ) : null}
56 | {hasChildren ? (
57 |
nodeContext.repeat()}>
58 | rep
59 |
60 | ) : null}
61 | {hasChildren ? (
62 | <>
63 | {canBeNested ? (
64 |
{
67 | nodeContext.updateConfig((config) => {
68 | config.fixedChildren = !props.fixedChildren
69 | })
70 | }}
71 | >
72 | fx
73 |
74 | ) : null}
75 | {!props.fixedChildren ? (
76 |
{
79 | nodeContext.updateConfig((config) => {
80 | config.direction = props.direction === 'horizontal' ? 'vertical' : 'horizontal'
81 | })
82 | }}
83 | >
84 | dir:{props.direction!.slice(0, 1)}
85 |
86 | ) : null}
87 | >
88 | ) : null}
89 |
90 | )}
91 | >
92 | )}
93 | >
94 | )
95 | }
96 |
97 | export default FlexContainerConfigure
98 |
--------------------------------------------------------------------------------
/src/components/core/DynamicNode/index.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useContext, useMemo } from 'react'
2 | import { cloneNodeMeta, findCurrentMeta, findParentMeta } from '../../../utils'
3 | import { componentMap, configureMap, defaultConfigure } from '../../../constants'
4 | import { ConfigureProps, DynamicNodeMeta } from '../../../types'
5 | import { DynamicRootContext } from '../DynamicRoot'
6 |
7 | export interface DynamicNodeProps {
8 | meta: DynamicNodeMeta
9 | index: number
10 | }
11 |
12 | export const DynamicNodeContext = createContext<{
13 | meta?: DynamicNodeMeta
14 | indexPath: number[]
15 | isActive: boolean
16 | setActive: (value: boolean) => void
17 | remove: () => void
18 | repeat: () => void
19 | updateConfig: