es-grid-template 1.7.37 → 1.7.39

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,6 +1,5 @@
1
- import * as React from "react";
2
- import type { ContextInfo } from "./type";
3
- import type { ContextMenuItem } from "./type";
1
+ import * as React from 'react';
2
+ import type { ContextInfo, ContextMenuItem } from './type';
4
3
  export declare const findItemByKey: (array: any[], key: string, value: any) => any;
5
4
  type Props<RecordType> = {
6
5
  rowData: RecordType | null;
@@ -1,6 +1,6 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  // import type { MenuProps } from "antd";
3
- import { Dropdown, Menu } from "antd";
3
+ import { Dropdown, Menu } from 'antd';
4
4
  export const findItemByKey = (array, key, value) => {
5
5
  for (let i = 0; i < array.length; i++) {
6
6
  const item = array[i];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import 'react-resizable/css/styles.css';
3
- import type { GridTableProps } from "./type";
3
+ import type { GridTableProps } from './type';
4
4
  import 'dayjs/locale/es';
5
5
  import 'dayjs/locale/vi';
6
6
  import './styles.scss';
@@ -1,45 +1,45 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
2
3
  import React, { createContext, Fragment, useCallback, useContext, useState } from 'react';
3
4
  import 'react-resizable/css/styles.css';
4
- import customParseFormat from 'dayjs/plugin/customParseFormat';
5
5
  import { addRowIdArray, booleanOperator, convertFilters, convertFlatColumn, filterDataByColumns4, findItemByKey, findItemPath, flattenArray, getAllRowKey, getFormat, getTypeFilter, groupArrayByColumns, isNullOrUndefined, numberOperator, removeColumns, removeInvisibleColumns, stringOperator, translateOption, unFlattenData, updateArrayByKey, updateColumnsByGroup,
6
6
  // updateData,
7
7
  updateOrInsert } from "./hooks";
8
- import dayjs from "dayjs";
8
+ import dayjs from 'dayjs';
9
9
  import 'dayjs/locale/es';
10
10
  import 'dayjs/locale/vi';
11
- import GridEdit from "./table/GridEdit";
11
+ import en from 'rc-master-ui/es/date-picker/locale/en_US';
12
+ import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
12
13
  import Grid from "./table/Grid";
13
- import en from "rc-master-ui/es/date-picker/locale/en_US";
14
- import vi from "rc-master-ui/es/date-picker/locale/vi_VN";
15
- import enDr from "rc-master-ui/es/locales/en_US";
16
- import viDr from "rc-master-ui/es/locales/vi_VN";
14
+ import GridEdit from "./table/GridEdit";
15
+ import enDr from 'rc-master-ui/es/locales/en_US';
16
+ import viDr from 'rc-master-ui/es/locales/vi_VN';
17
17
  // import useColumns from "./hooks/useColumns";
18
18
 
19
19
  import "./styles.scss";
20
20
  // import 'rc-master-ui/es/date-range-picker/styles/index.less'
21
21
  // import 'rc-master-ui/assets/index.css'
22
22
 
23
+ import { SearchOutlined } from '@ant-design/icons';
24
+ import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
25
+ import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';
26
+ import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from '@dnd-kit/sortable';
27
+ import { Button, Space } from 'antd';
28
+ import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
29
+ import classNames from 'classnames';
30
+ import { Select } from 'rc-master-ui';
31
+ import { Tooltip } from 'react-tooltip';
32
+ import Swal from 'sweetalert2';
33
+ import withReactContent from 'sweetalert2-react-content';
23
34
  import { flatColumns2, renderContent, renderFilter } from "./hooks/columns";
24
- import Group from "./table/Group";
25
- import Swal from "sweetalert2";
26
- import withReactContent from "sweetalert2-react-content";
27
- import { Tooltip } from "react-tooltip";
28
- import classNames from "classnames";
29
35
  import HeaderContent from "./hooks/content/HeaderContent";
30
- import { ArrowDown, ArrowUp, FilterFill, SortCancel } from "becoxy-icons";
31
- import { Select } from "rc-master-ui";
32
- import { Button, Space } from "antd";
33
- import { SearchOutlined } from "@ant-design/icons";
34
- import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
35
- import { closestCenter, DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
36
- import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
36
+ import Group from "./table/Group";
37
37
  // import {CSS} from "@dnd-kit/utilities";
38
- import { Resizable } from "react-resizable";
39
- import { faker } from "@faker-js/faker";
40
- import InfiniteTable from "./table/InfiniteTable";
41
- import useMergedState from "rc-util/es/hooks/useMergedState";
38
+ import { faker } from '@faker-js/faker';
42
39
  import Modal from 'antd/es/modal/Modal';
40
+ import useMergedState from "rc-util/es/hooks/useMergedState";
41
+ import { Resizable } from 'react-resizable';
42
+ import InfiniteTable from "./table/InfiniteTable";
43
43
  dayjs.extend(customParseFormat);
44
44
  const MySwal = withReactContent(Swal);
45
45
  const ASCEND = 'ascend';
@@ -213,9 +213,9 @@ const InternalTable = props => {
213
213
  const handleWindowResize = () => {
214
214
  setWindowSize(getWindowSize());
215
215
  };
216
- window.addEventListener("resize", handleWindowResize);
216
+ window.addEventListener('resize', handleWindowResize);
217
217
  return () => {
218
- window.removeEventListener("resize", handleWindowResize);
218
+ window.removeEventListener('resize', handleWindowResize);
219
219
  };
220
220
  }, []);
221
221
  const [scrollHeight, setHeight] = useState(0);
@@ -401,7 +401,7 @@ const InternalTable = props => {
401
401
  // handleSearch()
402
402
  // close()
403
403
  }
404
- }, t ? t("Clear") : 'Clear')));
404
+ }, t ? t('Clear') : 'Clear')));
405
405
  },
406
406
  filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
407
407
  fontSize: 12
@@ -586,7 +586,7 @@ const InternalTable = props => {
586
586
  if (currentGroupColumn?.template) {
587
587
  return renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat);
588
588
  }
589
- return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
589
+ return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ":", ' ', renderContent(currentGroupColumn, record[record.field], record, rowIndex, colIndex, false, cellFormat));
590
590
  }
591
591
  return renderContent(column, value, record, rowIndex, colIndex, false, cellFormat);
592
592
  },
@@ -658,7 +658,7 @@ const InternalTable = props => {
658
658
  if (tableRef.current && type === 'columnChoose') {
659
659
  tableRef.current.scrollTo({
660
660
  left: 0.1,
661
- behavior: "smooth"
661
+ behavior: 'smooth'
662
662
  });
663
663
  }
664
664
  onChooseColumns?.({
@@ -699,17 +699,11 @@ const InternalTable = props => {
699
699
  setColumns(updateColumnsByGroup(mergedColumns, groupedColumns));
700
700
  if (groupSetting) {
701
701
  if (groupSetting.client === false) {
702
-
703
702
  // setIsTree(true)
704
-
705
703
  // setGroupOpen([])
706
-
707
704
  // const dt = ungroupArray(dataSource)
708
-
709
705
  // const rs = groupArrayByColumns2(dt, [...value])
710
-
711
706
  // setResource([...rs])
712
-
713
707
  // if (groupSetting.onGroup) {
714
708
  // groupSetting.onGroup({
715
709
  // columnGrouped: value,
@@ -958,7 +952,6 @@ const InternalTable = props => {
958
952
  } : {
959
953
  y: scrollHeight - (summary ? 1 : 1)
960
954
  } // scroll height auto, không quá 600
961
-
962
955
  // height={isFullScreen ? windowSize.innerHeight - 100 : propsHeight}
963
956
  ,
964
957
  height: propsHeight,
@@ -1008,10 +1001,10 @@ const InternalTable = props => {
1008
1001
  style: {
1009
1002
  maxWidth: '100%',
1010
1003
  height: '100%'
1011
- },
1012
- onClose: () => setIsFullScreen(false),
1004
+ }
1005
+ // onClose={() => setIsFullScreen(false)}
1006
+ ,
1013
1007
  onCancel: () => setIsFullScreen(false)
1014
-
1015
1008
  // destroyOnClose
1016
1009
  ,
1017
1010
  styles: {
@@ -1073,7 +1066,6 @@ const InternalTable = props => {
1073
1066
  y: scrollHeight1 - (summary ? 1 : 1)
1074
1067
  } // scroll height auto, không quá 600
1075
1068
  ,
1076
-
1077
1069
  height: windowSize.innerHeight - 35,
1078
1070
  scrollHeight: scrollHeight1,
1079
1071
  components: {
@@ -1,4 +1,5 @@
1
- import React, { ReactElement, ReactNode } from "react";
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import React from "react";
2
3
  type Props = {
3
4
  t?: any;
4
5
  content?: any;
@@ -62,14 +62,8 @@ const InternalTable = props => {
62
62
  groupSetting,
63
63
  groupColumns,
64
64
  selectionSettings,
65
- // infiniteScroll,
66
- // wrapSettings,
67
- // onFilter,
68
- // expandable,
69
- // contextMenuItems: propContextMenuItems,
70
- // contextMenuHidden,
71
- contextMenuClick,
72
- contextMenuOpen,
65
+ // contextMenuClick,
66
+ // contextMenuOpen,
73
67
  height,
74
68
  ...rest
75
69
  } = props;
@@ -98,32 +92,6 @@ const InternalTable = props => {
98
92
  window.removeEventListener('resize', handleWindowResize);
99
93
  };
100
94
  }, []);
101
-
102
- // const local = lang && lang === 'en' ? en : vi
103
- // const dateRangeLocale = lang && lang === 'en' ? enDr : viDr
104
-
105
- // const buddhistLocale: PickerLocale = {
106
- // ...local,
107
- // lang: {
108
- // ...local.lang
109
- // }
110
- // }
111
-
112
- // const menuRef = React.useRef<any>(null)
113
- // const viewportWidth = windowSize.innerWidth
114
- // const viewportHeight = windowSize.innerHeight
115
-
116
- // const [menuVisible, setMenuVisible] = React.useState(false)
117
- // const [selectedRowData, setSelectedRowData] = React.useState<RecordType | null>(null)
118
- // const [position, setPosition] = React.useState<{
119
- // x: number | undefined
120
- // y: number | undefined
121
- // viewportWidth: number
122
- // viewportHeight: number
123
- // }>({ x: 0, y: 0, viewportWidth, viewportHeight })
124
-
125
- // const [tooltipContent, setTooltipContent] = useState<any>('')
126
-
127
95
  const [filterStates, setFilterState] = React.useState(null);
128
96
  const [sorterStates, setSorterStates] = React.useState([]);
129
97
  const [isFullScreen, setIsFullScreen] = React.useState(false);
@@ -193,81 +161,6 @@ const InternalTable = props => {
193
161
  setColumnsHiddenKeys(rsss);
194
162
  }
195
163
  };
196
-
197
- // const contextMenuItems = React.useMemo(() => {
198
- // if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
199
- // const hiddenItems = contextMenuHidden({
200
- // rowInfo: {
201
- // rowData: selectedRowData
202
- // }
203
- // })
204
-
205
- // return propContextMenuItems.filter(item => !(hiddenItems as string[]).includes(item?.key as string))
206
- // }
207
-
208
- // if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
209
- // return propContextMenuItems.filter(item => !(contextMenuHidden as string[]).includes(item?.key as string))
210
- // }
211
-
212
- // return propContextMenuItems
213
- // }, [propContextMenuItems, contextMenuHidden, selectedRowData])
214
-
215
- // const onContextMenu = (data: RecordType) => (event: any) => {
216
- // event.preventDefault() // Ngăn chặn menu mặc định của trình duyệt
217
-
218
- // setSelectedRowData(data)
219
-
220
- // contextMenuOpen?.({
221
- // rowInfo: {
222
- // rowData: data
223
- // },
224
- // event
225
- // })
226
-
227
- // setMenuVisible(true)
228
-
229
- // // Đợi DOM cập nhật và lấy kích thước menu
230
- // setTimeout(() => {
231
- // const menuElement = menuRef.current // Lấy menu từ DOM
232
- // const menuWidth = menuElement?.offsetWidth || 200 // Mặc định 200px nếu chưa render
233
- // const menuHeight = menuElement?.offsetHeight // Mặc định 450px nếu chưa render
234
-
235
- // // Điều chỉnh vị trí menu
236
- // let x = event.clientX
237
- // let y = event.clientY
238
-
239
- // if (x + menuWidth > viewportWidth) {
240
- // x = x - menuWidth - 10 // Cách cạnh phải 10px
241
- // }
242
-
243
- // if (y + menuHeight > viewportHeight) {
244
- // if (y < menuHeight) {
245
- // y = 10
246
- // } else {
247
- // y = y - 10 - menuHeight // Cách cạnh dưới 10px
248
- // }
249
- // }
250
-
251
- // setPosition(prevState => ({ ...prevState, x, y }))
252
- // }, 100)
253
-
254
- // if (!menuVisible) {
255
- // document.addEventListener(`click`, function onClickOutside(e) {
256
- // const element: any = e.target
257
- // const menuContainer = document.querySelector('.popup-context-menu')
258
-
259
- // const isInsideContainer = element.closest('.popup-context-menu') && menuContainer
260
-
261
- // if (isInsideContainer) {
262
- // return
263
- // }
264
- // setMenuVisible(false)
265
- // setPosition(prevState => ({ ...prevState, x: undefined, y: undefined }))
266
- // document.removeEventListener(`click`, onClickOutside)
267
- // })
268
- // }
269
- // }
270
-
271
164
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
272
165
  t: t,
273
166
  id: id,
@@ -294,7 +187,7 @@ const InternalTable = props => {
294
187
  // onContextMenu={onContextMenu}
295
188
  // contextMenuItems={contextMenuItems}
296
189
  ,
297
- editAble: editAble,
190
+ editAble: isFullScreen ? false : editAble,
298
191
  triggerChangeColumns: triggerChangeColumns,
299
192
  setExpanded: setExpanded,
300
193
  isFullScreen: isFullScreen,
@@ -313,8 +206,9 @@ const InternalTable = props => {
313
206
  style: {
314
207
  maxWidth: '100%',
315
208
  height: '100%'
316
- },
317
- onClose: () => setIsFullScreen(false),
209
+ }
210
+ // onClose={() => setIsFullScreen(false)}
211
+ ,
318
212
  onCancel: () => setIsFullScreen(false)
319
213
 
320
214
  // destroyOnClose
@@ -810,9 +810,12 @@ const TableContainerEdit = props => {
810
810
  // const duplicatedItems = rowsFocus.map(index => ({ ...newData[index], rowId: newGuid(), id: undefined, isDuplicate: true }))
811
811
 
812
812
  const duplicatedItem = table.getRowModel().flatRows.find(it => it.id === focusedCell?.rowId);
813
- setStartCell(focusedCell);
814
- setEndCell(focusedCell);
815
- setRangeState(getSelectedCellMatrix(table, focusedCell, focusedCell));
813
+
814
+ // setStartCell(focusedCell)
815
+ // setEndCell(focusedCell)
816
+
817
+ // setRangeState(getSelectedCellMatrix(table, focusedCell, focusedCell))
818
+
816
819
  const duplicatedItems = [{
817
820
  ...duplicatedItem?.original,
818
821
  rowId: newGuid(),
@@ -836,6 +839,9 @@ const TableContainerEdit = props => {
836
839
  // thêm n dòng bên trên
837
840
  const handleInsertBefore = React.useCallback((item, n) => {
838
841
  const defaultRowValue = getDefaultValue(defaultValue);
842
+ setStartCell(focusedCell);
843
+ setEndCell(focusedCell);
844
+ setRangeState(getSelectedCellMatrix(table, focusedCell, focusedCell));
839
845
 
840
846
  // const record: any = table.getRowModel().rows.find((it) => it.id === rowsFocus[rowsFocus.length - 1])?.original
841
847
  const record = table.getRowModel().flatRows.find(it => it.id === rowsFocus[rowsFocus.length - 1])?.original;
@@ -892,7 +898,7 @@ const TableContainerEdit = props => {
892
898
  triggerChangeData?.(newDataSource);
893
899
  }
894
900
  }
895
- }, [defaultValue, mergedFilterKeys, originData, rowKey, rowsFocus, setMergedFilterKeys, table, triggerChangeData]);
901
+ }, [defaultValue, focusedCell, mergedFilterKeys, originData, rowKey, rowsFocus, setMergedFilterKeys, table, triggerChangeData]);
896
902
 
897
903
  //thêm 1 dòng bên dưới
898
904
  const handleInsertAfter = React.useCallback((item, n) => {
@@ -1021,12 +1027,61 @@ const TableContainerEdit = props => {
1021
1027
  const filterData = flattenArray([...originData]);
1022
1028
  const rs = filterData.filter(it => !rowsFocus.includes(it[rowKey]));
1023
1029
  const newDaa = unFlattenData(rs);
1024
- triggerChangeData?.([...newDaa]);
1030
+ if (commandSettings && commandSettings.confirmDialog) {
1031
+ MySwal.fire({
1032
+ title: t ? t('Confirm') : 'Confirm',
1033
+ text: t ? t('Do you want to delete item?') : 'Do you want to delete item?',
1034
+ // icon: 'warning',
1035
+ allowOutsideClick: false,
1036
+ showCancelButton: true,
1037
+ confirmButtonText: t ? t('Delete') : 'Delete',
1038
+ cancelButtonText: t ? t('Cancel') : 'Cancel',
1039
+ customClass: {
1040
+ confirmButton: 'be-button btn-primary',
1041
+ cancelButton: 'be-button btn-danger ms-1'
1042
+ },
1043
+ buttonsStyling: false
1044
+ }).then(async result => {
1045
+ if (result.value) {
1046
+ triggerChangeData?.([...newDaa]);
1047
+ } else if (result.dismiss === MySwal.DismissReason.cancel) {}
1048
+ });
1049
+ } else {
1050
+ // không hiện dialog
1051
+ triggerChangeData?.([...newDaa]);
1052
+ }
1053
+ }
1054
+ }, [commandSettings, originData, rowKey, rowsFocus, t, triggerChangeData]);
1055
+ const handleDeleteAll = React.useCallback(item => {
1056
+ if (item.onClick) {
1057
+ item.onClick({
1058
+ toolbar: item
1059
+ });
1060
+ } else {
1061
+ if (commandSettings && commandSettings.confirmDialog) {
1062
+ MySwal.fire({
1063
+ title: t ? t('Confirm') : 'Confirm',
1064
+ text: t ? t('Do you want to delete item?') : 'Do you want to delete item?',
1065
+ // icon: 'warning',
1066
+ allowOutsideClick: false,
1067
+ showCancelButton: true,
1068
+ confirmButtonText: t ? t('Delete') : 'Delete',
1069
+ cancelButtonText: t ? t('Cancel') : 'Cancel',
1070
+ customClass: {
1071
+ confirmButton: 'be-button btn-primary',
1072
+ cancelButton: 'be-button btn-danger ms-1'
1073
+ },
1074
+ buttonsStyling: false
1075
+ }).then(async result => {
1076
+ if (result.value) {
1077
+ triggerChangeData?.([]);
1078
+ } else if (result.dismiss === MySwal.DismissReason.cancel) {}
1079
+ });
1080
+ } else {
1081
+ triggerChangeData?.([]);
1082
+ }
1025
1083
  }
1026
- }, [originData, rowKey, rowsFocus, triggerChangeData]);
1027
- const handleDeleteAll = React.useCallback(() => {
1028
- triggerChangeData?.([]);
1029
- }, [triggerChangeData]);
1084
+ }, [commandSettings, t, triggerChangeData]);
1030
1085
  const handleDeleteContent = () => {
1031
1086
  if (startCell && endCell) {
1032
1087
  const tmpData = flattenArray([...dataSource]);
@@ -1103,7 +1158,7 @@ const TableContainerEdit = props => {
1103
1158
  borderColor: '#eb4619'
1104
1159
  },
1105
1160
  variant: 'outlined',
1106
- onClick: handleDeleteAll,
1161
+ onClick: () => handleDeleteAll(item),
1107
1162
  className: "d-flex toolbar-button"
1108
1163
  }, item.label ? t ? t(item.label) : item.label : t ? t('Delete all item') : 'Delete all item'));
1109
1164
  }
@@ -1450,8 +1505,8 @@ const TableContainerEdit = props => {
1450
1505
  options: newOptions
1451
1506
  }
1452
1507
  };
1453
- const rrr = updateArrayByKey([...columns], newElem, 'field');
1454
- triggerChangeColumns?.(rrr, 'click');
1508
+ const rrr = updateArrayByKey([...propsColumns], newElem, 'field');
1509
+ triggerChangeColumns?.(rrr, [], "cellClick");
1455
1510
  }
1456
1511
  };
1457
1512
  if (onCellClick) {
@@ -287,7 +287,7 @@ const EditableCell = props => {
287
287
  const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
288
288
 
289
289
  // @ts-ignore
290
- // const timeValue = !isEmpty(record[column.dataIndex]) ? dayjs(record[column.dataIndex], timeFormat) : null
290
+ // const timeValue = !isEmpty(record[dataIndex]) ? dayjs(record[dataIndex], timeFormat) : null
291
291
  const maxTime = maxTimeValue ? dayjs(maxTimeValue, timeFormat) : undefined;
292
292
  const minTime = minTimeValue ? dayjs(minTimeValue, timeFormat) : undefined;
293
293
  return /*#__PURE__*/React.createElement(TimePicker, {
@@ -337,7 +337,7 @@ const EditableCell = props => {
337
337
  }
338
338
  if (isMulti || selectMode === 'checkbox') {
339
339
  // @ts-ignore
340
- valueSelectTable = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
340
+ valueSelectTable = !isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0 ? options.filter(val => record[dataIndex]?.includes(val[keySelect])) : undefined;
341
341
  }
342
342
  return /*#__PURE__*/React.createElement(AsyncTableSelect
343
343
  // id={`col${indexCol}-record${indexRow}`}
@@ -444,7 +444,7 @@ const EditableCell = props => {
444
444
  }
445
445
  if (isMulti || selectMode === 'checkbox') {
446
446
  // @ts-ignore
447
- valueSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
447
+ valueSelect = !isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0 ? options.filter(val => record[dataIndex]?.includes(val[keySelect])) : undefined;
448
448
  }
449
449
  return /*#__PURE__*/React.createElement(Select, {
450
450
  options: options,
@@ -530,7 +530,7 @@ const EditableCell = props => {
530
530
  }
531
531
  if (isMulti || selectMode === 'checkbox') {
532
532
  // @ts-ignore
533
- valueAsyncSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
533
+ valueAsyncSelect = !isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0 ? options.filter(val => record[dataIndex]?.includes(val[keySelect])) : undefined;
534
534
  }
535
535
  return /*#__PURE__*/React.createElement(AsyncSelect, {
536
536
  options: options,
@@ -652,7 +652,7 @@ const EditableCell = props => {
652
652
 
653
653
  const newTreeData = convertLabelToTitle(optionsTree);
654
654
  // @ts-ignore
655
- // const valueTreeSelect = column?.editSelectSettings?.isMulti ? (Array.isArray(record[column.dataIndex]) ? record[column.dataIndex] : []) : record[column.dataIndex]
655
+ // const valueTreeSelect = column?.editSelectSettings?.isMulti ? (Array.isArray(record[dataIndex]) ? record[dataIndex] : []) : record[dataIndex]
656
656
 
657
657
  let valueTreeSelect = value;
658
658
  if (fieldValue) {
@@ -661,7 +661,7 @@ const EditableCell = props => {
661
661
  }
662
662
  if (isMulti || selectMode === 'checkbox') {
663
663
  // @ts-ignore
664
- valueTreeSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
664
+ valueTreeSelect = !isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0 ? options.filter(val => record[dataIndex]?.includes(val[keySelect])) : undefined;
665
665
  }
666
666
  return /*#__PURE__*/React.createElement(TreeSelect, {
667
667
  id: `col${indexCol}-record${indexRow}`,
@@ -800,7 +800,7 @@ const EditableCell = props => {
800
800
  });
801
801
 
802
802
  // case 'file':
803
- // const valueFile = record[column.dataIndex]
803
+ // const valueFile = record[dataIndex]
804
804
  // return (
805
805
  //
806
806
  //
@@ -815,7 +815,7 @@ const EditableCell = props => {
815
815
  // const newValue = Array.isArray(val) ? val.map((it: any) => it) : val
816
816
  // const newrecordData = {
817
817
  // ...record,
818
- // [column.dataIndex]: newValue
818
+ // [dataIndex]: newValue
819
819
  // }
820
820
  // handleCellChange(val, newValue, newrecordData, col, indexRow, indexCol)
821
821
  // }}
@@ -875,7 +875,7 @@ const EditableCell = props => {
875
875
  });
876
876
 
877
877
  // case 'image':
878
- // let image = record[column.dataIndex]
878
+ // let image = record[dataIndex]
879
879
  // return (
880
880
  // <ImageUpload
881
881
  // id={`col${indexCol}-record${indexRow}`}
@@ -886,8 +886,8 @@ const EditableCell = props => {
886
886
  // const checkKey = checkKeyDown(val, col, indexRow + 1, indexCol + 1)
887
887
  // if (checkKey === 'ArrecordDown' || checkKey === 'ArrecordUp' || checkKey === 'Enter') {
888
888
  // let newVal = ''
889
- // if (newVal != record[column.dataIndex]) {
890
- // record[column.dataIndex] = path
889
+ // if (newVal != record[dataIndex]) {
890
+ // record[dataIndex] = path
891
891
  // // handleDataChange(path, record, col, indexRow, indexCol)
892
892
  // handleCellChange(path, record, col, indexRow, indexCol)
893
893
  // }
@@ -966,11 +966,7 @@ const EditableCell = props => {
966
966
  textAlign: column.align,
967
967
  resize: 'none',
968
968
  height: '100%'
969
- }
970
-
971
- // @ts-ignore
972
- // value={!isNullOrUndefined(record[column.dataIndex]) ? record[column.dataIndex] : ''}
973
- ,
969
+ },
974
970
  disabled: isDisable(column, record) ?? false,
975
971
  className: classNames('be-cell-editing rounded-0 input-element'),
976
972
  placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
@@ -2,7 +2,7 @@ import { flexRender } from "@tanstack/react-table";
2
2
  import Space from "rc-master-ui/es/space";
3
3
  import Command from "../components/command/Command";
4
4
  import ReactDOMServer from 'react-dom/server';
5
- import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, flattenArray, flattenData,
5
+ import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, findFirst, flattenArray, flattenData,
6
6
  // getCellsByPosition,
7
7
  getColIdsBetween, getCommonPinningStyles, getEditType, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
8
8
  // import { nonActionColumn } from "../hook/constant";
@@ -692,6 +692,7 @@ const TableBodyCellEdit = props => {
692
692
  }
693
693
  const handleMouseDownIndex = rowId => {
694
694
  const allColumns = table.getVisibleLeafColumns();
695
+ const firstCOl = findFirst(allColumns);
695
696
  const startCol = allColumns[0].id;
696
697
  const endCol = allColumns[allColumns.length - 1].id;
697
698
  setStartCell?.({
@@ -702,6 +703,12 @@ const TableBodyCellEdit = props => {
702
703
  rowId,
703
704
  colId: endCol
704
705
  });
706
+ if (firstCOl) {
707
+ setFocusedCell?.({
708
+ rowId: cell.row.id,
709
+ colId: firstCOl.id
710
+ });
711
+ }
705
712
  setRangeState?.(getSelectedCellMatrix(table, {
706
713
  rowId,
707
714
  colId: startCol
@@ -1106,7 +1113,9 @@ const TableBodyCellEdit = props => {
1106
1113
  handleEdit(e);
1107
1114
  // setEditingKey?.(cell.row.id)
1108
1115
  }
1109
- })), !isSelecting && !isEditing && rowNumber === rangeState?.endRowIndex && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1116
+ })), !isSelecting && !isEditing && rowRange &&
1117
+ // rowNumber === rangeState?.endRowIndex &&
1118
+ cell.row.id === rowRange[rowRange?.length - 1] && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1110
1119
  className: 'dragging-point',
1111
1120
  onMouseDown: e => {
1112
1121
  e.preventDefault();
@@ -135,3 +135,4 @@ export declare const convertToObjTrue: (arr: any) => {
135
135
  };
136
136
  export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
137
137
  export declare function isTree(arr: any[]): boolean;
138
+ export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
@@ -1893,4 +1893,9 @@ export function isTree(arr) {
1893
1893
  if (!checkNode(item)) return false;
1894
1894
  }
1895
1895
  return true;
1896
+ }
1897
+ export function findFirst(items) {
1898
+ const leftItem = items.find(item => item.getIsPinned() === 'left');
1899
+ if (leftItem) return leftItem;
1900
+ return null;
1896
1901
  }
@@ -1,6 +1,5 @@
1
- import * as React from "react";
2
- import type { ContextInfo } from "./type";
3
- import type { ContextMenuItem } from "./type";
1
+ import * as React from 'react';
2
+ import type { ContextInfo, ContextMenuItem } from './type';
4
3
  export declare const findItemByKey: (array: any[], key: string, value: any) => any;
5
4
  type Props<RecordType> = {
6
5
  rowData: RecordType | null;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import 'react-resizable/css/styles.css';
3
- import type { GridTableProps } from "./type";
3
+ import type { GridTableProps } from './type';
4
4
  import 'dayjs/locale/es';
5
5
  import 'dayjs/locale/vi';
6
6
  import './styles.scss';