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 / select-field / edit.js
jetformbuilder / assets / src / editor / blocks / select-field Last commit date
edit.js 2 years ago index.js 2 years ago preview.js 2 years ago
edit.js
136 lines
1 import { SelectRadioCheckPlaceholder } from '../../components/base-select-check-radio/select-radio-check-placeholder';
2 import SelectRadioCheck
3 from '../../components/base-select-check-radio/select-radio-check';
4 import preview from './preview';
5
6 const {
7 __,
8 } = wp.i18n;
9 const {
10 ToolBarFields,
11 BlockLabel,
12 BlockDescription,
13 BlockAdvancedValue,
14 BlockName,
15 BlockPlaceholder,
16 BlockAddPrevButton,
17 BlockPrevButtonLabel,
18 BlockVisibility,
19 BlockClassName,
20 FieldControl,
21 SwitchPageOnChangeControls,
22 } = JetFBComponents;
23
24 const {
25 useUniqueNameOnDuplicate,
26 } = JetFBHooks;
27
28 const {
29 InspectorControls,
30 useBlockProps,
31 } = wp.blockEditor;
32
33 const {
34 ToggleControl,
35 SelectControl,
36 PanelBody,
37 TextControl,
38 RangeControl,
39 } = wp.components;
40
41 /**
42 * @param props
43 * @returns {JSX.Element[]}
44 * @constructor
45 */
46 export default function SelectEdit( props ) {
47
48 const {
49 attributes,
50 setAttributes,
51 isSelected,
52 editProps: { uniqKey, attrHelp },
53 } = props;
54
55 const blockProps = useBlockProps();
56
57 useUniqueNameOnDuplicate();
58
59 if ( attributes.isPreview ) {
60 return <div style={ {
61 width: '100%',
62 display: 'flex',
63 justifyContent: 'center',
64 } }>
65 { preview }
66 </div>;
67 }
68
69 return <>
70 <ToolBarFields
71 key={ uniqKey( 'ToolBarFields' ) }
72 { ...props }
73 />
74 { !attributes.multiple && <SwitchPageOnChangeControls/> }
75 { isSelected && <InspectorControls
76 key={ uniqKey( 'InspectorControls' ) }
77 >
78 <PanelBody title={ __( 'General', 'jet-form-builder' ) }>
79 <BlockLabel/>
80 <BlockName/>
81 <BlockDescription/>
82 </PanelBody>
83 <PanelBody title={ __( 'Value', 'jet-form-builder' ) }>
84 <BlockAdvancedValue/>
85 </PanelBody>
86 <PanelBody
87 title={ __( 'Advanced', 'jet-form-builder' ) }
88 >
89 <BlockPlaceholder/>
90 { (
91 !!attributes.placeholder.length
92 ) && <ToggleControl
93 key={ uniqKey( 'is_disabled_placeholder' ) }
94 label={ __( 'Disable placeholder', 'jet-form-builder' ) }
95 checked={ attributes.is_disabled_placeholder }
96 onChange={ is_disabled_placeholder => setAttributes(
97 { is_disabled_placeholder } ) }
98 /> }
99 <BlockAddPrevButton/>
100 <BlockPrevButtonLabel/>
101 <BlockVisibility/>
102 <BlockClassName/>
103 </PanelBody>
104 </InspectorControls> }
105 <div key={ uniqKey( 'viewBlock' ) } { ...blockProps }>
106 <SelectRadioCheckPlaceholder
107 scriptData={ window.JetFormSelectFieldData }
108 { ...props }
109 />
110 <SelectRadioCheck { ...props }>
111 <ToggleControl
112 key="multiple"
113 label={ __( 'Is multiple', 'jet-form-builder' ) }
114 checked={ attributes.multiple }
115 help={ attrHelp( 'multiple' ) }
116 onChange={ multiple => setAttributes( { multiple } ) }
117 />
118 { attributes.multiple && <RangeControl
119 label={ __( 'Rows count', 'jet-form-builder' ) }
120 value={ attributes.multiple_size ?? 4 }
121 onChange={ multiple_size => setAttributes(
122 { multiple_size } ) }
123 allowReset
124 resetFallbackValue={ 4 }
125 min={ 1 }
126 max={ 25 }
127 /> }
128 <FieldControl
129 type="custom_settings"
130 key={ uniqKey( 'customSettingsFields' ) }
131 { ...props }
132 />
133 </SelectRadioCheck>
134 </div>
135 </>;
136 }