es-grid-template 1.8.64 → 1.8.66

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 (222) hide show
  1. package/es/grid-component/TempTable.d.ts +2 -2
  2. package/es/grid-component/TempTable.js +5 -5
  3. package/es/grid-component/hooks/index.js +0 -1
  4. package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
  5. package/es/grid-component/hooks/useLazyKVMap.js +0 -4
  6. package/es/grid-component/hooks/utils.d.ts +1 -8
  7. package/es/grid-component/hooks/utils.js +176 -144
  8. package/es/grid-component/index.d.ts +1 -1
  9. package/es/grid-component/index.js +0 -4
  10. package/es/grid-component/styles.scss +1394 -1394
  11. package/es/grid-component/type.d.ts +0 -407
  12. package/es/grid-component/type.js +490 -1
  13. package/es/table-component/type.d.ts +10 -0
  14. package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
  15. package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  16. package/es/table-virtuoso/InternalTable.js +391 -0
  17. package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  18. package/es/table-virtuoso/body/TableBodyCell.js +457 -0
  19. package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  20. package/es/table-virtuoso/body/TableBodyRow.js +112 -0
  21. package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
  22. package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
  23. package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
  24. package/es/table-virtuoso/header/TableHeadCell.js +265 -0
  25. package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
  26. package/es/table-virtuoso/header/renderFilter.js +289 -0
  27. package/es/table-virtuoso/hook/constant.d.ts +73 -0
  28. package/es/table-virtuoso/hook/constant.js +240 -0
  29. package/es/table-virtuoso/hook/convert.d.ts +1 -0
  30. package/es/table-virtuoso/hook/convert.js +28 -0
  31. package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
  32. package/es/table-virtuoso/hook/useColumns.js +302 -0
  33. package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
  34. package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
  35. package/es/table-virtuoso/hook/utils.d.ts +159 -0
  36. package/es/table-virtuoso/hook/utils.js +2263 -0
  37. package/es/table-virtuoso/index.d.ts +2 -0
  38. package/es/table-virtuoso/index.js +2 -0
  39. package/es/table-virtuoso/style.d.ts +22 -0
  40. package/es/table-virtuoso/style.js +12 -0
  41. package/es/table-virtuoso/style.scss +1441 -0
  42. package/es/table-virtuoso/table/Grid.d.ts +37 -0
  43. package/es/table-virtuoso/table/Grid.js +298 -0
  44. package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
  45. package/es/table-virtuoso/table/TableContainer.js +292 -0
  46. package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
  47. package/es/table-virtuoso/table/TableWrapper.js +161 -0
  48. package/es/table-virtuoso/type.d.ts +0 -0
  49. package/es/table-virtuoso/type.js +785 -0
  50. package/es/table-virtuoso/useContext.d.ts +97 -0
  51. package/es/table-virtuoso/useContext.js +21 -0
  52. package/lib/grid-component/TempTable.d.ts +2 -2
  53. package/lib/grid-component/TempTable.js +5 -7
  54. package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
  55. package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
  56. package/lib/grid-component/hooks/utils.d.ts +1 -8
  57. package/lib/grid-component/hooks/utils.js +179 -152
  58. package/lib/grid-component/index.d.ts +1 -1
  59. package/lib/grid-component/index.js +0 -3
  60. package/lib/grid-component/styles.scss +1394 -1394
  61. package/lib/grid-component/type.d.ts +0 -407
  62. package/lib/grid-component/type.js +490 -4
  63. package/lib/table-component/type.d.ts +10 -0
  64. package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
  65. package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  66. package/lib/table-virtuoso/InternalTable.js +400 -0
  67. package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  68. package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
  69. package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  70. package/lib/table-virtuoso/body/TableBodyRow.js +119 -0
  71. package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
  72. package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
  73. package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
  74. package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
  75. package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
  76. package/lib/table-virtuoso/header/renderFilter.js +299 -0
  77. package/lib/table-virtuoso/hook/constant.d.ts +73 -0
  78. package/lib/table-virtuoso/hook/constant.js +247 -0
  79. package/lib/table-virtuoso/hook/convert.d.ts +1 -0
  80. package/lib/table-virtuoso/hook/convert.js +34 -0
  81. package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
  82. package/lib/table-virtuoso/hook/useColumns.js +315 -0
  83. package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
  84. package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
  85. package/lib/table-virtuoso/hook/utils.d.ts +159 -0
  86. package/lib/table-virtuoso/hook/utils.js +2389 -0
  87. package/lib/table-virtuoso/index.d.ts +2 -0
  88. package/lib/table-virtuoso/index.js +9 -0
  89. package/lib/table-virtuoso/style.d.ts +22 -0
  90. package/lib/table-virtuoso/style.js +19 -0
  91. package/lib/table-virtuoso/style.scss +1441 -0
  92. package/lib/table-virtuoso/table/Grid.d.ts +37 -0
  93. package/lib/table-virtuoso/table/Grid.js +307 -0
  94. package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
  95. package/lib/table-virtuoso/table/TableContainer.js +300 -0
  96. package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
  97. package/lib/table-virtuoso/table/TableWrapper.js +166 -0
  98. package/lib/table-virtuoso/type.d.ts +0 -0
  99. package/lib/table-virtuoso/type.js +786 -0
  100. package/lib/table-virtuoso/useContext.d.ts +97 -0
  101. package/lib/table-virtuoso/useContext.js +27 -0
  102. package/package.json +2 -1
  103. package/es/grid-component/AdvanceFilter.d.ts +0 -14
  104. package/es/grid-component/AdvanceFilter.js +0 -454
  105. package/es/grid-component/CheckboxFilter.d.ts +0 -20
  106. package/es/grid-component/CheckboxFilter.js +0 -244
  107. package/es/grid-component/CheckboxFilter2.d.ts +0 -20
  108. package/es/grid-component/CheckboxFilter2.js +0 -244
  109. package/es/grid-component/ColumnsChoose.d.ts +0 -10
  110. package/es/grid-component/ColumnsChoose.js +0 -230
  111. package/es/grid-component/Command.d.ts +0 -8
  112. package/es/grid-component/Command.js +0 -80
  113. package/es/grid-component/ContextMenu.d.ts +0 -20
  114. package/es/grid-component/ContextMenu.js +0 -130
  115. package/es/grid-component/ConvertColumnTable.d.ts +0 -7
  116. package/es/grid-component/ConvertColumnTable.js +0 -144
  117. package/es/grid-component/EditForm/EditForm.d.ts +0 -27
  118. package/es/grid-component/EditForm/EditForm.js +0 -394
  119. package/es/grid-component/EditForm/index.d.ts +0 -1
  120. package/es/grid-component/EditForm/index.js +0 -1
  121. package/es/grid-component/EditableCell.d.ts +0 -20
  122. package/es/grid-component/EditableCell.js +0 -1030
  123. package/es/grid-component/FilterSearch.d.ts +0 -12
  124. package/es/grid-component/FilterSearch.js +0 -33
  125. package/es/grid-component/GridStyle.d.ts +0 -8
  126. package/es/grid-component/GridStyle.js +0 -5
  127. package/es/grid-component/InternalTable.js +0 -1170
  128. package/es/grid-component/TableGrid.d.ts +0 -21
  129. package/es/grid-component/TableGrid.js +0 -493
  130. package/es/grid-component/async-select/index.d.ts +0 -11
  131. package/es/grid-component/async-select/index.js +0 -38
  132. package/es/grid-component/async-table-select/index.d.ts +0 -11
  133. package/es/grid-component/async-table-select/index.js +0 -40
  134. package/es/grid-component/checkbox-control/index.d.ts +0 -13
  135. package/es/grid-component/checkbox-control/index.js +0 -40
  136. package/es/grid-component/hooks/columns/index.d.ts +0 -10
  137. package/es/grid-component/hooks/columns/index.js +0 -503
  138. package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
  139. package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
  140. package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
  141. package/es/grid-component/hooks/content/HeaderContent.js +0 -44
  142. package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
  143. package/es/grid-component/hooks/content/TooltipContent.js +0 -74
  144. package/es/grid-component/hooks/useColumns.d.ts +0 -19
  145. package/es/grid-component/hooks/useColumns.js +0 -317
  146. package/es/grid-component/number/index.d.ts +0 -10
  147. package/es/grid-component/number/index.js +0 -39
  148. package/es/grid-component/number-range/index.d.ts +0 -11
  149. package/es/grid-component/number-range/index.js +0 -63
  150. package/es/grid-component/table/Grid.d.ts +0 -23
  151. package/es/grid-component/table/Grid.js +0 -49
  152. package/es/grid-component/table/GridEdit.d.ts +0 -23
  153. package/es/grid-component/table/GridEdit.js +0 -2726
  154. package/es/grid-component/table/Group.d.ts +0 -21
  155. package/es/grid-component/table/Group.js +0 -195
  156. package/es/grid-component/table/InfiniteTable.d.ts +0 -23
  157. package/es/grid-component/table/InfiniteTable.js +0 -101
  158. package/es/grid-component/useContext.d.ts +0 -34
  159. package/es/grid-component/useContext.js +0 -8
  160. package/lib/grid-component/AdvanceFilter.d.ts +0 -14
  161. package/lib/grid-component/AdvanceFilter.js +0 -463
  162. package/lib/grid-component/CheckboxFilter.d.ts +0 -20
  163. package/lib/grid-component/CheckboxFilter.js +0 -253
  164. package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
  165. package/lib/grid-component/CheckboxFilter2.js +0 -253
  166. package/lib/grid-component/ColumnsChoose.d.ts +0 -10
  167. package/lib/grid-component/ColumnsChoose.js +0 -240
  168. package/lib/grid-component/Command.d.ts +0 -8
  169. package/lib/grid-component/Command.js +0 -88
  170. package/lib/grid-component/ContextMenu.d.ts +0 -20
  171. package/lib/grid-component/ContextMenu.js +0 -140
  172. package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
  173. package/lib/grid-component/ConvertColumnTable.js +0 -153
  174. package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
  175. package/lib/grid-component/EditForm/EditForm.js +0 -404
  176. package/lib/grid-component/EditForm/index.d.ts +0 -1
  177. package/lib/grid-component/EditForm/index.js +0 -16
  178. package/lib/grid-component/EditableCell.d.ts +0 -20
  179. package/lib/grid-component/EditableCell.js +0 -1032
  180. package/lib/grid-component/FilterSearch.d.ts +0 -12
  181. package/lib/grid-component/FilterSearch.js +0 -42
  182. package/lib/grid-component/GridStyle.d.ts +0 -8
  183. package/lib/grid-component/GridStyle.js +0 -12
  184. package/lib/grid-component/InternalTable.js +0 -1178
  185. package/lib/grid-component/TableGrid.d.ts +0 -21
  186. package/lib/grid-component/TableGrid.js +0 -493
  187. package/lib/grid-component/async-select/index.d.ts +0 -11
  188. package/lib/grid-component/async-select/index.js +0 -47
  189. package/lib/grid-component/async-table-select/index.d.ts +0 -11
  190. package/lib/grid-component/async-table-select/index.js +0 -49
  191. package/lib/grid-component/checkbox-control/index.d.ts +0 -13
  192. package/lib/grid-component/checkbox-control/index.js +0 -48
  193. package/lib/grid-component/hooks/columns/index.d.ts +0 -10
  194. package/lib/grid-component/hooks/columns/index.js +0 -518
  195. package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
  196. package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
  197. package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
  198. package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
  199. package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
  200. package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
  201. package/lib/grid-component/hooks/useColumns.d.ts +0 -19
  202. package/lib/grid-component/hooks/useColumns.js +0 -328
  203. package/lib/grid-component/number/index.d.ts +0 -10
  204. package/lib/grid-component/number/index.js +0 -47
  205. package/lib/grid-component/number-range/index.d.ts +0 -11
  206. package/lib/grid-component/number-range/index.js +0 -71
  207. package/lib/grid-component/table/Grid.d.ts +0 -23
  208. package/lib/grid-component/table/Grid.js +0 -58
  209. package/lib/grid-component/table/GridEdit.d.ts +0 -23
  210. package/lib/grid-component/table/GridEdit.js +0 -2723
  211. package/lib/grid-component/table/Group.d.ts +0 -21
  212. package/lib/grid-component/table/Group.js +0 -204
  213. package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
  214. package/lib/grid-component/table/InfiniteTable.js +0 -109
  215. package/lib/grid-component/useContext.d.ts +0 -34
  216. package/lib/grid-component/useContext.js +0 -13
  217. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
  218. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
  219. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
  220. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
  221. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
  222. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
@@ -1,503 +0,0 @@
1
- import { checkDecimalSeparator, checkThousandSeparator, convertDateToDayjs, convertDayjsToDate, convertFormat, getDatepickerFormat, getDateRangeFormat, getDateString, getEditType, getFormat, getTypeFilter, isColor, isEmpty } from "../utils";
2
- import { numericFormatter } from "react-numeric-component";
3
- import dayjs from "dayjs";
4
- import moment from "moment/moment";
5
- import React, { Fragment } from "react";
6
- import { CustomProvider, DatePicker, DateRangePicker, Empty, Input, Select } from "rc-master-ui";
7
- import CheckboxFilter from "../../CheckboxFilter";
8
- import { SELECTION_COLUMN } from "rc-master-ui/es/table/hooks/useSelection";
9
- import NumberRange from "../../number-range";
10
- import NumberInput from "../../number";
11
- import ControlCheckbox from "../content/ControlCheckbox";
12
- // import {Typography} from "antd";
13
- // const {RangePicker} = DatePicker
14
-
15
- // const { Text } = Typography;
16
-
17
- export function flatColumns(columns, parentKey = 'key') {
18
- // @ts-ignore
19
- return columns.filter(column => column && typeof column === 'object').reduce((list, column, index) => {
20
- const {
21
- fixed
22
- } = column;
23
- // Convert `fixed='true'` to `fixed='left'` instead
24
- const parsedFixed = fixed === true ? 'left' : fixed;
25
- const mergedKey = `${parentKey}-${index}`;
26
- const subColumns = column.children;
27
- if (subColumns && subColumns.length > 0) {
28
- return [...list, ...flatColumns(subColumns, mergedKey).map(subColum => ({
29
- fixed: parsedFixed,
30
- ...subColum
31
- }))];
32
- }
33
- return [...list, {
34
- key: mergedKey,
35
- ...column,
36
- fixed: parsedFixed
37
- }];
38
- }, []);
39
- }
40
- export const flatColumns2 = columns => {
41
- return columns.reduce((list, column) => {
42
- const subColumns = column.children;
43
- if (column === SELECTION_COLUMN) {
44
- return [...list, {
45
- ...column
46
- }];
47
- }
48
- if (subColumns && subColumns.length > 0) {
49
- return [...list, ...flatColumns2(subColumns).map(subColum => ({
50
- // fixed: parsedFixed,
51
- ...subColum
52
- }))];
53
- }
54
- return [...list, {
55
- ...column
56
- }];
57
- }, []);
58
- };
59
- export const getValueCell = (column, value, record, rowIndex, colIndex, format) => {
60
- switch (column?.type) {
61
- case 'number':
62
- const colFormat = typeof column.format === 'function' ? column.format(record) : column.format;
63
- const cellFormat = getFormat(colFormat, format);
64
- const thousandSeparator = cellFormat?.thousandSeparator;
65
- const decimalSeparator = cellFormat?.decimalSeparator;
66
- const dec = cellFormat?.decimalScale;
67
-
68
- // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
69
-
70
- const tmpval = typeof value === 'string' ? Number(value) : value;
71
- const numericFormatProps = {
72
- thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
73
- decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
74
- allowNegative: cellFormat?.allowNegative ?? true,
75
- prefix: cellFormat?.prefix,
76
- suffix: cellFormat?.suffix,
77
- decimalScale: dec,
78
- fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
79
- };
80
-
81
- // if ( typeof value === "string") {
82
- // const ttt = removeNumericFormat(value, undefined, numericFormatProps )
83
- //
84
- // }
85
-
86
- const contentNumber = !isEmpty(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
87
- // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? tmpval.toString() : tmpval.toString()) : '0'
88
-
89
- return !isEmpty(contentNumber) ? numericFormatter(contentNumber, numericFormatProps) : '';
90
- case 'date':
91
- return value ? dayjs(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
92
- case 'time':
93
- return value ? value : '';
94
- case 'year':
95
- const year = value ? moment(value).format('yyyy') : '';
96
- return /*#__PURE__*/React.createElement(Fragment, null, year);
97
- case 'datetime':
98
- return value ? moment(value).format(format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : '';
99
- case 'boolean':
100
- return value ? 'true' : 'false';
101
- case 'color':
102
- return value;
103
- case 'checkbox':
104
- return typeof value === 'boolean' ? value ? 'true' : 'false' : value ? '1' : '0';
105
- case 'file':
106
- const nameFile = typeof value === 'object' && !Array.isArray(value) ? value.name : Array.isArray(value) ? value.map(it => typeof it === 'object' ? it.name : it).filter(Boolean).join(", ") : '';
107
- return value ? nameFile : '';
108
- default:
109
- if (Array.isArray(value)) {
110
- return value.join(', ');
111
- }
112
- return value;
113
- }
114
- };
115
- export const renderValueCell = (column, value, record, rowIndex, colIndex, format, editAble) => {
116
- switch (column?.type) {
117
- case 'number':
118
- const colFormat = typeof column.format === 'function' ? column.format(record) : column.format;
119
- const cellFormat = getFormat(colFormat, format);
120
- const thousandSeparator = cellFormat?.thousandSeparator;
121
- const decimalSeparator = cellFormat?.decimalSeparator;
122
- const dec = cellFormat?.decimalScale;
123
-
124
- // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
125
-
126
- const tmpval = typeof value === 'string' ? Number(value) : value;
127
- const numericFormatProps = {
128
- thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
129
- decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
130
- allowNegative: cellFormat?.allowNegative ?? true,
131
- prefix: cellFormat?.prefix,
132
- suffix: cellFormat?.suffix,
133
- decimalScale: dec,
134
- fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
135
- };
136
-
137
- // if ( typeof value === "string") {
138
- // const ttt = removeNumericFormat(value, undefined, numericFormatProps )
139
- //
140
- // }
141
-
142
- const contentNumber = !isEmpty(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
143
- // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? tmpval.toString() : tmpval.toString()) : '0'
144
-
145
- return !isEmpty(contentNumber) ? numericFormatter(contentNumber, numericFormatProps) : '';
146
- case 'date':
147
- return value ? dayjs(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
148
- case 'time':
149
- return value ? value : '';
150
- case 'year':
151
- const year = value ? moment(value).format('yyyy') : '';
152
- return /*#__PURE__*/React.createElement(Fragment, null, year);
153
- case 'datetime':
154
- return value ? moment(value).format(format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : '';
155
- case 'boolean':
156
- return value ? 'true' : 'false';
157
- case 'color':
158
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
159
- className: 'w-100 h-100',
160
- style: {
161
- backgroundColor: isColor(value) ? value : '#fff',
162
- border: '1px solid #f0f0f0',
163
- height: '100%',
164
- minHeight: 20
165
- }
166
- }));
167
- case 'checkbox':
168
- // return (
169
- // <Checkbox
170
- // checked={!!value}
171
- //
172
- // />
173
- // )
174
-
175
- return /*#__PURE__*/React.createElement(ControlCheckbox, {
176
- column: column,
177
- record: record,
178
- rowIndex: rowIndex,
179
- colIndex: colIndex,
180
- checked: !!value,
181
- checkValue: value,
182
- editAble: editAble
183
- });
184
- case 'file':
185
- const nameFile = typeof value === 'object' && !Array.isArray(value) ? value.name : Array.isArray(value) ? value.map(it => typeof it === 'object' ? it.name : it).filter(Boolean).join(", ") : '';
186
- return value ? nameFile : '';
187
- default:
188
- if (Array.isArray(value)) {
189
- return value.join(', ');
190
- }
191
- return value;
192
- }
193
- };
194
- export const renderContent = (column, value, record, index, colIndex, editAble, format, onClick) => {
195
- const cellValue = value instanceof Date ? getDateString(column, value) : value;
196
- const content = renderValueCell(column, cellValue, record, index, colIndex, format, editAble);
197
- const editType = getEditType(column, record);
198
- return /*#__PURE__*/React.createElement(Fragment, null, column?.template ? typeof column.template === "function" ? column.template({
199
- value,
200
- index,
201
- rowData: record,
202
- field: column.field
203
- }) : column.template : content, (editType === 'select' || editType === 'selectTable') && /*#__PURE__*/React.createElement("span", {
204
- className: 'caret-down',
205
- onClick: onClick
206
- }));
207
- };
208
- export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t, format, dateRangeLocale) => {
209
- const cellFormat = column.format ? typeof column.format === 'function' ? column.format({}) : column.format : format;
210
- const type = getTypeFilter(column);
211
- const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type, cellFormat) ?? 'DD/MM/YYYY';
212
- const dateRangeFormat = convertFormat(getDateRangeFormat(column?.type, cellFormat) ?? 'dd/MM/yyyy');
213
- const find = dataSourceFilter?.find(it => it.key === column?.field);
214
- const options = find ? find.data : [];
215
- switch (type) {
216
- case 'Number':
217
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
218
- className: 'mb-1'
219
- }, /*#__PURE__*/React.createElement(NumberInput, {
220
- t: t,
221
- value: selectedKeys[0],
222
- onChange: vals => {
223
- setSelectedKeys(vals);
224
- }
225
- }))));
226
- case 'NumberRange':
227
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NumberRange, {
228
- t: t,
229
- min: selectedKeys[0],
230
- max: selectedKeys[1],
231
- onChange: vals => {
232
- setSelectedKeys(vals);
233
- }
234
- })));
235
- case 'Date':
236
- const dateValue = selectedKeys[0] ? convertDateToDayjs(new Date(selectedKeys[0]), dateFormat) : null;
237
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
238
- className: 'mb-1'
239
- }, /*#__PURE__*/React.createElement(DatePicker, {
240
- format: {
241
- format: dateFormat,
242
- type: 'mask'
243
- },
244
- locale: buddhistLocale,
245
- style: {
246
- width: '100%',
247
- height: '100%'
248
- },
249
- value: dateValue,
250
- defaultValue: dateValue
251
- // placeholder={t ? t(column?.placeholder) : column?.placeholder}
252
- ,
253
- onChange: (date, dateString) => {
254
- const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
255
- setSelectedKeys(newDateValue ? [newDateValue] : []);
256
- }
257
- }))));
258
- case 'DateRange':
259
- // const dateRangeValue: any = [selectedKeys[0] ? convertDateToDayjs(new Date(selectedKeys[0]), dateRangeFormat) : '', selectedKeys[1] ? convertDateToDayjs(new Date(selectedKeys[1]), dateRangeFormat) : '']
260
- const dateRangeValue = selectedKeys && selectedKeys.length > 0 ? [selectedKeys[0] ? new Date(selectedKeys[0]) : '', selectedKeys[1] ? new Date(selectedKeys[1]) : ''] : null;
261
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
262
- className: 'mb-1'
263
- }, /*#__PURE__*/React.createElement(CustomProvider, {
264
- locale: dateRangeLocale
265
- }, /*#__PURE__*/React.createElement(DateRangePicker
266
- // placeholder={['Ngày bắt đầu', 'Ngày bắt đầu']}
267
- , {
268
- style: {
269
- width: 300
270
- },
271
- format: dateRangeFormat,
272
- value: dateRangeValue,
273
- onChange: value => {
274
- const newDateRangeValue = value ? [value[0] ? moment(value[0]).format() : '', value[1] ? moment(value[1]).format() : ''] : [];
275
- setSelectedKeys(newDateRangeValue);
276
- }
277
- })))));
278
- case 'Week':
279
- const weekValue = !isEmpty(selectedKeys[0]) ? dayjs(selectedKeys[0], dateFormat) : null;
280
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
281
- className: 'mb-1'
282
- }, /*#__PURE__*/React.createElement(DatePicker, {
283
- format: {
284
- format: dateFormat,
285
- type: 'mask'
286
- },
287
- picker: 'week',
288
- locale: buddhistLocale,
289
- style: {
290
- width: '100%',
291
- height: '100%'
292
- },
293
- value: weekValue,
294
- defaultValue: weekValue,
295
- placeholder: column?.placeholder,
296
- onChange: (date, dateString) => {
297
- const newDateValue = dateString ?? null;
298
- setSelectedKeys(newDateValue ? [newDateValue] : []);
299
- }
300
- }))));
301
- case 'Month':
302
- const monthValue = !isEmpty(selectedKeys[0]) ? dayjs(selectedKeys[0], dateFormat) : null;
303
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
304
- className: 'mb-1'
305
- }, /*#__PURE__*/React.createElement(DatePicker, {
306
- format: {
307
- format: dateFormat,
308
- type: 'mask'
309
- },
310
- picker: 'month',
311
- locale: buddhistLocale,
312
- style: {
313
- width: '100%',
314
- height: '100%'
315
- },
316
- value: monthValue,
317
- defaultValue: monthValue,
318
- placeholder: column?.placeholder,
319
- onChange: (date, dateString) => {
320
- const newDateValue = dateString ?? null;
321
- setSelectedKeys(newDateValue ? [newDateValue] : []);
322
- }
323
- })));
324
-
325
- // case 'Quarter':
326
- //
327
- // // const monthValue = selectedKeys[0] ? convertDateToDayjs(new Date(selectedKeys[0]), dateFormat) : null
328
- //
329
- // const pickerFormat = getDatepickerFormat(getEditType(col) as IEditType, col)
330
- // const pickerValue = !isEmpty(selectedKeys[0]) ? dayjs(selectedKeys[0], pickerFormat) : null
331
- //
332
- // return (
333
- // <Fragment>
334
- // <div>
335
- //
336
- //
337
- // <div className={'mb-1'}>
338
- //
339
- // <DatePicker
340
- // format={{
341
- // format: dateFormat,
342
- // type: 'mask'
343
- // }}
344
- // locale={buddhistLocale}
345
- // style={{width: '100%', height: '100%'}}
346
- // value={pickerValue}
347
- // defaultValue={pickerValue}
348
- // placeholder={column.placeholder}
349
- // onChange={(date, dateString) => {
350
- // const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
351
- // setSelectedKeys(newDateValue ? [newDateValue] : [])
352
- //
353
- // }}
354
- //
355
- // />
356
- // </div>
357
- //
358
- //
359
- // </div>
360
- // </Fragment>
361
- // )
362
- //
363
- // case 'Year':
364
- //
365
- // // const monthValue = selectedKeys[0] ? convertDateToDayjs(new Date(selectedKeys[0]), dateFormat) : null
366
- //
367
- // const pickerFormat = getDatepickerFormat(getEditType(col) as IEditType, col)
368
- // const pickerValue = !isEmpty(selectedKeys[0]) ? dayjs(selectedKeys[0], pickerFormat) : null
369
- //
370
- // return (
371
- // <Fragment>
372
- // <div>
373
- //
374
- //
375
- // <div className={'mb-1'}>
376
- //
377
- // <DatePicker
378
- // format={{
379
- // format: dateFormat,
380
- // type: 'mask'
381
- // }}
382
- // locale={buddhistLocale}
383
- // style={{width: '100%', height: '100%'}}
384
- // value={pickerValue}
385
- // defaultValue={pickerValue}
386
- // placeholder={column.placeholder}
387
- // onChange={(date, dateString) => {
388
- // const newDateValue = dateString ? moment(convertDayjsToDate(dateString as string, dateFormat)).format() : null
389
- // setSelectedKeys(newDateValue ? [newDateValue] : [])
390
- //
391
- // }}
392
- //
393
- // />
394
- // </div>
395
- //
396
- //
397
- // </div>
398
- // </Fragment>
399
- // )
400
-
401
- case 'Dropdown':
402
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
403
- className: 'mb-1'
404
- }, /*#__PURE__*/React.createElement(Select
405
- // options={translateOption(numberOperator, t)}
406
- // options={find ? options : column.source ?? []}
407
- , {
408
- options: column.source ? column.source : options ?? [],
409
- style: {
410
- width: '100%',
411
- marginBottom: 8
412
- },
413
- value: selectedKeys[0],
414
- notFoundContent: /*#__PURE__*/React.createElement(Empty, {
415
- image: Empty.PRESENTED_IMAGE_SIMPLE,
416
- description: locale?.emptyText
417
- }),
418
- onChange: val => {
419
- // setOperatorKey(val)
420
- setSelectedKeys(val ? [val] : []);
421
- },
422
- showSearch: true,
423
- allowClear: true
424
- }))));
425
-
426
- // case 'DropTree':
427
- // return (
428
- // <Fragment>
429
- // <div>
430
- // {col.filterOption && col.filterOption.showOperator === false ? (
431
- // ''
432
- // ) : (
433
- // <div className={'mb-1'}>
434
- // <Select
435
- // options={translateOption(numberOperator, t)}
436
- // // options={t ? numberOperator.map((it: any) => ({...it, label: t(it.label)})) : numberOperator}
437
- //
438
- // classNamePrefix='select'
439
- // className={`react-select`}
440
- // value={translateOption(numberOperator, t).find(
441
- // ope => ope.value === (operator ? operator : getDefaultOperator(col))
442
- // )}
443
- // onChange={(val: any) => {
444
- // setCurrentFilter((prevState: any) => ({ ...prevState, operator: val.value }))
445
- // }}
446
- // />
447
- // </div>
448
- // )}
449
- //
450
- // <div className={'mb-1'}>
451
- // <Input
452
- // placeholder={'Nhập giá trị'}
453
- // value={value}
454
- // onChange={(val: any) => {
455
- // onChangeValueFilter(type, val.value)
456
- // }}
457
- // />
458
- // </div>
459
- //
460
- // <div className={'d-flex justify-content-end'}>
461
- // <Button color='flat-primary' className={'me-1 be-button'} onClick={(e: any) => handleOnFilter(e)}>
462
- // {t ? t('Filter') : 'Filter'}
463
- // </Button>
464
- // <Button color='flat-secondary' className={'be-button'} onClick={(e: any) => handleClearFilter(e)}>
465
- // {t ? t('Delete') : 'Delete'}
466
- // </Button>
467
- // </div>
468
- // </div>
469
- // </Fragment>
470
- // )
471
- //
472
- case 'Checkbox':
473
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
474
- className: 'mb-1'
475
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CheckboxFilter, {
476
- locale: locale,
477
- selectedKeys: selectedKeys,
478
- onSelect: setSelectedKeys
479
- // options={options}
480
- ,
481
- options: column.source ? column.source : options ?? [],
482
- filterMultiple: true,
483
- open: visible,
484
- searchValue: searchValue,
485
- setSearchValue: setSearchValue
486
- })))));
487
- case 'Text':
488
- default:
489
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
490
- className: 'mb-1'
491
- }, /*#__PURE__*/React.createElement(Input, {
492
- placeholder: t ? t('Search') : `Search`,
493
- value: selectedKeys[0],
494
- onChange: e => {
495
- setSelectedKeys(e.target.value ? [e.target.value] : ['']);
496
- }
497
- // onPressEnter={() => handleSearch(selectedKeys as string[], confirm)}
498
- ,
499
- onPressEnter: () => confirm(),
500
- allowClear: true
501
- }))));
502
- }
503
- };
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import type { ColumnTable } from "../../type";
3
- type Props = {
4
- column: ColumnTable;
5
- record?: any;
6
- rowIndex: number;
7
- colIndex: number;
8
- checkValue: any;
9
- checked: boolean;
10
- editAble?: boolean;
11
- };
12
- declare const ControlCheckbox: (props: Props) => React.JSX.Element;
13
- export default ControlCheckbox;
@@ -1,87 +0,0 @@
1
- import React, { useContext } from "react";
2
- import { isDisable, isEditable, parseBooleanToValue } from "../utils";
3
- import { Checkbox } from "rc-master-ui";
4
- import { TableContext } from "../../useContext";
5
- const ControlCheckbox = props => {
6
- const {
7
- column,
8
- record,
9
- rowIndex,
10
- colIndex,
11
- checkValue,
12
- editAble,
13
- checked
14
- } = props;
15
- const {
16
- handleCellChange,
17
- getRowKey
18
- } = useContext(TableContext);
19
-
20
- // const isEdit = getEditType(column, record)
21
-
22
- const isEdit = React.useMemo(() => {
23
- return isEditable(column, record);
24
- }, [column, record]);
25
-
26
- // const [isHover, setIsHover] = useState(false)
27
-
28
- const inputNode = value => {
29
- return /*#__PURE__*/React.createElement(Checkbox, {
30
- checked: Boolean(value),
31
- defaultChecked: Boolean(checked)
32
- // style={{ textAlign: column.align ?? 'left' }}
33
- ,
34
- onChange: val => {
35
- const newVal = typeof checkValue === "number" ? parseBooleanToValue(val.target.checked, typeof value) : val.target.checked;
36
-
37
- // onChange(newVal)
38
-
39
- const key = getRowKey?.(record, rowIndex);
40
- // const formState = getValues()
41
-
42
- handleCellChange?.({
43
- key: key,
44
- // @ts-ignore
45
- record: {
46
- ...record,
47
- [column.field]: newVal
48
- },
49
- option: value,
50
- prevState: value,
51
- newState: newVal,
52
- field: column.field ?? column.dataIndex,
53
- indexCol: colIndex,
54
- indexRow: rowIndex,
55
- type: 'blur'
56
- });
57
- },
58
- disabled: isDisable(column, record) ?? false
59
- });
60
- };
61
- return /*#__PURE__*/React.createElement("div", {
62
- // onMouseEnter={() => {
63
- // setIsHover(true)
64
- // }}
65
- //
66
- // onMouseLeave={() => {
67
- // setIsHover(false)
68
- // }}
69
- style: {
70
- display: 'flex',
71
- alignItems: 'center',
72
- justifyContent: column.align ?? 'center',
73
- paddingInline: 5,
74
- height: '100%',
75
- width: '100%'
76
- }
77
- }, editAble && isEdit !== false ? inputNode(checkValue) : /*#__PURE__*/React.createElement(Checkbox, {
78
- checked: checked,
79
- onChange: e => {
80
- e.preventDefault();
81
- },
82
- style: {
83
- textAlign: column.align ?? 'left'
84
- }
85
- }));
86
- };
87
- export default ControlCheckbox;
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import type { ColumnTable } from "../../type";
3
- import type { IWrapSettings } from "../../type";
4
- type Props = React.HTMLAttributes<HTMLDivElement> & {
5
- t?: any;
6
- id?: string;
7
- content?: string;
8
- wrapSettings?: IWrapSettings;
9
- column?: ColumnTable;
10
- template?: React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
11
- tooltip?: string | number | React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
12
- };
13
- declare const HeaderContent: (props: Props) => React.JSX.Element;
14
- export default HeaderContent;
@@ -1,44 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import React, { Fragment } from "react";
3
- import classnames from "classnames";
4
- import { getTemplate } from "../utils";
5
- import styled from "styled-components";
6
- const HeaderStyle = styled.div.withConfig({
7
- displayName: "HeaderStyle",
8
- componentId: "es-grid-template__sc-ibhq66-0"
9
- })([""]);
10
- const HeaderContent = props => {
11
- const {
12
- t,
13
- id,
14
- wrapSettings,
15
- column,
16
- onCopy,
17
- ...rest
18
- } = props;
19
- const {
20
- headerTooltip,
21
- headerText,
22
- columnGroupText,
23
- headerTemplate,
24
- headerTextWrap,
25
- ellipsis
26
- } = props.column ?? {};
27
- const text = React.useMemo(() => {
28
- return columnGroupText ?? headerText;
29
- }, [columnGroupText, headerText]);
30
- const tooltip = React.useMemo(() => {
31
- return t ? t?.(headerTooltip ?? columnGroupText ?? headerText) : headerTooltip ?? columnGroupText ?? headerText;
32
- }, [columnGroupText, headerText, headerTooltip, t]);
33
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(HeaderStyle, _extends({}, rest, {
34
- className: classnames('', {
35
- 'ui-rc-table-cell-ellipsis': ellipsis !== false && headerTextWrap !== true,
36
- 'header-text-wrap': headerTextWrap ?? (wrapSettings?.wrapMode === 'Header' || wrapSettings?.wrapMode === 'Both')
37
- }),
38
- "data-tooltip-id": `${id}-tooltip-header`,
39
- "data-tooltip-content": tooltip,
40
- "data-tooltip-offset": 16,
41
- onCopy: onCopy
42
- }), headerTemplate ? getTemplate(headerTemplate, column) : t ? t(text) : text));
43
- };
44
- export default HeaderContent;
@@ -1,13 +0,0 @@
1
- import React, { ReactElement, ReactNode } from "react";
2
- type Props = {
3
- t?: any;
4
- content?: any;
5
- value?: any;
6
- record?: any;
7
- rowIndex?: any;
8
- template?: React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
9
- tooltip?: ReactNode | ReactElement | ((value: any, record: any, index: number) => ReactNode | ReactElement);
10
- showTooltip?: boolean;
11
- };
12
- declare const TooltipContent: (props: Props) => React.JSX.Element;
13
- export default TooltipContent;