es-grid-template 1.9.45 → 1.9.46

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.
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
194
194
  value: any;
195
195
  rowData: RecordType;
196
196
  }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
197
- onCellStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
198
- onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
197
+ onCellStyles?: Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position">);
198
+ onCellHeaderStyles?: Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position">);
199
199
  onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
200
- onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
200
+ onCellFooterStyles?: Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "left" | "right" | "display" | "minWidth" | "position">);
201
201
  getValue?: (row: any, rowIndex: number) => any;
202
202
  getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
203
203
  headerCellProps?: import("./../../grid-component/type").CellProps;
@@ -316,9 +316,6 @@ const EditableCell = props => {
316
316
  const abc = moment(value).format(timeFormat);
317
317
  time = abc ? dayjs(abc, timeFormat) : null;
318
318
  }
319
-
320
- // time = value ? dayjs(value, timeFormat) : null
321
-
322
319
  const maxTimeValue = !isEmpty(column.maxTime) ? dayjs(column.maxTime).format(timeFormat) : null;
323
320
  const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
324
321
 
@@ -357,12 +354,8 @@ const EditableCell = props => {
357
354
  const newVal = moment(newDate.toDate()).format();
358
355
 
359
356
  // const newVal = datetime.isValid() ? moment(datetime.toDate()).format() : ''
360
-
361
357
  onChange(newVal);
362
358
  }
363
-
364
- // const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
365
-
366
359
  onChange(dateString);
367
360
  setTimeout(() => {
368
361
  // @ts-ignore
@@ -375,14 +368,23 @@ const EditableCell = props => {
375
368
  // @ts-ignore
376
369
  const prevState = record[dataIndex];
377
370
  const newState = itemState;
371
+ let newValue = newState;
372
+ if (typeTime === 'time') {
373
+ newValue = newState;
374
+ } else {
375
+ const datetime = dayjs(newState, timeFormat, true);
376
+ const newVal = datetime.isValid() ? moment(datetime.toDate()).format() : '';
377
+ onChange(newVal);
378
+ newValue = newVal;
379
+ }
378
380
  if (prevState !== newState) {
379
381
  handleCellChange?.({
380
382
  key: key,
381
383
  field: column.field ?? column.field,
382
384
  record: formState,
383
385
  prevState,
384
- newState,
385
- option: newState,
386
+ newState: newValue,
387
+ option: newValue,
386
388
  indexCol,
387
389
  indexRow,
388
390
  type: 'blur'
@@ -324,9 +324,6 @@ const EditableCell = props => {
324
324
  const abc = (0, _moment.default)(value).format(timeFormat);
325
325
  time = abc ? (0, _dayjs.default)(abc, timeFormat) : null;
326
326
  }
327
-
328
- // time = value ? dayjs(value, timeFormat) : null
329
-
330
327
  const maxTimeValue = !(0, _utils.isEmpty)(column.maxTime) ? (0, _dayjs.default)(column.maxTime).format(timeFormat) : null;
331
328
  const minTimeValue = !(0, _utils.isEmpty)(column.minTime) ? (0, _dayjs.default)(column.minTime).format(timeFormat) : null;
332
329
 
@@ -365,12 +362,8 @@ const EditableCell = props => {
365
362
  const newVal = (0, _moment.default)(newDate.toDate()).format();
366
363
 
367
364
  // const newVal = datetime.isValid() ? moment(datetime.toDate()).format() : ''
368
-
369
365
  onChange(newVal);
370
366
  }
371
-
372
- // const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
373
-
374
367
  onChange(dateString);
375
368
  setTimeout(() => {
376
369
  // @ts-ignore
@@ -383,14 +376,23 @@ const EditableCell = props => {
383
376
  // @ts-ignore
384
377
  const prevState = record[dataIndex];
385
378
  const newState = itemState;
379
+ let newValue = newState;
380
+ if (typeTime === 'time') {
381
+ newValue = newState;
382
+ } else {
383
+ const datetime = (0, _dayjs.default)(newState, timeFormat, true);
384
+ const newVal = datetime.isValid() ? (0, _moment.default)(datetime.toDate()).format() : '';
385
+ onChange(newVal);
386
+ newValue = newVal;
387
+ }
386
388
  if (prevState !== newState) {
387
389
  handleCellChange?.({
388
390
  key: key,
389
391
  field: column.field ?? column.field,
390
392
  record: formState,
391
393
  prevState,
392
- newState,
393
- option: newState,
394
+ newState: newValue,
395
+ option: newValue,
394
396
  indexCol,
395
397
  indexRow,
396
398
  type: 'blur'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.9.45",
3
+ "version": "1.9.46",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",