PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / sync-ui / components / limits.js

limits.js in ElasticPress 5.3.5, at assets/js/sync-ui/components/limits.js

79 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { Flex, FlexItem, TextControl } from '@wordpress/components';
5 import { WPElement } from '@wordpress/element';
6 import { __ } from '@wordpress/i18n';
7
8 /**
9 * Internal dependencies.
10 */
11 import { useSync } from '../../sync';
12 import { useSyncSettings } from '../provider';
13
14 /**
15 * Delete checkbox component.
16 *
17 * @returns {WPElement} Sync page component.
18 */
19 export default () => {
20 const { isSyncing } = useSync();
21 const { args, setArgs } = useSyncSettings();
22
23 /**
24 * Handle changing the lower limit.
25 *
26 * @param {string} value Selected lower ID.
27 * @returns {void}
28 */
29 const onChangeLower = (value) => {
30 const lower_limit_object_id = value ? Math.max(0, value) : value;
31
32 setArgs({ ...args, lower_limit_object_id });
33 };
34
35 /**
36 * Handle changing the upper limit.
37 *
38 * @param {string} value Selected upper ID.
39 * @returns {void}
40 */
41 const onChangeUpper = (value) => {
42 const upper_limit_object_id = value ? Math.max(0, value) : value;
43
44 setArgs({ ...args, upper_limit_object_id });
45 };
46
47 return (
48 <Flex className="ep-sync-advanced-control" justify="start">
49 <FlexItem grow="2">
50 <TextControl
51 disabled={isSyncing}
52 help={__('Sync objects with an ID of this number or higher.', 'elasticpress')}
53 label={__('Lower object ID', 'elasticpress')}
54 max={args.upper_limit_object_id}
55 min="0"
56 onChange={onChangeLower}
57 type="number"
58 value={args.lower_limit_object_id}
59 __nextHasNoMarginBottom
60 __next40pxDefaultSize
61 />
62 </FlexItem>
63 <FlexItem grow="2">
64 <TextControl
65 disabled={isSyncing}
66 help={__('Sync objects with an ID of this number or lower.', 'elasticpress')}
67 label={__('Higher object ID', 'elasticpress')}
68 min={args.lower_limit_object_id}
69 onChange={onChangeUpper}
70 type="number"
71 value={args.upper_limit_object_id}
72 __nextHasNoMarginBottom
73 __next40pxDefaultSize
74 />
75 </FlexItem>
76 </Flex>
77 );
78 };
79