@draftbit/core 46.10.3-ccc53a.2 → 46.10.3-cf3748.2
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/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Table/Table.js +123 -0
- package/lib/commonjs/components/Table/TableCell.js +49 -0
- package/lib/commonjs/components/Table/TableRow.js +61 -0
- package/lib/commonjs/components/Table/index.js +51 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/mappings/Table.js +140 -0
- package/lib/module/components/Table/Table.js +114 -0
- package/lib/module/components/Table/TableCell.js +41 -0
- package/lib/module/components/Table/TableRow.js +53 -0
- package/lib/module/components/Table/index.js +24 -0
- package/lib/module/constants.js +0 -1
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Table.js +133 -0
- package/lib/typescript/src/components/Table/Table.d.ts +19 -0
- package/lib/typescript/src/components/Table/Table.d.ts.map +1 -0
- package/lib/typescript/src/components/Table/TableCell.d.ts +9 -0
- package/lib/typescript/src/components/Table/TableCell.d.ts.map +1 -0
- package/lib/typescript/src/components/{DeprecatedCardWrapper.d.ts → Table/TableRow.d.ts} +7 -8
- package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -0
- package/lib/typescript/src/components/Table/index.d.ts +22 -0
- package/lib/typescript/src/components/Table/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{CardBlock.d.ts → Table.d.ts} +129 -81
- package/lib/typescript/src/mappings/Table.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Table/Table.js +93 -0
- package/src/components/Table/Table.tsx +176 -0
- package/src/components/Table/TableCell.js +31 -0
- package/src/components/Table/TableCell.tsx +59 -0
- package/src/components/Table/TableRow.js +37 -0
- package/src/components/Table/TableRow.tsx +77 -0
- package/src/components/Table/index.js +15 -0
- package/src/components/Table/index.tsx +44 -0
- package/src/index.js +1 -0
- package/src/index.tsx +2 -0
- package/src/mappings/Table.js +150 -0
- package/src/mappings/Table.ts +170 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +0 -40
- package/lib/commonjs/components/DeprecatedFAB.js +0 -157
- package/lib/commonjs/components/ProgressIndicator.js +0 -55
- package/lib/commonjs/components/ResizeMode.js +0 -5
- package/lib/commonjs/mappings/CardBlock.js +0 -126
- package/lib/commonjs/mappings/CardContainer.js +0 -108
- package/lib/commonjs/mappings/CardContainerRating.js +0 -130
- package/lib/commonjs/mappings/CardContainerShortImage.js +0 -124
- package/lib/commonjs/mappings/CardInline.js +0 -59
- package/lib/commonjs/mappings/ProgressIndicator.js +0 -188
- package/lib/module/components/DeprecatedCardWrapper.js +0 -32
- package/lib/module/components/DeprecatedFAB.js +0 -147
- package/lib/module/components/ProgressIndicator.js +0 -45
- package/lib/module/components/ResizeMode.js +0 -1
- package/lib/module/mappings/CardBlock.js +0 -119
- package/lib/module/mappings/CardContainer.js +0 -101
- package/lib/module/mappings/CardContainerRating.js +0 -123
- package/lib/module/mappings/CardContainerShortImage.js +0 -117
- package/lib/module/mappings/CardInline.js +0 -52
- package/lib/module/mappings/ProgressIndicator.js +0 -181
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +0 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +0 -56
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +0 -1
- package/lib/typescript/src/components/ProgressIndicator.d.ts +0 -24
- package/lib/typescript/src/components/ProgressIndicator.d.ts.map +0 -1
- package/lib/typescript/src/components/ResizeMode.d.ts +0 -2
- package/lib/typescript/src/components/ResizeMode.d.ts.map +0 -1
- package/lib/typescript/src/mappings/CardBlock.d.ts.map +0 -1
- package/lib/typescript/src/mappings/CardContainer.d.ts +0 -102
- package/lib/typescript/src/mappings/CardContainer.d.ts.map +0 -1
- package/lib/typescript/src/mappings/CardContainerRating.d.ts +0 -108
- package/lib/typescript/src/mappings/CardContainerRating.d.ts.map +0 -1
- package/lib/typescript/src/mappings/CardContainerShortImage.d.ts +0 -139
- package/lib/typescript/src/mappings/CardContainerShortImage.d.ts.map +0 -1
- package/lib/typescript/src/mappings/CardInline.d.ts +0 -62
- package/lib/typescript/src/mappings/CardInline.d.ts.map +0 -1
- package/lib/typescript/src/mappings/ProgressIndicator.d.ts +0 -181
- package/lib/typescript/src/mappings/ProgressIndicator.d.ts.map +0 -1
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedCardWrapper.tsx +0 -46
- package/src/components/DeprecatedFAB.js +0 -114
- package/src/components/DeprecatedFAB.tsx +0 -231
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/ProgressIndicator.tsx +0 -71
- package/src/components/ResizeMode.js +0 -1
- package/src/components/ResizeMode.ts +0 -7
- package/src/mappings/CardBlock.js +0 -123
- package/src/mappings/CardBlock.ts +0 -136
- package/src/mappings/CardContainer.js +0 -104
- package/src/mappings/CardContainer.ts +0 -116
- package/src/mappings/CardContainerRating.js +0 -126
- package/src/mappings/CardContainerRating.ts +0 -137
- package/src/mappings/CardContainerShortImage.js +0 -120
- package/src/mappings/CardContainerShortImage.ts +0 -130
- package/src/mappings/CardInline.js +0 -52
- package/src/mappings/CardInline.ts +0 -61
- package/src/mappings/ProgressIndicator.js +0 -181
- package/src/mappings/ProgressIndicator.ts +0 -190
|
@@ -3,69 +3,97 @@ export declare const SEED_DATA: ({
|
|
|
3
3
|
tag: string;
|
|
4
4
|
description: string;
|
|
5
5
|
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {
|
|
8
|
+
flex: number;
|
|
9
|
+
flexDirection?: undefined;
|
|
10
|
+
};
|
|
6
11
|
props: {
|
|
7
|
-
|
|
12
|
+
borderWidth: {
|
|
13
|
+
defaultValue: number;
|
|
8
14
|
label: string;
|
|
9
15
|
description: string;
|
|
10
|
-
group: string;
|
|
11
16
|
formType: string;
|
|
12
17
|
propType: string;
|
|
13
|
-
|
|
18
|
+
group: string;
|
|
14
19
|
editable: boolean;
|
|
15
20
|
required: boolean;
|
|
21
|
+
step: number;
|
|
16
22
|
};
|
|
17
|
-
|
|
23
|
+
borderColor: {
|
|
24
|
+
defaultValue: string;
|
|
18
25
|
group: string;
|
|
19
26
|
label: string;
|
|
20
27
|
description: string;
|
|
28
|
+
editable: boolean;
|
|
29
|
+
required: boolean;
|
|
21
30
|
formType: string;
|
|
22
31
|
propType: string;
|
|
23
|
-
|
|
32
|
+
};
|
|
33
|
+
borderStyle: {
|
|
34
|
+
defaultValue: string;
|
|
35
|
+
group: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description: string;
|
|
24
38
|
editable: boolean;
|
|
25
39
|
required: boolean;
|
|
40
|
+
formType: string;
|
|
41
|
+
propType: string;
|
|
42
|
+
options: never[];
|
|
26
43
|
};
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
drawTopBorder: {
|
|
45
|
+
defaultValue: boolean;
|
|
29
46
|
label: string;
|
|
30
47
|
description: string;
|
|
31
48
|
formType: string;
|
|
32
49
|
propType: string;
|
|
33
|
-
defaultValue: string;
|
|
34
50
|
editable: boolean;
|
|
35
51
|
required: boolean;
|
|
36
|
-
};
|
|
37
|
-
leftDescription: {
|
|
38
52
|
group: string;
|
|
53
|
+
};
|
|
54
|
+
cellVerticalPadding: {
|
|
55
|
+
defaultValue: number;
|
|
39
56
|
label: string;
|
|
40
57
|
description: string;
|
|
41
58
|
formType: string;
|
|
42
59
|
propType: string;
|
|
43
|
-
|
|
60
|
+
group: string;
|
|
44
61
|
editable: boolean;
|
|
45
62
|
required: boolean;
|
|
63
|
+
step: number;
|
|
46
64
|
};
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
cellHorizontalPadding: {
|
|
66
|
+
defaultValue: number;
|
|
49
67
|
label: string;
|
|
50
68
|
description: string;
|
|
51
69
|
formType: string;
|
|
52
70
|
propType: string;
|
|
53
|
-
|
|
71
|
+
group: string;
|
|
54
72
|
editable: boolean;
|
|
55
73
|
required: boolean;
|
|
74
|
+
step: number;
|
|
56
75
|
};
|
|
57
|
-
|
|
58
|
-
group: string;
|
|
76
|
+
showsVerticalScrollIndicator: {
|
|
59
77
|
label: string;
|
|
60
78
|
description: string;
|
|
61
79
|
formType: string;
|
|
62
80
|
propType: string;
|
|
63
|
-
defaultValue:
|
|
81
|
+
defaultValue: boolean;
|
|
64
82
|
editable: boolean;
|
|
65
83
|
required: boolean;
|
|
84
|
+
group: string;
|
|
66
85
|
};
|
|
67
|
-
|
|
86
|
+
drawBottomBorder: {
|
|
87
|
+
label: string;
|
|
88
|
+
description: string;
|
|
89
|
+
formType: string;
|
|
90
|
+
propType: string;
|
|
91
|
+
defaultValue: boolean;
|
|
92
|
+
editable: boolean;
|
|
93
|
+
required: boolean;
|
|
68
94
|
group: string;
|
|
95
|
+
};
|
|
96
|
+
drawStartBorder: {
|
|
69
97
|
label: string;
|
|
70
98
|
description: string;
|
|
71
99
|
formType: string;
|
|
@@ -73,217 +101,237 @@ export declare const SEED_DATA: ({
|
|
|
73
101
|
defaultValue: boolean;
|
|
74
102
|
editable: boolean;
|
|
75
103
|
required: boolean;
|
|
104
|
+
group: string;
|
|
76
105
|
};
|
|
77
|
-
|
|
78
|
-
defaultValue: any;
|
|
106
|
+
drawEndBorder: {
|
|
79
107
|
label: string;
|
|
80
108
|
description: string;
|
|
81
109
|
formType: string;
|
|
82
110
|
propType: string;
|
|
83
|
-
|
|
111
|
+
defaultValue: boolean;
|
|
84
112
|
editable: boolean;
|
|
85
113
|
required: boolean;
|
|
86
114
|
group: string;
|
|
87
115
|
};
|
|
88
116
|
};
|
|
89
|
-
stylesPanelSections?: undefined;
|
|
90
117
|
} | {
|
|
91
118
|
name: string;
|
|
92
119
|
tag: string;
|
|
93
120
|
description: string;
|
|
94
121
|
category: string;
|
|
122
|
+
stylesPanelSections: string[];
|
|
95
123
|
props: {
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
drawStartBorder: {
|
|
125
|
+
defaultValue: boolean;
|
|
98
126
|
label: string;
|
|
99
127
|
description: string;
|
|
100
128
|
formType: string;
|
|
101
129
|
propType: string;
|
|
102
|
-
defaultValue: null;
|
|
103
130
|
editable: boolean;
|
|
104
131
|
required: boolean;
|
|
132
|
+
group: string;
|
|
105
133
|
};
|
|
106
|
-
|
|
134
|
+
drawBottomBorder: {
|
|
135
|
+
defaultValue: boolean;
|
|
107
136
|
label: string;
|
|
108
137
|
description: string;
|
|
109
|
-
group: string;
|
|
110
138
|
formType: string;
|
|
111
139
|
propType: string;
|
|
112
|
-
defaultValue: number;
|
|
113
140
|
editable: boolean;
|
|
114
141
|
required: boolean;
|
|
115
|
-
};
|
|
116
|
-
image: {
|
|
117
142
|
group: string;
|
|
143
|
+
};
|
|
144
|
+
isTableHeader: {
|
|
118
145
|
label: string;
|
|
119
146
|
description: string;
|
|
120
147
|
formType: string;
|
|
121
148
|
propType: string;
|
|
122
|
-
defaultValue:
|
|
149
|
+
defaultValue: boolean;
|
|
123
150
|
editable: boolean;
|
|
124
151
|
required: boolean;
|
|
125
|
-
};
|
|
126
|
-
title: {
|
|
127
152
|
group: string;
|
|
153
|
+
};
|
|
154
|
+
borderWidth: {
|
|
128
155
|
label: string;
|
|
129
156
|
description: string;
|
|
130
157
|
formType: string;
|
|
131
158
|
propType: string;
|
|
132
|
-
|
|
159
|
+
group: string;
|
|
160
|
+
defaultValue: null;
|
|
133
161
|
editable: boolean;
|
|
134
162
|
required: boolean;
|
|
163
|
+
step: number;
|
|
135
164
|
};
|
|
136
|
-
|
|
165
|
+
borderColor: {
|
|
137
166
|
group: string;
|
|
138
167
|
label: string;
|
|
139
168
|
description: string;
|
|
169
|
+
editable: boolean;
|
|
170
|
+
required: boolean;
|
|
171
|
+
defaultValue: null;
|
|
140
172
|
formType: string;
|
|
141
173
|
propType: string;
|
|
142
|
-
|
|
174
|
+
};
|
|
175
|
+
borderStyle: {
|
|
176
|
+
group: string;
|
|
177
|
+
label: string;
|
|
178
|
+
description: string;
|
|
143
179
|
editable: boolean;
|
|
144
180
|
required: boolean;
|
|
181
|
+
formType: string;
|
|
182
|
+
propType: string;
|
|
183
|
+
defaultValue: null;
|
|
184
|
+
options: never[];
|
|
145
185
|
};
|
|
146
|
-
|
|
147
|
-
group: string;
|
|
186
|
+
drawTopBorder: {
|
|
148
187
|
label: string;
|
|
149
188
|
description: string;
|
|
150
189
|
formType: string;
|
|
151
190
|
propType: string;
|
|
152
|
-
defaultValue:
|
|
191
|
+
defaultValue: boolean;
|
|
153
192
|
editable: boolean;
|
|
154
193
|
required: boolean;
|
|
155
|
-
};
|
|
156
|
-
aspectRatio: {
|
|
157
194
|
group: string;
|
|
195
|
+
};
|
|
196
|
+
drawEndBorder: {
|
|
158
197
|
label: string;
|
|
159
198
|
description: string;
|
|
160
199
|
formType: string;
|
|
161
200
|
propType: string;
|
|
162
|
-
defaultValue:
|
|
201
|
+
defaultValue: boolean;
|
|
163
202
|
editable: boolean;
|
|
164
203
|
required: boolean;
|
|
165
|
-
};
|
|
166
|
-
titleCentered: {
|
|
167
204
|
group: string;
|
|
205
|
+
};
|
|
206
|
+
cellVerticalPadding: {
|
|
168
207
|
label: string;
|
|
169
208
|
description: string;
|
|
170
209
|
formType: string;
|
|
171
210
|
propType: string;
|
|
172
|
-
|
|
211
|
+
group: string;
|
|
212
|
+
defaultValue: null;
|
|
173
213
|
editable: boolean;
|
|
174
214
|
required: boolean;
|
|
215
|
+
step: number;
|
|
175
216
|
};
|
|
176
|
-
|
|
177
|
-
defaultValue: any;
|
|
217
|
+
cellHorizontalPadding: {
|
|
178
218
|
label: string;
|
|
179
219
|
description: string;
|
|
180
220
|
formType: string;
|
|
181
221
|
propType: string;
|
|
182
|
-
|
|
222
|
+
group: string;
|
|
223
|
+
defaultValue: null;
|
|
183
224
|
editable: boolean;
|
|
184
225
|
required: boolean;
|
|
185
|
-
|
|
226
|
+
step: number;
|
|
186
227
|
};
|
|
187
228
|
};
|
|
188
|
-
|
|
229
|
+
layout?: undefined;
|
|
189
230
|
} | {
|
|
190
231
|
name: string;
|
|
191
232
|
tag: string;
|
|
192
233
|
description: string;
|
|
193
234
|
category: string;
|
|
194
235
|
stylesPanelSections: string[];
|
|
236
|
+
layout: {
|
|
237
|
+
flex: number;
|
|
238
|
+
flexDirection: string;
|
|
239
|
+
};
|
|
195
240
|
props: {
|
|
196
|
-
|
|
197
|
-
|
|
241
|
+
drawEndBorder: {
|
|
242
|
+
defaultValue: boolean;
|
|
198
243
|
label: string;
|
|
199
244
|
description: string;
|
|
200
245
|
formType: string;
|
|
201
246
|
propType: string;
|
|
202
|
-
defaultValue: null;
|
|
203
247
|
editable: boolean;
|
|
204
248
|
required: boolean;
|
|
249
|
+
group: string;
|
|
205
250
|
};
|
|
206
|
-
|
|
251
|
+
borderWidth: {
|
|
207
252
|
label: string;
|
|
208
253
|
description: string;
|
|
209
|
-
group: string;
|
|
210
254
|
formType: string;
|
|
211
255
|
propType: string;
|
|
212
|
-
|
|
256
|
+
group: string;
|
|
257
|
+
defaultValue: null;
|
|
213
258
|
editable: boolean;
|
|
214
259
|
required: boolean;
|
|
260
|
+
step: number;
|
|
215
261
|
};
|
|
216
|
-
|
|
262
|
+
borderColor: {
|
|
217
263
|
group: string;
|
|
218
264
|
label: string;
|
|
219
265
|
description: string;
|
|
220
|
-
formType: string;
|
|
221
|
-
propType: string;
|
|
222
|
-
defaultValue: null;
|
|
223
266
|
editable: boolean;
|
|
224
267
|
required: boolean;
|
|
268
|
+
defaultValue: null;
|
|
269
|
+
formType: string;
|
|
270
|
+
propType: string;
|
|
225
271
|
};
|
|
226
|
-
|
|
272
|
+
borderStyle: {
|
|
227
273
|
group: string;
|
|
228
274
|
label: string;
|
|
229
275
|
description: string;
|
|
230
|
-
formType: string;
|
|
231
|
-
propType: string;
|
|
232
|
-
defaultValue: string;
|
|
233
276
|
editable: boolean;
|
|
234
277
|
required: boolean;
|
|
278
|
+
formType: string;
|
|
279
|
+
propType: string;
|
|
280
|
+
defaultValue: null;
|
|
281
|
+
options: never[];
|
|
235
282
|
};
|
|
236
|
-
|
|
237
|
-
group: string;
|
|
283
|
+
drawTopBorder: {
|
|
238
284
|
label: string;
|
|
239
285
|
description: string;
|
|
240
286
|
formType: string;
|
|
241
287
|
propType: string;
|
|
242
|
-
defaultValue:
|
|
288
|
+
defaultValue: boolean;
|
|
243
289
|
editable: boolean;
|
|
244
290
|
required: boolean;
|
|
245
|
-
};
|
|
246
|
-
rightDescription: {
|
|
247
291
|
group: string;
|
|
292
|
+
};
|
|
293
|
+
drawBottomBorder: {
|
|
248
294
|
label: string;
|
|
249
295
|
description: string;
|
|
250
296
|
formType: string;
|
|
251
297
|
propType: string;
|
|
252
|
-
defaultValue:
|
|
298
|
+
defaultValue: boolean;
|
|
253
299
|
editable: boolean;
|
|
254
300
|
required: boolean;
|
|
255
|
-
};
|
|
256
|
-
aspectRatio: {
|
|
257
301
|
group: string;
|
|
302
|
+
};
|
|
303
|
+
drawStartBorder: {
|
|
258
304
|
label: string;
|
|
259
305
|
description: string;
|
|
260
306
|
formType: string;
|
|
261
307
|
propType: string;
|
|
262
|
-
defaultValue:
|
|
308
|
+
defaultValue: boolean;
|
|
263
309
|
editable: boolean;
|
|
264
310
|
required: boolean;
|
|
265
|
-
};
|
|
266
|
-
titleCentered: {
|
|
267
311
|
group: string;
|
|
312
|
+
};
|
|
313
|
+
cellVerticalPadding: {
|
|
268
314
|
label: string;
|
|
269
315
|
description: string;
|
|
270
316
|
formType: string;
|
|
271
317
|
propType: string;
|
|
272
|
-
|
|
318
|
+
group: string;
|
|
319
|
+
defaultValue: null;
|
|
273
320
|
editable: boolean;
|
|
274
321
|
required: boolean;
|
|
322
|
+
step: number;
|
|
275
323
|
};
|
|
276
|
-
|
|
277
|
-
defaultValue: any;
|
|
324
|
+
cellHorizontalPadding: {
|
|
278
325
|
label: string;
|
|
279
326
|
description: string;
|
|
280
327
|
formType: string;
|
|
281
328
|
propType: string;
|
|
282
|
-
|
|
329
|
+
group: string;
|
|
330
|
+
defaultValue: null;
|
|
283
331
|
editable: boolean;
|
|
284
332
|
required: boolean;
|
|
285
|
-
|
|
333
|
+
step: number;
|
|
286
334
|
};
|
|
287
335
|
};
|
|
288
336
|
})[];
|
|
289
|
-
//# sourceMappingURL=
|
|
337
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Table.ts"],"names":[],"mappings":"AAsEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmGrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.10.3-
|
|
3
|
+
"version": "46.10.3-cf3748.2+cf37488",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.10.3-
|
|
44
|
+
"@draftbit/types": "^46.10.3-cf3748.2+cf37488",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
]
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "cf37488982c9f617ee126da24adba23bcab663dc"
|
|
104
104
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ScrollView, View, StyleSheet, } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
import { generateBorderStyles, TableStyleContext, } from "./index";
|
|
5
|
+
const Table = ({ theme, borderWidth = 1, borderColor = theme.colors.divider, borderStyle = "solid", drawTopBorder = true, drawBottomBorder = false, drawStartBorder = false, drawEndBorder = false, cellVerticalPadding = 10, cellHorizontalPadding = 10, data, keyExtractor, renderItem, children: childrenProp, style, ...rest }) => {
|
|
6
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
7
|
+
if ((data && !renderItem) || (renderItem && !data)) {
|
|
8
|
+
throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
|
|
9
|
+
}
|
|
10
|
+
if (data && renderItem && childrenProp) {
|
|
11
|
+
console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
|
|
12
|
+
}
|
|
13
|
+
const isTableHeader = React.useCallback((object) => {
|
|
14
|
+
return object.isTableHeader;
|
|
15
|
+
}, []);
|
|
16
|
+
const isRenderItem = data && renderItem;
|
|
17
|
+
//Uses 'renderItem' and 'data' to create an array of children
|
|
18
|
+
const dataAsChildren = React.useMemo(() => {
|
|
19
|
+
if (!isRenderItem)
|
|
20
|
+
return [];
|
|
21
|
+
return data.map((item, index) => {
|
|
22
|
+
const component = renderItem({ item, index });
|
|
23
|
+
if (!component) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const key = keyExtractor ? keyExtractor(item, index) : index.toString();
|
|
27
|
+
return React.cloneElement(component, {
|
|
28
|
+
key,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}, [data, renderItem, keyExtractor, isRenderItem]);
|
|
32
|
+
const children = isRenderItem
|
|
33
|
+
? dataAsChildren
|
|
34
|
+
: React.Children.toArray(childrenProp);
|
|
35
|
+
const validChildren = React.useMemo(() => children.filter((item) => React.isValidElement(item)), [children]);
|
|
36
|
+
const childrenWithoutHeader = React.useMemo(() => {
|
|
37
|
+
const flattenedWithoutNestedHeaders = validChildren.map((item) => {
|
|
38
|
+
const nestedChildren = React.Children.toArray(item.props.children);
|
|
39
|
+
//Header can be nested in React.Fragment when in renderItem
|
|
40
|
+
const nestedHeaders = nestedChildren.filter((child) => isTableHeader(child.props));
|
|
41
|
+
if (nestedHeaders === null || nestedHeaders === void 0 ? void 0 : nestedHeaders.length) {
|
|
42
|
+
//New element excluding header children
|
|
43
|
+
return React.cloneElement(item, {
|
|
44
|
+
children: nestedChildren.filter((child) => !isTableHeader(child.props)),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return item;
|
|
48
|
+
});
|
|
49
|
+
return flattenedWithoutNestedHeaders.filter((item) => !isTableHeader(item.props));
|
|
50
|
+
}, [validChildren, isTableHeader]);
|
|
51
|
+
const header = React.useMemo(() => {
|
|
52
|
+
const flattenedPossibleHeaders = validChildren.map((item) => {
|
|
53
|
+
const nestedChildren = React.Children.toArray(item.props.children);
|
|
54
|
+
//Header can be nested in React.Fragment when in renderItem
|
|
55
|
+
const nestedHeaders = nestedChildren.filter((child) => isTableHeader(child.props));
|
|
56
|
+
if (nestedHeaders === null || nestedHeaders === void 0 ? void 0 : nestedHeaders.length) {
|
|
57
|
+
return nestedHeaders[0];
|
|
58
|
+
}
|
|
59
|
+
return item;
|
|
60
|
+
});
|
|
61
|
+
const allHeaders = flattenedPossibleHeaders.filter((item) => isTableHeader(item.props));
|
|
62
|
+
if (allHeaders.length) {
|
|
63
|
+
return allHeaders[0]; //Only 1 header taken
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}, [validChildren, isTableHeader]);
|
|
67
|
+
const contextValue = {
|
|
68
|
+
borderColor,
|
|
69
|
+
borderStyle,
|
|
70
|
+
borderWidth,
|
|
71
|
+
cellHorizontalPadding,
|
|
72
|
+
cellVerticalPadding,
|
|
73
|
+
};
|
|
74
|
+
const borderViewStyle = generateBorderStyles({
|
|
75
|
+
borderColor,
|
|
76
|
+
borderWidth,
|
|
77
|
+
borderStyle,
|
|
78
|
+
drawTopBorder,
|
|
79
|
+
drawBottomBorder,
|
|
80
|
+
drawStartBorder,
|
|
81
|
+
drawEndBorder,
|
|
82
|
+
});
|
|
83
|
+
return (React.createElement(TableStyleContext.Provider, { value: contextValue },
|
|
84
|
+
React.createElement(View, { style: [styles.container, borderViewStyle, style] },
|
|
85
|
+
React.createElement(React.Fragment, null, header),
|
|
86
|
+
React.createElement(ScrollView, { ...rest }, childrenWithoutHeader))));
|
|
87
|
+
};
|
|
88
|
+
const styles = StyleSheet.create({
|
|
89
|
+
container: {
|
|
90
|
+
flex: 1,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
export default withTheme(Table);
|