PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.1
JetFormBuilder — Dynamic Blocks Form Builder v3.1.1
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 / package / validation / components / AdvancedRuleItem.js
jetformbuilder / assets / src / package / validation / components Last commit date
AdvancedRuleItem.js 2 years ago AdvancedRuleModalItem.js 2 years ago AdvancedRulesIsEmpty.js 2 years ago AdvancedRulesList.js 2 years ago AdvancedRulesModal.js 2 years ago ChooseRelatedField.js 2 years ago EditAdvancedRulesButton.js 2 years ago EditRulesModalContext.js 2 years ago HumanReadableRule.js 2 years ago ValidationBlockMessage.js 2 years ago ValidationMetaMessage.js 2 years ago ValidationToggleGroup.js 2 years ago
AdvancedRuleItem.js
77 lines
1 import EditRulesModalContext from './EditRulesModalContext';
2 import useBlockAttributes from '../../blocks/hooks/useBlockAttributes';
3 import DetailsContainer from '../../components/DetailsContainer';
4 import HoverContainer from '../../components/HoverContainer';
5 import HumanReadableRule from './HumanReadableRule';
6
7 const {
8 useContext,
9 useState,
10 } = wp.element;
11 const {
12 __,
13 } = wp.i18n;
14 const {
15 Button,
16 } = wp.components;
17
18 function AdvancedRuleItem( { rule, index = 0 } ) {
19 const { setShowModal } = useContext( EditRulesModalContext );
20 const [ attributes, setAttributes ] = useBlockAttributes();
21
22 const [ isHover, setHover ] = useState( false );
23
24 return <div
25 className="jet-fb p-relative"
26 onMouseOver={ () => setHover( true ) }
27 onMouseOut={ () => setHover( false ) }
28 >
29 <HoverContainer isHover={ isHover }>
30 <Button
31 isSmall
32 isSecondary
33 icon={ 'edit' }
34 onClick={ () => {
35 setAttributes( {
36 validation: {
37 ...attributes.validation,
38 rules: attributes.validation.rules.map(
39 ( current, currentIndex ) => {
40 current.__visible = index === currentIndex;
41 return current;
42 },
43 ),
44 },
45 } );
46 setShowModal( prev => !prev );
47 } }
48 >
49 { __( 'Edit', 'jet-form-builder' ) }
50 </Button>
51 <Button
52 isSmall
53 isDestructive
54 icon={ 'trash' }
55 onClick={ () => {
56 setAttributes( {
57 validation: {
58 ...attributes.validation,
59 rules: attributes.validation.rules.filter(
60 ( current, currentIndex ) => (
61 currentIndex !== index
62 ),
63 ),
64 },
65 } );
66 } }
67 >
68 { __( 'Delete', 'jet-form-builder' ) }
69 </Button>
70 </HoverContainer>
71 <DetailsContainer>
72 <HumanReadableRule rule={ rule }/>
73 </DetailsContainer>
74 </div>;
75 }
76
77 export default AdvancedRuleItem;