@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.
- package/BulkEdit/BulkEditDatePicker.jsx +305 -305
- package/BulkEdit/BulkEditInput.jsx +81 -81
- package/BulkEdit/BulkEditPopover.jsx +310 -310
- package/BulkEdit/BulkEditSelect.jsx +106 -106
- package/Renderers/ImageRenderer.jsx +103 -103
- package/Renderers/LinkRenderer.jsx +133 -133
- package/Renderers/ObjectRenderer.jsx +140 -140
- package/Renderers/StateRenderer.jsx +148 -148
- package/dist/BulkEdit/BulkEditDatePicker.js +35 -35
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/index.jsx +1 -0
- package/package.json +4 -4
- /package/dist/{preview-1768405724660.js → preview-1768559621799.js} +0 -0
|
@@ -1,305 +1,305 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import React, { useState, useCallback, useMemo } from 'react';
|
|
3
|
-
import { createMemoComparison } from '@bit.rhplus/react-memo';
|
|
4
|
-
import { Calendar, Button, Space, Tooltip } from 'antd';
|
|
5
|
-
import dayjs from 'dayjs';
|
|
6
|
-
import 'dayjs/locale/cs';
|
|
7
|
-
import styled from 'styled-components';
|
|
8
|
-
import Holidays from 'date-holidays';
|
|
9
|
-
|
|
10
|
-
dayjs.locale('cs');
|
|
11
|
-
|
|
12
|
-
const CalendarContainer = styled.div`
|
|
13
|
-
display: flex;
|
|
14
|
-
gap: 8px;
|
|
15
|
-
margin-bottom: 12px;
|
|
16
|
-
width: 900px;
|
|
17
|
-
justify-content: space-between;
|
|
18
|
-
|
|
19
|
-
.ant-picker-calendar {
|
|
20
|
-
max-width: 260px;
|
|
21
|
-
flex: 1;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.ant-picker-calendar-header {
|
|
25
|
-
padding: 8px 12px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ant-picker-cell-selected .ant-picker-cell-inner {
|
|
29
|
-
background: transparent !important;
|
|
30
|
-
color: inherit !important;
|
|
31
|
-
font-weight: normal !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ant-picker-cell-disabled {
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.ant-picker-cell-disabled .ant-picker-cell-inner {
|
|
39
|
-
color: rgba(0, 0, 0, 0.25) !important;
|
|
40
|
-
background: transparent !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.ant-picker-cell:not(.ant-picker-cell-in-view) .ant-picker-cell-inner {
|
|
44
|
-
color: rgba(0, 0, 0, 0.25) !important;
|
|
45
|
-
background: transparent !important;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
const BulkEditDatePicker = ({
|
|
50
|
-
value,
|
|
51
|
-
onChange,
|
|
52
|
-
onSubmit,
|
|
53
|
-
onCancel,
|
|
54
|
-
loading,
|
|
55
|
-
format = 'DD.MM.YYYY',
|
|
56
|
-
showTime = false,
|
|
57
|
-
}) => {
|
|
58
|
-
const today = dayjs();
|
|
59
|
-
const [selectedDate, setSelectedDate] = useState(value ? dayjs(value) : null);
|
|
60
|
-
const [baseMonth, setBaseMonth] = useState(today);
|
|
61
|
-
|
|
62
|
-
const month1 = baseMonth;
|
|
63
|
-
const month2 = baseMonth.add(1, 'month');
|
|
64
|
-
const month3 = baseMonth.add(2, 'month');
|
|
65
|
-
|
|
66
|
-
const hd = useMemo(() => new Holidays('CZ'), []);
|
|
67
|
-
|
|
68
|
-
const handleDateSelect = (date) => {
|
|
69
|
-
setSelectedDate(date);
|
|
70
|
-
if (showTime) {
|
|
71
|
-
onChange(date.toISOString());
|
|
72
|
-
} else {
|
|
73
|
-
onChange(date.format('YYYY-MM-DD'));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const getHoliday = useCallback((date) => {
|
|
78
|
-
const holidays = hd.isHoliday(date.toDate());
|
|
79
|
-
return holidays && holidays.length > 0 ? holidays[0].name : null;
|
|
80
|
-
}, [hd]);
|
|
81
|
-
|
|
82
|
-
const getVisibleHolidays = useCallback(() => {
|
|
83
|
-
const holidays = [];
|
|
84
|
-
const months = [month1, month2, month3];
|
|
85
|
-
|
|
86
|
-
months.forEach(month => {
|
|
87
|
-
const startOfMonth = month.startOf('month');
|
|
88
|
-
const endOfMonth = month.endOf('month');
|
|
89
|
-
let current = startOfMonth;
|
|
90
|
-
|
|
91
|
-
while (current.isBefore(endOfMonth) || current.isSame(endOfMonth, 'day')) {
|
|
92
|
-
const holidayName = getHoliday(current);
|
|
93
|
-
if (holidayName) {
|
|
94
|
-
holidays.push({
|
|
95
|
-
date: current.format('DD.MM.YYYY'),
|
|
96
|
-
name: holidayName,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
current = current.add(1, 'day');
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
return holidays;
|
|
104
|
-
}, [month1, month2, month3, getHoliday]);
|
|
105
|
-
|
|
106
|
-
const visibleHolidays = useMemo(() => getVisibleHolidays(), [getVisibleHolidays]);
|
|
107
|
-
|
|
108
|
-
const createCellRender = useCallback((monthValue) => {
|
|
109
|
-
return (current, info) => {
|
|
110
|
-
const isSelected = selectedDate &&
|
|
111
|
-
current.date() === selectedDate.date() &&
|
|
112
|
-
current.month() === selectedDate.month() &&
|
|
113
|
-
current.year() === selectedDate.year();
|
|
114
|
-
const isToday = current.isSame(today, 'day');
|
|
115
|
-
const holidayName = getHoliday(current);
|
|
116
|
-
|
|
117
|
-
if (isSelected) {
|
|
118
|
-
return (
|
|
119
|
-
<div className="ant-picker-cell-inner" style={{
|
|
120
|
-
background: '#1890ff',
|
|
121
|
-
color: 'white',
|
|
122
|
-
fontWeight: 600,
|
|
123
|
-
}}>
|
|
124
|
-
{current.date()}
|
|
125
|
-
</div>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (holidayName) {
|
|
130
|
-
return (
|
|
131
|
-
<div className="ant-picker-cell-inner" style={{
|
|
132
|
-
background: '#fff1f0',
|
|
133
|
-
color: '#cf1322',
|
|
134
|
-
fontWeight: 600,
|
|
135
|
-
}}>
|
|
136
|
-
{current.date()}
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (isToday) {
|
|
142
|
-
return (
|
|
143
|
-
<div className="ant-picker-cell-inner" style={{
|
|
144
|
-
background: '#e6f7ff',
|
|
145
|
-
color: '#1890ff',
|
|
146
|
-
fontWeight: 600,
|
|
147
|
-
border: '1px solid #1890ff',
|
|
148
|
-
}}>
|
|
149
|
-
{current.date()}
|
|
150
|
-
</div>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<div className="ant-picker-cell-inner">
|
|
156
|
-
{current.date()}
|
|
157
|
-
</div>
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
}, [selectedDate, today, getHoliday]);
|
|
161
|
-
|
|
162
|
-
return (
|
|
163
|
-
<>
|
|
164
|
-
<CalendarContainer onClick={(e) => e.stopPropagation()}>
|
|
165
|
-
<Calendar
|
|
166
|
-
fullscreen={false}
|
|
167
|
-
value={month1}
|
|
168
|
-
onSelect={handleDateSelect}
|
|
169
|
-
fullCellRender={createCellRender(month1)}
|
|
170
|
-
headerRender={({ value: currentValue }) => (
|
|
171
|
-
<div style={{
|
|
172
|
-
padding: '8px 12px',
|
|
173
|
-
fontWeight: 500,
|
|
174
|
-
textAlign: 'center',
|
|
175
|
-
display: 'flex',
|
|
176
|
-
alignItems: 'center',
|
|
177
|
-
justifyContent: 'space-between'
|
|
178
|
-
}}>
|
|
179
|
-
<span
|
|
180
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
181
|
-
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
182
|
-
>
|
|
183
|
-
‹
|
|
184
|
-
</span>
|
|
185
|
-
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
186
|
-
<span
|
|
187
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
188
|
-
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
189
|
-
>
|
|
190
|
-
›
|
|
191
|
-
</span>
|
|
192
|
-
</div>
|
|
193
|
-
)}
|
|
194
|
-
/>
|
|
195
|
-
<Calendar
|
|
196
|
-
fullscreen={false}
|
|
197
|
-
value={month2}
|
|
198
|
-
onSelect={handleDateSelect}
|
|
199
|
-
fullCellRender={createCellRender(month2)}
|
|
200
|
-
headerRender={({ value: currentValue }) => (
|
|
201
|
-
<div style={{
|
|
202
|
-
padding: '8px 12px',
|
|
203
|
-
fontWeight: 500,
|
|
204
|
-
textAlign: 'center',
|
|
205
|
-
display: 'flex',
|
|
206
|
-
alignItems: 'center',
|
|
207
|
-
justifyContent: 'space-between'
|
|
208
|
-
}}>
|
|
209
|
-
<span
|
|
210
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
211
|
-
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
212
|
-
>
|
|
213
|
-
‹
|
|
214
|
-
</span>
|
|
215
|
-
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
216
|
-
<span
|
|
217
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
218
|
-
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
219
|
-
>
|
|
220
|
-
›
|
|
221
|
-
</span>
|
|
222
|
-
</div>
|
|
223
|
-
)}
|
|
224
|
-
/>
|
|
225
|
-
<Calendar
|
|
226
|
-
fullscreen={false}
|
|
227
|
-
value={month3}
|
|
228
|
-
onSelect={handleDateSelect}
|
|
229
|
-
fullCellRender={createCellRender(month3)}
|
|
230
|
-
headerRender={({ value: currentValue }) => (
|
|
231
|
-
<div style={{
|
|
232
|
-
padding: '8px 12px',
|
|
233
|
-
fontWeight: 500,
|
|
234
|
-
textAlign: 'center',
|
|
235
|
-
display: 'flex',
|
|
236
|
-
alignItems: 'center',
|
|
237
|
-
justifyContent: 'space-between'
|
|
238
|
-
}}>
|
|
239
|
-
<span
|
|
240
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
241
|
-
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
242
|
-
>
|
|
243
|
-
‹
|
|
244
|
-
</span>
|
|
245
|
-
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
246
|
-
<span
|
|
247
|
-
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
248
|
-
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
249
|
-
>
|
|
250
|
-
›
|
|
251
|
-
</span>
|
|
252
|
-
</div>
|
|
253
|
-
)}
|
|
254
|
-
/>
|
|
255
|
-
</CalendarContainer>
|
|
256
|
-
|
|
257
|
-
{visibleHolidays.length > 0 && (
|
|
258
|
-
<div style={{ marginBottom: '12px', fontSize: '11px', color: '#666' }}>
|
|
259
|
-
{visibleHolidays.map((holiday, index) => {
|
|
260
|
-
const isSelectedHoliday = selectedDate && holiday.date === selectedDate.format('DD.MM.YYYY');
|
|
261
|
-
return (
|
|
262
|
-
<div
|
|
263
|
-
key={index}
|
|
264
|
-
style={{
|
|
265
|
-
marginBottom: '2px',
|
|
266
|
-
background: isSelectedHoliday ? '#e6f7ff' : 'transparent',
|
|
267
|
-
padding: isSelectedHoliday ? '2px 4px' : '0',
|
|
268
|
-
borderRadius: '2px',
|
|
269
|
-
fontWeight: isSelectedHoliday ? 600 : 'normal',
|
|
270
|
-
}}
|
|
271
|
-
>
|
|
272
|
-
<span style={{ color: '#cf1322', fontWeight: 500 }}>{holiday.date}</span> - {holiday.name}
|
|
273
|
-
</div>
|
|
274
|
-
);
|
|
275
|
-
})}
|
|
276
|
-
</div>
|
|
277
|
-
)}
|
|
278
|
-
|
|
279
|
-
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
|
280
|
-
<Button size="small" onClick={onCancel} disabled={loading}>
|
|
281
|
-
Zrušit
|
|
282
|
-
</Button>
|
|
283
|
-
<Button
|
|
284
|
-
type="primary"
|
|
285
|
-
size="small"
|
|
286
|
-
onClick={() => onSubmit(value)}
|
|
287
|
-
loading={loading}
|
|
288
|
-
>
|
|
289
|
-
Použít
|
|
290
|
-
</Button>
|
|
291
|
-
</Space>
|
|
292
|
-
</>
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// React.memo optimalizace
|
|
297
|
-
// ✅ PERFORMANCE FIX: Ignore callback references
|
|
298
|
-
const arePropsEqual = createMemoComparison(
|
|
299
|
-
['value', 'loading'], // Kritické props
|
|
300
|
-
['onChange', 'onSubmit', 'onCancel'], // Ignorované callbacky
|
|
301
|
-
false,
|
|
302
|
-
'BulkEditDatePicker'
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
export default React.memo(BulkEditDatePicker, arePropsEqual);
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import { createMemoComparison } from '@bit.rhplus/react-memo';
|
|
4
|
+
import { Calendar, Button, Space, Tooltip } from 'antd';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import 'dayjs/locale/cs';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import Holidays from 'date-holidays';
|
|
9
|
+
|
|
10
|
+
dayjs.locale('cs');
|
|
11
|
+
|
|
12
|
+
const CalendarContainer = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
margin-bottom: 12px;
|
|
16
|
+
width: 900px;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
|
|
19
|
+
.ant-picker-calendar {
|
|
20
|
+
max-width: 260px;
|
|
21
|
+
flex: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ant-picker-calendar-header {
|
|
25
|
+
padding: 8px 12px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ant-picker-cell-selected .ant-picker-cell-inner {
|
|
29
|
+
background: transparent !important;
|
|
30
|
+
color: inherit !important;
|
|
31
|
+
font-weight: normal !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ant-picker-cell-disabled {
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ant-picker-cell-disabled .ant-picker-cell-inner {
|
|
39
|
+
color: rgba(0, 0, 0, 0.25) !important;
|
|
40
|
+
background: transparent !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ant-picker-cell:not(.ant-picker-cell-in-view) .ant-picker-cell-inner {
|
|
44
|
+
color: rgba(0, 0, 0, 0.25) !important;
|
|
45
|
+
background: transparent !important;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const BulkEditDatePicker = ({
|
|
50
|
+
value,
|
|
51
|
+
onChange,
|
|
52
|
+
onSubmit,
|
|
53
|
+
onCancel,
|
|
54
|
+
loading,
|
|
55
|
+
format = 'DD.MM.YYYY',
|
|
56
|
+
showTime = false,
|
|
57
|
+
}) => {
|
|
58
|
+
const today = dayjs();
|
|
59
|
+
const [selectedDate, setSelectedDate] = useState(value ? dayjs(value) : null);
|
|
60
|
+
const [baseMonth, setBaseMonth] = useState(today);
|
|
61
|
+
|
|
62
|
+
const month1 = baseMonth;
|
|
63
|
+
const month2 = baseMonth.add(1, 'month');
|
|
64
|
+
const month3 = baseMonth.add(2, 'month');
|
|
65
|
+
|
|
66
|
+
const hd = useMemo(() => new Holidays('CZ'), []);
|
|
67
|
+
|
|
68
|
+
const handleDateSelect = (date) => {
|
|
69
|
+
setSelectedDate(date);
|
|
70
|
+
if (showTime) {
|
|
71
|
+
onChange(date.toISOString());
|
|
72
|
+
} else {
|
|
73
|
+
onChange(date.format('YYYY-MM-DD'));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getHoliday = useCallback((date) => {
|
|
78
|
+
const holidays = hd.isHoliday(date.toDate());
|
|
79
|
+
return holidays && holidays.length > 0 ? holidays[0].name : null;
|
|
80
|
+
}, [hd]);
|
|
81
|
+
|
|
82
|
+
const getVisibleHolidays = useCallback(() => {
|
|
83
|
+
const holidays = [];
|
|
84
|
+
const months = [month1, month2, month3];
|
|
85
|
+
|
|
86
|
+
months.forEach(month => {
|
|
87
|
+
const startOfMonth = month.startOf('month');
|
|
88
|
+
const endOfMonth = month.endOf('month');
|
|
89
|
+
let current = startOfMonth;
|
|
90
|
+
|
|
91
|
+
while (current.isBefore(endOfMonth) || current.isSame(endOfMonth, 'day')) {
|
|
92
|
+
const holidayName = getHoliday(current);
|
|
93
|
+
if (holidayName) {
|
|
94
|
+
holidays.push({
|
|
95
|
+
date: current.format('DD.MM.YYYY'),
|
|
96
|
+
name: holidayName,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
current = current.add(1, 'day');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return holidays;
|
|
104
|
+
}, [month1, month2, month3, getHoliday]);
|
|
105
|
+
|
|
106
|
+
const visibleHolidays = useMemo(() => getVisibleHolidays(), [getVisibleHolidays]);
|
|
107
|
+
|
|
108
|
+
const createCellRender = useCallback((monthValue) => {
|
|
109
|
+
return (current, info) => {
|
|
110
|
+
const isSelected = selectedDate &&
|
|
111
|
+
current.date() === selectedDate.date() &&
|
|
112
|
+
current.month() === selectedDate.month() &&
|
|
113
|
+
current.year() === selectedDate.year();
|
|
114
|
+
const isToday = current.isSame(today, 'day');
|
|
115
|
+
const holidayName = getHoliday(current);
|
|
116
|
+
|
|
117
|
+
if (isSelected) {
|
|
118
|
+
return (
|
|
119
|
+
<div className="ant-picker-cell-inner" style={{
|
|
120
|
+
background: '#1890ff',
|
|
121
|
+
color: 'white',
|
|
122
|
+
fontWeight: 600,
|
|
123
|
+
}}>
|
|
124
|
+
{current.date()}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (holidayName) {
|
|
130
|
+
return (
|
|
131
|
+
<div className="ant-picker-cell-inner" style={{
|
|
132
|
+
background: '#fff1f0',
|
|
133
|
+
color: '#cf1322',
|
|
134
|
+
fontWeight: 600,
|
|
135
|
+
}}>
|
|
136
|
+
{current.date()}
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (isToday) {
|
|
142
|
+
return (
|
|
143
|
+
<div className="ant-picker-cell-inner" style={{
|
|
144
|
+
background: '#e6f7ff',
|
|
145
|
+
color: '#1890ff',
|
|
146
|
+
fontWeight: 600,
|
|
147
|
+
border: '1px solid #1890ff',
|
|
148
|
+
}}>
|
|
149
|
+
{current.date()}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<div className="ant-picker-cell-inner">
|
|
156
|
+
{current.date()}
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
}, [selectedDate, today, getHoliday]);
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<CalendarContainer onClick={(e) => e.stopPropagation()}>
|
|
165
|
+
<Calendar
|
|
166
|
+
fullscreen={false}
|
|
167
|
+
value={month1}
|
|
168
|
+
onSelect={handleDateSelect}
|
|
169
|
+
fullCellRender={createCellRender(month1)}
|
|
170
|
+
headerRender={({ value: currentValue }) => (
|
|
171
|
+
<div style={{
|
|
172
|
+
padding: '8px 12px',
|
|
173
|
+
fontWeight: 500,
|
|
174
|
+
textAlign: 'center',
|
|
175
|
+
display: 'flex',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
justifyContent: 'space-between'
|
|
178
|
+
}}>
|
|
179
|
+
<span
|
|
180
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
181
|
+
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
182
|
+
>
|
|
183
|
+
‹
|
|
184
|
+
</span>
|
|
185
|
+
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
186
|
+
<span
|
|
187
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
188
|
+
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
189
|
+
>
|
|
190
|
+
›
|
|
191
|
+
</span>
|
|
192
|
+
</div>
|
|
193
|
+
)}
|
|
194
|
+
/>
|
|
195
|
+
<Calendar
|
|
196
|
+
fullscreen={false}
|
|
197
|
+
value={month2}
|
|
198
|
+
onSelect={handleDateSelect}
|
|
199
|
+
fullCellRender={createCellRender(month2)}
|
|
200
|
+
headerRender={({ value: currentValue }) => (
|
|
201
|
+
<div style={{
|
|
202
|
+
padding: '8px 12px',
|
|
203
|
+
fontWeight: 500,
|
|
204
|
+
textAlign: 'center',
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
justifyContent: 'space-between'
|
|
208
|
+
}}>
|
|
209
|
+
<span
|
|
210
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
211
|
+
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
212
|
+
>
|
|
213
|
+
‹
|
|
214
|
+
</span>
|
|
215
|
+
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
216
|
+
<span
|
|
217
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
218
|
+
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
219
|
+
>
|
|
220
|
+
›
|
|
221
|
+
</span>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
/>
|
|
225
|
+
<Calendar
|
|
226
|
+
fullscreen={false}
|
|
227
|
+
value={month3}
|
|
228
|
+
onSelect={handleDateSelect}
|
|
229
|
+
fullCellRender={createCellRender(month3)}
|
|
230
|
+
headerRender={({ value: currentValue }) => (
|
|
231
|
+
<div style={{
|
|
232
|
+
padding: '8px 12px',
|
|
233
|
+
fontWeight: 500,
|
|
234
|
+
textAlign: 'center',
|
|
235
|
+
display: 'flex',
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
justifyContent: 'space-between'
|
|
238
|
+
}}>
|
|
239
|
+
<span
|
|
240
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
241
|
+
onClick={() => setBaseMonth(baseMonth.subtract(1, 'month'))}
|
|
242
|
+
>
|
|
243
|
+
‹
|
|
244
|
+
</span>
|
|
245
|
+
<span>{currentValue.format('MMMM YYYY')}</span>
|
|
246
|
+
<span
|
|
247
|
+
style={{ cursor: 'pointer', padding: '0 4px' }}
|
|
248
|
+
onClick={() => setBaseMonth(baseMonth.add(1, 'month'))}
|
|
249
|
+
>
|
|
250
|
+
›
|
|
251
|
+
</span>
|
|
252
|
+
</div>
|
|
253
|
+
)}
|
|
254
|
+
/>
|
|
255
|
+
</CalendarContainer>
|
|
256
|
+
|
|
257
|
+
{visibleHolidays.length > 0 && (
|
|
258
|
+
<div style={{ marginBottom: '12px', fontSize: '11px', color: '#666' }}>
|
|
259
|
+
{visibleHolidays.map((holiday, index) => {
|
|
260
|
+
const isSelectedHoliday = selectedDate && holiday.date === selectedDate.format('DD.MM.YYYY');
|
|
261
|
+
return (
|
|
262
|
+
<div
|
|
263
|
+
key={index}
|
|
264
|
+
style={{
|
|
265
|
+
marginBottom: '2px',
|
|
266
|
+
background: isSelectedHoliday ? '#e6f7ff' : 'transparent',
|
|
267
|
+
padding: isSelectedHoliday ? '2px 4px' : '0',
|
|
268
|
+
borderRadius: '2px',
|
|
269
|
+
fontWeight: isSelectedHoliday ? 600 : 'normal',
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
<span style={{ color: '#cf1322', fontWeight: 500 }}>{holiday.date}</span> - {holiday.name}
|
|
273
|
+
</div>
|
|
274
|
+
);
|
|
275
|
+
})}
|
|
276
|
+
</div>
|
|
277
|
+
)}
|
|
278
|
+
|
|
279
|
+
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
|
280
|
+
<Button size="small" onClick={onCancel} disabled={loading}>
|
|
281
|
+
Zrušit
|
|
282
|
+
</Button>
|
|
283
|
+
<Button
|
|
284
|
+
type="primary"
|
|
285
|
+
size="small"
|
|
286
|
+
onClick={() => onSubmit(value)}
|
|
287
|
+
loading={loading}
|
|
288
|
+
>
|
|
289
|
+
Použít
|
|
290
|
+
</Button>
|
|
291
|
+
</Space>
|
|
292
|
+
</>
|
|
293
|
+
);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// React.memo optimalizace
|
|
297
|
+
// ✅ PERFORMANCE FIX: Ignore callback references
|
|
298
|
+
const arePropsEqual = createMemoComparison(
|
|
299
|
+
['value', 'loading'], // Kritické props
|
|
300
|
+
['onChange', 'onSubmit', 'onCancel'], // Ignorované callbacky
|
|
301
|
+
false,
|
|
302
|
+
'BulkEditDatePicker'
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
export default React.memo(BulkEditDatePicker, arePropsEqual);
|