es-grid-template 1.8.71 → 1.8.73

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.
Files changed (251) hide show
  1. package/es/grid-component/TempTable.js +2 -1
  2. package/es/grid-component/type.d.ts +1 -3
  3. package/es/group-component/ColumnsChoose.d.ts +13 -0
  4. package/es/group-component/ColumnsChoose.js +211 -0
  5. package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  6. package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
  7. package/es/group-component/ColumnsGroup/index.d.ts +1 -0
  8. package/es/group-component/ColumnsGroup/index.js +1 -0
  9. package/es/group-component/ContextMenu.d.ts +19 -0
  10. package/es/group-component/ContextMenu.js +74 -0
  11. package/es/group-component/InternalTable.d.ts +8 -0
  12. package/es/group-component/InternalTable.js +224 -0
  13. package/es/group-component/TableContainer.d.ts +49 -0
  14. package/es/group-component/TableContainer.js +375 -0
  15. package/es/group-component/TableContainerEdit.d.ts +48 -0
  16. package/es/group-component/TableContainerEdit.js +2068 -0
  17. package/es/group-component/body/EditableCell.d.ts +16 -0
  18. package/es/group-component/body/EditableCell.js +1066 -0
  19. package/es/group-component/body/TableBody.d.ts +14 -0
  20. package/es/group-component/body/TableBody.js +82 -0
  21. package/es/group-component/body/TableBodyCell.d.ts +12 -0
  22. package/es/group-component/body/TableBodyCell.js +587 -0
  23. package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
  24. package/es/group-component/body/TableBodyCellEdit.js +1398 -0
  25. package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  26. package/es/group-component/body/TableBodyCellEmpty.js +149 -0
  27. package/es/group-component/body/TableBodyRow.d.ts +21 -0
  28. package/es/group-component/body/TableBodyRow.js +199 -0
  29. package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  30. package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
  31. package/es/group-component/components/ControlCheckbox.d.ts +13 -0
  32. package/es/group-component/components/ControlCheckbox.js +84 -0
  33. package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
  34. package/es/group-component/components/EditForm/EditForm.js +394 -0
  35. package/es/group-component/components/EditForm/index.d.ts +1 -0
  36. package/es/group-component/components/EditForm/index.js +1 -0
  37. package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
  38. package/es/group-component/components/InputControl/InputControl.js +118 -0
  39. package/es/group-component/components/InputControl/index.d.ts +1 -0
  40. package/es/group-component/components/InputControl/index.js +1 -0
  41. package/es/group-component/components/async-select/index.d.ts +11 -0
  42. package/es/group-component/components/async-select/index.js +38 -0
  43. package/es/group-component/components/async-table-select/index.d.ts +11 -0
  44. package/es/group-component/components/async-table-select/index.js +40 -0
  45. package/es/group-component/components/checkbox-control/index.d.ts +13 -0
  46. package/es/group-component/components/checkbox-control/index.js +40 -0
  47. package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  48. package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
  49. package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  50. package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
  51. package/es/group-component/components/command/Command.d.ts +10 -0
  52. package/es/group-component/components/command/Command.js +35 -0
  53. package/es/group-component/components/number/index.d.ts +12 -0
  54. package/es/group-component/components/number/index.js +42 -0
  55. package/es/group-component/components/number-range/index.d.ts +13 -0
  56. package/es/group-component/components/number-range/index.js +79 -0
  57. package/es/group-component/features/operator.d.ts +24 -0
  58. package/es/group-component/features/operator.js +62 -0
  59. package/es/group-component/footer/TableFooter.d.ts +7 -0
  60. package/es/group-component/footer/TableFooter.js +34 -0
  61. package/es/group-component/footer/TableFooterCell.d.ts +7 -0
  62. package/es/group-component/footer/TableFooterCell.js +66 -0
  63. package/es/group-component/footer/TableFooterRow.d.ts +8 -0
  64. package/es/group-component/footer/TableFooterRow.js +30 -0
  65. package/es/group-component/header/TableHead.d.ts +15 -0
  66. package/es/group-component/header/TableHead.js +98 -0
  67. package/es/group-component/header/TableHeadCell.d.ts +15 -0
  68. package/es/group-component/header/TableHeadCell.js +310 -0
  69. package/es/group-component/header/TableHeadCell2.d.ts +17 -0
  70. package/es/group-component/header/TableHeadCell2.js +321 -0
  71. package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
  72. package/es/group-component/header/TableHeadGroupCell.js +94 -0
  73. package/es/group-component/header/TableHeadRow.d.ts +15 -0
  74. package/es/group-component/header/TableHeadRow.js +52 -0
  75. package/es/group-component/header/renderFilter.d.ts +20 -0
  76. package/es/group-component/header/renderFilter.js +291 -0
  77. package/es/group-component/hook/convert.d.ts +1 -0
  78. package/es/group-component/hook/convert.js +28 -0
  79. package/es/group-component/hook/useColumns.d.ts +28 -0
  80. package/es/group-component/hook/useColumns.js +306 -0
  81. package/es/group-component/hook/useFilterOperator.d.ts +7 -0
  82. package/es/group-component/hook/useFilterOperator.js +33 -0
  83. package/es/group-component/hook/utils.d.ts +220 -0
  84. package/es/group-component/hook/utils.js +2340 -0
  85. package/es/group-component/index.d.ts +2 -0
  86. package/es/group-component/index.js +2 -0
  87. package/es/group-component/style.d.ts +22 -0
  88. package/es/group-component/style.js +48 -0
  89. package/es/group-component/style.scss +1438 -0
  90. package/es/group-component/table/Grid.d.ts +33 -0
  91. package/es/group-component/table/Grid.js +439 -0
  92. package/es/group-component/table/TableWrapper.d.ts +33 -0
  93. package/es/group-component/table/TableWrapper.js +250 -0
  94. package/es/group-component/useContext.d.ts +100 -0
  95. package/es/group-component/useContext.js +21 -0
  96. package/es/table-component/InternalTable.js +9 -2
  97. package/es/table-component/TableContainer.d.ts +1 -0
  98. package/es/table-component/TableContainer.js +6 -2
  99. package/es/table-component/TableContainerEdit.d.ts +1 -0
  100. package/es/table-component/TableContainerEdit.js +4 -2
  101. package/es/table-component/body/TableBodyCell.js +49 -40
  102. package/es/table-component/body/TableBodyCellEdit.js +9 -6
  103. package/es/table-component/body/TableBodyRow.js +4 -1
  104. package/es/table-component/header/TableHeadCell2.js +39 -3
  105. package/es/table-component/hook/utils.d.ts +1 -0
  106. package/es/table-component/hook/utils.js +15 -7
  107. package/es/table-component/style.js +1 -1
  108. package/es/table-component/table/Grid.d.ts +1 -0
  109. package/es/table-component/table/Grid.js +10 -3
  110. package/es/table-component/useContext.d.ts +6 -0
  111. package/es/table-component/useContext.js +2 -1
  112. package/es/table-virtuoso/InternalTable.js +2 -2
  113. package/es/table-virtuoso/body/TableBodyCell.js +2 -7
  114. package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  115. package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
  116. package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  117. package/es/table-virtuoso/body/TableBodyRow.js +43 -1
  118. package/es/table-virtuoso/hook/utils.d.ts +1 -0
  119. package/es/table-virtuoso/hook/utils.js +29 -0
  120. package/es/table-virtuoso/style.js +3 -1
  121. package/es/table-virtuoso/table/Grid.js +2 -2
  122. package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
  123. package/es/table-virtuoso/table/TableWrapper.js +24 -5
  124. package/es/table-virtuoso/useContext.d.ts +6 -3
  125. package/es/table-virtuoso/useContext.js +18 -0
  126. package/lib/grid-component/TempTable.js +2 -1
  127. package/lib/grid-component/type.d.ts +1 -3
  128. package/lib/group-component/ColumnsChoose.d.ts +13 -0
  129. package/lib/group-component/ColumnsChoose.js +221 -0
  130. package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  131. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
  132. package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
  133. package/lib/group-component/ColumnsGroup/index.js +16 -0
  134. package/lib/group-component/ContextMenu.d.ts +19 -0
  135. package/lib/group-component/ContextMenu.js +83 -0
  136. package/lib/group-component/InternalTable.d.ts +8 -0
  137. package/lib/group-component/InternalTable.js +233 -0
  138. package/lib/group-component/TableContainer.d.ts +49 -0
  139. package/lib/group-component/TableContainer.js +382 -0
  140. package/lib/group-component/TableContainerEdit.d.ts +48 -0
  141. package/lib/group-component/TableContainerEdit.js +2075 -0
  142. package/lib/group-component/body/EditableCell.d.ts +16 -0
  143. package/lib/group-component/body/EditableCell.js +1075 -0
  144. package/lib/group-component/body/TableBody.d.ts +14 -0
  145. package/lib/group-component/body/TableBody.js +91 -0
  146. package/lib/group-component/body/TableBodyCell.d.ts +12 -0
  147. package/lib/group-component/body/TableBodyCell.js +595 -0
  148. package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
  149. package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
  150. package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  151. package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
  152. package/lib/group-component/body/TableBodyRow.d.ts +21 -0
  153. package/lib/group-component/body/TableBodyRow.js +206 -0
  154. package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  155. package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
  156. package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
  157. package/lib/group-component/components/ControlCheckbox.js +92 -0
  158. package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
  159. package/lib/group-component/components/EditForm/EditForm.js +404 -0
  160. package/lib/group-component/components/EditForm/index.d.ts +1 -0
  161. package/lib/group-component/components/EditForm/index.js +16 -0
  162. package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
  163. package/lib/group-component/components/InputControl/InputControl.js +127 -0
  164. package/lib/group-component/components/InputControl/index.d.ts +1 -0
  165. package/lib/group-component/components/InputControl/index.js +16 -0
  166. package/lib/group-component/components/async-select/index.d.ts +11 -0
  167. package/lib/group-component/components/async-select/index.js +47 -0
  168. package/lib/group-component/components/async-table-select/index.d.ts +11 -0
  169. package/lib/group-component/components/async-table-select/index.js +49 -0
  170. package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
  171. package/lib/group-component/components/checkbox-control/index.js +48 -0
  172. package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  173. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
  174. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  175. package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
  176. package/lib/group-component/components/command/Command.d.ts +10 -0
  177. package/lib/group-component/components/command/Command.js +44 -0
  178. package/lib/group-component/components/number/index.d.ts +12 -0
  179. package/lib/group-component/components/number/index.js +50 -0
  180. package/lib/group-component/components/number-range/index.d.ts +13 -0
  181. package/lib/group-component/components/number-range/index.js +87 -0
  182. package/lib/group-component/features/operator.d.ts +24 -0
  183. package/lib/group-component/features/operator.js +67 -0
  184. package/lib/group-component/footer/TableFooter.d.ts +7 -0
  185. package/lib/group-component/footer/TableFooter.js +44 -0
  186. package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
  187. package/lib/group-component/footer/TableFooterCell.js +75 -0
  188. package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
  189. package/lib/group-component/footer/TableFooterRow.js +37 -0
  190. package/lib/group-component/header/TableHead.d.ts +15 -0
  191. package/lib/group-component/header/TableHead.js +107 -0
  192. package/lib/group-component/header/TableHeadCell.d.ts +15 -0
  193. package/lib/group-component/header/TableHeadCell.js +319 -0
  194. package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
  195. package/lib/group-component/header/TableHeadCell2.js +330 -0
  196. package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
  197. package/lib/group-component/header/TableHeadGroupCell.js +103 -0
  198. package/lib/group-component/header/TableHeadRow.d.ts +15 -0
  199. package/lib/group-component/header/TableHeadRow.js +59 -0
  200. package/lib/group-component/header/renderFilter.d.ts +20 -0
  201. package/lib/group-component/header/renderFilter.js +301 -0
  202. package/lib/group-component/hook/convert.d.ts +1 -0
  203. package/lib/group-component/hook/convert.js +34 -0
  204. package/lib/group-component/hook/useColumns.d.ts +28 -0
  205. package/lib/group-component/hook/useColumns.js +318 -0
  206. package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
  207. package/lib/group-component/hook/useFilterOperator.js +40 -0
  208. package/lib/group-component/hook/utils.d.ts +220 -0
  209. package/lib/group-component/hook/utils.js +2468 -0
  210. package/lib/group-component/index.d.ts +2 -0
  211. package/lib/group-component/index.js +9 -0
  212. package/lib/group-component/style.d.ts +22 -0
  213. package/lib/group-component/style.js +55 -0
  214. package/lib/group-component/style.scss +1438 -0
  215. package/lib/group-component/table/Grid.d.ts +33 -0
  216. package/lib/group-component/table/Grid.js +444 -0
  217. package/lib/group-component/table/TableWrapper.d.ts +33 -0
  218. package/lib/group-component/table/TableWrapper.js +259 -0
  219. package/lib/group-component/useContext.d.ts +100 -0
  220. package/lib/group-component/useContext.js +27 -0
  221. package/lib/table-component/InternalTable.js +9 -2
  222. package/lib/table-component/TableContainer.d.ts +1 -0
  223. package/lib/table-component/TableContainer.js +6 -2
  224. package/lib/table-component/TableContainerEdit.d.ts +1 -0
  225. package/lib/table-component/TableContainerEdit.js +4 -2
  226. package/lib/table-component/body/TableBodyCell.js +49 -40
  227. package/lib/table-component/body/TableBodyCellEdit.js +9 -6
  228. package/lib/table-component/body/TableBodyRow.js +4 -1
  229. package/lib/table-component/header/TableHeadCell2.js +38 -2
  230. package/lib/table-component/hook/utils.d.ts +1 -0
  231. package/lib/table-component/hook/utils.js +16 -7
  232. package/lib/table-component/style.js +1 -1
  233. package/lib/table-component/table/Grid.d.ts +1 -0
  234. package/lib/table-component/table/Grid.js +10 -3
  235. package/lib/table-component/useContext.d.ts +6 -0
  236. package/lib/table-component/useContext.js +2 -1
  237. package/lib/table-virtuoso/InternalTable.js +2 -2
  238. package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
  239. package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  240. package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
  241. package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  242. package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
  243. package/lib/table-virtuoso/hook/utils.d.ts +1 -0
  244. package/lib/table-virtuoso/hook/utils.js +32 -1
  245. package/lib/table-virtuoso/style.js +3 -1
  246. package/lib/table-virtuoso/table/Grid.js +2 -2
  247. package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
  248. package/lib/table-virtuoso/table/TableWrapper.js +24 -5
  249. package/lib/table-virtuoso/useContext.d.ts +6 -3
  250. package/lib/table-virtuoso/useContext.js +18 -0
  251. package/package.json +1 -1
@@ -0,0 +1,1066 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useContext } from "react";
3
+ import { ColorPicker, DatePicker, Divider, Input, TimePicker, Row, Col } from "antd";
4
+ import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs, convertLabelToTitle, getDatepickerFormat, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat } from "../hook/utils";
5
+ import classNames from "classnames";
6
+ import { NumericFormat } from "react-numeric-component";
7
+ import dayjs from "dayjs";
8
+ import moment from "moment";
9
+ import { Controller } from "react-hook-form";
10
+ import { Checkbox, Select, TreeSelect } from "rc-master-ui";
11
+ import { AsyncSelect } from "../components/async-select";
12
+ import { AsyncTableSelect } from "../components/async-table-select";
13
+ import { cyan, green, red, blue } from '@ant-design/colors';
14
+ import { EditForm } from "../components/EditForm";
15
+ import { TableContext } from "../useContext";
16
+ const {
17
+ SHOW_PARENT
18
+ } = TreeSelect;
19
+ const {
20
+ TextArea
21
+ } = Input;
22
+ const filterTreeNode = (input, treeNode) => {
23
+ const {
24
+ title,
25
+ value
26
+ } = treeNode;
27
+ if (typeof title === "string" || typeof title === 'number') {
28
+ return title.toString().toLowerCase().includes(input.toLowerCase()) || value.toLowerCase().includes(input.toLowerCase());
29
+ }
30
+ return value.toLowerCase().includes(input.toLowerCase());
31
+ };
32
+ const EditableCell = props => {
33
+ const {
34
+ // t,
35
+ // editing,
36
+ dataIndex,
37
+ editType,
38
+ record,
39
+ // index,
40
+ // children,
41
+ column,
42
+ indexRow,
43
+ indexCol
44
+ // cellEditing,
45
+ // ...restProps
46
+ } = props;
47
+ const {
48
+ format,
49
+ control,
50
+ getValues,
51
+ handleCellChange,
52
+ errors,
53
+ id,
54
+ startCell,
55
+ rowKey,
56
+ t
57
+ } = useContext(TableContext);
58
+ const datePickerRef = React.useRef(null);
59
+ const dateTimePickerRef = React.useRef(null);
60
+ // const timePickerRef = React.useRef(null);
61
+
62
+ const colFormat = typeof column?.format === 'function' ? column?.format(record) : column?.format;
63
+ const cellFormat = getFormat(colFormat, format);
64
+ const inputNode = (value, onChange) => {
65
+ const dateFormat = getDatepickerFormat(editType, cellFormat);
66
+ const date = !isEmpty(value) ? convertDateToDayjs(new Date(value), dateFormat) : null;
67
+ const maxDate = convertDateToDayjs(column.maxDate, dateFormat) ?? undefined;
68
+ const minDate = convertDateToDayjs(column.minDate, dateFormat) ?? undefined;
69
+ const {
70
+ fieldValue,
71
+ columns: selectColumns,
72
+ isMulti,
73
+ selectMode,
74
+ menuWidth,
75
+ fieldNames,
76
+ toolbarItems,
77
+ filterOption,
78
+ inputKey,
79
+ // toolbarClick,
80
+ loadOptions,
81
+ validateOption,
82
+ options: propsOptions
83
+ } = column.editSelectSettings || {};
84
+ const isInvalid = column.field ? errors[column.field] : false;
85
+
86
+ // @ts-ignore
87
+ const key = record[rowKey];
88
+ const field = column.field ?? '';
89
+
90
+ // const message = errors && column.field && errors[column.field] ? errors[column.field].message : ''
91
+ const message = isInvalid?.message;
92
+ const keySelect = checkFieldKey(column?.editSelectSettings?.fieldKey);
93
+ const selectOptions = typeof propsOptions === 'function' ? propsOptions(record, column.field) : propsOptions;
94
+ const options = validateOption ? validateOption(record, column.field) : selectOptions ?? [];
95
+ const optionsTree = validateOption ? convertArrayWithIndent(validateOption(record, column.field)) : selectOptions ? convertArrayWithIndent(selectOptions) : [];
96
+
97
+ // const currt = flatColumns2()
98
+
99
+ switch (editType) {
100
+ case 'date':
101
+ return /*#__PURE__*/React.createElement(DatePicker, {
102
+ ref: datePickerRef,
103
+ format: {
104
+ format: dateFormat,
105
+ type: 'mask'
106
+ },
107
+ autoFocus: column.field === startCell?.colId,
108
+ defaultOpen: column.field === startCell?.colId
109
+
110
+ // locale={buddhistLocale}
111
+ ,
112
+ style: {
113
+ width: '100%',
114
+ height: '100%'
115
+ }
116
+ // value={date}
117
+ ,
118
+ defaultValue: date
119
+ // preserveInvalidOnBlur
120
+ ,
121
+
122
+ onBlur: () => {
123
+ const formState = getValues();
124
+ const itemState = getValues(dataIndex);
125
+ // @ts-ignore
126
+ const prevState = record[dataIndex];
127
+ const newState = itemState;
128
+ if (newState !== prevState) {
129
+ handleCellChange?.({
130
+ key: key,
131
+ field: column.field,
132
+ record: formState,
133
+ prevState,
134
+ newState,
135
+ option: newState,
136
+ indexCol,
137
+ indexRow,
138
+ type: 'blur'
139
+ });
140
+ }
141
+ },
142
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
143
+ disabled: isDisable(column, record) ?? false,
144
+ maxDate: maxDate,
145
+ minDate: minDate,
146
+ onChange: (newDate, dateString) => {
147
+ const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
148
+ onChange(newDateValue);
149
+ setTimeout(() => {
150
+ // @ts-ignore
151
+ datePickerRef.current?.focus();
152
+ }, 0);
153
+ },
154
+ popupClassName: 'be-popup-container',
155
+ status: isInvalid ? 'error' : undefined,
156
+ "data-tooltip-content": message,
157
+ "data-tooltip-id": `${id}-tooltip-error`
158
+ });
159
+ case 'datetime':
160
+ return /*#__PURE__*/React.createElement(DatePicker
161
+ // id={`col${indexCol}-record${indexRow}`}
162
+ , {
163
+ ref: dateTimePickerRef,
164
+ format: {
165
+ format: dateFormat,
166
+ type: 'mask'
167
+ }
168
+ // locale={buddhistLocale}
169
+ ,
170
+ style: {
171
+ width: '100%',
172
+ height: '100%'
173
+ },
174
+ showTime: true
175
+ // value={date}
176
+ ,
177
+ defaultValue: date,
178
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
179
+ disabled: isDisable(column, record) ?? false,
180
+ maxDate: maxDate,
181
+ minDate: minDate,
182
+ onChange: (newDate, dateString) => {
183
+ const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
184
+ onChange(newDateValue);
185
+ setTimeout(() => {
186
+ // @ts-ignore
187
+ dateTimePickerRef.current?.focus();
188
+ }, 0);
189
+ },
190
+ onBlur: () => {
191
+ const formState = getValues();
192
+ const itemState = getValues(dataIndex);
193
+ // @ts-ignore
194
+ const prevState = record[dataIndex];
195
+ const newState = itemState;
196
+ if (prevState !== newState) {
197
+ handleCellChange?.({
198
+ key: key,
199
+ field: column.field ?? column.field,
200
+ record: formState,
201
+ prevState,
202
+ newState,
203
+ option: newState,
204
+ indexCol,
205
+ indexRow,
206
+ type: 'blur'
207
+ });
208
+ }
209
+ },
210
+ popupClassName: 'be-popup-container',
211
+ status: isInvalid ? 'error' : undefined,
212
+ "data-tooltip-content": message,
213
+ "data-tooltip-id": `${id}-tooltip-error`,
214
+ autoFocus: column.field === startCell?.colId,
215
+ defaultOpen: column.field === startCell?.colId
216
+ });
217
+ case 'month':
218
+ case 'quarter':
219
+ case 'year':
220
+ const pickerFormat = getDatepickerFormat(editType, cellFormat);
221
+ const maxDateValue1 = !isEmpty(column.maxDate) ? dayjs(column.maxDate, pickerFormat) : undefined;
222
+ const minDateValue1 = !isEmpty(column.minDate) ? dayjs(column.minDate, pickerFormat) : undefined;
223
+ return /*#__PURE__*/React.createElement(DatePicker, {
224
+ id: `col${indexCol}-record${indexRow}`,
225
+ format: {
226
+ format: pickerFormat,
227
+ type: 'mask'
228
+ },
229
+ style: {
230
+ width: '100%',
231
+ height: '100%'
232
+ },
233
+ picker: editType,
234
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
235
+ disabled: isDisable(column, record) ?? false,
236
+ maxDate: maxDateValue1,
237
+ minDate: minDateValue1,
238
+ popupClassName: 'be-popup-container',
239
+ status: isInvalid ? 'error' : undefined,
240
+ "data-tooltip-content": message,
241
+ "data-tooltip-id": `${id}-tooltip-error`,
242
+ autoFocus: column.field === startCell?.colId,
243
+ defaultOpen: column.field === startCell?.colId
244
+ });
245
+ case 'week':
246
+ const weekFormat = getDatepickerFormat(editType, cellFormat);
247
+ const maxWeekValue = !isEmpty(column.maxDate) ? dayjs(column.maxDate, weekFormat) : undefined;
248
+ const minWeekValue = !isEmpty(column.minDate) ? dayjs(column.minDate, weekFormat) : undefined;
249
+ return /*#__PURE__*/React.createElement(DatePicker, {
250
+ format: val => customWeekStartEndFormat(val, weekFormat),
251
+ style: {
252
+ width: '100%',
253
+ height: '100%'
254
+ },
255
+ picker: editType,
256
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
257
+ disabled: isDisable(column, record) ?? false,
258
+ maxDate: maxWeekValue,
259
+ minDate: minWeekValue,
260
+ popupClassName: 'be-popup-container',
261
+ status: isInvalid ? 'error' : undefined,
262
+ "data-tooltip-content": message,
263
+ "data-tooltip-id": `${id}-tooltip-error`,
264
+ autoFocus: column.field === startCell?.colId,
265
+ defaultOpen: column.field === startCell?.colId
266
+ });
267
+ case 'time':
268
+ const timeFormat = getDatepickerFormat(editType, cellFormat);
269
+ const time = value ? dayjs(value, timeFormat) : null;
270
+ const maxTimeValue = !isEmpty(column.maxTime) ? dayjs(column.maxTime).format(timeFormat) : null;
271
+ const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
272
+
273
+ // @ts-ignore
274
+ // const timeValue = !isEmpty(record[dataIndex]) ? dayjs(record[dataIndex], timeFormat) : null
275
+ const maxTime = maxTimeValue ? dayjs(maxTimeValue, timeFormat) : undefined;
276
+ const minTime = minTimeValue ? dayjs(minTimeValue, timeFormat) : undefined;
277
+ return /*#__PURE__*/React.createElement(TimePicker, {
278
+ format: {
279
+ format: timeFormat,
280
+ type: 'mask'
281
+ },
282
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
283
+ maxDate: maxTime,
284
+ minDate: minTime
285
+ // value={time}
286
+ ,
287
+ defaultValue: time,
288
+ disabled: isDisable(column, record) ?? false,
289
+ style: {
290
+ width: '100%',
291
+ height: '100%'
292
+ },
293
+ popupClassName: 'be-popup-container',
294
+ status: isInvalid ? 'error' : undefined,
295
+ "data-tooltip-content": message,
296
+ "data-tooltip-id": `${id}-tooltip-error`,
297
+ autoFocus: column.field === startCell?.colId,
298
+ defaultOpen: column.field === startCell?.colId,
299
+ onChange: (newDate, dateString) => {
300
+ // const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
301
+ onChange(dateString);
302
+ setTimeout(() => {
303
+ // @ts-ignore
304
+ dateTimePickerRef.current?.focus();
305
+ }, 0);
306
+ },
307
+ onBlur: () => {
308
+ const formState = getValues();
309
+ const itemState = getValues(dataIndex);
310
+ // @ts-ignore
311
+ const prevState = record[dataIndex];
312
+ const newState = itemState;
313
+ if (prevState !== newState) {
314
+ handleCellChange?.({
315
+ key: key,
316
+ field: column.field ?? column.field,
317
+ record: formState,
318
+ prevState,
319
+ newState,
320
+ option: newState,
321
+ indexCol,
322
+ indexRow,
323
+ type: 'blur'
324
+ });
325
+ }
326
+ }
327
+ });
328
+ case 'selectTable':
329
+ const rr = selectColumns ?? [];
330
+ const columnsTable = rr.map(colSelect => {
331
+ return {
332
+ title: colSelect.headerTemplate ? colSelect.headerTemplate : t ? t(colSelect.headerText) : colSelect.headerText,
333
+ dataIndex: colSelect.field ?? colSelect.dataIndex,
334
+ key: colSelect.dataIndex,
335
+ render: colSelect.template ? (text, recd, ind) => /*#__PURE__*/React.createElement(React.Fragment, null, colSelect.template?.({
336
+ value: text,
337
+ rowData: recd,
338
+ column: colSelect,
339
+ field: colSelect.field,
340
+ index: ind,
341
+ [colSelect.field]: text
342
+ })) : undefined,
343
+ width: colSelect.width,
344
+ ellipsis: true,
345
+ align: colSelect.textAlign
346
+ };
347
+ });
348
+ let valueSelectTable = value;
349
+ if (fieldValue) {
350
+ // @ts-ignore
351
+ valueSelectTable = record[fieldValue] ?? value;
352
+ }
353
+
354
+ // if (isMulti || selectMode === 'checkbox') {
355
+ // // @ts-ignore
356
+ // valueSelectTable = (!isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0) ? options.filter((val: any) => record[dataIndex]?.includes(val[keySelect])) : undefined
357
+
358
+ // }
359
+
360
+ return /*#__PURE__*/React.createElement(AsyncTableSelect
361
+ // id={`col${indexCol}-record${indexRow}`}
362
+ , {
363
+ columns: columnsTable,
364
+ options: options,
365
+ defaultOptions: options,
366
+ value: valueSelectTable,
367
+ rowData: record,
368
+ autoDestroy: true,
369
+ onChange: (val, option) => {
370
+ onChange(val ?? '');
371
+ const formState = getValues();
372
+ // const itemState = getValues(dataIndex)
373
+ // @ts-ignore
374
+ const prevState = record[dataIndex];
375
+ const newState = val;
376
+ handleCellChange?.({
377
+ // @ts-ignore
378
+ key: record[rowKey],
379
+ field: column.field ?? column.field,
380
+ record: formState,
381
+ prevState,
382
+ newState,
383
+ option: option,
384
+ indexCol,
385
+ indexRow,
386
+ type: 'blur'
387
+ });
388
+ },
389
+ showSearch: true,
390
+ mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
391
+ valueSelectAble: true,
392
+ selectMode: selectMode,
393
+ style: {
394
+ width: '100%',
395
+ height: '100%'
396
+ },
397
+ defaultOpen: column.field === startCell?.colId,
398
+ autoFocus: column.field === startCell?.colId
399
+
400
+ // defaultOpen={column.field === cellEditing?.column.field}
401
+ ,
402
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
403
+ allowClear: column.isClearable ?? false,
404
+ maxTagCount: 'responsive',
405
+ rowKey: keySelect,
406
+ popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
407
+ optionFilterProp: "label",
408
+ popupClassName: 'be-popup-container',
409
+ loadOptions: loadOptions,
410
+ status: isInvalid ? 'error' : undefined,
411
+ dropdownRender: menu => {
412
+ if (toolbarItems && toolbarItems.length > 0) {
413
+ return /*#__PURE__*/React.createElement(React.Fragment, null, menu, /*#__PURE__*/React.createElement(Divider, {
414
+ style: {
415
+ margin: '8px 0'
416
+ }
417
+ }), /*#__PURE__*/React.createElement("div", {
418
+ className: 'toolbar-control d-flex justify-content-end'
419
+ }));
420
+ } else {
421
+ return /*#__PURE__*/React.createElement(React.Fragment, null, " ", menu);
422
+ }
423
+ },
424
+ filterOption: filterOption,
425
+ fieldNames: fieldNames ? fieldNames : {
426
+ value: keySelect,
427
+ label: inputKey ?? 'label'
428
+ },
429
+ onBlur: event => {
430
+ if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
431
+ const val = event.inputValue;
432
+ onChange(val ?? '');
433
+ const formState = getValues();
434
+ // const itemState = getValues(dataIndex)
435
+ // @ts-ignore
436
+ const prevState = record[dataIndex];
437
+ const newState = val;
438
+ handleCellChange?.({
439
+ key,
440
+ field: column.field ?? column.field,
441
+ record: formState,
442
+ prevState,
443
+ newState,
444
+ option: {
445
+ value: val,
446
+ label: val,
447
+ searchTextAsValue: true
448
+ },
449
+ indexCol,
450
+ indexRow,
451
+ type: 'blur'
452
+ });
453
+ }
454
+ },
455
+ "data-tooltip-content": message,
456
+ "data-tooltip-id": `${id}-tooltip-error`
457
+ });
458
+ case 'select':
459
+ let valueSelect = value;
460
+ if (fieldValue) {
461
+ // @ts-ignore
462
+ valueSelect = record[fieldValue] ?? value;
463
+ }
464
+
465
+ // if (isMulti || selectMode === 'checkbox') {
466
+ // // @ts-ignore
467
+ // valueSelect = (!isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0) ? options.filter((val: any) => record[dataIndex]?.includes(val[keySelect])) : undefined
468
+
469
+ // }
470
+
471
+ return /*#__PURE__*/React.createElement(Select, {
472
+ options: options,
473
+ value: valueSelect,
474
+ onChange: (val, option) => {
475
+ onChange(val ?? '');
476
+ const formState = getValues();
477
+ // const itemState = getValues(dataIndex)
478
+ // @ts-ignore
479
+ const prevState = record[dataIndex];
480
+ const newState = val;
481
+ handleCellChange?.({
482
+ key,
483
+ field: column.field ?? column.field,
484
+ record: formState,
485
+ prevState,
486
+ newState,
487
+ option: option,
488
+ indexCol,
489
+ indexRow,
490
+ type: 'blur'
491
+ });
492
+ },
493
+ autoDestroy: true,
494
+ showSearch: true,
495
+ mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
496
+ valueSelectAble: true,
497
+ defaultOpen: column.field === startCell?.colId,
498
+ autoFocus: column.field === startCell?.colId
499
+
500
+ // defaultOpen={column.field === cellEditing?.column.field}
501
+ ,
502
+
503
+ style: {
504
+ width: '100%',
505
+ height: '100%'
506
+ },
507
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
508
+ allowClear: column.isClearable ?? false,
509
+ maxTagCount: 'responsive',
510
+ popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
511
+ optionFilterProp: "label",
512
+ popupClassName: 'be-popup-container',
513
+ status: isInvalid ? 'error' : undefined,
514
+ filterOption: filterOption,
515
+ fieldNames: fieldNames ? fieldNames : {
516
+ value: keySelect,
517
+ label: inputKey ?? 'label'
518
+ },
519
+ onBlur: event => {
520
+ if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
521
+ const val = event.inputValue;
522
+ onChange(val ?? '');
523
+ const formState = getValues();
524
+ // const itemState = getValues(dataIndex)
525
+ // @ts-ignore
526
+ const prevState = record[dataIndex];
527
+ const newState = val;
528
+ handleCellChange?.({
529
+ key,
530
+ field: column.field ?? column.field,
531
+ record: formState,
532
+ prevState,
533
+ newState,
534
+ option: {
535
+ value: val,
536
+ label: val,
537
+ searchTextAsValue: true
538
+ },
539
+ indexCol,
540
+ indexRow,
541
+ type: 'blur'
542
+ });
543
+ }
544
+ },
545
+ "data-tooltip-content": message,
546
+ "data-tooltip-id": `${id}-tooltip-error`
547
+ });
548
+ case 'asyncSelect':
549
+ let valueAsyncSelect = value;
550
+ if (fieldValue) {
551
+ // @ts-ignore
552
+ valueAsyncSelect = record[fieldValue] ?? value;
553
+ }
554
+
555
+ // if (isMulti || selectMode === 'checkbox') {
556
+ // // @ts-ignore
557
+ // valueAsyncSelect = (!isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0) ? options.filter((val: any) => record[dataIndex]?.includes(val[keySelect])) : undefined
558
+
559
+ // }
560
+
561
+ return /*#__PURE__*/React.createElement(AsyncSelect, {
562
+ options: options,
563
+ defaultOptions: options,
564
+ value: valueAsyncSelect,
565
+ onChange: (val, option) => {
566
+ onChange(val ?? '');
567
+ const formState = getValues();
568
+ // const itemState = getValues(dataIndex)
569
+ // @ts-ignore
570
+ const prevState = record[dataIndex];
571
+ const newState = val;
572
+ handleCellChange?.({
573
+ key,
574
+ field: column.field ?? column.field,
575
+ record: formState,
576
+ prevState,
577
+ newState,
578
+ option: option,
579
+ indexCol,
580
+ indexRow,
581
+ type: 'blur'
582
+ });
583
+ },
584
+ autoDestroy: true,
585
+ showSearch: true,
586
+ defaultOpen: column.field === startCell?.colId,
587
+ autoFocus: column.field === startCell?.colId
588
+
589
+ // defaultOpen={column.field === cellEditing?.column.field}
590
+ ,
591
+ mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
592
+ valueSelectAble: true,
593
+ style: {
594
+ width: '100%',
595
+ height: '100%'
596
+ },
597
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
598
+ allowClear: column.isClearable ?? false,
599
+ maxTagCount: 'responsive',
600
+ popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
601
+ optionFilterProp: "label",
602
+ popupClassName: 'be-popup-container',
603
+ loadOptions: loadOptions,
604
+ status: isInvalid ? 'error' : undefined
605
+ // dropdownRender={(menu) => {
606
+ // if (toolbarItems && toolbarItems.length > 0) {
607
+ // return (
608
+ // <>
609
+ // {menu}
610
+ // <Divider style={{margin: '8px 0'}}/>
611
+ //
612
+ // <div
613
+ // className={'toolbar-control d-flex justify-content-end'}
614
+ // >
615
+ // {toolbarItems.map((it) => {
616
+ // return (
617
+ // <div
618
+ // key={it.key}
619
+ // className={'toolbar-item'}
620
+ // onClick={() => toolbarClick?.({item: it, column})}
621
+ // >
622
+ // {it.template ? getTemplate(it.template) : (
623
+ // <Button className='toolbar-item-btn'>
624
+ //
625
+ // {it.icon && getTemplate(it.icon)}
626
+ // {it.title}
627
+ // </Button>
628
+ // )}
629
+ //
630
+ // </div>
631
+ // )
632
+ // })}
633
+ //
634
+ // </div>
635
+ // </>
636
+ // )
637
+ // } else {
638
+ // return <> {menu}</>
639
+ // }
640
+ //
641
+ // }}
642
+ ,
643
+ filterOption: filterOption,
644
+ fieldNames: fieldNames ? fieldNames : {
645
+ value: keySelect,
646
+ label: inputKey ?? 'label'
647
+ },
648
+ onBlur: event => {
649
+ if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
650
+ const val = event.inputValue;
651
+ onChange(val ?? '');
652
+ const formState = getValues();
653
+ // const itemState = getValues(dataIndex)
654
+ // @ts-ignore
655
+ const prevState = record[dataIndex];
656
+ const newState = val;
657
+ handleCellChange?.({
658
+ key,
659
+ field: column.field ?? column.field,
660
+ record: formState,
661
+ prevState,
662
+ newState,
663
+ option: {
664
+ value: val,
665
+ label: val,
666
+ searchTextAsValue: true
667
+ },
668
+ indexCol,
669
+ indexRow,
670
+ type: 'blur'
671
+ });
672
+ }
673
+ },
674
+ "data-tooltip-content": message,
675
+ "data-tooltip-id": `${id}-tooltip-error`
676
+ });
677
+ case 'treeSelect':
678
+ // let valueTreeSelect
679
+
680
+ const newTreeData = convertLabelToTitle(optionsTree);
681
+ // @ts-ignore
682
+ // const valueTreeSelect = column?.editSelectSettings?.isMulti ? (Array.isArray(record[dataIndex]) ? record[dataIndex] : []) : record[dataIndex]
683
+
684
+ let valueTreeSelect = value;
685
+ if (fieldValue) {
686
+ // @ts-ignore
687
+ valueTreeSelect = record[fieldValue] ?? value;
688
+ }
689
+
690
+ // if (isMulti || selectMode === 'checkbox') {
691
+ // // @ts-ignore
692
+ // valueTreeSelect = (!isNullOrUndefined(record[dataIndex]) && Array.isArray(record[dataIndex]) && record[dataIndex]?.length > 0) ? options.filter((val: any) => record[dataIndex]?.includes(val[keySelect])) : undefined
693
+
694
+ // }
695
+
696
+ return /*#__PURE__*/React.createElement(TreeSelect, {
697
+ id: `col${indexCol}-record${indexRow}`,
698
+ className: 'be-tree-select',
699
+ style: {
700
+ width: '100%',
701
+ height: '100%'
702
+ },
703
+ value: valueTreeSelect,
704
+ dropdownStyle: {
705
+ maxHeight: 400,
706
+ overflow: 'auto'
707
+ },
708
+ treeData: newTreeData,
709
+ placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
710
+ treeDefaultExpandAll: true,
711
+ defaultOpen: column.field === startCell?.colId,
712
+ autoFocus: column.field === startCell?.colId
713
+
714
+ // defaultOpen={column.field === cellEditing?.column.field}
715
+ ,
716
+ virtual: true,
717
+ allowClear: true,
718
+ showSearch: true
719
+ // maxTagTextLength={column?.editSelectSettings?.showItems}
720
+ ,
721
+ maxTagCount: column?.editSelectSettings?.showItems,
722
+ maxTagPlaceholder: 2,
723
+ treeTitleRender: column?.editSelectSettings?.formatOptionLabel,
724
+ showCheckedStrategy: SHOW_PARENT,
725
+ multiple: column?.editSelectSettings?.selectMode === 'checkbox' || column?.editSelectSettings?.isMulti
726
+ // fieldNames={{label: inputKey ? inputKey : 'title', value: keySelect, children: 'children'}}
727
+ ,
728
+ treeCheckable: column?.editSelectSettings?.selectMode === 'checkbox',
729
+ filterTreeNode: filterTreeNode,
730
+ popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
731
+ onSelect: (val, option) => {
732
+ onChange(val ?? '');
733
+ const formState = getValues();
734
+ // const itemState = getValues(dataIndex)
735
+ // @ts-ignore
736
+ const prevState = record[dataIndex];
737
+ const newState = val;
738
+ handleCellChange?.({
739
+ key,
740
+ field: column.field,
741
+ record: formState,
742
+ prevState,
743
+ newState,
744
+ option: option,
745
+ indexCol,
746
+ indexRow,
747
+ type: 'blur'
748
+ });
749
+ },
750
+ popupClassName: 'be-popup-container',
751
+ status: isInvalid ? 'error' : undefined,
752
+ "data-tooltip-content": message,
753
+ "data-tooltip-id": `${id}-tooltip-error`
754
+ });
755
+ case 'checkbox':
756
+ return /*#__PURE__*/React.createElement("div", {
757
+ style: {
758
+ display: 'flex',
759
+ alignItems: 'center',
760
+ justifyContent: column.align ?? 'center',
761
+ paddingInline: 5,
762
+ height: '100%',
763
+ width: '100%'
764
+ }
765
+ }, /*#__PURE__*/React.createElement(Checkbox, {
766
+ checked: Boolean(value)
767
+ // style={{ textAlign: column.align ?? 'left' }}
768
+ ,
769
+ onChange: val => {
770
+ const newVal = typeof value === "number" ? parseBooleanToValue(val.target.checked, typeof value) : val.target.checked;
771
+ onChange(newVal);
772
+ const formState = getValues();
773
+ handleCellChange?.({
774
+ key,
775
+ record: formState,
776
+ option: value,
777
+ prevState: value,
778
+ newState: newVal,
779
+ field: column.field ?? column.field,
780
+ indexCol,
781
+ indexRow,
782
+ type: 'blur'
783
+ });
784
+ },
785
+ disabled: isDisable(column, record) ?? false
786
+ }));
787
+ case 'form':
788
+ const valueForm = value;
789
+ return /*#__PURE__*/React.createElement(EditForm, {
790
+ rowData: record,
791
+ column: column,
792
+ t: t,
793
+ id: `col${indexCol}-record${indexRow}`,
794
+ value: valueForm,
795
+ fieldKey: column.editFromSettings?.fieldKey,
796
+ indexRow: indexRow
797
+
798
+ // cellFocus={column.field === cellEditing?.column.field}
799
+ ,
800
+
801
+ onChange: val => {
802
+ const formState = getValues();
803
+
804
+ // @ts-ignore
805
+ const prevState = record[dataIndex];
806
+ const newState = val;
807
+ handleCellChange?.({
808
+ key,
809
+ field: column.field,
810
+ record: {
811
+ ...formState,
812
+ [column.field ?? '']: val
813
+ },
814
+ prevState,
815
+ newState,
816
+ option: val,
817
+ indexCol,
818
+ indexRow,
819
+ type: 'blur'
820
+ });
821
+ }
822
+ // cellEditing={cellEditing}
823
+
824
+ // menuPortalTarget={tableContainerRef}
825
+ // classNamePrefix={column.classElement ?? 'select'}
826
+ ,
827
+ placeholder: t ? t(column.placeholder ? column.placeholder : '') : column.placeholder ? column.placeholder : '',
828
+ menuWidth: column.editFromSettings?.menuWidth,
829
+ menuHeight: column.editFromSettings?.menuHeight
830
+ });
831
+
832
+ // case 'file':
833
+ // const valueFile = record[dataIndex]
834
+ // return (
835
+ //
836
+ //
837
+ // <InputFile
838
+ // value={valueFile}
839
+ // uploading={column.uploading}
840
+ // allowedExtensions={column.allowedExtensions}
841
+ // asyncUploadSettings={column.asyncUploadSettings}
842
+ // disable={isDisable(col, record)}
843
+ // onChange={(val: string) => {
844
+ //
845
+ // const newValue = Array.isArray(val) ? val.map((it: any) => it) : val
846
+ // const newrecordData = {
847
+ // ...record,
848
+ // [dataIndex]: newValue
849
+ // }
850
+ // handleCellChange(val, newValue, newrecordData, col, indexRow, indexCol)
851
+ // }}
852
+ //
853
+ //
854
+ // />
855
+ //
856
+ //
857
+ // )
858
+
859
+ case 'color':
860
+ const color = isColor(value) ? value : '#ffffff';
861
+ const presets = genPresets({
862
+ blue,
863
+ red,
864
+ green,
865
+ cyan
866
+ });
867
+ return /*#__PURE__*/React.createElement(ColorPicker, {
868
+ value: color,
869
+ allowClear: column.isClearable ?? true,
870
+ onChangeComplete: valueColor => {
871
+ onChange(`#${valueColor.toHex()}`);
872
+ const formState = getValues();
873
+ handleCellChange?.({
874
+ key,
875
+ field,
876
+ option: `#${valueColor.toHex()}`,
877
+ record: formState,
878
+ prevState: value,
879
+ newState: `#${valueColor.toHex()}`,
880
+ indexCol,
881
+ indexRow,
882
+ type: 'blur'
883
+ });
884
+ },
885
+ presets: presets,
886
+ panelRender: (_, {
887
+ components: {
888
+ Picker,
889
+ Presets
890
+ }
891
+ }) => /*#__PURE__*/React.createElement(Row, {
892
+ justify: "space-between",
893
+ wrap: false,
894
+ className: "custom-panel be-popup-container"
895
+ }, /*#__PURE__*/React.createElement(Col, {
896
+ span: 12
897
+ }, /*#__PURE__*/React.createElement(Presets, null)), /*#__PURE__*/React.createElement(Divider, {
898
+ type: "vertical",
899
+ style: {
900
+ height: 'auto'
901
+ }
902
+ }), /*#__PURE__*/React.createElement(Col, {
903
+ flex: "auto"
904
+ }, /*#__PURE__*/React.createElement(Picker, null)))
905
+ });
906
+
907
+ // case 'image':
908
+ // let image = record[dataIndex]
909
+ // return (
910
+ // <ImageUpload
911
+ // id={`col${indexCol}-record${indexRow}`}
912
+ // defaultImage={image}
913
+ // width={column.width}
914
+ // height={38}
915
+ // onKeyDown={(val: any, path: string) => {
916
+ // const checkKey = checkKeyDown(val, col, indexRow + 1, indexCol + 1)
917
+ // if (checkKey === 'ArrecordDown' || checkKey === 'ArrecordUp' || checkKey === 'Enter') {
918
+ // let newVal = ''
919
+ // if (newVal != record[dataIndex]) {
920
+ // record[dataIndex] = path
921
+ // // handleDataChange(path, record, col, indexRow, indexCol)
922
+ // handleCellChange(path, record, col, indexRow, indexCol)
923
+ // }
924
+ // }
925
+ // }}
926
+ // />
927
+ // )
928
+
929
+ case 'numeric':
930
+ const thousandSeparator = cellFormat?.thousandSeparator;
931
+ const decimalSeparator = cellFormat?.decimalSeparator;
932
+
933
+ // let floatValue = value
934
+
935
+ const numericFormatProps = {
936
+ value,
937
+ thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
938
+ decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
939
+ decimalScale: cellFormat?.decimalScale ?? undefined,
940
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false,
941
+ allowNegative: cellFormat?.allowNegative ?? true,
942
+ prefix: cellFormat?.prefix ?? undefined,
943
+ suffix: cellFormat?.suffix ?? undefined
944
+ };
945
+ return /*#__PURE__*/React.createElement(NumericFormat, _extends({
946
+ id: `col${indexCol}-record${indexRow}`
947
+ // value={value ? numericFormatter(value.toString(), numericFormatProps) : ''}
948
+ // value={value}
949
+ }, numericFormatProps, {
950
+ min: column.min,
951
+ max: column.max,
952
+ customInput: Input
953
+ // valueIsNumericString={true}
954
+ ,
955
+ placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
956
+ autoComplete: 'off',
957
+ className: classNames('be-cell-editing rounded-0 input-element', {
958
+ 'is-invalid': isInvalid,
959
+ 'be-cell-edit-align-center': column.align === 'center',
960
+ 'be-cell-edit-align-left': column.align === 'left',
961
+ 'be-cell-edit-align-right': !column.align || column.align === 'right'
962
+ }),
963
+ autoFocus: column.field === startCell?.colId,
964
+ onValueChange: values => {
965
+ onChange(values?.floatValue || 0);
966
+ },
967
+ onBlur: () => {
968
+ const formState = getValues();
969
+ const itemState = getValues(dataIndex);
970
+
971
+ // @ts-ignore
972
+ const prevState = record[dataIndex];
973
+ const newState = value;
974
+ // @ts-ignore
975
+ if (itemState !== record[dataIndex]) {
976
+ handleCellChange?.({
977
+ key: key,
978
+ field,
979
+ option: newState,
980
+ record: formState,
981
+ prevState,
982
+ newState,
983
+ indexCol,
984
+ indexRow,
985
+ type: 'blur'
986
+ });
987
+ }
988
+ },
989
+ "data-tooltip-content": message,
990
+ "data-tooltip-id": `${id}-tooltip-error`
991
+ }));
992
+ default:
993
+ return /*#__PURE__*/React.createElement(TextArea, {
994
+ id: `col${indexCol}-record${indexRow}`,
995
+ style: {
996
+ textAlign: column.align,
997
+ resize: 'none',
998
+ height: '100%'
999
+ },
1000
+ disabled: isDisable(column, record) ?? false,
1001
+ className: classNames('be-cell-editing rounded-0 input-element'),
1002
+ placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
1003
+ value: !isNullOrUndefined(value) ? value : '',
1004
+ onBlur: () => {
1005
+ const formState = getValues();
1006
+ // const itemState = getValues(dataIndex)
1007
+
1008
+ // @ts-ignore
1009
+ const prevState = record[dataIndex];
1010
+ const newState = value;
1011
+ if (newState !== prevState) {
1012
+ handleCellChange?.({
1013
+ key: key,
1014
+ record: formState,
1015
+ option: value,
1016
+ prevState,
1017
+ newState,
1018
+ field,
1019
+ indexCol,
1020
+ indexRow,
1021
+ type: 'blur'
1022
+ });
1023
+ }
1024
+ },
1025
+ onPressEnter: () => {
1026
+ const formState = getValues();
1027
+ const newState = getValues(dataIndex);
1028
+ // @ts-ignore
1029
+ const prevState = record[dataIndex];
1030
+
1031
+ // @ts-ignore
1032
+
1033
+ handleCellChange?.({
1034
+ key: key,
1035
+ newState,
1036
+ prevState,
1037
+ record: formState,
1038
+ indexCol,
1039
+ indexRow,
1040
+ type: 'enter'
1041
+ });
1042
+ // }
1043
+ },
1044
+ onChange: onChange,
1045
+ status: isInvalid ? 'error' : undefined,
1046
+ "data-tooltip-content": message,
1047
+ "data-tooltip-id": `${id}-tooltip-error`,
1048
+ autoSize: {
1049
+ minRows: 1,
1050
+ maxRows: 1
1051
+ }
1052
+ });
1053
+ }
1054
+ };
1055
+ return /*#__PURE__*/React.createElement(Controller, {
1056
+ name: dataIndex,
1057
+ control: control,
1058
+ render: ({
1059
+ field: {
1060
+ value,
1061
+ onChange
1062
+ }
1063
+ }) => inputNode(value, onChange)
1064
+ });
1065
+ };
1066
+ export default EditableCell;