es-grid-template 1.7.46 → 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.
@@ -591,7 +591,8 @@ const InternalTable = props => {
591
591
  }
592
592
  return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
593
593
  },
594
- defaultSortOrder: 'ascend',
594
+ // defaultSortOrder: 'ascend',
595
+
595
596
  hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(column.field) ? true : transformedColumn.hidden
596
597
  };
597
598
  });
@@ -15,7 +15,5 @@ interface UseColumnsConfig<RecordType> {
15
15
  rowKey?: any;
16
16
  onMouseHover?: any;
17
17
  }
18
- declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
19
- any
20
- ];
18
+ declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [any];
21
19
  export default useColumns;
@@ -651,6 +651,7 @@ const TableContainerEdit = props => {
651
651
  setEndCell(undefined);
652
652
  setStartCell(undefined);
653
653
  setRangeState(undefined);
654
+ setFocusedCell(undefined);
654
655
  }
655
656
  };
656
657
 
@@ -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 ?? [];
@@ -599,7 +599,8 @@ const InternalTable = props => {
599
599
  }
600
600
  return (0, _columns.renderContent)(column, value, record, rowIndex, colIndex, false, cellFormat);
601
601
  },
602
- defaultSortOrder: 'ascend',
602
+ // defaultSortOrder: 'ascend',
603
+
603
604
  hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(column.field) ? true : transformedColumn.hidden
604
605
  };
605
606
  });
@@ -658,6 +658,7 @@ const TableContainerEdit = props => {
658
658
  setEndCell(undefined);
659
659
  setStartCell(undefined);
660
660
  setRangeState(undefined);
661
+ setFocusedCell(undefined);
661
662
  }
662
663
  };
663
664
 
@@ -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 ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.7.46",
3
+ "version": "1.7.48",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",