es-grid-template 1.8.70 → 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 (239) 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/TableContainerEdit.js +2 -2
  98. package/es/table-component/body/TableBodyCell.js +49 -40
  99. package/es/table-component/body/TableBodyCellEdit.js +9 -3
  100. package/es/table-component/body/TableBodyRow.js +4 -1
  101. package/es/table-component/hook/utils.d.ts +1 -0
  102. package/es/table-component/hook/utils.js +15 -7
  103. package/es/table-component/style.js +1 -1
  104. package/es/table-component/table/Grid.js +3 -0
  105. package/es/table-component/useContext.d.ts +5 -0
  106. package/es/table-virtuoso/InternalTable.js +2 -2
  107. package/es/table-virtuoso/body/TableBodyCell.js +2 -7
  108. package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  109. package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
  110. package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  111. package/es/table-virtuoso/body/TableBodyRow.js +43 -1
  112. package/es/table-virtuoso/hook/utils.d.ts +1 -0
  113. package/es/table-virtuoso/hook/utils.js +29 -0
  114. package/es/table-virtuoso/style.js +3 -1
  115. package/es/table-virtuoso/table/Grid.js +2 -2
  116. package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
  117. package/es/table-virtuoso/table/TableWrapper.js +24 -5
  118. package/es/table-virtuoso/useContext.d.ts +6 -3
  119. package/es/table-virtuoso/useContext.js +18 -0
  120. package/lib/grid-component/TempTable.js +2 -1
  121. package/lib/group-component/ColumnsChoose.d.ts +13 -0
  122. package/lib/group-component/ColumnsChoose.js +221 -0
  123. package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  124. package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
  125. package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
  126. package/lib/group-component/ColumnsGroup/index.js +16 -0
  127. package/lib/group-component/ContextMenu.d.ts +19 -0
  128. package/lib/group-component/ContextMenu.js +83 -0
  129. package/lib/group-component/InternalTable.d.ts +8 -0
  130. package/lib/group-component/InternalTable.js +233 -0
  131. package/lib/group-component/TableContainer.d.ts +49 -0
  132. package/lib/group-component/TableContainer.js +382 -0
  133. package/lib/group-component/TableContainerEdit.d.ts +48 -0
  134. package/lib/group-component/TableContainerEdit.js +2075 -0
  135. package/lib/group-component/body/EditableCell.d.ts +16 -0
  136. package/lib/group-component/body/EditableCell.js +1075 -0
  137. package/lib/group-component/body/TableBody.d.ts +14 -0
  138. package/lib/group-component/body/TableBody.js +91 -0
  139. package/lib/group-component/body/TableBodyCell.d.ts +12 -0
  140. package/lib/group-component/body/TableBodyCell.js +595 -0
  141. package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
  142. package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
  143. package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
  144. package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
  145. package/lib/group-component/body/TableBodyRow.d.ts +21 -0
  146. package/lib/group-component/body/TableBodyRow.js +206 -0
  147. package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
  148. package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
  149. package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
  150. package/lib/group-component/components/ControlCheckbox.js +92 -0
  151. package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
  152. package/lib/group-component/components/EditForm/EditForm.js +404 -0
  153. package/lib/group-component/components/EditForm/index.d.ts +1 -0
  154. package/lib/group-component/components/EditForm/index.js +16 -0
  155. package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
  156. package/lib/group-component/components/InputControl/InputControl.js +127 -0
  157. package/lib/group-component/components/InputControl/index.d.ts +1 -0
  158. package/lib/group-component/components/InputControl/index.js +16 -0
  159. package/lib/group-component/components/async-select/index.d.ts +11 -0
  160. package/lib/group-component/components/async-select/index.js +47 -0
  161. package/lib/group-component/components/async-table-select/index.d.ts +11 -0
  162. package/lib/group-component/components/async-table-select/index.js +49 -0
  163. package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
  164. package/lib/group-component/components/checkbox-control/index.js +48 -0
  165. package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  166. package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
  167. package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  168. package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
  169. package/lib/group-component/components/command/Command.d.ts +10 -0
  170. package/lib/group-component/components/command/Command.js +44 -0
  171. package/lib/group-component/components/number/index.d.ts +12 -0
  172. package/lib/group-component/components/number/index.js +50 -0
  173. package/lib/group-component/components/number-range/index.d.ts +13 -0
  174. package/lib/group-component/components/number-range/index.js +87 -0
  175. package/lib/group-component/features/operator.d.ts +24 -0
  176. package/lib/group-component/features/operator.js +67 -0
  177. package/lib/group-component/footer/TableFooter.d.ts +7 -0
  178. package/lib/group-component/footer/TableFooter.js +44 -0
  179. package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
  180. package/lib/group-component/footer/TableFooterCell.js +75 -0
  181. package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
  182. package/lib/group-component/footer/TableFooterRow.js +37 -0
  183. package/lib/group-component/header/TableHead.d.ts +15 -0
  184. package/lib/group-component/header/TableHead.js +107 -0
  185. package/lib/group-component/header/TableHeadCell.d.ts +15 -0
  186. package/lib/group-component/header/TableHeadCell.js +319 -0
  187. package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
  188. package/lib/group-component/header/TableHeadCell2.js +330 -0
  189. package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
  190. package/lib/group-component/header/TableHeadGroupCell.js +103 -0
  191. package/lib/group-component/header/TableHeadRow.d.ts +15 -0
  192. package/lib/group-component/header/TableHeadRow.js +59 -0
  193. package/lib/group-component/header/renderFilter.d.ts +20 -0
  194. package/lib/group-component/header/renderFilter.js +301 -0
  195. package/lib/group-component/hook/convert.d.ts +1 -0
  196. package/lib/group-component/hook/convert.js +34 -0
  197. package/lib/group-component/hook/useColumns.d.ts +28 -0
  198. package/lib/group-component/hook/useColumns.js +318 -0
  199. package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
  200. package/lib/group-component/hook/useFilterOperator.js +40 -0
  201. package/lib/group-component/hook/utils.d.ts +220 -0
  202. package/lib/group-component/hook/utils.js +2468 -0
  203. package/lib/group-component/index.d.ts +2 -0
  204. package/lib/group-component/index.js +9 -0
  205. package/lib/group-component/style.d.ts +22 -0
  206. package/lib/group-component/style.js +55 -0
  207. package/lib/group-component/style.scss +1438 -0
  208. package/lib/group-component/table/Grid.d.ts +33 -0
  209. package/lib/group-component/table/Grid.js +443 -0
  210. package/lib/group-component/table/TableWrapper.d.ts +33 -0
  211. package/lib/group-component/table/TableWrapper.js +259 -0
  212. package/lib/group-component/useContext.d.ts +100 -0
  213. package/lib/group-component/useContext.js +27 -0
  214. package/lib/table-component/InternalTable.js +6 -1
  215. package/lib/table-component/TableContainer.js +4 -2
  216. package/lib/table-component/TableContainerEdit.js +2 -2
  217. package/lib/table-component/body/TableBodyCell.js +49 -40
  218. package/lib/table-component/body/TableBodyCellEdit.js +9 -3
  219. package/lib/table-component/body/TableBodyRow.js +4 -1
  220. package/lib/table-component/hook/utils.d.ts +1 -0
  221. package/lib/table-component/hook/utils.js +16 -7
  222. package/lib/table-component/style.js +1 -1
  223. package/lib/table-component/table/Grid.js +3 -0
  224. package/lib/table-component/useContext.d.ts +5 -0
  225. package/lib/table-virtuoso/InternalTable.js +2 -2
  226. package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
  227. package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
  228. package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
  229. package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
  230. package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
  231. package/lib/table-virtuoso/hook/utils.d.ts +1 -0
  232. package/lib/table-virtuoso/hook/utils.js +32 -1
  233. package/lib/table-virtuoso/style.js +3 -1
  234. package/lib/table-virtuoso/table/Grid.js +2 -2
  235. package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
  236. package/lib/table-virtuoso/table/TableWrapper.js +24 -5
  237. package/lib/table-virtuoso/useContext.d.ts +6 -3
  238. package/lib/table-virtuoso/useContext.js +18 -0
  239. package/package.json +1 -1
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNumericComponent = require("react-numeric-component");
9
+ var _rcMasterUi = require("rc-master-ui");
10
+ var _utils = require("../../hook/utils");
11
+ 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); }
12
+ 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; }
13
+ const NumberRange = props => {
14
+ const {
15
+ t,
16
+ max,
17
+ min,
18
+ format,
19
+ onChange,
20
+ onPressEnter
21
+ } = props;
22
+ const values = _react.default.useMemo(() => [min, max], [min, max]);
23
+
24
+ // const [values, setValues] = React.useState<any[]>(() =>
25
+ // mergedValues,
26
+ // );
27
+
28
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
29
+ className: '',
30
+ style: {
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ columnGap: 5
34
+ }
35
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
36
+ value: values[0] ?? ''
37
+ // value={min}
38
+ ,
39
+ thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
40
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
41
+ allowNegative: true,
42
+ customInput: _rcMasterUi.Input,
43
+ className: 'input-element',
44
+ onValueChange: vals => {
45
+ // onChangeValueFilter(type, values.floatValue, 'min')
46
+
47
+ // setValues([vals.floatValue, values[1]])
48
+ onChange?.([vals.floatValue, max]);
49
+ }
50
+ // placeholder={t ? t('Min') : 'Min'}
51
+ ,
52
+ placeholder: t ? t('From') : 'From'
53
+ // autoFocus={true}
54
+ ,
55
+ allowClear: true,
56
+ classNames: {
57
+ input: 'filter-input'
58
+ },
59
+ onPressEnter: () => {
60
+ const maxInput = document.querySelector('.number-max-input');
61
+ if (maxInput) {
62
+ maxInput.focus();
63
+ }
64
+ }
65
+ })), /*#__PURE__*/_react.default.createElement("span", null, " - "), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
66
+ value: values[1] ?? ''
67
+ // value={max}
68
+ ,
69
+ thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
70
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
71
+ allowNegative: true,
72
+ customInput: _rcMasterUi.Input,
73
+ className: 'input-element',
74
+ onValueChange: vals => {
75
+ // setValues([values[0], vals.floatValue])
76
+ onChange?.([min, vals.floatValue]);
77
+ }
78
+ // placeholder={t ? t('Max') : 'Max'}
79
+ ,
80
+ placeholder: t ? t('To') : 'To',
81
+ onPressEnter: onPressEnter,
82
+ classNames: {
83
+ input: 'number-max-input'
84
+ }
85
+ }))));
86
+ };
87
+ var _default = exports.default = NumberRange;
@@ -0,0 +1,24 @@
1
+ import { OnChangeFn, RowData, TableFeature } from '@tanstack/react-table';
2
+ export type ColumnOperatorState = ColumnOperator[];
3
+ export interface OperatorTableState {
4
+ operator: ColumnOperatorState;
5
+ }
6
+ export interface ColumnOperator {
7
+ id: string;
8
+ operator: string;
9
+ }
10
+ export interface OperatorOptions {
11
+ enableOperator?: boolean;
12
+ onColumnOperatorChange?: OnChangeFn<ColumnOperatorState>;
13
+ }
14
+ declare module '@tanstack/react-table' {
15
+ interface TableState extends OperatorTableState {
16
+ }
17
+ interface TableOptionsResolved<TData extends RowData> extends OperatorOptions {
18
+ }
19
+ interface Column<TData extends RowData, TValue> {
20
+ getFilterOperator: () => string;
21
+ setFilterOperator: (operator: string) => void;
22
+ }
23
+ }
24
+ export declare const OperatorFeature: TableFeature<any>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OperatorFeature = void 0;
7
+ var _reactTable = require("@tanstack/react-table");
8
+ // TypeScript setup for our new feature with all of the same type-safety as stock TanStack Table features
9
+
10
+ // define types for our new feature's table options
11
+
12
+ // Define types for our new feature's table APIs
13
+ // export interface OperatorInstance {
14
+ // setDensity: (updater: Updater<OpetorState>) => void
15
+
16
+ // toggleDensity: (value?: OpetorState) => void
17
+ // }
18
+
19
+ // Use declaration merging to add our new feature APIs and state types to TanStack Table's existing types.
20
+
21
+ const OperatorFeature = exports.OperatorFeature = {
22
+ // define the new feature's initial state
23
+ getInitialState: state => {
24
+ return {
25
+ operator: [],
26
+ ...state
27
+ };
28
+ },
29
+ // define the new feature's default options
30
+ getDefaultOptions: table => {
31
+ return {
32
+ enableOperator: true,
33
+ onColumnOperatorChange: (0, _reactTable.makeStateUpdater)('operator', table)
34
+ };
35
+ },
36
+ // if you need to add a default column definition...
37
+ // getDefaultColumnDef: <TData extends RowData>(): Partial<ColumnDef<TData>> => {
38
+ // return { meta: {} } //use meta instead of directly adding to the columnDef to avoid typescript stuff that's hard to workaround
39
+ // },
40
+
41
+ // define the new feature's table instance methods
42
+
43
+ // if you need to add row instance APIs...
44
+ // createRow: <TData extends RowData>(row, table): void => {},
45
+ // if you need to add cell instance APIs...
46
+ // createCell: <TData extends RowData>(cell, column, row, table): void => {},
47
+ // if you need to add column instance APIs...
48
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
49
+ createColumn: (column, table) => {
50
+ column.getFilterOperator = () => {
51
+ return table.getState().operator?.find(op => op.id === column.id)?.operator ?? undefined;
52
+ };
53
+ column.setFilterOperator = updater => {
54
+ const safeUpdater = old => {
55
+ const others = old.filter(op => op.id !== column.id);
56
+ return [...others, {
57
+ id: column.id,
58
+ operator: updater
59
+ }];
60
+ };
61
+ return table.options.onColumnOperatorChange?.(safeUpdater);
62
+ };
63
+ }
64
+
65
+ // if you need to add header instance APIs...
66
+ // createHeader: <TData extends RowData>(header, table): void => {},
67
+ };
@@ -0,0 +1,7 @@
1
+ import type { Table } from "@tanstack/react-table";
2
+ import React from "react";
3
+ interface TableFooterProps<T> {
4
+ table: Table<T>;
5
+ }
6
+ declare const TableFooter: <RecordType extends object>({ table, }: TableFooterProps<RecordType>) => React.JSX.Element;
7
+ export default TableFooter;
@@ -0,0 +1,44 @@
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 _TableFooterRow = _interopRequireDefault(require("./TableFooterRow"));
9
+ var _useContext = require("../useContext");
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ 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); }
12
+ 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; }
13
+ // import type { Virtualizer } from "@tanstack/react-virtual";
14
+
15
+ const TableFooter = ({
16
+ // columnVirtualizer,
17
+ table
18
+ // virtualPaddingLeft,
19
+ // virtualPaddingRight,
20
+ // ...rest
21
+ }) => {
22
+ const {
23
+ prefix
24
+ } = (0, _react.useContext)(_useContext.TableContext);
25
+ return /*#__PURE__*/_react.default.createElement("div", {
26
+ className: `${prefix}-grid-tfoot`,
27
+ style: {
28
+ display: "grid",
29
+ position: "sticky",
30
+ bottom: 0,
31
+ zIndex: 1
32
+ }
33
+ }, /*#__PURE__*/_react.default.createElement(_TableFooterRow.default, {
34
+ table: table
35
+ // columnVirtualizer={columnVirtualizer}
36
+ ,
37
+ headerGroup: table.getHeaderGroups()[table.getHeaderGroups().length - 1]
38
+ // key={headerGroup.id}
39
+ // virtualPaddingLeft={virtualPaddingLeft}
40
+ // virtualPaddingRight={virtualPaddingRight}
41
+ // {...rest}
42
+ }));
43
+ };
44
+ var _default = exports.default = TableFooter;
@@ -0,0 +1,7 @@
1
+ import type { Column } from "@tanstack/react-table";
2
+ import React from "react";
3
+ interface TableFooterCellProps<T> {
4
+ column: Column<T, any>;
5
+ }
6
+ declare const TableFooterCell: <RecordType extends object>({ column }: TableFooterCellProps<RecordType>) => React.JSX.Element;
7
+ export default TableFooterCell;
@@ -0,0 +1,75 @@
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 _react = _interopRequireWildcard(require("react"));
9
+ var _utils = require("../hook/utils");
10
+ var _useContext = require("../useContext");
11
+ var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _hooks = require("../../grid-component/hooks");
13
+ var _reactNumericComponent = require("react-numeric-component");
14
+ 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); }
15
+ 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; }
16
+ const TableFooterCell = ({
17
+ column
18
+ }) => {
19
+ const isPinned = column.getIsPinned();
20
+ const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
21
+ const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
22
+ const {
23
+ prefix,
24
+ format,
25
+ dataSource
26
+ } = (0, _react.useContext)(_useContext.TableContext);
27
+ const col = column.columnDef.meta ?? {};
28
+ const colFormat = typeof col.format === 'function' ? col.format({}) : col.format;
29
+ const cellFormat = (0, _utils.getFormat)(colFormat, format);
30
+ const thousandSeparator = cellFormat?.thousandSeparator;
31
+ const decimalSeparator = cellFormat?.decimalSeparator;
32
+
33
+ // const dec = (col.format?.decimalScale || col.format?.decimalScale === 0) ? col.format?.decimalScale : format?.decimalScale
34
+ const dec = cellFormat?.decimalScale;
35
+
36
+ // const sumValue = col.type === 'number' ? sumDataByField(filterDataByColumns4(dataSource, filterStates) as any[], col?.key as string) : 0
37
+ const sumValue = col.type === 'number' ? (0, _hooks.sumByField)(dataSource, col?.field) : 0;
38
+ const value = !(0, _utils.isEmpty)(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
39
+ const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
40
+ const numberValue = Number(value);
41
+ const numericFormatProps = {
42
+ thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
43
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
44
+ allowNegative: cellFormat?.allowNegative ?? false,
45
+ prefix: cellFormat?.prefix,
46
+ suffix: cellFormat?.suffix,
47
+ decimalScale: dec,
48
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
49
+ };
50
+ return /*#__PURE__*/_react.default.createElement("div", {
51
+ // ref={el => {
52
+ // if (el) columnVirtualizer.measureElement(el)
53
+ // }}
54
+ // data-index={header.id}
55
+
56
+ className: (0, _classnames.default)(`${prefix}-grid-cell`, {
57
+ // [`${prefix}-grid-cell-ellipsis`]:!wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
58
+ // [`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header'),
59
+ [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
60
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
61
+ [`${prefix}-grid-cell-text-right`]: true
62
+ }),
63
+ key: column.id
64
+ // colSpan={header.colSpan}
65
+ ,
66
+ style: {
67
+ display: 'flex',
68
+ ...(0, _utils.getCommonPinningStyles)(column),
69
+ // width: column?.getSize() ?? column.getSize(),
70
+ minWidth: column?.getSize()
71
+ // backgroundColor: "#fafafa",
72
+ }
73
+ }, column.id !== "id" && column.id !== "selection_column" ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps)) : '');
74
+ };
75
+ var _default = exports.default = TableFooterCell;
@@ -0,0 +1,8 @@
1
+ import type { HeaderGroup, Table } from "@tanstack/react-table";
2
+ import React from "react";
3
+ interface TableFooterRowProps<T> {
4
+ table: Table<T>;
5
+ headerGroup: HeaderGroup<T>;
6
+ }
7
+ declare const TableFooterRow: <RecordType extends object>({ table, headerGroup, }: TableFooterRowProps<RecordType>) => React.JSX.Element;
8
+ export default TableFooterRow;
@@ -0,0 +1,37 @@
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 _TableFooterCell = _interopRequireDefault(require("./TableFooterCell"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _useContext = require("../useContext");
11
+ const TableFooterRow = ({
12
+ table,
13
+ headerGroup
14
+ }) => {
15
+ const visibleColumns = table.getVisibleLeafColumns();
16
+ const {
17
+ onRowFooterStyles
18
+ } = _react.default.useContext(_useContext.TableContext);
19
+ const rowStyles = typeof onRowFooterStyles === 'function' ? onRowFooterStyles() : onRowFooterStyles;
20
+ return /*#__PURE__*/_react.default.createElement("div", {
21
+ key: headerGroup.id,
22
+ style: {
23
+ ...rowStyles,
24
+ display: "grid",
25
+ width: "100%",
26
+ height: 37,
27
+ gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
28
+ },
29
+ className: "ui-rc-grid-footer-row"
30
+ }, visibleColumns.map(header => {
31
+ return /*#__PURE__*/_react.default.createElement(_TableFooterCell.default, {
32
+ key: header.id,
33
+ column: header
34
+ });
35
+ }));
36
+ };
37
+ var _default = exports.default = TableFooterRow;
@@ -0,0 +1,15 @@
1
+ import type { Column } from '@tanstack/react-table';
2
+ import { type Table } from '@tanstack/react-table';
3
+ import { type Virtualizer } from '@tanstack/react-virtual';
4
+ import React from 'react';
5
+ interface TableHeadProps<T> {
6
+ tableContainerRef: React.RefObject<HTMLDivElement>;
7
+ table: Table<T>;
8
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
9
+ virtualPaddingLeft: number | undefined;
10
+ virtualPaddingRight: number | undefined;
11
+ fixedLeftColumns: Column<T, unknown>[];
12
+ fixedRightColumns: Column<T, unknown>[];
13
+ }
14
+ declare const TableHead: <RecordType extends object>({ columnVirtualizer, table, }: TableHeadProps<RecordType>) => React.JSX.Element;
15
+ export default TableHead;
@@ -0,0 +1,107 @@
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 _react = _interopRequireWildcard(require("react"));
9
+ var _useContext = require("../useContext");
10
+ var _TableHeadCell = _interopRequireDefault(require("./TableHeadCell2"));
11
+ var _TableHeadGroupCell = _interopRequireDefault(require("./TableHeadGroupCell"));
12
+ 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); }
13
+ 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; }
14
+ const TableHead = ({
15
+ columnVirtualizer,
16
+ table
17
+ }) => {
18
+ const {
19
+ prefix,
20
+ onRowHeaderStyles
21
+ } = (0, _react.useContext)(_useContext.TableContext);
22
+ const headerGroups = table.getFlatHeaders();
23
+ const leafColumns = table.getVisibleFlatColumns();
24
+ const headerDepth = table.getHeaderGroups().length;
25
+ const rowStyles = typeof onRowHeaderStyles === 'function' ? onRowHeaderStyles() : onRowHeaderStyles;
26
+ return /*#__PURE__*/_react.default.createElement("div", {
27
+ className: `${prefix}-grid-thead`,
28
+ style: {
29
+ ...rowStyles,
30
+ display: 'grid',
31
+ position: 'sticky',
32
+ top: 0,
33
+ zIndex: 1,
34
+ gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
35
+ }
36
+ }, leafColumns.map(column => {
37
+ const depth = column.depth ?? 0;
38
+
39
+ // const colSpan = column.columns.length || 1;
40
+ const colSpan = column.getFlatColumns().filter(col => col.getIsVisible() && col.columns.length < 1).length;
41
+ // const colSpan = getVisibleChildCount(column);
42
+
43
+ const rowSpan = column.columns?.length > 0 ? 1 : headerDepth - depth;
44
+ const header = headerGroups.find(it => it.id === column.id || it.column.id === column.id && it.subHeaders.length > 0);
45
+ // const groupHeader = headerGroups.find((it) => it.column.id === column.id && it.subHeaders.length >= 2)
46
+
47
+ if (header?.subHeaders && header.subHeaders.length >= 2) {
48
+ return /*#__PURE__*/_react.default.createElement(_TableHeadGroupCell.default, {
49
+ key: column.id,
50
+ depth: depth,
51
+ column: column,
52
+ header: header,
53
+ table: table,
54
+ columnVirtualizer: columnVirtualizer,
55
+ colSpan: colSpan,
56
+ rowSpan: rowSpan
57
+ });
58
+ } else {
59
+ return /*#__PURE__*/_react.default.createElement(_TableHeadCell.default, {
60
+ key: column.id,
61
+ depth: depth,
62
+ column: column,
63
+ header: header,
64
+ table: table,
65
+ columnVirtualizer: columnVirtualizer
66
+ // rowHeaderVirtualizer={rowHeaderVirtualizer}
67
+ ,
68
+ colSpan: colSpan,
69
+ rowSpan: rowSpan
70
+ });
71
+ }
72
+
73
+ // if (header) {
74
+ // return (
75
+ // <TableHeadCell2
76
+ // key={column.id}
77
+ // depth={depth}
78
+ // column={column}
79
+ // header={header as any}
80
+ // table={table}
81
+ // columnVirtualizer={columnVirtualizer}
82
+ // // rowHeaderVirtualizer={rowHeaderVirtualizer}
83
+ // colSpan={colSpan}
84
+ // rowSpan={rowSpan}
85
+ // />
86
+ // )
87
+ // }
88
+
89
+ // return (
90
+ // <div
91
+ // key={col.id}
92
+ // className="th p-2 border font-bold flex items-center justify-center"
93
+ // style={{
94
+ // // width: col.getSize(),
95
+ // minWidth: col.getSize(),
96
+ // gridRow: `${depth + 1} / span ${rowSpan}`,
97
+
98
+ // gridColumn: `span ${colSpan}`,
99
+ // }}
100
+ // >
101
+ // aaaaa
102
+ // {/* {flexRender(col.columnDef.header, header.getContext())} */}
103
+ // </div>
104
+ // );
105
+ }));
106
+ };
107
+ var _default = exports.default = TableHead;
@@ -0,0 +1,15 @@
1
+ import type { Table } from '@tanstack/react-table';
2
+ import { type Header } from '@tanstack/react-table';
3
+ import React from 'react';
4
+ import type { Virtualizer } from '@tanstack/react-virtual';
5
+ interface TableHeadCellProps<T> {
6
+ t?: any;
7
+ table: Table<T>;
8
+ header: Header<T, unknown>;
9
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
10
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
11
+ colSpan: any;
12
+ rowSpan: any;
13
+ }
14
+ declare const TableHeadCell: <RecordType extends object>(props: TableHeadCellProps<RecordType>) => React.JSX.Element;
15
+ export default TableHeadCell;