es-grid-template 0.0.7 → 0.0.8
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.
- package/es/CheckboxFilter.d.ts +1 -1
- package/es/CheckboxFilter.js +7 -10
- package/es/ColumnsChoose.d.ts +2 -3
- package/es/ColumnsChoose.js +65 -69
- package/es/FilterSearch.js +1 -1
- package/es/{GridTable.d.ts → InternalTable.d.ts} +2 -2
- package/es/InternalTable.js +185 -0
- package/es/LoadingSpinner.d.ts +3 -0
- package/es/LoadingSpinner.js +20 -0
- package/es/TableGrid.d.ts +10 -0
- package/es/{GridTable.js → TableGrid.js} +395 -267
- package/es/hooks/constant.js +1 -1
- package/es/hooks/utils.d.ts +2 -1
- package/es/hooks/utils.js +23 -3
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/styles.scss +287 -21
- package/es/type.d.ts +17 -5
- package/lib/CheckboxFilter.d.ts +1 -1
- package/lib/CheckboxFilter.js +11 -13
- package/lib/ColumnsChoose.d.ts +2 -3
- package/lib/ColumnsChoose.js +65 -69
- package/lib/FilterSearch.js +2 -2
- package/lib/{GridTable.d.ts → InternalTable.d.ts} +2 -2
- package/lib/InternalTable.js +194 -0
- package/lib/LoadingSpinner.d.ts +3 -0
- package/lib/LoadingSpinner.js +29 -0
- package/lib/TableGrid.d.ts +10 -0
- package/lib/{GridTable.js → TableGrid.js} +401 -274
- package/lib/hooks/constant.js +1 -1
- package/lib/hooks/utils.d.ts +2 -1
- package/lib/hooks/utils.js +26 -5
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/styles.scss +287 -21
- package/lib/type.d.ts +17 -5
- package/package.json +6 -4
package/es/hooks/constant.js
CHANGED
package/es/hooks/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
import type { EditType, IColumnType, TypeFilter } from "ui
|
|
2
|
+
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
3
3
|
import type { ColumnType } from "../type";
|
|
4
4
|
export declare const sumDataByField: (data: any[], field: string) => any;
|
|
5
5
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
@@ -16,3 +16,4 @@ export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[
|
|
|
16
16
|
export declare const updateColumns: (columns: any[], includes: string[]) => any[];
|
|
17
17
|
export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType, col: ColumnType<any>) => string;
|
|
18
18
|
export declare const getTypeFilter: (col: ColumnType<any>) => TypeFilter;
|
|
19
|
+
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
|
package/es/hooks/utils.js
CHANGED
|
@@ -126,6 +126,9 @@ export const updateColumns = (columns, includes) => {
|
|
|
126
126
|
...column
|
|
127
127
|
};
|
|
128
128
|
let hasVisibleChild = false;
|
|
129
|
+
if (!column.key && !column.dataIndex) {
|
|
130
|
+
return column;
|
|
131
|
+
}
|
|
129
132
|
if (newColumn.children) {
|
|
130
133
|
newColumn.children = updateColumns(newColumn.children, includes);
|
|
131
134
|
hasVisibleChild = newColumn.children.some(child => !child.hidden);
|
|
@@ -164,10 +167,10 @@ export const getDatepickerFormat = (type, col) => {
|
|
|
164
167
|
}
|
|
165
168
|
};
|
|
166
169
|
export const getTypeFilter = col => {
|
|
167
|
-
if (col
|
|
170
|
+
if (col?.typeFilter) {
|
|
168
171
|
return col.typeFilter;
|
|
169
172
|
}
|
|
170
|
-
const type = col
|
|
173
|
+
const type = col?.type ?? 'Text';
|
|
171
174
|
switch (type) {
|
|
172
175
|
case "number":
|
|
173
176
|
return 'Number';
|
|
@@ -181,7 +184,7 @@ export const getTypeFilter = col => {
|
|
|
181
184
|
return 'Checkbox';
|
|
182
185
|
|
|
183
186
|
// case "week": return ''
|
|
184
|
-
// case "month": return
|
|
187
|
+
// case "month": return 'Month'
|
|
185
188
|
// case "quarter": return col.format?.dateFormat ? col.format?.dateFormat : 'DD/MM/YYYY'
|
|
186
189
|
// case "year": return col.format?.yearFormat ? col.format?.yearFormat : 'YYYY'
|
|
187
190
|
// case "time": return col.format?.timeFormat ? col.format?.timeFormat : 'HH:mm'
|
|
@@ -189,4 +192,21 @@ export const getTypeFilter = col => {
|
|
|
189
192
|
default:
|
|
190
193
|
return 'Text';
|
|
191
194
|
}
|
|
195
|
+
};
|
|
196
|
+
export const updateArrayByKey = (arr, element, key) => {
|
|
197
|
+
if (arr) {
|
|
198
|
+
return arr.map(item => {
|
|
199
|
+
if (item[key] === element[key]) {
|
|
200
|
+
return {
|
|
201
|
+
...item,
|
|
202
|
+
...element
|
|
203
|
+
};
|
|
204
|
+
} else if (item.children && item.children.length > 0) {
|
|
205
|
+
item.children = updateArrayByKey(item.children, element, key);
|
|
206
|
+
}
|
|
207
|
+
return item;
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
192
212
|
};
|
package/es/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default
|
|
1
|
+
import InternalTable from './InternalTable';
|
|
2
|
+
export default InternalTable;
|
package/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default
|
|
1
|
+
import InternalTable from "./InternalTable";
|
|
2
|
+
export default InternalTable;
|
package/es/styles.scss
CHANGED
|
@@ -1,30 +1,296 @@
|
|
|
1
|
-
$prefix
|
|
1
|
+
$prefix: 'ui-rc' !default;
|
|
2
|
+
$primary: #eb4619 !default;
|
|
3
|
+
$rowHoverBg: #FBDED6 !default;
|
|
4
|
+
$rowSelectedBg: #FEF2EF !default;
|
|
5
|
+
$tableBorderColor: #e0e0e0 !default;
|
|
6
|
+
//$rowSelectedHoverBg: 'ui-rc' !default;
|
|
7
|
+
|
|
8
|
+
|
|
2
9
|
.popup-context-menu {
|
|
3
10
|
min-width: 200px;
|
|
4
11
|
}
|
|
5
12
|
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
.react-resizable {
|
|
14
|
+
position: relative;
|
|
15
|
+
background-clip: padding-box;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.react-resizable-handle {
|
|
19
|
+
position: absolute;
|
|
20
|
+
right: -5px;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
width: 10px;
|
|
24
|
+
height: 100%;
|
|
25
|
+
cursor: col-resize;
|
|
26
|
+
//transform: translateY(-50%);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// -------------- Table -------------
|
|
30
|
+
.#{$prefix}-table-wrapper {
|
|
31
|
+
&.table-none-column-select {
|
|
32
|
+
.#{$prefix}-table-cell {
|
|
33
|
+
&.#{$prefix}-table-selection-column {
|
|
34
|
+
padding: 0 !important;
|
|
35
|
+
overflow: hidden !important;
|
|
36
|
+
border-inline-end: 0 !important;
|
|
37
|
+
//flex: 0 0 0 !important;
|
|
38
|
+
//width: 0 !important;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.#{$prefix}-table-tbody {
|
|
44
|
+
.#{$prefix}-table-row {
|
|
45
|
+
&.#{$prefix}-table-row-selected {
|
|
46
|
+
>.#{$prefix}-table-cell {
|
|
47
|
+
background: #FEF2EF;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
>.#{$prefix}-table-cell {
|
|
51
|
+
&.#{$prefix}-table-cell-row-hover {
|
|
52
|
+
background: #FBDED6;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.#{$prefix}-table-tbody-virtual {
|
|
59
|
+
.#{$prefix}-table-cell {
|
|
60
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.#{$prefix}-table-bordered {
|
|
65
|
+
|
|
66
|
+
.#{$prefix}-table-tbody-virtual {
|
|
67
|
+
.#{$prefix}-table-cell {
|
|
68
|
+
border-inline-end: 1px solid $tableBorderColor;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
.#{$prefix}-table {
|
|
76
|
+
&.#{$prefix}-table-bordered {
|
|
77
|
+
> .#{$prefix}-table-container {
|
|
78
|
+
|
|
79
|
+
> .#{$prefix}-table-content,
|
|
80
|
+
> .#{$prefix}-table-header,
|
|
81
|
+
> .#{$prefix}-table-body,
|
|
82
|
+
> .#{$prefix}-table-summary {
|
|
83
|
+
> table {
|
|
84
|
+
> thead {
|
|
85
|
+
> tr:not(:last-child) {
|
|
86
|
+
> th {
|
|
87
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
border-inline-start: 1px solid $tableBorderColor;
|
|
95
|
+
border-top: 1px solid $tableBorderColor;
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
> .#{$prefix}-table-content,
|
|
99
|
+
> .#{$prefix}-table-header,
|
|
100
|
+
> .#{$prefix}-table-body,
|
|
101
|
+
> .#{$prefix}-table-summary {
|
|
102
|
+
> table {
|
|
103
|
+
> thead,
|
|
104
|
+
> tbody,
|
|
105
|
+
> tfoot {
|
|
106
|
+
> tr {
|
|
107
|
+
> th,
|
|
108
|
+
> td {
|
|
109
|
+
border-inline-end: 1px solid $tableBorderColor;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
>.#{$prefix}-table-title {
|
|
119
|
+
border: 1px solid $tableBorderColor;
|
|
120
|
+
border-bottom: 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
.#{$prefix}-table-thead >tr>th,
|
|
127
|
+
.#{$prefix}-table-thead >tr>td {
|
|
128
|
+
background-color: #ffffff;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.#{$prefix}-table-thead {
|
|
132
|
+
> tr {
|
|
133
|
+
> th,
|
|
134
|
+
> td {
|
|
135
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.#{$prefix}-table-summary {
|
|
141
|
+
.#{$prefix}-table-cell {
|
|
142
|
+
background-color: #fafafa;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
> tr > td {
|
|
146
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.#{$prefix}-table-bordered .#{$prefix}-table-tbody-virtual .#{$prefix}-table-cell.#{$prefix}-table-cell-fix-right-first:before {
|
|
151
|
+
border-inline-start: 1px solid $tableBorderColor;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.#{$prefix}-table.#{$prefix}-table-bordered {
|
|
155
|
+
> .#{$prefix}-table-container {
|
|
156
|
+
> .#{$prefix}-table-header > table > thead > tr,
|
|
157
|
+
> .#{$prefix}-table-summary > table > tfoot > tr {
|
|
158
|
+
> .#{$prefix}-table-cell-fix-right-first::before {
|
|
159
|
+
border-inline-start: 1px solid $tableBorderColor;
|
|
160
|
+
content: "";
|
|
161
|
+
position: absolute;
|
|
162
|
+
inset-block: 0;
|
|
163
|
+
inset-inline-start: -1px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
.#{$prefix}-table.#{$prefix}-table-bordered {
|
|
171
|
+
> .#{$prefix}-table-container {
|
|
172
|
+
> .#{$prefix}-table-header > table > thead > tr,
|
|
173
|
+
> .#{$prefix}-table-summary > table > tfoot > tr {
|
|
174
|
+
> .#{$prefix}-table-cell-fix-right-first::after {
|
|
175
|
+
border-inline-end: 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
15
178
|
}
|
|
16
179
|
}
|
|
180
|
+
|
|
181
|
+
.#{$prefix}-table-ping-left {
|
|
182
|
+
.#{$prefix}-table-cell-fix-left-first::after,
|
|
183
|
+
.#{$prefix}-table-cell-fix-left-last::after {
|
|
184
|
+
box-shadow: inset 10px 0 8px -8px rgba(5, 5, 5, 0.2);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.#{$prefix}-table-ping-right {
|
|
189
|
+
.#{$prefix}-table-cell-fix-right-first::after,
|
|
190
|
+
.#{$prefix}-table-cell-fix-right-last::after {
|
|
191
|
+
box-shadow: inset -10px 0 8px -8px rgba(5, 5, 5, 0.2);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.#{$prefix}-spin-nested-loading >div>.#{$prefix}-spin {
|
|
196
|
+
max-height: 100%;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// -------------- Checkbox ----------
|
|
203
|
+
|
|
204
|
+
.#{$prefix}-checkbox-indeterminate {
|
|
205
|
+
&:hover {
|
|
206
|
+
.#{$prefix}-checkbox-inner {
|
|
207
|
+
border-color: $primary !important; ;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
.#{$prefix}-checkbox-inner {
|
|
211
|
+
&:after {
|
|
212
|
+
background-color: $primary;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.#{$prefix}-checkbox {
|
|
218
|
+
&.#{$prefix}-checkbox-checked {
|
|
219
|
+
&:hover {
|
|
220
|
+
.#{$prefix}-checkbox-inner {
|
|
221
|
+
background-color: $primary;
|
|
222
|
+
border-color: $primary;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
.#{$prefix}-checkbox-inner {
|
|
226
|
+
background-color: $primary;
|
|
227
|
+
border-color: $primary;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.#{$prefix}-checkbox:not(.#{$prefix}-checkbox-disabled):hover {
|
|
233
|
+
.#{$prefix}-checkbox-inner {
|
|
234
|
+
border-color: $primary;
|
|
235
|
+
}
|
|
17
236
|
}
|
|
237
|
+
|
|
238
|
+
.#{$prefix}-checkbox-wrapper:not(.#{$prefix}-checkbox-wrapper-disabled):hover {
|
|
239
|
+
.#{$prefix}-checkbox-inner {
|
|
240
|
+
border-color: $primary;
|
|
241
|
+
}
|
|
242
|
+
.#{$prefix}-checkbox-checked:not(.#{$prefix}-checkbox-disabled) {
|
|
243
|
+
.#{$prefix}-checkbox-inner {
|
|
244
|
+
background-color: $primary;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
18
247
|
}
|
|
19
248
|
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
249
|
+
// ------------ Tree ---------------
|
|
250
|
+
|
|
251
|
+
.#{$prefix}-tree {
|
|
252
|
+
.#{$prefix}-tree-checkbox-checked {
|
|
253
|
+
.#{$prefix}-tree-checkbox-inner {
|
|
254
|
+
background-color: $primary;
|
|
255
|
+
border-color: $primary;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.#{$prefix}-tree-checkbox-wrapper-checked:not(.#{$prefix}-tree-checkbox-wrapper-disabled):hover,
|
|
260
|
+
.#{$prefix}-tree-checkbox-checked:not(.#{$prefix}-tree-checkbox-disabled):hover {
|
|
261
|
+
.#{$prefix}-tree-checkbox-inner {
|
|
262
|
+
background-color: $primary;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.#{$prefix}-tree-checkbox-wrapper:not(.#{$prefix}-tree-checkbox-wrapper-disabled):hover,
|
|
267
|
+
.#{$prefix}-tree-checkbox:not(.#{$prefix}-tree-checkbox-disabled):hover {
|
|
268
|
+
.#{$prefix}-tree-checkbox-inner {
|
|
269
|
+
border-color: $primary;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
.#{$prefix}-pagination {
|
|
278
|
+
&::before {
|
|
279
|
+
content: "";
|
|
280
|
+
position: absolute;
|
|
281
|
+
border-left: 1px solid $tableBorderColor;
|
|
282
|
+
height: 55px;
|
|
283
|
+
bottom: 0;
|
|
284
|
+
left: 0;
|
|
285
|
+
}
|
|
286
|
+
&::after {
|
|
287
|
+
content: "";
|
|
288
|
+
position: absolute;
|
|
289
|
+
border-left: 1px solid $tableBorderColor;
|
|
290
|
+
height: 55px;
|
|
291
|
+
bottom: 0;
|
|
292
|
+
visibility: visible;
|
|
293
|
+
right: 0;
|
|
294
|
+
}
|
|
295
|
+
border-bottom: 1px solid $tableBorderColor;
|
|
296
|
+
}
|
package/es/type.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { TableProps, TableColumnType as RcColumnType } from "ui-rc";
|
|
2
1
|
import type { Key, ReactElement, ReactNode } from "react";
|
|
3
2
|
import type React from "react";
|
|
4
3
|
import type { IOperator } from "./hooks";
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
4
|
+
import type { TypeFilter, TableProps, TableColumnType as RcColumnType } from "rc-master-ui";
|
|
5
|
+
import type { FilterOperator, TableRowSelection } from "rc-master-ui/es/table/interface";
|
|
6
|
+
import type { ToolbarItem } from "rc-master-ui/es/toolbar";
|
|
7
|
+
import type { ItemType } from "rc-master-ui/es/menu/interface";
|
|
8
8
|
export type IColumnType = "number" | "time" | "date" | "week" | "month" | "file" | "quarter" | "year" | "datetime" | "string" | "boolean" | "checkbox" | "color" | null | undefined;
|
|
9
9
|
export type AnyObject = Record<PropertyKey, any>;
|
|
10
10
|
export interface ColumnGroupType<RecordType = AnyObject> extends Omit<ColumnType<RecordType>, 'dataIndex'> {
|
|
@@ -20,9 +20,12 @@ export type ColumnType<RecordType> = RcColumnType<RecordType> & {
|
|
|
20
20
|
operator?: FilterOperator;
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
showInColumnChoose?: boolean;
|
|
23
|
+
typeFilter?: TypeFilter;
|
|
24
|
+
children?: ColumnsType<RecordType>;
|
|
25
|
+
headerText?: string;
|
|
23
26
|
};
|
|
24
27
|
export type ColumnsType<RecordType = AnyObject> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[];
|
|
25
|
-
export interface GridTableProps<RecordType> extends Omit<TableProps<RecordType>, 'columns' | 'rowSelection'> {
|
|
28
|
+
export interface GridTableProps<RecordType> extends Omit<TableProps<RecordType>, 'columns' | 'rowSelection' | 'loading'> {
|
|
26
29
|
columns?: ColumnsType<RecordType>;
|
|
27
30
|
format?: IFormat;
|
|
28
31
|
t?: any;
|
|
@@ -49,7 +52,16 @@ export interface GridTableProps<RecordType> extends Omit<TableProps<RecordType>,
|
|
|
49
52
|
rowData: RecordType;
|
|
50
53
|
selected: RecordType | RecordType[];
|
|
51
54
|
}) => void;
|
|
55
|
+
dataSourceFilter?: SourceFilter[];
|
|
56
|
+
onFilterClick?: (column: ColumnType<RecordType>, callback: (key: string, data: any) => void) => void;
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
allowResizing?: boolean;
|
|
52
59
|
}
|
|
60
|
+
export type SourceFilter = {
|
|
61
|
+
key: string;
|
|
62
|
+
data: any[];
|
|
63
|
+
loadOptions?: (search: string, callback: (newOptions: any[]) => void) => void;
|
|
64
|
+
};
|
|
53
65
|
export type RowSelection<RecordType> = Omit<TableRowSelection<RecordType>, 'type' | 'columnWidth' | 'hideSelectAll' | 'defaultSelectedRowKeys'>;
|
|
54
66
|
export type SelectionSettings = {
|
|
55
67
|
mode?: 'checkbox' | 'radio';
|
package/lib/CheckboxFilter.d.ts
CHANGED
package/lib/CheckboxFilter.js
CHANGED
|
@@ -8,15 +8,12 @@ exports.default = void 0;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _FilterSearch = _interopRequireDefault(require("./FilterSearch"));
|
|
11
|
-
var
|
|
11
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
12
12
|
var _antd = require("antd");
|
|
13
|
-
var _useFilter = require("
|
|
13
|
+
var _useFilter = require("rc-master-ui/es/table/hooks/useFilter");
|
|
14
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
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
|
-
// import
|
|
17
|
-
|
|
18
|
-
// import Empty from "ui-rc/dist/empty";
|
|
19
|
-
// import Tree from "ui-rc/dist/tree";
|
|
16
|
+
// import Tree from "rc-master-ui/es/tree";
|
|
20
17
|
|
|
21
18
|
function searchValueMatched(searchValue, text) {
|
|
22
19
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
@@ -49,7 +46,7 @@ function renderFilterItems({
|
|
|
49
46
|
})
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
|
-
const Component = filterMultiple ?
|
|
49
|
+
const Component = filterMultiple ? _rcMasterUi.Checkbox : _rcMasterUi.Radio;
|
|
53
50
|
const item = {
|
|
54
51
|
key: filter.value !== undefined ? key : index,
|
|
55
52
|
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, {
|
|
@@ -116,8 +113,8 @@ const CheckboxFilter = props => {
|
|
|
116
113
|
[`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(options || [])
|
|
117
114
|
});
|
|
118
115
|
console.log('selectedKeys', selectedKeys);
|
|
119
|
-
const empty = /*#__PURE__*/React.createElement(
|
|
120
|
-
image:
|
|
116
|
+
const empty = /*#__PURE__*/React.createElement(_rcMasterUi.Empty, {
|
|
117
|
+
image: _rcMasterUi.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
121
118
|
description: locale.filterEmptyText,
|
|
122
119
|
imageStyle: {
|
|
123
120
|
height: 24
|
|
@@ -161,10 +158,11 @@ const CheckboxFilter = props => {
|
|
|
161
158
|
children: node.children?.map(item => getFilterData(item)) || []
|
|
162
159
|
});
|
|
163
160
|
const onCheckAll = e => {
|
|
164
|
-
console.log('e.target.checked', e.target.checked)
|
|
161
|
+
// console.log('e.target.checked', e.target.checked)
|
|
165
162
|
if (e.target.checked) {
|
|
166
163
|
const allFilterKeys = (0, _useFilter.flattenKeys)(options).map(key => String(key));
|
|
167
|
-
|
|
164
|
+
|
|
165
|
+
// console.log('allFilterKeys', allFilterKeys)
|
|
168
166
|
// setFilteredKeysSync(allFilterKeys);
|
|
169
167
|
onSelect?.(allFilterKeys);
|
|
170
168
|
} else {
|
|
@@ -193,7 +191,7 @@ const CheckboxFilter = props => {
|
|
|
193
191
|
locale: locale
|
|
194
192
|
}), /*#__PURE__*/React.createElement("div", {
|
|
195
193
|
className: `${tablePrefixCls}-filter-dropdown-tree`
|
|
196
|
-
}, filterMultiple ? /*#__PURE__*/React.createElement(
|
|
194
|
+
}, filterMultiple ? /*#__PURE__*/React.createElement(_rcMasterUi.Checkbox
|
|
197
195
|
// checked={selectedKeys.length === flattenKeys(column.filters).length}
|
|
198
196
|
, {
|
|
199
197
|
checked: selectedKeys.length === (0, _useFilter.flattenKeys)(options).length
|
|
@@ -239,7 +237,7 @@ const CheckboxFilter = props => {
|
|
|
239
237
|
onChange: onSearch,
|
|
240
238
|
tablePrefixCls: tablePrefixCls,
|
|
241
239
|
locale: locale
|
|
242
|
-
}), isEmpty ? empty : /*#__PURE__*/React.createElement(
|
|
240
|
+
}), isEmpty ? empty : /*#__PURE__*/React.createElement(_rcMasterUi.Menu, {
|
|
243
241
|
selectable: true,
|
|
244
242
|
multiple: filterMultiple,
|
|
245
243
|
prefixCls: `${dropdownPrefixCls}-menu`,
|
package/lib/ColumnsChoose.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const BoxInputFilterColumn: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
import type { ColumnsType } from "./type";
|
|
5
4
|
export type IColumnsChoose<RecordType> = {
|
|
6
5
|
columns: any[];
|
|
7
|
-
setColumns: Dispatch<SetStateAction<
|
|
6
|
+
setColumns: Dispatch<SetStateAction<ColumnsType<RecordType>>>;
|
|
8
7
|
t?: any;
|
|
9
8
|
};
|
|
10
9
|
export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;
|