es-grid-template 1.7.47 → 1.7.48
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.
|
@@ -283,6 +283,7 @@ const EditableCell = props => {
|
|
|
283
283
|
});
|
|
284
284
|
case 'time':
|
|
285
285
|
const timeFormat = getDatepickerFormat(editType, cellFormat);
|
|
286
|
+
const time = value ? dayjs(value, timeFormat) : null;
|
|
286
287
|
const maxTimeValue = !isEmpty(column.maxTime) ? dayjs(column.maxTime).format(timeFormat) : null;
|
|
287
288
|
const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
|
|
288
289
|
|
|
@@ -297,7 +298,10 @@ const EditableCell = props => {
|
|
|
297
298
|
},
|
|
298
299
|
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
299
300
|
maxDate: maxTime,
|
|
300
|
-
minDate: minTime
|
|
301
|
+
minDate: minTime
|
|
302
|
+
// value={time}
|
|
303
|
+
,
|
|
304
|
+
defaultValue: time,
|
|
301
305
|
disabled: isDisable(column, record) ?? false,
|
|
302
306
|
style: {
|
|
303
307
|
width: '100%',
|
|
@@ -308,7 +312,35 @@ const EditableCell = props => {
|
|
|
308
312
|
"data-tooltip-content": message,
|
|
309
313
|
"data-tooltip-id": `${id}-tooltip-error`,
|
|
310
314
|
autoFocus: column.field === startCell?.colId,
|
|
311
|
-
defaultOpen: column.field === startCell?.colId
|
|
315
|
+
defaultOpen: column.field === startCell?.colId,
|
|
316
|
+
onChange: (newDate, dateString) => {
|
|
317
|
+
// const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
|
|
318
|
+
onChange(dateString);
|
|
319
|
+
setTimeout(() => {
|
|
320
|
+
// @ts-ignore
|
|
321
|
+
dateTimePickerRef.current?.focus();
|
|
322
|
+
}, 0);
|
|
323
|
+
},
|
|
324
|
+
onBlur: () => {
|
|
325
|
+
const formState = getValues();
|
|
326
|
+
const itemState = getValues(dataIndex);
|
|
327
|
+
// @ts-ignore
|
|
328
|
+
const prevState = record[dataIndex];
|
|
329
|
+
const newState = itemState;
|
|
330
|
+
if (prevState !== newState) {
|
|
331
|
+
handleCellChange?.({
|
|
332
|
+
key: key,
|
|
333
|
+
field: column.field ?? column.field,
|
|
334
|
+
record: formState,
|
|
335
|
+
prevState,
|
|
336
|
+
newState,
|
|
337
|
+
option: newState,
|
|
338
|
+
indexCol,
|
|
339
|
+
indexRow,
|
|
340
|
+
type: 'blur'
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
312
344
|
});
|
|
313
345
|
case 'selectTable':
|
|
314
346
|
const rr = selectColumns ?? [];
|
|
@@ -285,6 +285,7 @@ const EditableCell = props => {
|
|
|
285
285
|
});
|
|
286
286
|
case 'time':
|
|
287
287
|
const timeFormat = (0, _utils.getDatepickerFormat)(editType, cellFormat);
|
|
288
|
+
const time = value ? (0, _dayjs.default)(value, timeFormat) : null;
|
|
288
289
|
const maxTimeValue = !(0, _utils.isEmpty)(column.maxTime) ? (0, _dayjs.default)(column.maxTime).format(timeFormat) : null;
|
|
289
290
|
const minTimeValue = !(0, _utils.isEmpty)(column.minTime) ? (0, _dayjs.default)(column.minTime).format(timeFormat) : null;
|
|
290
291
|
|
|
@@ -299,7 +300,10 @@ const EditableCell = props => {
|
|
|
299
300
|
},
|
|
300
301
|
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
301
302
|
maxDate: maxTime,
|
|
302
|
-
minDate: minTime
|
|
303
|
+
minDate: minTime
|
|
304
|
+
// value={time}
|
|
305
|
+
,
|
|
306
|
+
defaultValue: time,
|
|
303
307
|
disabled: (0, _utils.isDisable)(column, record) ?? false,
|
|
304
308
|
style: {
|
|
305
309
|
width: '100%',
|
|
@@ -310,7 +314,35 @@ const EditableCell = props => {
|
|
|
310
314
|
"data-tooltip-content": message,
|
|
311
315
|
"data-tooltip-id": `${id}-tooltip-error`,
|
|
312
316
|
autoFocus: column.field === startCell?.colId,
|
|
313
|
-
defaultOpen: column.field === startCell?.colId
|
|
317
|
+
defaultOpen: column.field === startCell?.colId,
|
|
318
|
+
onChange: (newDate, dateString) => {
|
|
319
|
+
// const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
|
|
320
|
+
onChange(dateString);
|
|
321
|
+
setTimeout(() => {
|
|
322
|
+
// @ts-ignore
|
|
323
|
+
dateTimePickerRef.current?.focus();
|
|
324
|
+
}, 0);
|
|
325
|
+
},
|
|
326
|
+
onBlur: () => {
|
|
327
|
+
const formState = getValues();
|
|
328
|
+
const itemState = getValues(dataIndex);
|
|
329
|
+
// @ts-ignore
|
|
330
|
+
const prevState = record[dataIndex];
|
|
331
|
+
const newState = itemState;
|
|
332
|
+
if (prevState !== newState) {
|
|
333
|
+
handleCellChange?.({
|
|
334
|
+
key: key,
|
|
335
|
+
field: column.field ?? column.field,
|
|
336
|
+
record: formState,
|
|
337
|
+
prevState,
|
|
338
|
+
newState,
|
|
339
|
+
option: newState,
|
|
340
|
+
indexCol,
|
|
341
|
+
indexRow,
|
|
342
|
+
type: 'blur'
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
314
346
|
});
|
|
315
347
|
case 'selectTable':
|
|
316
348
|
const rr = selectColumns ?? [];
|