ados-rcm 1.0.8 → 1.0.10
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/dist/AModule/AComponents/ABase/ABase.d.ts +51 -16
- package/dist/AModule/AComponents/AButton/AButton.d.ts +15 -1
- package/dist/AModule/AComponents/AButton/AIconButton.d.ts +21 -7
- package/dist/AModule/AComponents/ACheckBox/ACheckBox.d.ts +18 -4
- package/dist/AModule/AComponents/AClock/AClock.d.ts +64 -0
- package/dist/AModule/AComponents/ADatePicker/ADatePicker.d.ts +92 -0
- package/dist/AModule/AComponents/ADatePicker/ADateRangePicker.d.ts +36 -13
- package/dist/AModule/AComponents/ADialog/ADialog.d.ts +133 -12
- package/dist/AModule/AComponents/AFileBox/AFileBox.d.ts +30 -0
- package/dist/AModule/AComponents/AFloatMenu/AFloatMenu.d.ts +107 -5
- package/dist/AModule/AComponents/AFrames/AFrames.d.ts +35 -4
- package/dist/AModule/AComponents/AGrow/AGrow.d.ts +10 -0
- package/dist/AModule/AComponents/AIcon/AIcon.d.ts +11 -7
- package/dist/AModule/AComponents/AInput/AInput.d.ts +95 -2
- package/dist/AModule/AComponents/AListView/AListView.d.ts +60 -7
- package/dist/AModule/AComponents/ASelect/ASelect.d.ts +118 -21
- package/dist/AModule/AComponents/ASpace/ASpace.d.ts +22 -0
- package/dist/AModule/AComponents/AStepper/AStepper.d.ts +64 -5
- package/dist/AModule/AComponents/ASwitch/ASwitch.d.ts +17 -0
- package/dist/AModule/AComponents/ATab/ATab.d.ts +62 -0
- package/dist/AModule/AComponents/ATable/ATable.d.ts +545 -18
- package/dist/AModule/AComponents/ATable/ATableBody.d.ts +2 -2
- package/dist/AModule/AComponents/AText/AText.d.ts +24 -0
- package/dist/AModule/AComponents/ATextArea/ATextArea.d.ts +77 -1
- package/dist/AModule/AComponents/ATooltip/ATooltip.d.ts +29 -2
- package/dist/AModule/AComponents/ATree/ATree.d.ts +122 -4
- package/dist/AModule/AComponents/ATypes/ATypes.d.ts +10 -4
- package/dist/AModule/AComponents/AWrap/AWrap.d.ts +28 -2
- package/dist/AModule/AUtils/cbF.d.ts +3 -3
- package/dist/index.cjs.js +15 -41
- package/dist/index.es.js +4377 -7995
- package/package.json +1 -1
|
@@ -1,34 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ATable
|
|
3
|
+
*
|
|
4
|
+
* Notice 1 : Defs Explanation
|
|
5
|
+
* - Keys of defs are used as each columns.
|
|
6
|
+
* - defaultDef is used as default for each columns, and will not be rendered.
|
|
7
|
+
* - def is calculated as {...defaultDef, ...def}.
|
|
8
|
+
*
|
|
9
|
+
* Notice 2 : Select and Check
|
|
10
|
+
* - Select and Check are different. not like ATree. careful.
|
|
11
|
+
*
|
|
12
|
+
* Notice 3 : entireItems and pagedItems
|
|
13
|
+
* - pagedItems is the items to be rendered.
|
|
14
|
+
* - pagedItems can be provided directly, or it can be calculated from entireItems.
|
|
15
|
+
* - entireItems is the entire items, and will be filtered, sorted, and paged to become the pagedItems.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* Todo 1 : Defs is declared as type. it would be better to declare as interface, but I couldn't find the way.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
4
21
|
import React from 'react';
|
|
5
22
|
import { TUseValues } from '../../AHooks/useValues';
|
|
23
|
+
import { TCanCallback } from '../../AUtils/cbF';
|
|
24
|
+
import { IItem } from '../../AUtils/objF';
|
|
6
25
|
import { Resources } from '../AResource/AResource';
|
|
26
|
+
import { TIdx } from '../ATypes/ATypes';
|
|
7
27
|
export interface IATableTHProps<T extends IItem> {
|
|
28
|
+
/**
|
|
29
|
+
* defKey : TIdx
|
|
30
|
+
* <br/>Description : defKey of the given defs
|
|
31
|
+
*/
|
|
8
32
|
defKey: TIdx;
|
|
33
|
+
/**
|
|
34
|
+
* def : IATableDef<T>
|
|
35
|
+
* <br/>Description : def of the given defs
|
|
36
|
+
*/
|
|
9
37
|
def: IATableDef<T>;
|
|
10
38
|
}
|
|
11
39
|
export interface IATableTRProps<T extends IItem> {
|
|
40
|
+
/**
|
|
41
|
+
* item : T
|
|
42
|
+
* <br/>Description : item of the given items
|
|
43
|
+
*/
|
|
12
44
|
item: T;
|
|
13
45
|
}
|
|
14
46
|
export interface IATableTDProps<T extends IItem> extends IATableTHProps<T>, IATableTRProps<T> {
|
|
15
47
|
}
|
|
16
48
|
export interface IATableDef<T extends IItem> {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
49
|
+
/**
|
|
50
|
+
* width? : TCanCallback<IATableTHProps<T>, number>
|
|
51
|
+
* <br/>Description : width of the column
|
|
52
|
+
*/
|
|
53
|
+
width?: TCanCallback<IATableTHProps<T>, number>;
|
|
54
|
+
/**
|
|
55
|
+
* maxWidth? : TCanCallback<IATableTHProps<T>, number>
|
|
56
|
+
* <br/>Description : maxWidth of the column
|
|
57
|
+
*/
|
|
58
|
+
maxWidth?: TCanCallback<IATableTHProps<T>, number>;
|
|
59
|
+
/**
|
|
60
|
+
* minWidth? : TCanCallback<IATableTHProps<T>, number>
|
|
61
|
+
* <br/>Description : minWidth of the column
|
|
62
|
+
*/
|
|
63
|
+
minWidth?: TCanCallback<IATableTHProps<T>, number>;
|
|
64
|
+
/**
|
|
65
|
+
* align? : TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>
|
|
66
|
+
* <br/>Description : align of the column. type of justifyContent
|
|
67
|
+
*/
|
|
68
|
+
align?: TCanCallback<IATableTHProps<T>, React.CSSProperties['justifyContent']>;
|
|
69
|
+
/**
|
|
70
|
+
* colSpan? : TCanCallback<IATableTHProps<T>, number>
|
|
71
|
+
* <br/>Description : colSpan of the column. headers will be not affected and td will overlap.
|
|
72
|
+
*/
|
|
73
|
+
colSpan?: TCanCallback<IATableTHProps<T>, number>;
|
|
74
|
+
/**
|
|
75
|
+
* hContent? : TCanCallback<IATableTHProps<T>, React.ReactNode>
|
|
76
|
+
* <br/>Description : content of the th
|
|
77
|
+
*/
|
|
78
|
+
hContent?: TCanCallback<IATableTHProps<T>, React.ReactNode>;
|
|
79
|
+
/**
|
|
80
|
+
* hColor? : TCanCallback<IATableTHProps<T>, React.CSSProperties['color']>
|
|
81
|
+
* <br/>Description : color of the th
|
|
82
|
+
*/
|
|
83
|
+
hColor?: TCanCallback<IATableTHProps<T>, React.CSSProperties['color']>;
|
|
84
|
+
/**
|
|
85
|
+
* hBackgroundColor? : TCanCallback<IATableTHProps<T>, React.CSSProperties['backgroundColor']>
|
|
86
|
+
* <br/>Description : backgroundColor of the th
|
|
87
|
+
*/
|
|
88
|
+
hBackgroundColor?: TCanCallback<IATableTHProps<T>, React.CSSProperties['backgroundColor']>;
|
|
89
|
+
/**
|
|
90
|
+
* isSortable? : boolean
|
|
91
|
+
* <br/>Description : decides whether the column is sortable or not
|
|
92
|
+
*/
|
|
25
93
|
isSortable?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* noResize? : boolean
|
|
96
|
+
* <br/>Description : decides whether the column is resizable or not
|
|
97
|
+
*/
|
|
26
98
|
noResize?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* sortF? : (a: T, b: T) => number
|
|
101
|
+
* <br/>Description : sortF of the column
|
|
102
|
+
*/
|
|
27
103
|
sortF?: (a: T, b: T) => number;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
104
|
+
/**
|
|
105
|
+
* content? : TCanCallback<IATableTDProps<T>, React.ReactNode>
|
|
106
|
+
* <br/>Description : content of the td
|
|
107
|
+
*/
|
|
108
|
+
content?: TCanCallback<IATableTDProps<T>, React.ReactNode>;
|
|
109
|
+
/**
|
|
110
|
+
* asText? : TCanCallback<IATableTDProps<T>, string | number>
|
|
111
|
+
* <br/>Description : for filteration. complicated contents can be filtered using asText.
|
|
112
|
+
*/
|
|
113
|
+
asText?: TCanCallback<IATableTDProps<T>, string | number>;
|
|
114
|
+
/**
|
|
115
|
+
* color? : TCanCallback<IATableTDProps<T>, React.CSSProperties['color']>
|
|
116
|
+
* <br/>Description : color of the td
|
|
117
|
+
*/
|
|
118
|
+
color?: TCanCallback<IATableTDProps<T>, React.CSSProperties['color']>;
|
|
119
|
+
/**
|
|
120
|
+
* backgroundColor? : TCanCallback<IATableTDProps<T>, React.CSSProperties['backgroundColor']>
|
|
121
|
+
* <br/>Description : backgroundColor of the td
|
|
122
|
+
*/
|
|
123
|
+
backgroundColor?: TCanCallback<IATableTDProps<T>, React.CSSProperties['backgroundColor']>;
|
|
32
124
|
}
|
|
33
125
|
export type TATableDefs<T extends IItem> = {
|
|
34
126
|
[key in Exclude<keyof T, symbol>]?: IATableDef<T>;
|
|
@@ -38,118 +130,553 @@ export type TATableDefs<T extends IItem> = {
|
|
|
38
130
|
export type TATableFilterType = 'String' | 'Select' | 'Date' | 'DateRange';
|
|
39
131
|
export interface IATableFilterDef<T extends IItem> {
|
|
40
132
|
String: {
|
|
133
|
+
/**
|
|
134
|
+
* type : 'String'
|
|
135
|
+
* <br/>Description : type of the String filter Def
|
|
136
|
+
*/
|
|
41
137
|
type: 'String';
|
|
138
|
+
/**
|
|
139
|
+
* defKey? : keyof T | ''
|
|
140
|
+
* <br/>Description : defKey of the String filter Def
|
|
141
|
+
*/
|
|
42
142
|
defKey?: keyof T | '';
|
|
143
|
+
/**
|
|
144
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['String']) => any
|
|
145
|
+
* <br/>Description : predicate of the String filter Def. if not provided, it will have default predicate.
|
|
146
|
+
*/
|
|
43
147
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['String']) => any;
|
|
148
|
+
/**
|
|
149
|
+
* placeholder? : string
|
|
150
|
+
* <br/>Description : placeholder of the String filter Def
|
|
151
|
+
*/
|
|
44
152
|
placeholder?: string;
|
|
45
153
|
};
|
|
46
154
|
Select: {
|
|
155
|
+
/**
|
|
156
|
+
* type : 'Select'
|
|
157
|
+
* <br/>Description : type of the Select filter Def
|
|
158
|
+
*/
|
|
47
159
|
type: 'Select';
|
|
160
|
+
/**
|
|
161
|
+
* defKey? : keyof T | ''
|
|
162
|
+
* <br/>Description : defKey of the Select filter Def
|
|
163
|
+
*/
|
|
48
164
|
defKey?: keyof T | '';
|
|
165
|
+
/**
|
|
166
|
+
* options : (string | number)[]
|
|
167
|
+
* <br/>Description : options of the Select filter Def
|
|
168
|
+
*/
|
|
49
169
|
options: (string | number)[];
|
|
50
|
-
|
|
170
|
+
/**
|
|
171
|
+
* placeholder : (string | number)[]
|
|
172
|
+
* <br/>Description : values of the Select filter Def
|
|
173
|
+
*/
|
|
174
|
+
placeholder?: string;
|
|
175
|
+
/**
|
|
176
|
+
* OptionRenderer? : (option: string | number) => React.ReactNode
|
|
177
|
+
* <br/>Description : OptionRenderer of the Select filter Def
|
|
178
|
+
*/
|
|
51
179
|
OptionRenderer?: (option: string | number) => React.ReactNode;
|
|
180
|
+
/**
|
|
181
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Select']) => any
|
|
182
|
+
* <br/>Description : predicate of the Select filter Def. if not provided, it will have default predicate.
|
|
183
|
+
*/
|
|
52
184
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Select']) => any;
|
|
53
185
|
};
|
|
54
186
|
Date: {
|
|
187
|
+
/**
|
|
188
|
+
* type : 'Date'
|
|
189
|
+
* <br/>Description : type of the Date filter Def
|
|
190
|
+
*/
|
|
55
191
|
type: 'Date';
|
|
192
|
+
/**
|
|
193
|
+
* defKey? : keyof T | ''
|
|
194
|
+
* <br/>Description : defKey of the Date filter Def
|
|
195
|
+
*/
|
|
56
196
|
defKey?: keyof T | '';
|
|
197
|
+
/**
|
|
198
|
+
* minDate? : Date
|
|
199
|
+
* <br/>Description : minDate of the Date filter Def
|
|
200
|
+
*/
|
|
57
201
|
minDate?: Date;
|
|
202
|
+
/**
|
|
203
|
+
* maxDate? : Date
|
|
204
|
+
* <br/>Description : maxDate of the Date filter Def
|
|
205
|
+
*/
|
|
58
206
|
maxDate?: Date;
|
|
207
|
+
/**
|
|
208
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Date']) => any
|
|
209
|
+
* <br/>Description : predicate of the Date filter Def. if not provided, it will have default predicate.
|
|
210
|
+
*/
|
|
59
211
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Date']) => any;
|
|
60
212
|
};
|
|
61
213
|
DateRange: {
|
|
214
|
+
/**
|
|
215
|
+
* type : 'DateRange'
|
|
216
|
+
* <br/>Description : type of the DateRange filter Def
|
|
217
|
+
*/
|
|
62
218
|
type: 'DateRange';
|
|
219
|
+
/**
|
|
220
|
+
* defKey? : keyof T | ''
|
|
221
|
+
* <br/>Description : defKey of the DateRange filter Def
|
|
222
|
+
*/
|
|
63
223
|
defKey?: keyof T | '';
|
|
224
|
+
/**
|
|
225
|
+
* minDate? : Date
|
|
226
|
+
* <br/>Description : minDate of the DateRange filter Def
|
|
227
|
+
*/
|
|
64
228
|
minDate?: Date;
|
|
229
|
+
/**
|
|
230
|
+
* maxDate? : Date
|
|
231
|
+
* <br/>Description : maxDate of the DateRange filter Def
|
|
232
|
+
*/
|
|
65
233
|
maxDate?: Date;
|
|
234
|
+
/**
|
|
235
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['DateRange']) => any
|
|
236
|
+
* <br/>Description : predicate of the DateRange filter Def. if not provided, it will have default predicate.
|
|
237
|
+
*/
|
|
66
238
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['DateRange']) => any;
|
|
67
239
|
};
|
|
68
240
|
}
|
|
241
|
+
export type TATableSomeFilterDef<T extends IItem> = IATableFilterDef<T>[TATableFilterType];
|
|
69
242
|
export type TATableFilterationDefs<T extends IItem> = {
|
|
243
|
+
/**
|
|
244
|
+
* type : 'And' | 'Or'
|
|
245
|
+
* <br/>Description : type of the filteration Defs
|
|
246
|
+
*/
|
|
70
247
|
type: 'And' | 'Or';
|
|
71
|
-
|
|
248
|
+
/**
|
|
249
|
+
* defs : TATableSomeFilterDef<T>[]
|
|
250
|
+
* <br/>Description : defs of the filteration Defs
|
|
251
|
+
*/
|
|
252
|
+
defs: TATableSomeFilterDef<T>[];
|
|
72
253
|
};
|
|
73
254
|
export interface IATableFilter<T extends IItem> {
|
|
74
255
|
String: {
|
|
256
|
+
/**
|
|
257
|
+
* type : 'String'
|
|
258
|
+
* <br/>Description : type of the String filter
|
|
259
|
+
*/
|
|
75
260
|
type: 'String';
|
|
261
|
+
/**
|
|
262
|
+
* defKey? : keyof T | ''
|
|
263
|
+
* <br/>Description : defKey of the String filter
|
|
264
|
+
*/
|
|
76
265
|
defKey: keyof T | '';
|
|
266
|
+
/**
|
|
267
|
+
* value : string
|
|
268
|
+
* <br/>Description : value of the String filter
|
|
269
|
+
*/
|
|
77
270
|
value: string;
|
|
271
|
+
/**
|
|
272
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['String']) => any
|
|
273
|
+
* <br/>Description : predicate of the String filter
|
|
274
|
+
*/
|
|
78
275
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['String']) => any;
|
|
276
|
+
/**
|
|
277
|
+
* placeholder? : string
|
|
278
|
+
* <br/>Description : placeholder of the String filter
|
|
279
|
+
*/
|
|
79
280
|
placeholder?: string;
|
|
80
281
|
};
|
|
81
282
|
Select: {
|
|
283
|
+
/**
|
|
284
|
+
* type : 'Select'
|
|
285
|
+
* <br/>Description : type of the Select filter
|
|
286
|
+
*/
|
|
82
287
|
type: 'Select';
|
|
288
|
+
/**
|
|
289
|
+
* defKey : keyof T | ''
|
|
290
|
+
* <br/>Description : defKey of the Select filter
|
|
291
|
+
*/
|
|
83
292
|
defKey: keyof T | '';
|
|
293
|
+
/**
|
|
294
|
+
* values : (string | number)[]
|
|
295
|
+
* <br/>Description : values of the Select filter
|
|
296
|
+
*/
|
|
84
297
|
values: (string | number)[];
|
|
298
|
+
/**
|
|
299
|
+
* options : (string | number)[]
|
|
300
|
+
* <br/>Description : options of the Select filter
|
|
301
|
+
*/
|
|
85
302
|
options: (string | number)[];
|
|
303
|
+
/**
|
|
304
|
+
* placeholder : string
|
|
305
|
+
* <br/>Description : placeholder of the Select filter
|
|
306
|
+
*/
|
|
86
307
|
placeholder?: string;
|
|
308
|
+
/**
|
|
309
|
+
* OptionRenderer? : (option: string | number) => React.ReactNode
|
|
310
|
+
* <br/>Description : OptionRenderer of the Select filter
|
|
311
|
+
*/
|
|
87
312
|
OptionRenderer?: (option: string | number) => React.ReactNode;
|
|
313
|
+
/**
|
|
314
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Select']) => any
|
|
315
|
+
* <br/>Description : predicate of the Select filter. if not provided, it will have default predicate.
|
|
316
|
+
*/
|
|
88
317
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Select']) => any;
|
|
89
318
|
};
|
|
90
319
|
Date: {
|
|
320
|
+
/**
|
|
321
|
+
* type : 'Date'
|
|
322
|
+
* <br/>Description : type of the Date filter
|
|
323
|
+
*/
|
|
91
324
|
type: 'Date';
|
|
325
|
+
/**
|
|
326
|
+
* defKey : keyof T | ''
|
|
327
|
+
* <br/>Description : defKey of the Date filter
|
|
328
|
+
*/
|
|
92
329
|
defKey: keyof T;
|
|
330
|
+
/**
|
|
331
|
+
* value : Date
|
|
332
|
+
* <br/>Description : value of the Date filter
|
|
333
|
+
*/
|
|
93
334
|
value: Date;
|
|
335
|
+
/**
|
|
336
|
+
* minDate? : Date
|
|
337
|
+
* <br/>Description : minDate of the Date filter
|
|
338
|
+
*/
|
|
94
339
|
minDate?: Date;
|
|
340
|
+
/**
|
|
341
|
+
* maxDate? : Date
|
|
342
|
+
* <br/>Description : maxDate of the Date filter
|
|
343
|
+
*/
|
|
95
344
|
maxDate?: Date;
|
|
345
|
+
/**
|
|
346
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Date']) => any
|
|
347
|
+
* <br/>Description : predicate of the Date filter. if not provided, it will have default predicate.
|
|
348
|
+
*/
|
|
96
349
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['Date']) => any;
|
|
97
350
|
};
|
|
98
351
|
DateRange: {
|
|
352
|
+
/**
|
|
353
|
+
* type : 'DateRange'
|
|
354
|
+
* <br/>Description : type of the DateRange filter
|
|
355
|
+
*/
|
|
99
356
|
type: 'DateRange';
|
|
357
|
+
/**
|
|
358
|
+
* defKey : keyof T | ''
|
|
359
|
+
* <br/>Description : defKey of the DateRange filter
|
|
360
|
+
*/
|
|
100
361
|
defKey: keyof T | '';
|
|
362
|
+
/**
|
|
363
|
+
* sDate : Date
|
|
364
|
+
* <br/>Description : sDate of the DateRange filter
|
|
365
|
+
*/
|
|
101
366
|
sDate: Date;
|
|
367
|
+
/**
|
|
368
|
+
* eDate : Date
|
|
369
|
+
* <br/>Description : eDate of the DateRange filter
|
|
370
|
+
*/
|
|
102
371
|
eDate: Date;
|
|
372
|
+
/**
|
|
373
|
+
* minDate? : Date
|
|
374
|
+
* <br/>Description : minDate of the DateRange filter
|
|
375
|
+
*/
|
|
103
376
|
minDate?: Date;
|
|
377
|
+
/**
|
|
378
|
+
* maxDate? : Date
|
|
379
|
+
* <br/>Description : maxDate of the DateRange filter
|
|
380
|
+
*/
|
|
104
381
|
maxDate?: Date;
|
|
382
|
+
/**
|
|
383
|
+
* predicate? : (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['DateRange']) => any
|
|
384
|
+
* <br/>Description : predicate of the DateRange filter. if not provided, it will have default predicate.
|
|
385
|
+
*/
|
|
105
386
|
predicate?: (item: T, defs: TATableDefs<T>, filter: IATableFilter<T>['DateRange']) => any;
|
|
106
387
|
};
|
|
107
388
|
}
|
|
108
389
|
export type TATableSomeFilter<T extends IItem> = IATableFilter<T>[TATableFilterType];
|
|
109
390
|
export type TATableFilteration<T extends IItem> = {
|
|
391
|
+
/**
|
|
392
|
+
* type : 'And' | 'Or'
|
|
393
|
+
* <br/>Description : type of the filteration
|
|
394
|
+
*/
|
|
110
395
|
type: 'And' | 'Or';
|
|
396
|
+
/**
|
|
397
|
+
* filters : TATableSomeFilter<T>[]
|
|
398
|
+
* <br/>Description : filters of the filteration
|
|
399
|
+
*/
|
|
111
400
|
filters: TATableSomeFilter<T>[];
|
|
112
401
|
};
|
|
113
402
|
export type TATableSortF<T extends IItem> = (a: T, b: T) => number;
|
|
114
403
|
export interface IATableSortation<T extends IItem> {
|
|
404
|
+
/**
|
|
405
|
+
* defKey? : keyof T
|
|
406
|
+
* <br/>Description : defKey of the sortation
|
|
407
|
+
*/
|
|
115
408
|
defKey?: keyof T;
|
|
409
|
+
/**
|
|
410
|
+
* isAsc? : boolean
|
|
411
|
+
* <br/>Description : isAsc of the sortation
|
|
412
|
+
*/
|
|
116
413
|
isAsc?: boolean;
|
|
414
|
+
/**
|
|
415
|
+
* sortF? : TATableSortF<T>
|
|
416
|
+
* <br/>Description : sortF of the sortation
|
|
417
|
+
*/
|
|
117
418
|
sortF?: TATableSortF<T>;
|
|
118
419
|
}
|
|
119
420
|
export interface IATablePagination {
|
|
421
|
+
/**
|
|
422
|
+
* page : number
|
|
423
|
+
* <br/>Description : page of the pagination
|
|
424
|
+
*/
|
|
120
425
|
page: number;
|
|
426
|
+
/**
|
|
427
|
+
* pageSize : number
|
|
428
|
+
* <br/>Description : pageSize of the pagination
|
|
429
|
+
*/
|
|
121
430
|
pageSize: number;
|
|
431
|
+
/**
|
|
432
|
+
* pageRange : number
|
|
433
|
+
* <br/>Description : pageRange of the pagination
|
|
434
|
+
*/
|
|
122
435
|
pageRange: number;
|
|
123
436
|
}
|
|
124
437
|
export interface IATableState<T extends IItem> {
|
|
438
|
+
/**
|
|
439
|
+
* entireItems? : T[]
|
|
440
|
+
* <br/>Description : entireItems of the state
|
|
441
|
+
*/
|
|
125
442
|
entireItems?: T[];
|
|
443
|
+
/**
|
|
444
|
+
* filteration : TATableFilteration<T>
|
|
445
|
+
* <br/>Description : filteration of the state
|
|
446
|
+
*/
|
|
126
447
|
filteration: TATableFilteration<T>;
|
|
448
|
+
/**
|
|
449
|
+
* pagination : IATablePagination
|
|
450
|
+
* <br/>Description : pagination of the state
|
|
451
|
+
*/
|
|
127
452
|
pagination: IATablePagination;
|
|
453
|
+
/**
|
|
454
|
+
* sortation : IATableSortation<T>
|
|
455
|
+
* <br/>Description : sortation of the state
|
|
456
|
+
*/
|
|
128
457
|
sortation: IATableSortation<T>;
|
|
129
458
|
}
|
|
130
459
|
export interface IATableProps<T extends IItem> {
|
|
460
|
+
/**
|
|
461
|
+
* defs : TATableDefs<T>
|
|
462
|
+
* <br/>Description : defs of ATable
|
|
463
|
+
* <br/>Basic Usage :
|
|
464
|
+
* <br/>(1)const entireItems = [{name: 'John', age: 20}, {name: 'Jane', age: 21}];
|
|
465
|
+
* const defs = {
|
|
466
|
+
* 'name': {content: ({item}) => item.name},
|
|
467
|
+
* 'age': {content: ({item}) => item.age},
|
|
468
|
+
* }
|
|
469
|
+
* <ATable defs={defs} entireItems={entireItems}/>
|
|
470
|
+
*/
|
|
131
471
|
defs: TATableDefs<T>;
|
|
472
|
+
/**
|
|
473
|
+
* defaultDef? : IATableDef<T>
|
|
474
|
+
* <br/>Description : defaultDef of ATable
|
|
475
|
+
* <br/>Basic Usage :
|
|
476
|
+
* <br/>(1)const defaultDef = {content: ({item}) => item.name};
|
|
477
|
+
* <ATable defs={defs} defaultDef={defaultDef}/>
|
|
478
|
+
*/
|
|
132
479
|
defaultDef?: IATableDef<T>;
|
|
133
|
-
|
|
480
|
+
/**
|
|
481
|
+
* rProps? : TCanCallback<IATableTRProps<T>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>
|
|
482
|
+
* <br/>Description : rProps of ATable
|
|
483
|
+
* <br/>Basic Usage :
|
|
484
|
+
* <br/>(1)const rProps = ({item}) => ({backgroundColor : 'pink'});
|
|
485
|
+
* <ATable defs={defs} rProps={rProps}/>
|
|
486
|
+
*/
|
|
487
|
+
rProps?: TCanCallback<IATableTRProps<T>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
488
|
+
/**
|
|
489
|
+
* useSelect? : TUseValues<T>
|
|
490
|
+
* <br/>Description : useSelect of ATable.
|
|
491
|
+
* <br/>Basic Usage :
|
|
492
|
+
* <br/>(1)const [selectedItems, setSelectedItems] = useState<T[]>([]);
|
|
493
|
+
* <ATable defs={defs} entireItems={entireItems} useSelect={[selectedItems, setSelectedItems]}/>
|
|
494
|
+
*/
|
|
134
495
|
useSelect?: TUseValues<T[]>;
|
|
496
|
+
/**
|
|
497
|
+
* isSelectMulti? : boolean
|
|
498
|
+
* <br/>Description : isSelectMulti of ATable. if true, multiple items can be selected.
|
|
499
|
+
*/
|
|
135
500
|
isSelectMulti?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* selectDisabled? : (item: T) => string | boolean | undefined
|
|
503
|
+
* <br/>Description : selectDisabled of ATable. if string is returned, it will be displayed as tooltip.
|
|
504
|
+
*/
|
|
136
505
|
selectDisabled?: (item: T) => string | boolean | undefined;
|
|
506
|
+
/**
|
|
507
|
+
* useCheck? : TUseValues<T[]>
|
|
508
|
+
* <br/>Description : useCheck of ATable
|
|
509
|
+
* <br/>Basic Usage :
|
|
510
|
+
* <br/>(1)const [checkedItems, setCheckedItems] = useState<T[]>([]);
|
|
511
|
+
* <ATable defs={defs} entireItems={entireItems} useCheck={[checkedItems, setCheckedItems]}/>
|
|
512
|
+
*/
|
|
137
513
|
useCheck?: TUseValues<T[]>;
|
|
514
|
+
/**
|
|
515
|
+
* checkDisabled? : (item: T) => string | boolean | undefined
|
|
516
|
+
* <br/>Description : checkDisabled of ATable. if string is returned, it will be displayed as tooltip.
|
|
517
|
+
*/
|
|
138
518
|
checkDisabled?: (item: T) => string | boolean | undefined;
|
|
519
|
+
/**
|
|
520
|
+
* isLoading? : boolean
|
|
521
|
+
* <br/>Description : decides whether the table is loading or not
|
|
522
|
+
*/
|
|
139
523
|
isLoading?: boolean;
|
|
524
|
+
/**
|
|
525
|
+
* isDisabled? : boolean
|
|
526
|
+
* <br/>Description : decides whether the table is disabled or not
|
|
527
|
+
*/
|
|
140
528
|
isDisabled?: boolean;
|
|
529
|
+
/**
|
|
530
|
+
* title? : React.ReactNode
|
|
531
|
+
* <br/>Description : title of ATable
|
|
532
|
+
*/
|
|
141
533
|
title?: React.ReactNode;
|
|
534
|
+
/**
|
|
535
|
+
* entireItems? : T[]
|
|
536
|
+
* <br/>Description : entireItems of ATable. entireItems will be affected by filteration, sortation, and pagination.
|
|
537
|
+
* <br/>Basic Usage :
|
|
538
|
+
* <br/>(1)const entireItems = [{name: 'John', age: 20}, {name: 'Jane', age: 21}];
|
|
539
|
+
* <ATable defs={defs} entireItems={entireItems}/> *
|
|
540
|
+
*/
|
|
142
541
|
entireItems?: T[];
|
|
542
|
+
/**
|
|
543
|
+
* onStateChange? : (params: IATableState<T>) => void
|
|
544
|
+
* <br/>Description : onStateChange of ATable. will be called when filteration, sortation, and pagination changes.
|
|
545
|
+
* <br/>Basic Usage :
|
|
546
|
+
* <br/>(1)const [pagedItems, setPagedItems] = useState<T[]>([]);
|
|
547
|
+
* const [totalCount, setTotalCount] = useState<number>(0);
|
|
548
|
+
* const onStateChange = ({entireItems, filteration, pagination, sortation}) => {
|
|
549
|
+
* const {items, totalCount} = apiCall(entireItems, filteration, pagination, sortation);
|
|
550
|
+
* setPagedItems(newItems);
|
|
551
|
+
* setTotalCount(newTotalCount);
|
|
552
|
+
* }
|
|
553
|
+
* <ATable defs={defs} pagedItems={pagedItems} totalCount={totalCount} onStateChange={onStateChange}/>
|
|
554
|
+
*/
|
|
143
555
|
onStateChange?: (params: IATableState<T>) => void;
|
|
556
|
+
/**
|
|
557
|
+
* pagedItems? : T[]
|
|
558
|
+
* <br/>Description : pagedItems of ATable. if provided, entireItems will be ignored. pagedItems will not be affected by filteration, sortation, and pagination.
|
|
559
|
+
* <br/>Basic Usage :
|
|
560
|
+
* <br/>(1)const pagedItems = [{name: 'John', age: 20}, {name: 'Jane', age: 21}];
|
|
561
|
+
* <ATable defs={defs} pagedItems={pagedItems}/>
|
|
562
|
+
*/
|
|
144
563
|
pagedItems?: T[];
|
|
564
|
+
/**
|
|
565
|
+
* totalCount? : number
|
|
566
|
+
* <br/>Description : totalCount of ATable. if provided, pagination will be affected.
|
|
567
|
+
*/
|
|
145
568
|
totalCount?: number;
|
|
569
|
+
/**
|
|
570
|
+
* filterationDefs? : TATableFilterationDefs<T>
|
|
571
|
+
* <br/>Description : filterationDefs of ATable
|
|
572
|
+
* <br/>Basic Usage :
|
|
573
|
+
* <br/>(1)const filterationDefs = {type: 'Or', defs: [{type: 'String', placeholder: 'Search'}]};
|
|
574
|
+
* <ATable defs={defs} entireItems={entireItems} filterationDefs={filterationDefs}/>
|
|
575
|
+
*/
|
|
146
576
|
filterationDefs?: TATableFilterationDefs<T>;
|
|
577
|
+
/**
|
|
578
|
+
* useFilteration? : TUseValues<TATableFilteration<T>>
|
|
579
|
+
* <br/>Description : useFilteration of ATable. filteration can be controlled by useFilteration.
|
|
580
|
+
* <br/>Basic Usage :
|
|
581
|
+
* <br/>(1)const [filteration, setFilteration] = useState<TATableFilteration<T>>({type: 'Or', filters: []});
|
|
582
|
+
* <ATable defs={defs} entireItems={entireItems} useFilteration={[filteration, setFilteration]}/>
|
|
583
|
+
*/
|
|
147
584
|
useFilteration?: TUseValues<TATableFilteration<T>>;
|
|
585
|
+
/**
|
|
586
|
+
* toggleFilterationDefs? : TATableFilterationDefs<T>
|
|
587
|
+
* <br/>Description : toggleFilterationDefs of ATable. table can have two filterations. one is main filteration, and the other is toggle filteration.
|
|
588
|
+
* <br/>Basic Usage :
|
|
589
|
+
* <br/>(1)const toggleFilterationDefs = {type: 'Or', defs: [{type: 'String', placeholder: 'Search'}]};
|
|
590
|
+
* <ATable defs={defs} entireItems={entireItems} toggleFilterationDefs={toggleFilterationDefs}/>
|
|
591
|
+
*/
|
|
148
592
|
toggleFilterationDefs?: TATableFilterationDefs<T>;
|
|
593
|
+
/**
|
|
594
|
+
* useToggleFilteration? : TUseValues<TATableFilteration<T>>
|
|
595
|
+
* <br/>Description : useToggleFilteration of ATable. toggleFilteration can be controlled by useToggleFilteration.
|
|
596
|
+
* <br/>Basic Usage :
|
|
597
|
+
* <br/>(1)const [toggleFilteration, setToggleFilteration] = useState<TATableFilteration<T>>({type: 'Or', filters: []});
|
|
598
|
+
* <ATable defs={defs} entireItems={entireItems} useToggleFilteration={[toggleFilteration, setToggleFilteration]}/>
|
|
599
|
+
*/
|
|
149
600
|
useToggleFilteration?: TUseValues<TATableFilteration<T>>;
|
|
601
|
+
/**
|
|
602
|
+
* usePagination? : TUseValues<IATablePagination>
|
|
603
|
+
* <br/>Description : usePagination of ATable. pagination can be controlled by usePagination.
|
|
604
|
+
* <br/>Basic Usage :
|
|
605
|
+
* <br/>(1)const [pagination, setPagination] = useState<IATablePagination>({page: 1, pageSize: 50, pageRange: 10});
|
|
606
|
+
* <ATable defs={defs} entireItems={entireItems} usePagination={[pagination, setPagination]}/>
|
|
607
|
+
*/
|
|
150
608
|
usePagination?: TUseValues<IATablePagination>;
|
|
609
|
+
/**
|
|
610
|
+
* useSortation? : TUseValues<IATableSortation<T>>
|
|
611
|
+
* <br/>Description : useSortation of ATable. sortation can be controlled by useSortation.
|
|
612
|
+
* <br/>Basic Usage :
|
|
613
|
+
* <br/>(1)const [sortation, setSortation] = useState<IATableSortation<T>>({defKey: 'name', isAsc: true});
|
|
614
|
+
* <ATable defs={defs} entireItems={entireItems} useSortation={[sortation, setSortation]}/>
|
|
615
|
+
*/
|
|
151
616
|
useSortation?: TUseValues<IATableSortation<T>>;
|
|
617
|
+
/**
|
|
618
|
+
* TopRightAddon? : React.ReactNode
|
|
619
|
+
* <br/>Description : TopRightAddon of ATable
|
|
620
|
+
* <br/>Basic Usage :
|
|
621
|
+
* <br/>(1)<ATable defs={defs} entireItems={entireItems} TopRightAddon={<AButton>Click</AButton>}/>
|
|
622
|
+
*/
|
|
152
623
|
TopRightAddon?: React.ReactNode;
|
|
624
|
+
/**
|
|
625
|
+
* resources? : Partial<typeof Resources.ATable>
|
|
626
|
+
* <br/>Description : resources of ATable
|
|
627
|
+
*/
|
|
153
628
|
resources?: Partial<typeof Resources.ATable>;
|
|
154
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* AComponent : ATable
|
|
632
|
+
* <br/>Description : ATable is a table component. it can have defs and items to display the table. and has select, check, filteration, sortation, pagination options available.
|
|
633
|
+
* <br/>Basic Usage :
|
|
634
|
+
* <br/>(1)const entireItems = [{name: 'John', age: 20}, {name: 'Jane', age: 21}];
|
|
635
|
+
* const defs = {
|
|
636
|
+
* 'name': {content: ({item}) => item.name},
|
|
637
|
+
* 'age': {content: ({item}) => item.age},
|
|
638
|
+
* 'height' : {}
|
|
639
|
+
* }
|
|
640
|
+
* const defaultDefs = {
|
|
641
|
+
* content : ({item}) => 'default value!'
|
|
642
|
+
* }
|
|
643
|
+
* <ATable defs={defs} entireItems={entireItems} defaultDef={defaultDefs}/>
|
|
644
|
+
*
|
|
645
|
+
* <br/>(2)const [pagedItems, setPagedItems] = useState<T[]>([{name: 'John', age: 20}, {name: 'Jane', age: 21}]);
|
|
646
|
+
* const [totalCount, setTotalCount] = useState<number>(2);
|
|
647
|
+
* const defs = {
|
|
648
|
+
* 'name': {content: ({item}) => item.name},
|
|
649
|
+
* 'age': {content: ({item}) => item.age},
|
|
650
|
+
* }
|
|
651
|
+
* const onStateChange = ({entireItems, filteration, pagination, sortation}) => {
|
|
652
|
+
* const {items, totalCount} = apiCall(entireItems, filteration, pagination, sortation);
|
|
653
|
+
* setPagedItems(newItems);
|
|
654
|
+
* setTotalCount(newTotalCount);
|
|
655
|
+
* }
|
|
656
|
+
* <ATable defs={defs} pagedItems={pagedItems} totalCount={totalCount} onStateChange={onStateChange}/>
|
|
657
|
+
*
|
|
658
|
+
* <br/>(3)const [entireItems, setEntireItems] = useState<T[]>([{name: 'John', age: 20}, {name: 'Jane', age: 21}]);
|
|
659
|
+
* const [selectedItems, setSelectedItems] = useState<T[]>([]);
|
|
660
|
+
* const [checkedItems, setCheckedItems] = useState<T[]>([]);
|
|
661
|
+
* const selectDisabled = (item) => item.name === 'John' ? 'John is disabled' : false;
|
|
662
|
+
* const checkDisabled = (item) => item.name === 'Jane' ? 'Jane is disabled' : false;
|
|
663
|
+
* const defs = {
|
|
664
|
+
* 'name': {content: ({item}) => item.name},
|
|
665
|
+
* 'age': {content: ({item}) => item.age},
|
|
666
|
+
* }
|
|
667
|
+
* <ATable defs={defs} entireItems={entireItems}
|
|
668
|
+
* useSelect={[selectedItems, setSelectedItems]}
|
|
669
|
+
* useCheck={[checkedItems, setCheckedItems]}
|
|
670
|
+
* selectDisabled={selectDisabled}
|
|
671
|
+
* checkDisabled={checkDisabled}/>
|
|
672
|
+
*
|
|
673
|
+
* <br/>(4)const [entireItems, setEntireItems] = useState<T[]>([{name: 'John', age: 20}, {name: 'Jane', age: 21}]);
|
|
674
|
+
* const filterationDefs = {type: 'Or', defs: [{type: 'String', placeholder: 'Search'}]};
|
|
675
|
+
* const defaultPagination = {page: 1, pageSize: 50, pageRange: 10};
|
|
676
|
+
* const defs = {
|
|
677
|
+
* 'name': {content: ({item}) => item.name},
|
|
678
|
+
* 'age': {content: ({item}) => item.age, asText: ({item}) => item.age, isSortable : true},
|
|
679
|
+
* }
|
|
680
|
+
* <ATable defs={defs} entireItems={entireItems} filterationDefs={filterationDefs} usePagination={[defaultPagination, undefined]}/>
|
|
681
|
+
*/
|
|
155
682
|
export declare const ATable: <T extends IItem>({ defs: extDefs, defaultDef: extDefaultDef, rProps, useSelect, isSelectMulti, selectDisabled, useCheck, checkDisabled, isLoading, isDisabled, title, entireItems, onStateChange, pagedItems: extPagedItems, totalCount: extTotalCount, filterationDefs, useFilteration, toggleFilterationDefs, useToggleFilteration, usePagination, useSortation, TopRightAddon, resources: extResources, }: IATableProps<T>) => import("react/jsx-runtime").JSX.Element;
|