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,513 @@
1
+ import type { CheckboxProps, TablePaginationConfig } from 'rc-master-ui';
2
+ import type { ItemType } from 'rc-master-ui/es/menu/interface';
3
+ import type { OnChangeFn } from '@tanstack/react-table';
4
+ import type { ReactElement, ReactNode } from 'react';
5
+ import type { IOperator } from './hook/constant';
6
+ import type { ColorPickerProps } from 'antd';
7
+ import type { TableLocale } from "rc-master-ui/lib/table/interface";
8
+ export type ExtendedColumnFilter = {
9
+ id: string;
10
+ value: string;
11
+ operator?: FilterOperator;
12
+ };
13
+ export type OpetorState = ColumnOperator[];
14
+ export interface OpetorTableState {
15
+ operator: OpetorState;
16
+ }
17
+ export interface ColumnOperator {
18
+ id: string;
19
+ operator: string;
20
+ }
21
+ export interface DensityOptions {
22
+ enableOperator?: boolean;
23
+ onOperatorChange?: OnChangeFn<OpetorState>;
24
+ }
25
+ export type Key = React.Key;
26
+ export type PaginationConfig = TablePaginationConfig & {
27
+ currentPage?: number;
28
+ };
29
+ export type AnyObject = Record<PropertyKey, any>;
30
+ export type IFormat = {
31
+ thousandSeparator?: string;
32
+ decimalSeparator?: string;
33
+ decimalScale?: number | undefined;
34
+ allowNegative?: boolean;
35
+ prefix?: string | undefined;
36
+ suffix?: string | undefined;
37
+ fixedDecimalScale?: boolean;
38
+ dateFormat?: string;
39
+ datetimeFormat?: string;
40
+ timeFormat?: string;
41
+ weekFormat?: string;
42
+ monthFormat?: string;
43
+ yearFormat?: string;
44
+ };
45
+ export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple';
46
+ export type EditType = 'text' | 'numeric' | 'asyncSelect' | 'date' | 'datetime' | 'time' | 'week' | 'month' | 'quarter' | 'year' | 'select' | 'checkbox' | 'currency' | 'image' | 'selectTable' | 'customSelect' | 'form' | 'color' | 'treeSelect' | 'file';
47
+ export type ITextAlign = 'center' | 'left' | 'right';
48
+ export type TypeFilter = 'Text' | 'Date' | 'Time' | 'Datetime' | 'DateRange' | 'Month' | 'Quarter' | 'Year' | 'Week' | 'Number' | 'NumberRange' | 'Dropdown' | 'DropTree' | 'Checkbox' | 'CheckboxTree' | 'CheckboxDropdown';
49
+ export type IColumnType = 'number' | 'time' | 'date' | 'week' | 'month' | 'file' | 'quarter' | 'year' | 'datetime' | 'string' | 'boolean' | 'checkbox' | 'color' | null | undefined;
50
+ export type FilterOperator = 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'startsWith' | 'endsWith' | 'contains';
51
+ export type FixedType = 'left' | 'right' | boolean;
52
+ export type SelectMode = 'checkbox' | 'radio' | undefined;
53
+ type IGrid = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
54
+ export interface FieldNames {
55
+ value?: string;
56
+ label?: string;
57
+ groupLabel?: string;
58
+ options?: string;
59
+ }
60
+ export interface CommandItem {
61
+ id: string;
62
+ type?: string;
63
+ visible?: boolean | ((record: any) => boolean);
64
+ title: string;
65
+ color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
66
+ tooltip?: string;
67
+ icon?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
68
+ template?: ReactNode | ReactElement | ((record: any) => ReactNode | ReactElement);
69
+ client?: boolean;
70
+ confirmDialog?: boolean;
71
+ }
72
+ export type ColumnTemplate<RecordType> = {
73
+ value: any;
74
+ rowData: RecordType;
75
+ index: number;
76
+ field: string;
77
+ };
78
+ export type ColumnTable<RecordType = AnyObject> = {
79
+ field?: string;
80
+ width?: number;
81
+ maxWidth?: number;
82
+ minWidth?: number;
83
+ align?: ITextAlign;
84
+ type?: IColumnType;
85
+ haveSum?: boolean;
86
+ isSummary?: boolean;
87
+ summaryTemplate?: (data: number, key: string) => ReactElement | ReactNode;
88
+ format?: IFormat | ((rowData: any) => IFormat);
89
+ allowFiltering?: boolean;
90
+ /**
91
+ * @deprecated Please use `allowSorter` instead.
92
+ * @since 1.0.0
93
+ */
94
+ sorter?: boolean;
95
+ allowSorter?: boolean;
96
+ operator?: FilterOperator;
97
+ hideOperator?: boolean;
98
+ placeholder?: string;
99
+ showInColumnChoose?: boolean;
100
+ typeFilter?: TypeFilter;
101
+ source?: any[];
102
+ showFilterSearch?: boolean;
103
+ headerText?: string;
104
+ visible?: boolean;
105
+ headerTooltip?: boolean | string | (() => ReactNode | ReactElement);
106
+ columnGroupText?: string;
107
+ textAlign?: ITextAlign;
108
+ headerTextAlign?: ITextAlign;
109
+ template?: ReactNode | ReactElement | ((args: ColumnTemplate<RecordType>) => ReactNode | ReactElement);
110
+ showTooltip?: boolean;
111
+ tooltipDescription?: ReactNode | ReactElement | ((value: any, record: RecordType, index: number) => ReactNode | ReactElement);
112
+ headerTemplate?: React.ReactNode | React.ReactElement | ((column: ColumnTable<RecordType>) => React.ReactNode | React.ReactElement);
113
+ commandItems?: CommandItem[];
114
+ children?: ColumnTable<RecordType>[];
115
+ editType?: EditType | ((rowData?: RecordType) => EditType);
116
+ disable?: boolean | ((rowData: any) => boolean);
117
+ editEnable?: boolean | ((rowData: any) => boolean);
118
+ isClearable?: boolean;
119
+ maxDate?: any;
120
+ minDate?: any;
121
+ maxTime?: any;
122
+ minTime?: any;
123
+ max?: number;
124
+ min?: number;
125
+ editSelectSettings?: IEditSelectSettings;
126
+ editFromSettings?: IEditFromSettings;
127
+ /**
128
+ * @deprecated Please use `fixed` instead.
129
+ * @since 1.6.5
130
+ */
131
+ fixedType?: FixedType;
132
+ fixed?: FixedType;
133
+ headerTextWrap?: boolean;
134
+ ellipsis?: boolean;
135
+ allowResizing?: boolean;
136
+ };
137
+ export type Locale = TableLocale & {
138
+ ok_btn?: string;
139
+ cancel_btn?: string;
140
+ add_rows?: string;
141
+ add_rows_before?: string;
142
+ add_rows_after?: string;
143
+ add_1?: string;
144
+ add_10?: string;
145
+ add_50?: string;
146
+ add_100?: string;
147
+ add_children?: string;
148
+ delete_content?: string;
149
+ delete_rows?: string;
150
+ custom?: string;
151
+ filterTitle: string;
152
+ filterConfirm: string;
153
+ filterEmptyText: string;
154
+ filterCheckall: string;
155
+ filterSearchPlaceholder: string;
156
+ emptyText: string;
157
+ selectAll: string;
158
+ selectInvert: string;
159
+ selectNone: string;
160
+ selectionAll: string;
161
+ sortTitle: string;
162
+ expand: string;
163
+ collapse: string;
164
+ triggerDesc: string;
165
+ triggerAsc: string;
166
+ cancelSort: string;
167
+ };
168
+ export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
169
+ export type TableProps<RecordType = AnyObject> = {
170
+ editAble?: boolean;
171
+ infiniteScroll?: boolean;
172
+ next?: () => void;
173
+ locale?: Locale;
174
+ groupAble?: boolean;
175
+ groupColumns?: string[];
176
+ groupSetting?: IGroupSetting;
177
+ onChooseColumns?: (props: IOnChooseColumns) => void;
178
+ pagination?: false | PaginationConfig;
179
+ showCustomTooltip?: boolean;
180
+ sortMultiple?: boolean;
181
+ dataSource: RecordType[];
182
+ columns: ColumnsTable<RecordType>;
183
+ height?: number;
184
+ format?: IFormat;
185
+ t?: any;
186
+ lang?: string;
187
+ contextMenuItems?: ContextMenuItem[];
188
+ showDefaultContext?: boolean;
189
+ contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<RecordType>, 'item' | 'event'>) => string[]);
190
+ contextMenuOpen?: (args: Omit<ContextInfo<RecordType>, 'item'>) => void;
191
+ contextMenuClick?: (args: ContextInfo<RecordType>) => void;
192
+ recordDoubleClick?: (args: RecordDoubleClickEventArgs<RecordType>) => void;
193
+ toolbarItems?: ToolbarItem[];
194
+ showColumnChoose?: boolean;
195
+ showAdvanceFilter?: boolean;
196
+ onFilter?: (query: {
197
+ field: string;
198
+ key: string;
199
+ operator: IOperator;
200
+ predicate: 'and' | 'or';
201
+ value: any;
202
+ }[]) => void;
203
+ onSorter?: (args: Sorter[]) => void;
204
+ selectionSettings?: SelectionSettings;
205
+ rowSelection?: RowSelection<RecordType>;
206
+ rowSelected?: (args: {
207
+ type: string;
208
+ rowData: RecordType;
209
+ selected: RecordType | RecordType[];
210
+ }) => void;
211
+ dataSourceFilter?: SourceFilter[];
212
+ onFilterClick?: (column: ColumnTable<RecordType>, callback: (key: string, data: any) => void) => void;
213
+ loading?: boolean;
214
+ allowResizing?: boolean;
215
+ showToolbar?: boolean;
216
+ onDataChange?: (data: RecordType[]) => void;
217
+ defaultValue?: AnyObject | (() => AnyObject);
218
+ summary?: boolean | ((data: readonly RecordType[]) => React.ReactNode);
219
+ showEmptyText?: boolean;
220
+ commandSettings?: CommandSettings;
221
+ onCellPaste?: ICellPasteModel<RecordType>;
222
+ onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
223
+ onCellClick?: (args: ICellClick, callback?: any) => void;
224
+ rowEditable?: (rowData: RecordType) => boolean;
225
+ validate?: any;
226
+ onBlur?: (data: RecordType[]) => void;
227
+ onExpandClick?: (args: {
228
+ expandedKeys: string[];
229
+ key: string;
230
+ rowData: any;
231
+ }) => void;
232
+ wrapSettings?: IWrapSettings;
233
+ actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
234
+ commandClick?: (args: CommandClick) => void;
235
+ expandable?: ExpandableConfig<RecordType>;
236
+ fullScreen?: boolean;
237
+ };
238
+ export type ExpandableConfig<RecordType> = {
239
+ expandedRowKeys?: readonly Key[];
240
+ defaultExpandedRowKeys?: readonly Key[];
241
+ expandedRowRender?: ExpandedRowRender<RecordType>;
242
+ columnTitle?: React.ReactNode;
243
+ expandRowByClick?: boolean;
244
+ expandIcon?: RenderExpandIcon<RecordType>;
245
+ onExpand?: (expanded: boolean, record: RecordType) => void;
246
+ onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
247
+ defaultExpandAllRows?: boolean;
248
+ indentSize?: number;
249
+ expandIconColumnIndex?: number;
250
+ showExpandColumn?: boolean;
251
+ expandedRowClassName?: string | RowClassName<RecordType>;
252
+ childrenColumnName?: string;
253
+ rowExpandable?: (record: RecordType) => boolean;
254
+ columnWidth?: number | string;
255
+ fixed?: FixedType;
256
+ };
257
+ export type RenderExpandIcon<RecordType> = (props: RenderExpandIconProps<RecordType>) => React.ReactNode;
258
+ export interface RenderExpandIconProps<RecordType> {
259
+ prefixCls: string;
260
+ expanded: boolean;
261
+ record: RecordType;
262
+ expandable: boolean;
263
+ onExpand: TriggerEventHandler<RecordType>;
264
+ }
265
+ export type TriggerEventHandler<RecordType> = (record: RecordType, event: React.MouseEvent<HTMLElement>) => void;
266
+ export type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string;
267
+ export type ExpandedRowRender<ValueType> = (record: ValueType, index: number, indent: number, expanded: boolean) => React.ReactNode;
268
+ export type CommandClick = {
269
+ id: string;
270
+ rowId: string;
271
+ rowData: any;
272
+ index: number;
273
+ rows?: any[];
274
+ };
275
+ export type IEditSelectSettings = {
276
+ fieldKey?: string;
277
+ options: any[] | ((rowData: any, field: string) => any[]);
278
+ /** get value form other field **/
279
+ fieldValue?: string;
280
+ /** get label form other field **/
281
+ fieldLabel?: string;
282
+ /** cho phép nhập giá trị - onBlur: giá trị search được set thành value **/
283
+ searchTextAsValue?: boolean;
284
+ inputKey?: string;
285
+ filterKey?: string[];
286
+ selectMode?: SelectMode;
287
+ getPasteValue?: (value: any) => Record<string, any> | null;
288
+ validateOption?: (rowData: any, field: string) => any[];
289
+ defaultOptions?: any[];
290
+ defaultValue?: (value: any, rowData: any) => {
291
+ value: any;
292
+ label: string;
293
+ [key: string]: string;
294
+ } | null;
295
+ formatOptionLabel?: (option: any) => ReactNode | ReactElement;
296
+ loadOptions?: (search: string, callback: (newOptions: any[]) => void, args?: LoadOptionsArgs) => void;
297
+ isMulti?: boolean;
298
+ closeMenuOnSelect?: boolean;
299
+ menuWidth?: number;
300
+ menuHeight?: number;
301
+ columns?: ColumnSelectTable[];
302
+ toolbarItems?: ToolbarItem[];
303
+ toolbarClick?: (props: ToolbarClick) => void;
304
+ toolbarHeight?: number;
305
+ hideSelectedOptions?: boolean;
306
+ showItems?: number;
307
+ isLengthSelected?: boolean;
308
+ fieldNames?: FieldNames;
309
+ filterOption?: boolean | FilterFunc<any>;
310
+ };
311
+ export type IEditFromSettings = {
312
+ fieldKey: string;
313
+ formOpen?: (props: IFormOpen) => void;
314
+ formClose?: (props: IFormOpen) => void;
315
+ formatLabel?: (value: any) => string;
316
+ menuWidth?: number;
317
+ menuHeight?: number;
318
+ labelWith?: number;
319
+ items: any[];
320
+ layout?: {
321
+ xl?: IGrid;
322
+ lg?: IGrid;
323
+ md?: IGrid;
324
+ sm?: IGrid;
325
+ xs?: IGrid;
326
+ };
327
+ defaultValues?: Record<string, any>;
328
+ schema?: any;
329
+ };
330
+ export type IFormOpen = {
331
+ value?: any;
332
+ setValue?: any;
333
+ getValues?: any;
334
+ reset?: any;
335
+ rowData?: any;
336
+ };
337
+ export type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;
338
+ export type ToolbarClick = {
339
+ item: any;
340
+ column: any;
341
+ };
342
+ export type ColumnSelectTable = {
343
+ field: string;
344
+ dataIndex?: string;
345
+ type?: IColumnType;
346
+ headerText?: string;
347
+ fixedType?: 'left' | 'right' | undefined;
348
+ width?: number | undefined;
349
+ minWidth?: number;
350
+ maxWidth?: number;
351
+ visible?: boolean;
352
+ textAlign?: ITextAlign;
353
+ headerTextAlign?: ITextAlign;
354
+ template?: (props: ITemplateColumn) => ReactNode | ReactElement;
355
+ headerTemplate?: any;
356
+ ellipsis?: boolean | undefined;
357
+ format?: IFormat;
358
+ tooltipDescription?: string | ((rowData: any) => string | ReactNode);
359
+ showTooltip?: boolean;
360
+ showTooltipHeader?: boolean;
361
+ };
362
+ export type ITemplateColumn = {
363
+ value: any;
364
+ column: any;
365
+ rowData: any;
366
+ field: number | string;
367
+ index: number;
368
+ };
369
+ export type RawValueType = string | number;
370
+ export type ToolbarItem = {
371
+ position?: 'Top' | 'Bottom';
372
+ align?: ITextAlign;
373
+ onClick?: (args: any) => void;
374
+ key?: React.Key;
375
+ value?: RawValueType;
376
+ label?: React.ReactNode;
377
+ template?: React.ReactNode | React.ReactElement | (() => React.ReactNode | React.ReactElement);
378
+ title?: React.ReactNode;
379
+ disabled?: boolean;
380
+ [key: string]: any;
381
+ };
382
+ export type LoadOptionsArgs = {
383
+ rowData?: any;
384
+ };
385
+ export type IGroupSetting = {
386
+ client?: boolean;
387
+ onGroup?: (props: IOnGroup) => void;
388
+ hiddenColumnGroup?: boolean;
389
+ showGroupIcon?: boolean;
390
+ unClearableLevel?: 1 | 2 | 3 | undefined;
391
+ sumGroup?: boolean;
392
+ };
393
+ type IOnGroup = {
394
+ columnGrouped: string[];
395
+ columns: ColumnsTable;
396
+ flattenColumns: ColumnsTable;
397
+ };
398
+ export type IOnChooseColumns = {
399
+ columns: ColumnsTable;
400
+ showColumns: ColumnsTable;
401
+ flattenColumns: ColumnsTable;
402
+ };
403
+ export type ContextMenuItem = ItemType;
404
+ export type CommandSettings = {
405
+ client?: boolean;
406
+ confirmDialog?: boolean;
407
+ };
408
+ export interface ICellPasteModel<RecordType = AnyObject> {
409
+ onPasted?: (args: IOnPastedProps, handleCallback: (callbackData: any[]) => void) => void;
410
+ dataChange?: (data: RecordType[]) => void;
411
+ getCallbackData?: (props: any) => void;
412
+ maxRowsPaste?: number;
413
+ }
414
+ export type IOnPastedProps = {
415
+ data: any[];
416
+ copyRows: any[];
417
+ pastedColumns: string[];
418
+ pasteData: any[];
419
+ type: 'onPaste' | 'onChange' | 'onCellPaste';
420
+ };
421
+ export type ICellClick = {
422
+ index: number;
423
+ indexCol?: number;
424
+ rowId: string | number;
425
+ type: 'Editing' | 'Default';
426
+ field: string;
427
+ cellValue: any;
428
+ rowData: any;
429
+ };
430
+ export type CellChangeArgs<T> = {
431
+ type: 'onPaste' | 'onChange' | 'onCellPaste';
432
+ value: any;
433
+ option: AnyObject;
434
+ rowData: T;
435
+ rowsData: T[];
436
+ indexRow: number;
437
+ rowId?: string;
438
+ field: string | undefined;
439
+ indexCol: any;
440
+ sumValue?: any[];
441
+ };
442
+ export type IWrapMode = 'Header' | 'Both' | 'Content';
443
+ export type IWrapSettings = {
444
+ wrapMode?: IWrapMode;
445
+ };
446
+ export type SelectionSettings<T = AnyObject> = {
447
+ mode?: 'checkbox' | 'radio';
448
+ type?: 'single' | 'multiple';
449
+ checkboxOnly?: boolean;
450
+ columnWidth?: number;
451
+ hideSelectAll?: boolean;
452
+ selectedRowKeys?: Key[];
453
+ defaultSelectedRowKeys?: Key[];
454
+ getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
455
+ };
456
+ export type SelectionSelectFn<T = AnyObject> = (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
457
+ export type RowSelection<T> = {
458
+ preserveSelectedRowKeys?: boolean;
459
+ selectedRowKeys?: Key[];
460
+ defaultSelectedRowKeys?: Key[];
461
+ onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: {
462
+ type: RowSelectMethod;
463
+ }, selectedRow: T) => void;
464
+ getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>>;
465
+ onSelect?: SelectionSelectFn<T>;
466
+ /** @deprecated This function is deprecated and should use `onChange` instead */
467
+ onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
468
+ /** @deprecated This function is deprecated and should use `onChange` instead */
469
+ onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
470
+ /** @deprecated This function is deprecated and should use `onChange` instead */
471
+ onSelectInvert?: (selectedRowKeys: Key[]) => void;
472
+ /** @deprecated This function is deprecated and should use `onChange` instead */
473
+ onSelectNone?: () => void;
474
+ fixed?: FixedType;
475
+ columnTitle?: React.ReactNode | ((checkboxNode: React.ReactNode) => React.ReactNode);
476
+ checkStrictly?: boolean;
477
+ checkboxOnly?: boolean;
478
+ arrowKey?: boolean;
479
+ };
480
+ export type RecordDoubleClickEventArgs<RecordType> = {
481
+ rowData: RecordType;
482
+ rowIndex: number | undefined;
483
+ e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
484
+ };
485
+ export type SourceFilter = {
486
+ key: string;
487
+ data: any[];
488
+ loadOptions?: (search: string, callback: (newOptions: any[]) => void) => void;
489
+ };
490
+ export type ContextInfo<RecordType> = {
491
+ rowInfo: {
492
+ rowData: RecordType | null;
493
+ };
494
+ event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
495
+ item: ItemType;
496
+ };
497
+ export type Presets = Required<ColorPickerProps>['presets'][number];
498
+ export type RangeState = {
499
+ rowRange: string[];
500
+ colRange: string[];
501
+ startRowIndex: number | undefined;
502
+ endRowIndex: number | undefined;
503
+ startColIndex: number | undefined;
504
+ endColIndex: number | undefined;
505
+ rowIds: string[];
506
+ colIds: string[];
507
+ };
508
+ export type Sorter = {
509
+ columnKey: string;
510
+ field: string;
511
+ order: 'ascend' | 'descend';
512
+ };
513
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { ExpandableConfig, IFormat, IWrapSettings, Locale, RangeState, RecordDoubleClickEventArgs, SelectionSettings } from "./type";
3
+ import type { SubmitHandler } from "react-hook-form";
4
+ export type IPositionCell = {
5
+ rowId: string;
6
+ colId: string;
7
+ } | undefined;
8
+ export interface IContext<T> {
9
+ prefix: string;
10
+ id: string;
11
+ rowKey: string;
12
+ originData: any[];
13
+ dataSource: any[];
14
+ format?: IFormat;
15
+ expandable?: ExpandableConfig<T>;
16
+ wrapSettings?: IWrapSettings;
17
+ setExpanded: any;
18
+ expanded: any;
19
+ recordDoubleClick?: (args: RecordDoubleClickEventArgs<T>) => void;
20
+ selectionSettings?: SelectionSettings;
21
+ setIsSelectionChange: Dispatch<SetStateAction<{
22
+ isChange: boolean;
23
+ type: string;
24
+ rowData: T;
25
+ }>>;
26
+ setSorterChange: Dispatch<SetStateAction<boolean>>;
27
+ setFilterChange: Dispatch<SetStateAction<boolean>>;
28
+ onContextMenu?: (data: T) => (event: any) => void;
29
+ locale?: Locale;
30
+ control?: any;
31
+ errors?: any;
32
+ handleSubmit?: any;
33
+ onSubmit?: SubmitHandler<any>;
34
+ getValues?: any;
35
+ reset?: any;
36
+ setValue?: any;
37
+ handleCellChange?: (args: ContextCellChange) => void;
38
+ editingKey?: string;
39
+ setEditingKey?: Dispatch<SetStateAction<string>>;
40
+ rangeState?: RangeState;
41
+ setRangeState?: Dispatch<SetStateAction<RangeState | undefined>>;
42
+ rangePasteState?: RangeState;
43
+ setRangePasteState?: Dispatch<SetStateAction<RangeState | undefined>>;
44
+ startCell?: IPositionCell;
45
+ setStartCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
46
+ endCell?: IPositionCell;
47
+ setEndCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
48
+ startPasteCell?: IPositionCell;
49
+ setStartPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
50
+ endPasteCell?: IPositionCell;
51
+ setEndPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
52
+ isSelecting?: boolean;
53
+ setIsSelecting?: Dispatch<SetStateAction<boolean>>;
54
+ isPasting?: boolean;
55
+ setIsPasting?: Dispatch<SetStateAction<boolean>>;
56
+ focusedCell?: IPositionCell;
57
+ setFocusedCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
58
+ triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
59
+ handleDeleteContent?: () => void;
60
+ handleAddMulti?: (item: any, n: number, id?: string) => void;
61
+ dataErrors?: any[];
62
+ }
63
+ export declare const TableContext: import("react").Context<IContext<any>>;
64
+ export type ContextCellChange = {
65
+ key: string;
66
+ record: any;
67
+ field: string | undefined;
68
+ option: any;
69
+ indexRow: number;
70
+ indexCol: number;
71
+ newState?: any;
72
+ prevState?: any;
73
+ type: 'enter' | 'blur' | 'outClick';
74
+ };
@@ -0,0 +1,15 @@
1
+ import { createContext } from 'react';
2
+ export const TableContext = /*#__PURE__*/createContext({
3
+ prefix: 'ui-rc',
4
+ id: '',
5
+ rowKey: 'rowId',
6
+ dataSource: [],
7
+ originData: [],
8
+ expanded: {},
9
+ // triggerFilter: () => { },
10
+
11
+ setIsSelectionChange: () => {},
12
+ setSorterChange: () => {},
13
+ setFilterChange: () => {},
14
+ setExpanded: () => {}
15
+ });
package/lib/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export { default as Splitter } from './splitter';
16
16
  export type { SplitterProps } from './splitter';
17
17
  export { default as Collapse } from './collapse';
18
18
  export type { CollapsePanelProps, CollapseProps } from './collapse';
19
+ export { default as TableComponent } from './table-component';
package/lib/index.js CHANGED
@@ -52,6 +52,12 @@ Object.defineProperty(exports, "Splitter", {
52
52
  return _splitter.default;
53
53
  }
54
54
  });
55
+ Object.defineProperty(exports, "TableComponent", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _tableComponent.default;
59
+ }
60
+ });
55
61
  Object.defineProperty(exports, "Tabs", {
56
62
  enumerable: true,
57
63
  get: function () {
@@ -66,4 +72,5 @@ var _select = _interopRequireDefault(require("./select"));
66
72
  var _dateRangePicker = _interopRequireDefault(require("./date-range-picker"));
67
73
  var _datepicker = _interopRequireDefault(require("./datepicker"));
68
74
  var _splitter = _interopRequireDefault(require("./splitter"));
69
- var _collapse = _interopRequireDefault(require("./collapse"));
75
+ var _collapse = _interopRequireDefault(require("./collapse"));
76
+ var _tableComponent = _interopRequireDefault(require("./table-component"));
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { ColumnsTable, ColumnTable } from "./type";
3
+ import type { ColumnDef } from "@tanstack/react-table";
4
+ export type IColumnsChoose<RecordType> = {
5
+ columns: ColumnDef<RecordType>[];
6
+ originColumns: ColumnTable[];
7
+ columnsGroup?: string[];
8
+ triggerChangeColumns?: (columns: ColumnsTable<RecordType>, keys: string[], type: string) => void;
9
+ t?: any;
10
+ triggerChangeKeys?: any;
11
+ columnHidden: any;
12
+ };
13
+ export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;