@bit.rhplus/ag-grid 0.0.80 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,81 +1,81 @@
1
- /* eslint-disable */
2
- import React, { useRef, useEffect } from 'react';
3
- import { createMemoComparison } from '@bit.rhplus/react-memo';
4
- import { Input, Button, Space } from 'antd';
5
-
6
- const BulkEditInput = ({
7
- value,
8
- onChange,
9
- onSubmit,
10
- onCancel,
11
- loading,
12
- placeholder = 'Zadejte hodnotu...',
13
- allowClear = true,
14
- maxLength,
15
- type = 'text',
16
- }) => {
17
- const inputRef = useRef(null);
18
-
19
- useEffect(() => {
20
- if (inputRef.current) {
21
- setTimeout(() => {
22
- inputRef.current?.focus();
23
- inputRef.current?.select();
24
- }, 100);
25
- }
26
- }, []);
27
-
28
- const handleKeyDown = (e) => {
29
- if (e.key === 'Enter' && !loading) {
30
- e.preventDefault();
31
- onSubmit(value);
32
- } else if (e.key === 'Escape') {
33
- e.preventDefault();
34
- onCancel();
35
- }
36
- };
37
-
38
- return (
39
- <>
40
- <div style={{ marginBottom: '12px' }} onClick={(e) => e.stopPropagation()}>
41
- <Input
42
- ref={inputRef}
43
- value={value}
44
- onChange={(e) => onChange(e.target.value)}
45
- placeholder={placeholder}
46
- disabled={loading}
47
- allowClear={allowClear}
48
- maxLength={maxLength}
49
- type={type}
50
- onKeyDown={handleKeyDown}
51
- onClick={(e) => e.stopPropagation()}
52
- />
53
- </div>
54
-
55
- <Space style={{ width: '100%', justifyContent: 'flex-end' }}>
56
- <Button size="small" onClick={onCancel} disabled={loading}>
57
- Zrušit
58
- </Button>
59
- <Button
60
- type="primary"
61
- size="small"
62
- onClick={() => onSubmit(value)}
63
- loading={loading}
64
- >
65
- Použít
66
- </Button>
67
- </Space>
68
- </>
69
- );
70
- };
71
-
72
- // React.memo optimalizace
73
- // ✅ PERFORMANCE FIX: Ignore callback references
74
- const arePropsEqual = createMemoComparison(
75
- ['value', 'loading', 'placeholder', 'allowClear', 'maxLength', 'type'], // Kritické props
76
- ['onChange', 'onSubmit', 'onCancel'], // Ignorované callbacky
77
- false,
78
- 'BulkEditInput'
79
- );
80
-
81
- export default React.memo(BulkEditInput, arePropsEqual);
1
+ /* eslint-disable */
2
+ import React, { useRef, useEffect } from 'react';
3
+ import { createMemoComparison } from '@bit.rhplus/react-memo';
4
+ import { Input, Button, Space } from 'antd';
5
+
6
+ const BulkEditInput = ({
7
+ value,
8
+ onChange,
9
+ onSubmit,
10
+ onCancel,
11
+ loading,
12
+ placeholder = 'Zadejte hodnotu...',
13
+ allowClear = true,
14
+ maxLength,
15
+ type = 'text',
16
+ }) => {
17
+ const inputRef = useRef(null);
18
+
19
+ useEffect(() => {
20
+ if (inputRef.current) {
21
+ setTimeout(() => {
22
+ inputRef.current?.focus();
23
+ inputRef.current?.select();
24
+ }, 100);
25
+ }
26
+ }, []);
27
+
28
+ const handleKeyDown = (e) => {
29
+ if (e.key === 'Enter' && !loading) {
30
+ e.preventDefault();
31
+ onSubmit(value);
32
+ } else if (e.key === 'Escape') {
33
+ e.preventDefault();
34
+ onCancel();
35
+ }
36
+ };
37
+
38
+ return (
39
+ <>
40
+ <div style={{ marginBottom: '12px' }} onClick={(e) => e.stopPropagation()}>
41
+ <Input
42
+ ref={inputRef}
43
+ value={value}
44
+ onChange={(e) => onChange(e.target.value)}
45
+ placeholder={placeholder}
46
+ disabled={loading}
47
+ allowClear={allowClear}
48
+ maxLength={maxLength}
49
+ type={type}
50
+ onKeyDown={handleKeyDown}
51
+ onClick={(e) => e.stopPropagation()}
52
+ />
53
+ </div>
54
+
55
+ <Space style={{ width: '100%', justifyContent: 'flex-end' }}>
56
+ <Button size="small" onClick={onCancel} disabled={loading}>
57
+ Zrušit
58
+ </Button>
59
+ <Button
60
+ type="primary"
61
+ size="small"
62
+ onClick={() => onSubmit(value)}
63
+ loading={loading}
64
+ >
65
+ Použít
66
+ </Button>
67
+ </Space>
68
+ </>
69
+ );
70
+ };
71
+
72
+ // React.memo optimalizace
73
+ // ✅ PERFORMANCE FIX: Ignore callback references
74
+ const arePropsEqual = createMemoComparison(
75
+ ['value', 'loading', 'placeholder', 'allowClear', 'maxLength', 'type'], // Kritické props
76
+ ['onChange', 'onSubmit', 'onCancel'], // Ignorované callbacky
77
+ false,
78
+ 'BulkEditInput'
79
+ );
80
+
81
+ export default React.memo(BulkEditInput, arePropsEqual);