es-grid-template 1.8.71 → 1.8.72

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