PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.2
JetFormBuilder — Dynamic Blocks Form Builder v3.1.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / assets / src / editor / blocks / conditional-block / condition.group.item.js
jetformbuilder / assets / src / editor / blocks / conditional-block Last commit date
deprecations 2 years ago condition.group.item.js 2 years ago conditional.model.context.js 2 years ago conditions.is.empty.js 2 years ago conditions.list.js 2 years ago conditions.modal.content.js 2 years ago conditions.modal.js 2 years ago edit.js 2 years ago index.js 2 years ago options.js 2 years ago preview.js 2 years ago save.js 2 years ago
condition.group.item.js
81 lines
1 import ConditionalModalContext from './conditional.model.context';
2
3 const {
4 DetailsContainer,
5 HoverContainer,
6 HumanReadableConditions,
7 } = JetFBComponents;
8 const {
9 useBlockAttributes,
10 } = JetFBHooks;
11
12 const {
13 useState,
14 useEffect,
15 useContext,
16 } = wp.element;
17
18 const {
19 __,
20 } = wp.i18n;
21 const {
22 Button,
23 } = wp.components;
24
25 function ConditionGroupItem( { group } ) {
26 const [ isHover, setHover ] = useState( false );
27 const { setShowModal } = useContext( ConditionalModalContext );
28 const [ attributes, setAttributes ] = useBlockAttributes();
29
30 const conditions = group.map( ( { condition } ) => condition );
31 const indexes = group.map( ( { index } ) => index );
32
33 return <div
34 className="jet-fb p-relative"
35 onMouseOver={ () => setHover( true ) }
36 onMouseOut={ () => setHover( false ) }
37 >
38 <HoverContainer isHover={ isHover }>
39 <Button
40 isSmall
41 isSecondary
42 icon={ 'edit' }
43 onClick={ () => {
44 setAttributes(
45 ( { conditions } ) => conditions.map(
46 ( current, index ) => {
47 current.__visible = index === indexes[ 0 ];
48 return current;
49 },
50 ),
51 );
52 setShowModal( prev => !prev );
53 } }
54 >
55 { __( 'Edit', 'jet-form-builder' ) }
56 </Button>
57 <Button
58 isSmall
59 isDestructive
60 icon={ 'trash' }
61 onClick={ () => {
62 setAttributes( {
63 conditions: attributes.conditions.filter(
64 ( current, index ) => !indexes.includes( index ),
65 ),
66 } );
67 } }
68 >
69 { __( 'Delete', 'jet-form-builder' ) }
70 </Button>
71 </HoverContainer>
72 <DetailsContainer>
73 <HumanReadableConditions
74 conditions={ conditions }
75 showWarning
76 />
77 </DetailsContainer>
78 </div>;
79 }
80
81 export default ConditionGroupItem;