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