es-grid-template 1.7.23 → 1.7.25

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 (163) hide show
  1. package/es/index.d.ts +1 -0
  2. package/es/index.js +3 -1
  3. package/es/table-component/ColumnsChoose.d.ts +13 -0
  4. package/es/table-component/ColumnsChoose.js +206 -0
  5. package/es/table-component/ContextMenu.d.ts +20 -0
  6. package/es/table-component/ContextMenu.js +75 -0
  7. package/es/table-component/InternalTable.d.ts +9 -0
  8. package/es/table-component/InternalTable.js +308 -0
  9. package/es/table-component/TableContainer.d.ts +31 -0
  10. package/es/table-component/TableContainer.js +249 -0
  11. package/es/table-component/TableContainerEdit.d.ts +31 -0
  12. package/es/table-component/TableContainerEdit.js +1301 -0
  13. package/es/table-component/body/EditableCell.d.ts +16 -0
  14. package/es/table-component/body/EditableCell.js +1039 -0
  15. package/es/table-component/body/TableBody.d.ts +19 -0
  16. package/es/table-component/body/TableBody.js +64 -0
  17. package/es/table-component/body/TableBodyCell.d.ts +12 -0
  18. package/es/table-component/body/TableBodyCell.js +149 -0
  19. package/es/table-component/body/TableBodyCellEdit.d.ts +16 -0
  20. package/es/table-component/body/TableBodyCellEdit.js +931 -0
  21. package/es/table-component/body/TableBodyRow.d.ts +21 -0
  22. package/es/table-component/body/TableBodyRow.js +151 -0
  23. package/es/table-component/components/ControlCheckbox.d.ts +13 -0
  24. package/es/table-component/components/ControlCheckbox.js +84 -0
  25. package/es/table-component/components/EditForm/EditForm.d.ts +27 -0
  26. package/es/table-component/components/EditForm/EditForm.js +395 -0
  27. package/es/table-component/components/EditForm/index.d.ts +1 -0
  28. package/es/table-component/components/EditForm/index.js +1 -0
  29. package/es/table-component/components/InputControl/InputControl.d.ts +27 -0
  30. package/es/table-component/components/InputControl/InputControl.js +121 -0
  31. package/es/table-component/components/InputControl/index.d.ts +1 -0
  32. package/es/table-component/components/InputControl/index.js +1 -0
  33. package/es/table-component/components/async-select/index.d.ts +11 -0
  34. package/es/table-component/components/async-select/index.js +41 -0
  35. package/es/table-component/components/async-table-select/index.d.ts +11 -0
  36. package/es/table-component/components/async-table-select/index.js +44 -0
  37. package/es/table-component/components/checkbox-control/index.d.ts +13 -0
  38. package/es/table-component/components/checkbox-control/index.js +40 -0
  39. package/es/table-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  40. package/es/table-component/components/checkbox-filter/CheckboxFilter.js +240 -0
  41. package/es/table-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  42. package/es/table-component/components/checkbox-filter/FilterSearch.js +36 -0
  43. package/es/table-component/components/command/Command.d.ts +10 -0
  44. package/es/table-component/components/command/Command.js +33 -0
  45. package/es/table-component/components/number/index.d.ts +10 -0
  46. package/es/table-component/components/number/index.js +42 -0
  47. package/es/table-component/components/number-range/index.d.ts +11 -0
  48. package/es/table-component/components/number-range/index.js +66 -0
  49. package/es/table-component/features/operator.d.ts +24 -0
  50. package/es/table-component/features/operator.js +62 -0
  51. package/es/table-component/footer/TableFooter.d.ts +13 -0
  52. package/es/table-component/footer/TableFooter.js +33 -0
  53. package/es/table-component/footer/TableFooterCell.d.ts +10 -0
  54. package/es/table-component/footer/TableFooterCell.js +66 -0
  55. package/es/table-component/footer/TableFooterRow.d.ts +14 -0
  56. package/es/table-component/footer/TableFooterRow.js +73 -0
  57. package/es/table-component/header/TableHead.d.ts +14 -0
  58. package/es/table-component/header/TableHead.js +60 -0
  59. package/es/table-component/header/TableHeadCell.d.ts +14 -0
  60. package/es/table-component/header/TableHeadCell.js +343 -0
  61. package/es/table-component/header/TableHeadRow.d.ts +16 -0
  62. package/es/table-component/header/TableHeadRow.js +76 -0
  63. package/es/table-component/header/renderFilter.d.ts +20 -0
  64. package/es/table-component/header/renderFilter.js +281 -0
  65. package/es/table-component/hook/constant.d.ts +73 -0
  66. package/es/table-component/hook/constant.js +240 -0
  67. package/es/table-component/hook/useColumns.d.ts +9 -0
  68. package/es/table-component/hook/useColumns.js +169 -0
  69. package/es/table-component/hook/useFilterOperator.d.ts +7 -0
  70. package/es/table-component/hook/useFilterOperator.js +33 -0
  71. package/es/table-component/hook/utils.d.ts +133 -0
  72. package/es/table-component/hook/utils.js +1870 -0
  73. package/es/table-component/index.d.ts +5 -0
  74. package/es/table-component/index.js +2 -0
  75. package/es/table-component/style.scss +1129 -0
  76. package/es/table-component/table/Grid.d.ts +24 -0
  77. package/es/table-component/table/Grid.js +234 -0
  78. package/es/table-component/type.d.ts +513 -0
  79. package/es/table-component/type.js +1 -0
  80. package/es/table-component/useContext.d.ts +74 -0
  81. package/es/table-component/useContext.js +15 -0
  82. package/lib/index.d.ts +1 -0
  83. package/lib/index.js +8 -1
  84. package/lib/table-component/ColumnsChoose.d.ts +13 -0
  85. package/lib/table-component/ColumnsChoose.js +216 -0
  86. package/lib/table-component/ContextMenu.d.ts +20 -0
  87. package/lib/table-component/ContextMenu.js +85 -0
  88. package/lib/table-component/InternalTable.d.ts +9 -0
  89. package/lib/table-component/InternalTable.js +313 -0
  90. package/lib/table-component/TableContainer.d.ts +31 -0
  91. package/lib/table-component/TableContainer.js +257 -0
  92. package/lib/table-component/TableContainerEdit.d.ts +31 -0
  93. package/lib/table-component/TableContainerEdit.js +1310 -0
  94. package/lib/table-component/body/EditableCell.d.ts +16 -0
  95. package/lib/table-component/body/EditableCell.js +1041 -0
  96. package/lib/table-component/body/TableBody.d.ts +19 -0
  97. package/lib/table-component/body/TableBody.js +72 -0
  98. package/lib/table-component/body/TableBodyCell.d.ts +12 -0
  99. package/lib/table-component/body/TableBodyCell.js +158 -0
  100. package/lib/table-component/body/TableBodyCellEdit.d.ts +16 -0
  101. package/lib/table-component/body/TableBodyCellEdit.js +938 -0
  102. package/lib/table-component/body/TableBodyRow.d.ts +21 -0
  103. package/lib/table-component/body/TableBodyRow.js +158 -0
  104. package/lib/table-component/components/ControlCheckbox.d.ts +13 -0
  105. package/lib/table-component/components/ControlCheckbox.js +92 -0
  106. package/lib/table-component/components/EditForm/EditForm.d.ts +27 -0
  107. package/lib/table-component/components/EditForm/EditForm.js +406 -0
  108. package/lib/table-component/components/EditForm/index.d.ts +1 -0
  109. package/lib/table-component/components/EditForm/index.js +16 -0
  110. package/lib/table-component/components/InputControl/InputControl.d.ts +27 -0
  111. package/lib/table-component/components/InputControl/InputControl.js +131 -0
  112. package/lib/table-component/components/InputControl/index.d.ts +1 -0
  113. package/lib/table-component/components/InputControl/index.js +16 -0
  114. package/lib/table-component/components/async-select/index.d.ts +11 -0
  115. package/lib/table-component/components/async-select/index.js +49 -0
  116. package/lib/table-component/components/async-table-select/index.d.ts +11 -0
  117. package/lib/table-component/components/async-table-select/index.js +53 -0
  118. package/lib/table-component/components/checkbox-control/index.d.ts +13 -0
  119. package/lib/table-component/components/checkbox-control/index.js +48 -0
  120. package/lib/table-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
  121. package/lib/table-component/components/checkbox-filter/CheckboxFilter.js +249 -0
  122. package/lib/table-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
  123. package/lib/table-component/components/checkbox-filter/FilterSearch.js +44 -0
  124. package/lib/table-component/components/command/Command.d.ts +10 -0
  125. package/lib/table-component/components/command/Command.js +42 -0
  126. package/lib/table-component/components/number/index.d.ts +10 -0
  127. package/lib/table-component/components/number/index.js +50 -0
  128. package/lib/table-component/components/number-range/index.d.ts +11 -0
  129. package/lib/table-component/components/number-range/index.js +74 -0
  130. package/lib/table-component/features/operator.d.ts +24 -0
  131. package/lib/table-component/features/operator.js +67 -0
  132. package/lib/table-component/footer/TableFooter.d.ts +13 -0
  133. package/lib/table-component/footer/TableFooter.js +42 -0
  134. package/lib/table-component/footer/TableFooterCell.d.ts +10 -0
  135. package/lib/table-component/footer/TableFooterCell.js +76 -0
  136. package/lib/table-component/footer/TableFooterRow.d.ts +14 -0
  137. package/lib/table-component/footer/TableFooterRow.js +81 -0
  138. package/lib/table-component/header/TableHead.d.ts +14 -0
  139. package/lib/table-component/header/TableHead.js +69 -0
  140. package/lib/table-component/header/TableHeadCell.d.ts +14 -0
  141. package/lib/table-component/header/TableHeadCell.js +352 -0
  142. package/lib/table-component/header/TableHeadRow.d.ts +16 -0
  143. package/lib/table-component/header/TableHeadRow.js +84 -0
  144. package/lib/table-component/header/renderFilter.d.ts +20 -0
  145. package/lib/table-component/header/renderFilter.js +291 -0
  146. package/lib/table-component/hook/constant.d.ts +73 -0
  147. package/lib/table-component/hook/constant.js +247 -0
  148. package/lib/table-component/hook/useColumns.d.ts +9 -0
  149. package/lib/table-component/hook/useColumns.js +180 -0
  150. package/lib/table-component/hook/useFilterOperator.d.ts +7 -0
  151. package/lib/table-component/hook/useFilterOperator.js +40 -0
  152. package/lib/table-component/hook/utils.d.ts +133 -0
  153. package/lib/table-component/hook/utils.js +1969 -0
  154. package/lib/table-component/index.d.ts +5 -0
  155. package/lib/table-component/index.js +9 -0
  156. package/lib/table-component/style.scss +1129 -0
  157. package/lib/table-component/table/Grid.d.ts +24 -0
  158. package/lib/table-component/table/Grid.js +236 -0
  159. package/lib/table-component/type.d.ts +513 -0
  160. package/lib/table-component/type.js +5 -0
  161. package/lib/table-component/useContext.d.ts +74 -0
  162. package/lib/table-component/useContext.js +21 -0
  163. package/package.json +4 -2
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AsyncTableSelect = AsyncTableSelect;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
11
+ var _rcMasterUi = require("rc-master-ui");
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
+ // import type {TableSelectProps} from "rc-master-ui/es/table-select"
15
+
16
+ // import type {LoadOptionsArgs} from "../type";
17
+
18
+ function AsyncTableSelect({
19
+ loadOptions,
20
+ debounceTimeout = 500,
21
+ defaultOptions,
22
+ columns,
23
+ rowData,
24
+ ...props
25
+ }) {
26
+ const [options, setOptions] = (0, _react.useState)(defaultOptions ?? []);
27
+ const debounceFetcher = (0, _react.useMemo)(() => {
28
+ const fetchOptions = value => {
29
+ if (value.trim().length === 0) {
30
+ setOptions(defaultOptions ?? []);
31
+ return;
32
+ }
33
+ if (loadOptions) {
34
+ loadOptions(value, newOptions => {
35
+ setOptions(newOptions);
36
+ }, {
37
+ rowData
38
+ });
39
+ }
40
+ };
41
+ return (0, _debounce.default)(fetchOptions, debounceTimeout);
42
+ }, [debounceTimeout, loadOptions, defaultOptions, rowData]);
43
+ (0, _react.useEffect)(() => {
44
+ setOptions(defaultOptions ?? []);
45
+ }, [defaultOptions]);
46
+ return /*#__PURE__*/_react.default.createElement(_rcMasterUi.TableSelect, (0, _extends2.default)({}, props, {
47
+ filterOption: loadOptions ? false : props?.filterOption,
48
+ onSearch: debounceFetcher,
49
+ onSelect: () => setOptions(defaultOptions ?? []),
50
+ options: options,
51
+ columns: columns
52
+ }));
53
+ }
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ type OptionType = {
3
+ value: any;
4
+ label: string;
5
+ [key: string]: any;
6
+ };
7
+ type Props<T> = {
8
+ options: T[];
9
+ value: any[];
10
+ onChange?: (value: any[]) => void;
11
+ };
12
+ declare const CheckboxControl: <T extends OptionType>(props: Props<T>) => React.JSX.Element;
13
+ export default CheckboxControl;
@@ -0,0 +1,48 @@
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;
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import type { TableLocale } from "rc-master-ui/es/table/interface";
3
+ type Props = {
4
+ options: any[];
5
+ filterSearch?: boolean;
6
+ open?: boolean;
7
+ tablePrefixCls?: string;
8
+ prefixCls?: string;
9
+ dropdownPrefixCls?: string;
10
+ filterMultiple: boolean;
11
+ showFilter?: boolean;
12
+ onSelect?: (value: any) => void;
13
+ selectedKeys: string[];
14
+ locale?: TableLocale;
15
+ filterMode?: 'menu' | 'tree';
16
+ };
17
+ declare const CheckboxFilter: (props: Props) => React.JSX.Element;
18
+ export default CheckboxFilter;
@@ -0,0 +1,249 @@
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 _classnames = _interopRequireDefault(require("classnames"));
10
+ var _rcMasterUi = require("rc-master-ui");
11
+ var _antd = require("antd");
12
+ var _useFilter = require("rc-master-ui/es/table/hooks/useFilter");
13
+ var _FilterSearch = _interopRequireDefault(require("./FilterSearch"));
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
+ function searchValueMatched(searchValue, text) {
17
+ if (typeof text === 'string' || typeof text === 'number') {
18
+ return text?.toString().toLowerCase().includes(searchValue.trim().toLowerCase());
19
+ }
20
+ return false;
21
+ }
22
+ function renderFilterItems({
23
+ filters,
24
+ prefixCls,
25
+ filteredKeys,
26
+ filterMultiple,
27
+ searchValue,
28
+ filterSearch
29
+ }) {
30
+ return filters.map((filter, index) => {
31
+ const key = String(filter.value);
32
+ if (filter.children) {
33
+ return {
34
+ key: key || index,
35
+ label: filter.text,
36
+ popupClassName: `${prefixCls}-dropdown-submenu`,
37
+ children: renderFilterItems({
38
+ filters: filter.children,
39
+ prefixCls,
40
+ filteredKeys,
41
+ filterMultiple,
42
+ searchValue,
43
+ filterSearch
44
+ })
45
+ };
46
+ }
47
+ const Component = filterMultiple ? _rcMasterUi.Checkbox : _rcMasterUi.Radio;
48
+ const item = {
49
+ key: filter.value !== undefined ? key : index,
50
+ label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, {
51
+ checked: filteredKeys.includes(key)
52
+ }), /*#__PURE__*/React.createElement("span", null, filter.text))
53
+ };
54
+ if (searchValue.trim()) {
55
+ if (typeof filterSearch === 'function') {
56
+ return filterSearch(searchValue, filter) ? item : null;
57
+ }
58
+ return searchValueMatched(searchValue, filter.text) ? item : null;
59
+ }
60
+ return item;
61
+ });
62
+ }
63
+ function hasSubMenu(filters) {
64
+ return filters.some(({
65
+ children
66
+ }) => children);
67
+ }
68
+ const CheckboxFilter = props => {
69
+ const {
70
+ // column,
71
+ filterSearch = true,
72
+ tablePrefixCls = 'ui-rc-table',
73
+ prefixCls = 'ui-rc-table-filter',
74
+ dropdownPrefixCls = 'ui-rc-dropdown',
75
+ filterMultiple,
76
+ selectedKeys,
77
+ locale,
78
+ options,
79
+ filterMode = 'tree',
80
+ // open,
81
+ // searchValue,
82
+ showFilter,
83
+ // setSearchValue,
84
+ onSelect
85
+ } = props;
86
+ const [searchValue, setSearchValue] = React.useState('');
87
+ const [openKeys, setOpenKeys] = React.useState([]);
88
+
89
+ // clear search value after close filter dropdown
90
+ // React.useEffect(() => {
91
+ // // if (visible) {
92
+ // setSearchValue('');
93
+ // // }
94
+ // }, [open]);
95
+
96
+ const onOpenChange = keys => {
97
+ setOpenKeys(keys);
98
+ };
99
+ const items = renderFilterItems({
100
+ // filters: column.filters || [],
101
+ filters: options || [],
102
+ filterSearch,
103
+ prefixCls,
104
+ filteredKeys: selectedKeys ?? [],
105
+ filterMultiple,
106
+ searchValue
107
+ });
108
+ const dropdownMenuClass = (0, _classnames.default)({
109
+ // [`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(column.filters || []),
110
+ [`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(options || [])
111
+ });
112
+ const empty = /*#__PURE__*/React.createElement(_rcMasterUi.Empty, {
113
+ image: _rcMasterUi.Empty.PRESENTED_IMAGE_SIMPLE,
114
+ description: locale?.filterEmptyText,
115
+ imageStyle: {
116
+ height: 24
117
+ },
118
+ style: {
119
+ margin: 0,
120
+ padding: '16px 0'
121
+ }
122
+ });
123
+ const isEmpty = items.every(item => item === null);
124
+ const onSearch = e => {
125
+ const {
126
+ value
127
+ } = e.target;
128
+ setSearchValue(value);
129
+ };
130
+
131
+ // if ((column.filters || []).length === 0) {
132
+ // return empty;
133
+ // }
134
+
135
+ const getTreeData = ({
136
+ filters
137
+ }) => (filters || []).map((filter, index) => {
138
+ const key = String(filter.value);
139
+ const item = {
140
+ title: filter.text,
141
+ key: filter.value !== undefined ? key : String(index)
142
+ };
143
+ if (filter.children) {
144
+ item.children = getTreeData({
145
+ filters: filter.children
146
+ });
147
+ }
148
+ return item;
149
+ });
150
+ const getFilterData = node => ({
151
+ ...node,
152
+ text: node.title,
153
+ value: node.key,
154
+ children: node.children?.map(item => getFilterData(item)) || []
155
+ });
156
+ const onCheckAll = e => {
157
+ if (e.target.checked) {
158
+ const allFilterKeys = (0, _useFilter.flattenKeys)(options).map(key => String(key));
159
+
160
+ // setFilteredKeysSync(allFilterKeys);
161
+ onSelect?.(allFilterKeys);
162
+ } else {
163
+ onSelect?.([]);
164
+ // setFilteredKeysSync([]);
165
+ }
166
+ };
167
+ const onCheck = (keys, {
168
+ node,
169
+ checked
170
+ }) => {
171
+ if (!filterMultiple) {
172
+ // onSelectKeys({ selectedKeys: checked && node.key ? [node.key] : [] });
173
+ onSelect?.(checked && node.key ? [node.key] : []);
174
+ } else {
175
+ // onSelectKeys({ selectedKeys: keys });
176
+ onSelect?.(keys);
177
+ }
178
+ };
179
+ if (filterMode === 'tree') {
180
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(_FilterSearch.default, {
181
+ filterSearch: filterSearch,
182
+ value: searchValue,
183
+ onChange: onSearch,
184
+ tablePrefixCls: tablePrefixCls,
185
+ locale: locale
186
+ }), /*#__PURE__*/React.createElement("div", {
187
+ className: `${tablePrefixCls}-filter-dropdown-tree`
188
+ }, filterMultiple && options.length > 0 ? /*#__PURE__*/React.createElement(_rcMasterUi.Checkbox
189
+ // checked={selectedKeys.length === flattenKeys(column.filters).length}
190
+ , {
191
+ checked: selectedKeys.length === (0, _useFilter.flattenKeys)(options).length
192
+ // indeterminate={
193
+ // selectedKeys.length > 0 &&
194
+ // selectedKeys.length < flattenKeys(column.filters).length
195
+ // }
196
+ ,
197
+
198
+ indeterminate: selectedKeys.length > 0 && selectedKeys.length < (0, _useFilter.flattenKeys)(options).length,
199
+ className: `${tablePrefixCls}-filter-dropdown-checkall`,
200
+ onChange: onCheckAll
201
+ }, locale?.filterCheckall) : /*#__PURE__*/React.createElement(_rcMasterUi.Empty, null), /*#__PURE__*/React.createElement(_antd.Tree, {
202
+ checkable: true,
203
+ selectable: false,
204
+ blockNode: true,
205
+ multiple: filterMultiple,
206
+ checkStrictly: !filterMultiple,
207
+ className: `${dropdownPrefixCls}-menu`,
208
+ onCheck: onCheck,
209
+ checkedKeys: selectedKeys,
210
+ selectedKeys: selectedKeys,
211
+ showIcon: false
212
+ // treeData={getTreeData({ filters: column.filters })}
213
+ ,
214
+ treeData: getTreeData({
215
+ filters: options
216
+ }),
217
+ autoExpandParent: true,
218
+ defaultExpandAll: true,
219
+ filterTreeNode: searchValue.trim() ? node => {
220
+ if (typeof filterSearch === 'function') {
221
+ // @ts-ignore
222
+ return filterSearch(searchValue, getFilterData(node));
223
+ }
224
+ return searchValueMatched(searchValue, node.title);
225
+ } : undefined
226
+ })));
227
+ }
228
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_FilterSearch.default, {
229
+ filterSearch: filterSearch,
230
+ value: searchValue,
231
+ onChange: onSearch,
232
+ tablePrefixCls: tablePrefixCls,
233
+ locale: locale
234
+ }), isEmpty ? empty : /*#__PURE__*/React.createElement(_rcMasterUi.Menu, {
235
+ selectable: true,
236
+ multiple: filterMultiple,
237
+ prefixCls: `${dropdownPrefixCls}-menu`,
238
+ className: dropdownMenuClass,
239
+ onSelect: onSelect,
240
+ onDeselect: onSelect,
241
+ selectedKeys: selectedKeys
242
+ // getPopupContainer={getPopupContainer}
243
+ ,
244
+ openKeys: openKeys,
245
+ onOpenChange: onOpenChange,
246
+ items: items
247
+ }));
248
+ };
249
+ var _default = exports.default = CheckboxFilter;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { FilterSearchType, TableLocale } from "antd/es/table/interface";
3
+ import type { AnyObject } from '../../type';
4
+ interface FilterSearchProps<RecordType = AnyObject> {
5
+ value: string;
6
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ filterSearch: FilterSearchType<RecordType>;
8
+ tablePrefixCls: string;
9
+ locale?: TableLocale;
10
+ }
11
+ declare const FilterSearch: <RecordType extends AnyObject = AnyObject>(props: FilterSearchProps<RecordType>) => React.JSX.Element;
12
+ export default FilterSearch;
@@ -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 React = _interopRequireWildcard(require("react"));
9
+ var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
10
+ var _rcMasterUi = require("rc-master-ui");
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 {AnyObject} from "./type"
14
+
15
+ const FilterSearch = props => {
16
+ const {
17
+ value,
18
+ filterSearch,
19
+ tablePrefixCls,
20
+ locale,
21
+ onChange
22
+ } = props;
23
+ if (!filterSearch) {
24
+ return null;
25
+ }
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ className: `${tablePrefixCls}-filter-dropdown-search`,
28
+ style: {
29
+ paddingLeft: 0,
30
+ paddingRight: 0
31
+ }
32
+ }, /*#__PURE__*/React.createElement(_rcMasterUi.Input, {
33
+ suffix: /*#__PURE__*/React.createElement(_SearchOutlined.default, null),
34
+ placeholder: locale?.filterSearchPlaceholder,
35
+ onChange: onChange,
36
+ value: value,
37
+ autoFocus: true
38
+ // for skip min-width of input
39
+ ,
40
+ htmlSize: 1,
41
+ className: `${tablePrefixCls}-filter-dropdown-search-input`
42
+ }));
43
+ };
44
+ var _default = exports.default = FilterSearch;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { CommandItem } from "../../type";
3
+ type Props<T> = {
4
+ id: string;
5
+ record: T;
6
+ item: CommandItem;
7
+ onClick: (e: any) => void;
8
+ };
9
+ declare const Command: <T extends object>(props: Props<T>) => React.JSX.Element;
10
+ export default Command;
@@ -0,0 +1,42 @@
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 _classnames = _interopRequireDefault(require("classnames"));
10
+ 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); }
11
+ 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; }
12
+ const Command = props => {
13
+ const {
14
+ item,
15
+ onClick,
16
+ record,
17
+ id
18
+ } = props;
19
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, item.template ? /*#__PURE__*/_react.default.createElement("div", {
20
+ "data-tooltip-id": `${id}-tooltip-content`,
21
+ "data-tooltip-content": item.tooltip || item.title,
22
+ id: item.id,
23
+ onClick: onClick
24
+ }, typeof item.template === 'function' ? item.template(record) : item.template) : /*#__PURE__*/_react.default.createElement("div", {
25
+ tabIndex: -1,
26
+ "data-tooltip-id": `${id}-tooltip-content`,
27
+ "data-tooltip-content": item.tooltip || item.title,
28
+ style: {
29
+ padding: '3px',
30
+ maxWidth: 45,
31
+ height: '100%',
32
+ display: 'flex',
33
+ cursor: 'pointer'
34
+ },
35
+ className: (0, _classnames.default)('command-item', {
36
+ 'btn-icon': item.title === ''
37
+ }),
38
+ color: item.color ? item.color : 'primary',
39
+ onClick: onClick
40
+ }, typeof item.icon === 'function' ? item.icon() : item.icon));
41
+ };
42
+ var _default = exports.default = Command;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import type { IFormat } from "../../type";
3
+ type Props = {
4
+ t?: any;
5
+ format?: IFormat;
6
+ value: number | string | undefined;
7
+ onChange?: (values: any[]) => void;
8
+ };
9
+ declare const NumberInput: (props: Props) => React.JSX.Element;
10
+ export default NumberInput;
@@ -0,0 +1,50 @@
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
+ // import type {IFormat} from "../type"
14
+ // import {checkDecimalSeparator, checkThousandSeparator} from "../hooks"
15
+
16
+ const NumberInput = props => {
17
+ const {
18
+ t,
19
+ value,
20
+ format,
21
+ onChange
22
+ } = props;
23
+ const values = _react.default.useMemo(() => [value], [value]);
24
+
25
+ // const [values, setValues] = React.useState<any[]>(() =>
26
+ // mergedValues,
27
+ // );
28
+
29
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
30
+ value: values[0] ?? ''
31
+ // value={min}
32
+ ,
33
+ thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
34
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
35
+ allowNegative: true,
36
+ customInput: _rcMasterUi.Input,
37
+ className: 'rounded-0 input-element',
38
+ onValueChange: vals => {
39
+ // onChangeValueFilter(type, values.floatValue, 'min')
40
+
41
+ // setValues([vals.floatValue, values[1]])
42
+ onChange?.([vals.floatValue]);
43
+ }
44
+ // placeholder={t ? t('Min') : 'Min'}
45
+ ,
46
+ placeholder: t ? t('Enter') : 'Enter',
47
+ autoFocus: true
48
+ }));
49
+ };
50
+ var _default = exports.default = NumberInput;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import type { IFormat } from "../../type";
3
+ type Props = {
4
+ t?: any;
5
+ format?: IFormat;
6
+ min: number | string | undefined;
7
+ max: number | string | undefined;
8
+ onChange?: (values: any[]) => void;
9
+ };
10
+ declare const NumberRange: (props: Props) => React.JSX.Element;
11
+ export default NumberRange;
@@ -0,0 +1,74 @@
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
+ // import type {IFormat} from "../type"
14
+ // import {checkDecimalSeparator, checkThousandSeparator} from "../hooks"
15
+
16
+ const NumberRange = props => {
17
+ const {
18
+ t,
19
+ max,
20
+ min,
21
+ format,
22
+ onChange
23
+ } = props;
24
+ const values = _react.default.useMemo(() => [min, max], [min, max]);
25
+
26
+ // const [values, setValues] = React.useState<any[]>(() =>
27
+ // mergedValues,
28
+ // );
29
+
30
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
31
+ className: '',
32
+ style: {
33
+ display: 'flex',
34
+ alignItems: 'center',
35
+ columnGap: 5
36
+ }
37
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
38
+ value: values[0] ?? ''
39
+ // value={min}
40
+ ,
41
+ thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
42
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
43
+ allowNegative: true,
44
+ customInput: _rcMasterUi.Input,
45
+ className: ' rounded-0 input-element',
46
+ onValueChange: vals => {
47
+ // onChangeValueFilter(type, values.floatValue, 'min')
48
+
49
+ // setValues([vals.floatValue, values[1]])
50
+ onChange?.([vals.floatValue, max]);
51
+ }
52
+ // placeholder={t ? t('Min') : 'Min'}
53
+ ,
54
+ placeholder: t ? t('From') : 'From',
55
+ autoFocus: true
56
+ })), /*#__PURE__*/_react.default.createElement("span", null, " - "), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
57
+ value: values[1] ?? ''
58
+ // value={max}
59
+ ,
60
+ thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
61
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
62
+ allowNegative: true,
63
+ customInput: _rcMasterUi.Input,
64
+ className: ' rounded-0 input-element',
65
+ onValueChange: vals => {
66
+ // setValues([values[0], vals.floatValue])
67
+ onChange?.([min, vals.floatValue]);
68
+ }
69
+ // placeholder={t ? t('Max') : 'Max'}
70
+ ,
71
+ placeholder: t ? t('To') : 'To'
72
+ }))));
73
+ };
74
+ 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>;