aio-table 9.0.0 → 9.1.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.
- package/index.css +226 -0
- package/index.d.ts +98 -139
- package/index.js +449 -523
- package/package.json +1 -1
package/index.css
CHANGED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--aio-table-color: #0069ff;
|
|
3
|
+
--aio-table-transition: 0.3s;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.aio-table-rtl {
|
|
7
|
+
direction: rtl;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.aio-table .aio-table-text {
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.aio-table-color input {
|
|
15
|
+
width: 100%;
|
|
16
|
+
padding: 0;
|
|
17
|
+
margin: 0;
|
|
18
|
+
border: none;
|
|
19
|
+
outline: none;
|
|
20
|
+
-webkit-appearance: none;
|
|
21
|
+
-moz-appearance: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.aio-table-color img {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.aio-table-color input::-webkit-color-swatch {
|
|
30
|
+
border: none;
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.aio-table {
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
border-radius: 4px;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
height: fit-content;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
width: 100%;
|
|
42
|
+
background: #eee;
|
|
43
|
+
color: #888;
|
|
44
|
+
padding: 0;
|
|
45
|
+
border: 1px solid #eee;
|
|
46
|
+
gap: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.aio-table .aio-table {
|
|
50
|
+
color: inherit;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.aio-table-unit {
|
|
54
|
+
width: 100%;
|
|
55
|
+
flex: 1;
|
|
56
|
+
overflow: auto;
|
|
57
|
+
display:flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.aio-table-header {
|
|
62
|
+
top: 0;
|
|
63
|
+
display: flex;
|
|
64
|
+
position: sticky;
|
|
65
|
+
position: -webkit-sticky;
|
|
66
|
+
z-index: 10;
|
|
67
|
+
background: #f8f8f8;
|
|
68
|
+
min-width: fit-content;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.aio-table-title {
|
|
72
|
+
padding: 0 12px;
|
|
73
|
+
font-weight: bold;
|
|
74
|
+
height: 36px;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.aio-table-title-justify {
|
|
83
|
+
padding: 0;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
}
|
|
86
|
+
.aio-table-rows{
|
|
87
|
+
display:flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap:1px;
|
|
90
|
+
}
|
|
91
|
+
.aio-table-row {
|
|
92
|
+
display: flex;
|
|
93
|
+
min-width: fit-content;
|
|
94
|
+
}
|
|
95
|
+
.aio-table-cell {
|
|
96
|
+
padding: 6px 12px;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
min-height: 24px;
|
|
102
|
+
gap:6px;
|
|
103
|
+
background:#fff;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.aio-table-cell-before{
|
|
107
|
+
display:flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
}
|
|
111
|
+
.aio-table-cell-after{
|
|
112
|
+
display:flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
}
|
|
116
|
+
.aio-table-cell-value{
|
|
117
|
+
flex:1;
|
|
118
|
+
display:flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
}
|
|
121
|
+
.aio-table-cell-value.has-subtext:after {
|
|
122
|
+
content: attr(data-subtext);
|
|
123
|
+
font-size: 85%;
|
|
124
|
+
opacity: 0.7;
|
|
125
|
+
}
|
|
126
|
+
.aio-table-cell .aio-table-container {
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.aio-table-cell .aio-table {
|
|
131
|
+
width: 100%;
|
|
132
|
+
background: none;
|
|
133
|
+
border: none;
|
|
134
|
+
border-radius: 0;
|
|
135
|
+
background: none;
|
|
136
|
+
height: 100%;
|
|
137
|
+
min-height: 30px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.aio-table-cell .aio-table input {
|
|
141
|
+
padding: 0;
|
|
142
|
+
background: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.aio-table-cell-justify.aio-table-cell{
|
|
146
|
+
padding: 0 !important;
|
|
147
|
+
}
|
|
148
|
+
.aio-table-cell-justify .aio-table-cell-value{
|
|
149
|
+
padding: 0;
|
|
150
|
+
align-items: center;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.aio-table-cell-justify > input {
|
|
154
|
+
text-align: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.aio-table-toolbar {
|
|
158
|
+
left: 0;
|
|
159
|
+
display: flex;
|
|
160
|
+
width: 100%;
|
|
161
|
+
align-items: center;
|
|
162
|
+
background: #f8f8f8;
|
|
163
|
+
z-index: 100;
|
|
164
|
+
box-sizing: border-box;
|
|
165
|
+
min-height: 36px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.aio-table-toolbar-content {
|
|
169
|
+
font-weight: bold;
|
|
170
|
+
padding: 0 12px;
|
|
171
|
+
height: 100%;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.aio-table-toolbar-button {
|
|
177
|
+
height: 100%;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
min-width: 36px;
|
|
182
|
+
border: none;
|
|
183
|
+
background: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
.aio-table-remove {
|
|
189
|
+
border: none;
|
|
190
|
+
width: 36px;
|
|
191
|
+
background: none;
|
|
192
|
+
color: inherit;
|
|
193
|
+
align-items: center;
|
|
194
|
+
display: flex;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.aio-table-remove-title {
|
|
198
|
+
border: none;
|
|
199
|
+
width: 36px;
|
|
200
|
+
background: none;
|
|
201
|
+
color: inherit;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.aio-table-border-h {
|
|
205
|
+
height: 1px;
|
|
206
|
+
flex-shrink: 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.aio-table-border-v {
|
|
210
|
+
width: 1px;
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.aio-table-search {
|
|
215
|
+
flex: 1;
|
|
216
|
+
height: 100%;
|
|
217
|
+
padding: 6px;
|
|
218
|
+
box-sizing: border-box;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.aio-table-search .aio-input {
|
|
222
|
+
background: #fff;
|
|
223
|
+
border: none;
|
|
224
|
+
min-height: 30px;
|
|
225
|
+
}
|
|
226
|
+
|
package/index.d.ts
CHANGED
|
@@ -1,139 +1,98 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import
|
|
3
|
-
import "
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
onSwap?: true | ((newValue: T[], startRow: T, endRow: T) => void);
|
|
100
|
-
onSearch?: true | ((searchValue: string) => void);
|
|
101
|
-
paging?: AI_table_paging;
|
|
102
|
-
removeText?: string;
|
|
103
|
-
rowAfter?: (p: {
|
|
104
|
-
row: T;
|
|
105
|
-
rowIndex: number;
|
|
106
|
-
}) => ReactNode;
|
|
107
|
-
rowAttrs?: (p: {
|
|
108
|
-
row: T;
|
|
109
|
-
rowIndex: number;
|
|
110
|
-
}) => any;
|
|
111
|
-
rowBefore?: (p: {
|
|
112
|
-
row: T;
|
|
113
|
-
rowIndex: number;
|
|
114
|
-
}) => ReactNode;
|
|
115
|
-
rowGap?: number;
|
|
116
|
-
rowsTemplate?: (rows: T[]) => ReactNode;
|
|
117
|
-
rowTemplate?: (p: {
|
|
118
|
-
row: T;
|
|
119
|
-
rowIndex: number;
|
|
120
|
-
isLast: boolean;
|
|
121
|
-
}) => ReactNode;
|
|
122
|
-
toolbar?: ReactNode | (() => ReactNode);
|
|
123
|
-
toolbarAttrs?: any;
|
|
124
|
-
tabIndex?: number;
|
|
125
|
-
value: T[];
|
|
126
|
-
onChange?: (v: T[]) => void;
|
|
127
|
-
className?: string;
|
|
128
|
-
style?: any;
|
|
129
|
-
attrs?: any;
|
|
130
|
-
onRemove?: true | ((p: {
|
|
131
|
-
row: T;
|
|
132
|
-
action?: Function;
|
|
133
|
-
rowIndex?: number;
|
|
134
|
-
parent?: T;
|
|
135
|
-
}) => Promise<boolean | void>);
|
|
136
|
-
placeholder?: ReactNode;
|
|
137
|
-
};
|
|
138
|
-
declare const AIOTable: <T>(rootProps: I_AIOTable<T>) => JSX.Element;
|
|
139
|
-
export default AIOTable;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
import { I_filter, I_filter_item, I_filter_saved_item, I_paging, I_sort } from "../../aio-component-utils";
|
|
4
|
+
type I_rowOption<T, R> = (p: I_rowDetail<T>) => R;
|
|
5
|
+
type I_cellOption<T, R> = ((p: I_cellDetail<T>) => R) | string;
|
|
6
|
+
type I_rowDetail<T> = {
|
|
7
|
+
row: T;
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
isFirst: boolean;
|
|
10
|
+
isLast: boolean;
|
|
11
|
+
};
|
|
12
|
+
type I_cellDetail<T> = I_rowDetail<T> & {
|
|
13
|
+
column: I_table_column<T>;
|
|
14
|
+
change: (newRow: T) => void;
|
|
15
|
+
isDate: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type I_table_paging = I_paging;
|
|
18
|
+
export type I_table_sort<T> = I_sort<T>;
|
|
19
|
+
export type I_table_filter = I_filter;
|
|
20
|
+
export type I_table_filter_item = I_filter_item;
|
|
21
|
+
export type I_table_filter_saved_item = I_filter_saved_item;
|
|
22
|
+
export type I_table_column<T> = {
|
|
23
|
+
title?: any;
|
|
24
|
+
sort?: true | I_table_sort<T>;
|
|
25
|
+
filterId?: string;
|
|
26
|
+
search?: boolean;
|
|
27
|
+
id?: string;
|
|
28
|
+
_id?: string;
|
|
29
|
+
width?: any;
|
|
30
|
+
minWidth?: any;
|
|
31
|
+
excel?: string | boolean;
|
|
32
|
+
justify?: boolean;
|
|
33
|
+
value?: string;
|
|
34
|
+
attrs?: I_cellOption<T, {
|
|
35
|
+
[attrs: string]: any;
|
|
36
|
+
}>;
|
|
37
|
+
before?: I_cellOption<T, ReactNode>;
|
|
38
|
+
after?: I_cellOption<T, ReactNode>;
|
|
39
|
+
subtext?: I_cellOption<T, ReactNode>;
|
|
40
|
+
template?: I_cellOption<T, ReactNode>;
|
|
41
|
+
titleAttrs?: {
|
|
42
|
+
[attrs: string]: any;
|
|
43
|
+
};
|
|
44
|
+
type?: 'text' | 'number' | 'month' | 'day' | 'hour' | 'minute';
|
|
45
|
+
};
|
|
46
|
+
export type I_table<T> = {
|
|
47
|
+
fa?: boolean;
|
|
48
|
+
addText?: ReactNode | ((value: any) => ReactNode);
|
|
49
|
+
columns?: I_table_column<T>[];
|
|
50
|
+
excel?: string | ((value: any[]) => any[]);
|
|
51
|
+
getValue?: {
|
|
52
|
+
[key: string]: (p: {
|
|
53
|
+
row: T;
|
|
54
|
+
column: I_table_column<T>;
|
|
55
|
+
rowIndex: number;
|
|
56
|
+
change: (newRow: T) => void;
|
|
57
|
+
}) => any;
|
|
58
|
+
};
|
|
59
|
+
headerAttrs?: any;
|
|
60
|
+
onAdd?: () => Promise<T | undefined>;
|
|
61
|
+
onRemove?: (p: {
|
|
62
|
+
row: T;
|
|
63
|
+
rowIndex?: number;
|
|
64
|
+
}) => Promise<boolean>;
|
|
65
|
+
onChangePaging?: (newPaging: I_table_paging) => void;
|
|
66
|
+
onChangeSort?: (sorts: I_table_sort<T>[]) => Promise<boolean>;
|
|
67
|
+
onSwap?: true | ((newValue: T[], startRow: T, endRow: T) => void);
|
|
68
|
+
onSearch?: true | ((searchValue: string) => void);
|
|
69
|
+
paging?: I_table_paging;
|
|
70
|
+
removeText?: string;
|
|
71
|
+
rowOption?: {
|
|
72
|
+
before?: I_rowOption<T, ReactNode>;
|
|
73
|
+
after?: I_rowOption<T, ReactNode>;
|
|
74
|
+
attrs?: I_rowOption<T, {
|
|
75
|
+
[attrs: string]: any;
|
|
76
|
+
}>;
|
|
77
|
+
template?: I_rowOption<T, ReactNode>;
|
|
78
|
+
};
|
|
79
|
+
cellAttrs?: string | ((p: {
|
|
80
|
+
row: T;
|
|
81
|
+
column: I_table_column<T>;
|
|
82
|
+
rowIndex: number;
|
|
83
|
+
}) => any);
|
|
84
|
+
rowsTemplate?: (rows: T[]) => ReactNode;
|
|
85
|
+
toolbar?: ReactNode | (() => ReactNode);
|
|
86
|
+
toolbarAttrs?: any;
|
|
87
|
+
tabIndex?: number;
|
|
88
|
+
value: T[];
|
|
89
|
+
onChange?: (v: T[]) => void;
|
|
90
|
+
className?: string;
|
|
91
|
+
style?: any;
|
|
92
|
+
attrs?: any;
|
|
93
|
+
placeholder?: ReactNode;
|
|
94
|
+
filter?: I_table_filter;
|
|
95
|
+
gap?: [number, number];
|
|
96
|
+
};
|
|
97
|
+
declare const AIOTable: <T>(props: I_table<T>) => JSX.Element;
|
|
98
|
+
export default AIOTable;
|