es-grid-template 1.2.0 → 1.2.1

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 (67) hide show
  1. package/assets/index.css +679 -0
  2. package/assets/index.scss +1006 -0
  3. package/es/grid-component/ColumnsChoose.d.ts +1 -0
  4. package/es/grid-component/ColumnsChoose.js +63 -28
  5. package/es/grid-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  6. package/es/grid-component/ColumnsGroup/ColumnsGroup.js +223 -0
  7. package/es/grid-component/ColumnsGroup/index.d.ts +1 -0
  8. package/es/grid-component/ColumnsGroup/index.js +1 -0
  9. package/es/grid-component/ConvertColumnTable.d.ts +7 -0
  10. package/es/grid-component/ConvertColumnTable.js +143 -0
  11. package/es/grid-component/EditableCell.js +1 -1
  12. package/es/grid-component/GridStyle.js +1 -1
  13. package/es/grid-component/InternalTable.js +148 -248
  14. package/es/grid-component/TableGrid.d.ts +4 -1
  15. package/es/grid-component/TableGrid.js +29 -58
  16. package/es/grid-component/hooks/{useColumns → columns}/index.d.ts +2 -2
  17. package/es/grid-component/hooks/{useColumns → columns}/index.js +20 -16
  18. package/es/grid-component/hooks/content/HeaderContent.d.ts +11 -0
  19. package/es/grid-component/hooks/content/HeaderContent.js +80 -0
  20. package/es/grid-component/hooks/content/TooltipContent.d.ts +13 -0
  21. package/es/grid-component/hooks/content/TooltipContent.js +74 -0
  22. package/es/grid-component/hooks/useColumns.d.ts +16 -0
  23. package/es/grid-component/hooks/useColumns.js +272 -0
  24. package/es/grid-component/hooks/utils.d.ts +46 -1
  25. package/es/grid-component/hooks/utils.js +740 -2
  26. package/es/grid-component/index.js +3 -1
  27. package/es/grid-component/styles.scss +304 -64
  28. package/es/grid-component/table/Grid.d.ts +2 -0
  29. package/es/grid-component/table/Grid.js +1 -5
  30. package/es/grid-component/table/GridEdit.d.ts +4 -1
  31. package/es/grid-component/table/GridEdit.js +690 -281
  32. package/es/grid-component/table/Group.d.ts +13 -0
  33. package/es/grid-component/table/Group.js +154 -0
  34. package/es/grid-component/type.d.ts +38 -1
  35. package/lib/grid-component/ColumnsChoose.d.ts +1 -0
  36. package/lib/grid-component/ColumnsChoose.js +62 -27
  37. package/lib/grid-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  38. package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +234 -0
  39. package/lib/grid-component/ColumnsGroup/index.d.ts +1 -0
  40. package/lib/grid-component/ColumnsGroup/index.js +16 -0
  41. package/lib/grid-component/ConvertColumnTable.d.ts +7 -0
  42. package/lib/grid-component/ConvertColumnTable.js +152 -0
  43. package/lib/grid-component/EditableCell.js +1 -1
  44. package/lib/grid-component/GridStyle.js +1 -1
  45. package/lib/grid-component/InternalTable.js +142 -248
  46. package/lib/grid-component/TableGrid.d.ts +4 -1
  47. package/lib/grid-component/TableGrid.js +23 -56
  48. package/lib/grid-component/hooks/{useColumns → columns}/index.d.ts +2 -2
  49. package/lib/grid-component/hooks/{useColumns → columns}/index.js +20 -16
  50. package/lib/grid-component/hooks/content/HeaderContent.d.ts +11 -0
  51. package/lib/grid-component/hooks/content/HeaderContent.js +87 -0
  52. package/lib/grid-component/hooks/content/TooltipContent.d.ts +13 -0
  53. package/lib/grid-component/hooks/content/TooltipContent.js +81 -0
  54. package/lib/grid-component/hooks/useColumns.d.ts +16 -0
  55. package/lib/grid-component/hooks/useColumns.js +283 -0
  56. package/lib/grid-component/hooks/utils.d.ts +46 -1
  57. package/lib/grid-component/hooks/utils.js +763 -5
  58. package/lib/grid-component/index.js +2 -1
  59. package/lib/grid-component/styles.scss +304 -64
  60. package/lib/grid-component/table/Grid.d.ts +2 -0
  61. package/lib/grid-component/table/Grid.js +1 -5
  62. package/lib/grid-component/table/GridEdit.d.ts +4 -1
  63. package/lib/grid-component/table/GridEdit.js +689 -280
  64. package/lib/grid-component/table/Group.d.ts +13 -0
  65. package/lib/grid-component/table/Group.js +163 -0
  66. package/lib/grid-component/type.d.ts +38 -1
  67. package/package.json +106 -105
@@ -1,5 +1,3 @@
1
- // import * as React from 'react'
2
-
3
1
  import { checkDecimalSeparator, checkThousandSeparator, convertDateToDayjs, convertDayjsToDate, getDatepickerFormat, getDateString, getTypeFilter, isColor, isEmpty } from "../utils";
4
2
  import { NumericFormat, numericFormatter } from "react-numeric-component";
5
3
  import dayjs from "dayjs";
@@ -34,15 +32,16 @@ export function flatColumns(columns, parentKey = 'key') {
34
32
  }];
35
33
  }, []);
36
34
  }
37
- export function flatColumns2(columns, parentKey = 'key') {
35
+ export function flatColumns2(columns
36
+ // parentKey = 'key'
37
+ ) {
38
38
  // @ts-ignore
39
- return columns.reduce((list, column, index) => {
40
- const {
41
- fixed
42
- } = column;
39
+ return columns.reduce((list, column) => {
40
+ // const { fixed } = column
43
41
  // Convert `fixed='true'` to `fixed='left'` instead
44
- const parsedFixed = fixed === true ? 'left' : fixed;
45
- const mergedKey = `${parentKey}-${index}`;
42
+ // const parsedFixed = fixed === true ? 'left' : fixed
43
+ // const mergedKey = `${parentKey}-${index}`
44
+
46
45
  const subColumns = column.children;
47
46
  if (column === SELECTION_COLUMN) {
48
47
  return [...list, {
@@ -50,15 +49,15 @@ export function flatColumns2(columns, parentKey = 'key') {
50
49
  }];
51
50
  }
52
51
  if (subColumns && subColumns.length > 0) {
53
- return [...list, ...flatColumns(subColumns, mergedKey).map(subColum => ({
54
- fixed: parsedFixed,
52
+ return [...list, ...flatColumns(subColumns).map(subColum => ({
53
+ // fixed: parsedFixed,
55
54
  ...subColum
56
55
  }))];
57
56
  }
58
57
  return [...list, {
59
- key: mergedKey,
60
- ...column,
61
- fixed: parsedFixed
58
+ // key: mergedKey,
59
+ ...column
60
+ // fixed: parsedFixed
62
61
  }];
63
62
  }, []);
64
63
  }
@@ -125,8 +124,13 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
125
124
  const type = getTypeFilter(column);
126
125
  const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type, column) ?? 'DD/MM/YYYY';
127
126
  const dateRangeFormat = getDatepickerFormat(column?.type, column) ?? 'DD/MM/YYYY';
128
- const find = dataSourceFilter?.find(it => it.key === column?.key);
127
+ const find = dataSourceFilter?.find(it => it.key === column?.field);
129
128
  const options = find ? find.data : [];
129
+
130
+ // console.log('dataSourceFilter', dataSourceFilter)
131
+ // console.log('options', options)
132
+ // console.log('column', column)
133
+
130
134
  switch (type) {
131
135
  case 'Number':
132
136
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
@@ -361,7 +365,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
361
365
  }, /*#__PURE__*/React.createElement(Select
362
366
  // options={translateOption(numberOperator, t)}
363
367
  , {
364
- options: options,
368
+ options: find ? options : column.source ?? [],
365
369
  style: {
366
370
  width: '100%',
367
371
  marginBottom: 8
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import type { ColumnTable } from "../../type";
3
+ type Props = {
4
+ t?: any;
5
+ content?: string;
6
+ column?: ColumnTable;
7
+ template?: React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
8
+ tooltip?: string | number | React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
9
+ };
10
+ declare const HeaderContent: (props: Props) => React.JSX.Element;
11
+ export default HeaderContent;
@@ -0,0 +1,80 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { Fragment, useState } from "react";
3
+ import classnames from "classnames";
4
+ import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal
5
+ // useClick
6
+ } from "@floating-ui/react";
7
+ import styled from "styled-components";
8
+ import { getTemplate } from "../utils";
9
+ const TooltipStyle = styled.div.withConfig({
10
+ displayName: "TooltipStyle",
11
+ componentId: "es-grid-template__sc-ibhq66-0"
12
+ })(["width:max-content;background-color:#444;color:white;font-size:90%;padding:4px 8px;border-radius:4px;opacity:0.9;z-index:9999;max-width:450px;"]);
13
+ const HeaderContent = props => {
14
+ const {
15
+ t
16
+ } = props;
17
+ const {
18
+ headerTooltip,
19
+ headerText,
20
+ columnGroupText,
21
+ headerTemplate,
22
+ title
23
+ } = props.column ?? {};
24
+ const text = React.useMemo(() => {
25
+ return columnGroupText ?? headerText ?? title;
26
+ }, [columnGroupText, headerText, title]);
27
+ const tooltip = React.useMemo(() => {
28
+ return headerTooltip ?? columnGroupText ?? headerText ?? title;
29
+ }, [columnGroupText, headerText, headerTooltip, title]);
30
+ const [isOpen, setIsOpen] = useState(false);
31
+ const {
32
+ refs,
33
+ floatingStyles,
34
+ context
35
+ } = useFloating({
36
+ open: isOpen,
37
+ onOpenChange: setIsOpen,
38
+ placement: "top",
39
+ whileElementsMounted: autoUpdate,
40
+ middleware: [offset(5), flip({
41
+ fallbackAxisSideDirection: "start"
42
+ }), shift()]
43
+ });
44
+ const hover = useHover(context, {
45
+ move: false
46
+ });
47
+ const focus = useFocus(context);
48
+ const dismiss = useDismiss(context);
49
+ const role = useRole(context, {
50
+ role: "tooltip"
51
+ });
52
+ const {
53
+ getReferenceProps,
54
+ getFloatingProps
55
+ } = useInteractions([hover, focus, dismiss, role]);
56
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
57
+ ref: refs.setReference
58
+ }, getReferenceProps(), {
59
+ tabIndex: -1,
60
+ style: {
61
+ flex: 1,
62
+ overflow: 'hidden',
63
+ textOverflow: 'ellipsis',
64
+ wordBreak: 'keep-all'
65
+ }
66
+ // style={{flex: 1}}
67
+ ,
68
+ className: classnames('', {})
69
+ }), headerTemplate ? getTemplate(headerTemplate) : t ? t(text) : text), isOpen && (headerTooltip !== false || headerTemplate || headerTooltip || columnGroupText || headerText || title) && /*#__PURE__*/React.createElement(FloatingPortal, {
70
+ root: document.body
71
+ }, /*#__PURE__*/React.createElement(TooltipStyle, _extends({
72
+ className: "Tooltip",
73
+ ref: refs.setFloating,
74
+ style: {
75
+ ...floatingStyles,
76
+ zIndex: 1999
77
+ }
78
+ }, getFloatingProps()), headerTooltip && typeof headerTooltip === 'function' ? headerTooltip() : t ? t(tooltip) : tooltip)));
79
+ };
80
+ export default HeaderContent;
@@ -0,0 +1,13 @@
1
+ import React, { ReactElement, ReactNode } from "react";
2
+ type Props = {
3
+ t?: any;
4
+ content?: any;
5
+ value?: any;
6
+ record?: any;
7
+ rowIndex?: any;
8
+ template?: React.ReactElement | React.ReactNode | (() => React.ReactElement | React.ReactNode);
9
+ tooltip?: ReactNode | ReactElement | ((value: any, record: any, index: number) => ReactNode | ReactElement);
10
+ showTooltip?: boolean;
11
+ };
12
+ declare const TooltipContent: (props: Props) => React.JSX.Element;
13
+ export default TooltipContent;
@@ -0,0 +1,74 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { Fragment, useState } from "react";
3
+ import classnames from "classnames";
4
+ import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal
5
+ // useClick
6
+ } from "@floating-ui/react";
7
+ import styled from "styled-components";
8
+ import { useIsOverflow } from "../useIsOverflow";
9
+ // import {getTemplate} from "../utils";
10
+
11
+ const TooltipStyle = styled.div.withConfig({
12
+ displayName: "TooltipStyle",
13
+ componentId: "es-grid-template__sc-7yfbzv-0"
14
+ })(["width:max-content;background-color:#444;color:white;font-size:90%;padding:4px 8px;border-radius:4px;opacity:0.9;z-index:9999;max-width:450px;"]);
15
+ const TooltipContent = props => {
16
+ const {
17
+ content,
18
+ tooltip,
19
+ value,
20
+ record,
21
+ rowIndex,
22
+ showTooltip
23
+ } = props;
24
+ const [isOpen, setIsOpen] = useState(false);
25
+ const {
26
+ refs,
27
+ floatingStyles,
28
+ context
29
+ } = useFloating({
30
+ open: isOpen,
31
+ onOpenChange: setIsOpen,
32
+ placement: "top",
33
+ whileElementsMounted: autoUpdate,
34
+ middleware: [offset(5), flip({
35
+ fallbackAxisSideDirection: "start"
36
+ }), shift()]
37
+ });
38
+ const isOverflow = useIsOverflow(refs.reference);
39
+ const hover = useHover(context, {
40
+ move: false
41
+ });
42
+ const focus = useFocus(context);
43
+ const dismiss = useDismiss(context);
44
+ const role = useRole(context, {
45
+ role: "tooltip"
46
+ });
47
+ const {
48
+ getReferenceProps,
49
+ getFloatingProps
50
+ } = useInteractions([hover, focus, dismiss, role]);
51
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
52
+ ref: refs.setReference
53
+ }, getReferenceProps(), {
54
+ style: {
55
+ flex: 1,
56
+ overflow: 'hidden',
57
+ textOverflow: 'ellipsis',
58
+ wordBreak: 'keep-all'
59
+ },
60
+ className: classnames('', {})
61
+ }), content()), isOpen && showTooltip !== false && isOverflow &&
62
+ /*#__PURE__*/
63
+ // {true && (
64
+ React.createElement(FloatingPortal, {
65
+ root: document.body
66
+ }, /*#__PURE__*/React.createElement(TooltipStyle, _extends({
67
+ className: "Tooltip",
68
+ ref: refs.setFloating,
69
+ style: {
70
+ ...floatingStyles
71
+ }
72
+ }, getFloatingProps()), tooltip && typeof tooltip === 'function' ? tooltip(value, record, rowIndex) : tooltip ?? content())));
73
+ };
74
+ export default TooltipContent;
@@ -0,0 +1,16 @@
1
+ import type { AnyObject, IGroupSetting } from "../type";
2
+ export declare const SELECTION_COLUMN: {};
3
+ interface UseColumnsConfig {
4
+ t?: any;
5
+ buddhistLocale?: any;
6
+ dataSourceFilter?: any;
7
+ locale?: any;
8
+ format?: any;
9
+ handleResize?: any;
10
+ sortMultiple?: boolean;
11
+ groupAble?: boolean;
12
+ groupSetting?: IGroupSetting;
13
+ groupColumns?: string[];
14
+ }
15
+ declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig) => readonly [any];
16
+ export default useColumns;
@@ -0,0 +1,272 @@
1
+ import * as React from 'react';
2
+ // import type {Key} from 'react';
3
+ import { Fragment, useCallback } from 'react';
4
+ // import Command from "../Command";
5
+ import { Button, Space } from "antd";
6
+ import { Select } from "rc-master-ui";
7
+ import { getTypeFilter } from "./utils";
8
+ import { booleanOperator, numberOperator, stringOperator, translateOption } from "./constant";
9
+ import { flatColumns2, renderContent, renderFilter } from "./columns";
10
+ import { SearchOutlined } from "@ant-design/icons";
11
+ import { ArrowDown, ArrowUp, FilterFill } from "becoxy-icons";
12
+ import classNames from "classnames";
13
+ import HeaderContent from "./content/HeaderContent";
14
+ const ASCEND = 'ascend';
15
+ const DESCEND = 'descend';
16
+ export const SELECTION_COLUMN = {};
17
+
18
+ // const EMPTY_LIST: React.Key[] = [];
19
+
20
+ const useColumns = config => {
21
+ // const {
22
+ // preserveSelectedRowKeys,
23
+ // selectedRowKeys,
24
+ // defaultSelectedRowKeys,
25
+ // onSelectMultiple,
26
+ // columnWidth: selectionColWidth,
27
+ // type: selectionType,
28
+ // selections,
29
+ // fixed,
30
+ // } = rowSelection || {};
31
+
32
+ const {
33
+ t,
34
+ dataSourceFilter,
35
+ buddhistLocale,
36
+ locale,
37
+ sortMultiple,
38
+ format,
39
+ handleResize,
40
+ groupAble,
41
+ groupColumns,
42
+ groupSetting
43
+ } = config;
44
+
45
+ // ====================== Selections ======================
46
+
47
+ const handleSearch = (selectedKeys, confirm) => {
48
+ confirm();
49
+ };
50
+ const getColumnSearchProps = useCallback(column => ({
51
+ filterDropdown: ({
52
+ setSelectedKeys,
53
+ selectedKeys,
54
+ confirm,
55
+ // close,
56
+ setOperatorKey,
57
+ operatorKey,
58
+ visible,
59
+ searchValue,
60
+ setSearchValue
61
+ }) => {
62
+ const type = getTypeFilter(column);
63
+ // const operatorOptions = !type || type === 'Text' ? stringOperator : numberOperator
64
+ // const operatorOptions = type === 'Checkbox' || type === 'Dropdown' || type === 'DropTree' || ty
65
+ const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
66
+ return /*#__PURE__*/React.createElement("div", {
67
+ style: {
68
+ padding: 8,
69
+ minWidth: 275
70
+ },
71
+ onKeyDown: e => e.stopPropagation()
72
+ }, column?.showOperator !== false && column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
73
+ className: 'mb-1'
74
+ }, /*#__PURE__*/React.createElement(Select, {
75
+ options: translateOption(operatorOptions, t),
76
+ style: {
77
+ width: '100%',
78
+ marginBottom: 8
79
+ },
80
+ value: operatorKey,
81
+ onChange: val => {
82
+ setOperatorKey(val);
83
+ }
84
+ })), /*#__PURE__*/React.createElement("div", {
85
+ style: {
86
+ marginBottom: 8
87
+ }
88
+ }, renderFilter(column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t)), /*#__PURE__*/React.createElement(Space, {
89
+ style: {
90
+ justifyContent: 'end',
91
+ width: '100%'
92
+ }
93
+ }, /*#__PURE__*/React.createElement(Button, {
94
+ type: "primary",
95
+ onClick: () => {
96
+ confirm({
97
+ closeDropdown: false
98
+ });
99
+ handleSearch(selectedKeys, confirm);
100
+ },
101
+ icon: /*#__PURE__*/React.createElement(SearchOutlined, null),
102
+ size: "small",
103
+ style: {
104
+ width: 90
105
+ }
106
+ }, t ? t('Filter') : 'Filter'), /*#__PURE__*/React.createElement(Button, {
107
+ type: "link",
108
+ size: "small",
109
+ onClick: () => {
110
+ // setSearchValue('')
111
+ setSelectedKeys([]);
112
+ confirm();
113
+ // handleSearch()
114
+ // close()
115
+ }
116
+ }, t ? t("Clear") : 'Clear')));
117
+ },
118
+ filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
119
+ fontSize: 12
120
+ // onClick={() => {
121
+ // onFilterClick?.(column, onFilterCallback)
122
+ // }}
123
+ ,
124
+ style: {
125
+ color: filtered ? '#E3165B' : '#283046'
126
+ }
127
+ }),
128
+ filterDropdownProps: {
129
+ onOpenChange(open) {
130
+ if (open) {
131
+ // setTimeout(() => searchInput.current?.select(), 100)
132
+ }
133
+ }
134
+ }
135
+ }), [buddhistLocale, dataSourceFilter, locale, t]);
136
+
137
+ // ======================= Columns ========================
138
+ const transformColumns = useCallback(columns => {
139
+ // >>>>>>>>>>> Support selection
140
+ const cloneColumns = [...columns];
141
+ const firstNonGroupColumn = flatColumns2(cloneColumns).find(col => col.field && !groupColumns?.includes(col.field) && col.hidden !== true);
142
+ const nonGroupColumns = flatColumns2(cloneColumns).filter(col => col.field && !groupColumns?.includes(col.field) && col.hidden !== true);
143
+
144
+ // ===================== Render =====================
145
+
146
+ const convertColumns = cols => {
147
+ return cols.map(col => {
148
+ const colIndex = flatColumns2(cols).findIndex(it => it.field === col.field);
149
+ if (col === SELECTION_COLUMN) {
150
+ return SELECTION_COLUMN;
151
+ }
152
+ const transformedColumn = {
153
+ ...col,
154
+ dataIndex: col.field ?? col.dataIndex,
155
+ key: col.field ?? col.dataIndex ?? col.key,
156
+ // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
157
+ // title: () => (<span>aaa</span>),
158
+ title: () => /*#__PURE__*/React.createElement(HeaderContent, {
159
+ column: col,
160
+ t: t
161
+ }),
162
+ // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
163
+ ellipsis: col.ellipsis !== false,
164
+ align: col.textAlign ?? col.align,
165
+ fixed: col.frozen ? col.frozen.toLowerCase() : col.fixed
166
+ };
167
+ if (transformedColumn.children && transformedColumn.children?.length) {
168
+ return {
169
+ ...transformedColumn,
170
+ children: convertColumns(transformedColumn.children)
171
+ };
172
+ }
173
+ if (["index", "#"].includes(col.field)) {
174
+ return {
175
+ ...transformedColumn,
176
+ onCell: () => ({
177
+ className: 'cell-number'
178
+ }),
179
+ render: (_, __, rowIndex) => rowIndex + 1
180
+ };
181
+ }
182
+ if (col.key === 'command') {
183
+ return {
184
+ ...transformedColumn
185
+ };
186
+ }
187
+ return {
188
+ ...transformedColumn,
189
+ ...(transformedColumn.allowFiltering === false ? {} : {
190
+ ...getColumnSearchProps(col)
191
+ }),
192
+ sorter: col.sorter === false ? undefined : {
193
+ compare: a => a,
194
+ multiple: sortMultiple ? colIndex : undefined
195
+ },
196
+ sortIcon: args => {
197
+ const {
198
+ sortOrder
199
+ } = args;
200
+ return /*#__PURE__*/React.createElement(Fragment, null, !sortOrder && /*#__PURE__*/React.createElement(ArrowUp, {
201
+ fontSize: 15,
202
+ style: {
203
+ display: 'flex',
204
+ opacity: 0,
205
+ marginLeft: 4
206
+ },
207
+ className: classNames(`ui-rc-table-column-sorter-up`, {
208
+ active: true
209
+ })
210
+ }), sortOrder === ASCEND && /*#__PURE__*/React.createElement("span", {
211
+ className: classNames(`ui-rc-table-column-sorter-up`, {
212
+ active: sortOrder === ASCEND
213
+ }),
214
+ style: {
215
+ display: 'flex',
216
+ marginLeft: 4
217
+ }
218
+ }, /*#__PURE__*/React.createElement(ArrowUp, {
219
+ fontSize: 15,
220
+ color: '#000'
221
+ })), sortOrder === DESCEND && /*#__PURE__*/React.createElement("span", {
222
+ className: classNames(`ui-rc-table-column-sorter-up`, {
223
+ active: sortOrder === DESCEND
224
+ }),
225
+ style: {
226
+ display: 'flex',
227
+ marginLeft: 4
228
+ }
229
+ }, /*#__PURE__*/React.createElement(ArrowDown, {
230
+ fontSize: 15,
231
+ color: '#000'
232
+ })));
233
+ },
234
+ onHeaderCell: () => ({
235
+ width: col.width,
236
+ onResize: handleResize?.(col)
237
+ }),
238
+ onCell: data => {
239
+ return {
240
+ colSpan: data.children && col.field === firstNonGroupColumn?.field ? 2 : data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
241
+ zIndex: data.children && col.field === firstNonGroupColumn?.field ? 11 : undefined,
242
+ className: classNames('', {
243
+ 'cell-group': data.children,
244
+ 'cell-group-fixed': data.children && col.field === firstNonGroupColumn?.field
245
+ })
246
+ };
247
+ },
248
+ render: (value, record, rowIndex) => {
249
+ if (groupSetting && groupSetting.hiddenColumnGroup === false) {
250
+ if (record.children) {
251
+ return renderContent(col, value, record, rowIndex, format);
252
+ }
253
+ if (groupColumns?.includes(col.field)) {
254
+ return '';
255
+ }
256
+ return renderContent(col, value, record, rowIndex, format);
257
+ }
258
+ if (col.field === firstNonGroupColumn?.field && record.children) {
259
+ const currentGroupColumn = flatColumns2(cols).find(it => it.field === record.field);
260
+ return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, format));
261
+ }
262
+ return renderContent(col, value, record, rowIndex, format);
263
+ },
264
+ hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? col.hidden : groupAble && groupColumns && groupColumns.includes(col.field) ? true : col.hidden
265
+ };
266
+ });
267
+ };
268
+ return convertColumns(cloneColumns);
269
+ }, [format, getColumnSearchProps, groupAble, groupColumns, groupSetting, handleResize, sortMultiple, t]);
270
+ return [transformColumns];
271
+ };
272
+ export default useColumns;
@@ -5,6 +5,7 @@ import type { ColumnEditType, ColumnsType, ColumnTable, GetRowKey } from "../typ
5
5
  import type { SelectionSettings } from "../type";
6
6
  import type { AnyObject } from "../type";
7
7
  import type { Key } from "react";
8
+ import type { ColumnsTable } from "../type";
8
9
  export declare const newGuid: () => any;
9
10
  export declare const sumDataByField: (data: any[], field: string) => any;
10
11
  export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
@@ -19,6 +20,7 @@ export declare const getAllVisibleKeys: (columns: any[]) => any[];
19
20
  export declare const getVisibleColumnKeys: (columns: any[]) => string[];
20
21
  export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[]): string[];
21
22
  export declare const updateColumns: (columns: any[], includes: string[]) => any[];
23
+ export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string[]) => any[];
22
24
  export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType, col: ColumnTable<any>) => string;
23
25
  export declare const customWeekStartEndFormat: (value: any, weekFormat: string) => string;
24
26
  export declare const getTypeFilter: (col: ColumnTable<any>) => TypeFilter;
@@ -38,6 +40,49 @@ export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'nu
38
40
  export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
39
41
  export declare function findAllChildrenKeys<RecordType>(data: readonly RecordType[], getRowKey: GetRowKey<RecordType>, childrenColumnName: string): Key[];
40
42
  export declare const flattenArray: <RecordType extends AnyObject = AnyObject>(arr: any[]) => RecordType[];
41
- export declare const flattenData: <RecordType extends AnyObject = AnyObject>(childrenColumnName: keyof RecordType, data?: RecordType[]) => RecordType[];
43
+ export declare const flattenData: <RecordType extends AnyObject = AnyObject>(childrenColumnName: string, data?: RecordType[]) => RecordType[];
42
44
  export declare const countItemsBeforeIndex: (array: any[], index: number) => number;
43
45
  export declare const getRowNumber: (array: any[], rowKey: any, key: any) => number;
46
+ export declare const getDefaultValue: (defaultValue: any) => AnyObject;
47
+ export declare const addRowIdArray: (inputArray: any[]) => any[];
48
+ export declare const findItemByKey: (array: any, key: string | number, value: any) => any;
49
+ export declare const getLastSelectCell: (selectCells: any) => {
50
+ row: number;
51
+ col: number;
52
+ };
53
+ export declare const getFirstSelectCell: (selectCells: any) => {
54
+ row: number;
55
+ col: number;
56
+ };
57
+ export declare const getRowsPasteIndex: (pasteRows: any) => number[];
58
+ export declare const mmm: (string | number | boolean)[][];
59
+ export declare function cloneRows(array: any[], numRows: number): any[];
60
+ export declare function addRows1(arr: any[], n: number): any[];
61
+ export declare function addRows2(arr: any[], n: number): {
62
+ newArr: any[];
63
+ addedRows: any[];
64
+ };
65
+ export declare function addRows(arr: any[], n: number): {
66
+ newArr: any[];
67
+ addedRows: any[];
68
+ };
69
+ export declare function addRows4(arr: any[], n: number): {
70
+ newArr: any[];
71
+ addedRows: any[];
72
+ };
73
+ export declare function addRows6(arr: any, n: number): {
74
+ newArr: any[];
75
+ addedRows: any[];
76
+ };
77
+ export declare function addRows7(arr: any, n: number): any;
78
+ export declare function addRows8(arr: any, n: number): {
79
+ combined: any;
80
+ addedRows: any[];
81
+ } | {
82
+ combined: any[];
83
+ addedRows: any[];
84
+ };
85
+ export declare const transformColumns: <RecordType>(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any) => ColumnsTable<RecordType>;
86
+ export declare const transformColumns1: <RecordType>(cols: ColumnsTable<RecordType>, sortMultiple?: boolean) => ColumnsTable<RecordType>;
87
+ export declare const removeColumns: <RecordType>(columns: ColumnsTable, groupColumns: string[]) => ColumnsTable<RecordType>;
88
+ export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];