@draftbit/core 46.10.3-1ab4b6.2 → 46.10.3-258cfa.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/Accordion/AccordionItem.js +23 -4
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +2 -17
- package/lib/commonjs/components/Shadow.js +2 -15
- package/lib/commonjs/components/Table/Table.js +5 -7
- package/lib/commonjs/components/Table/TableCell.js +3 -3
- package/lib/commonjs/components/Table/TableRow.js +4 -4
- package/lib/commonjs/components/Table/index.js +25 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/Layout.js +177 -85
- package/lib/commonjs/mappings/NativeBase/Layout.js +108 -0
- package/lib/module/components/Table/Table.js +5 -5
- package/lib/module/components/Table/TableCell.js +1 -1
- package/lib/module/components/Table/TableRow.js +1 -1
- package/lib/module/components/Table/index.js +21 -0
- package/lib/module/mappings/Layout.js +178 -86
- package/lib/module/mappings/NativeBase/Layout.js +101 -0
- package/lib/typescript/src/components/Table/Table.d.ts +3 -7
- package/lib/typescript/src/components/Table/Table.d.ts.map +1 -1
- package/lib/typescript/src/components/Table/TableCell.d.ts +1 -1
- package/lib/typescript/src/components/Table/TableCell.d.ts.map +1 -1
- package/lib/typescript/src/components/Table/TableRow.d.ts +1 -1
- package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Table/index.d.ts +18 -0
- package/lib/typescript/src/components/Table/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Layout.d.ts +108 -72
- package/lib/typescript/src/mappings/Layout.d.ts.map +1 -1
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +133 -0
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Table/Table.js +3 -4
- package/src/components/Table/Table.tsx +3 -7
- package/src/components/Table/TableCell.js +1 -1
- package/src/components/Table/TableCell.tsx +1 -5
- package/src/components/Table/TableRow.js +1 -1
- package/src/components/Table/TableRow.tsx +1 -1
- package/src/components/Table/index.js +12 -0
- package/src/components/Table/index.tsx +41 -0
- package/src/mappings/Layout.js +176 -100
- package/src/mappings/Layout.ts +178 -116
- package/src/mappings/NativeBase/Layout.js +124 -0
- package/src/mappings/NativeBase/Layout.ts +145 -0
- package/lib/commonjs/components/Table/TableCommon.js +0 -30
- package/lib/module/components/Table/TableCommon.js +0 -21
- package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -20
- package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
- package/src/components/Table/TableCommon.js +0 -12
- package/src/components/Table/TableCommon.ts +0 -40
|
@@ -1,133 +1,169 @@
|
|
|
1
1
|
export declare const SEED_DATA: ({
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
category: string;
|
|
5
|
+
stylesPanelSections: string[];
|
|
2
6
|
props: {
|
|
3
|
-
|
|
7
|
+
justifyContent: {
|
|
4
8
|
label: string;
|
|
9
|
+
group: string;
|
|
5
10
|
description: string;
|
|
6
11
|
formType: string;
|
|
7
12
|
propType: string;
|
|
13
|
+
defaultValue: string;
|
|
14
|
+
editable: boolean;
|
|
15
|
+
required: boolean;
|
|
16
|
+
};
|
|
17
|
+
alignItems: {
|
|
18
|
+
label: string;
|
|
8
19
|
group: string;
|
|
9
|
-
|
|
20
|
+
description: string;
|
|
21
|
+
formType: string;
|
|
22
|
+
propType: string;
|
|
23
|
+
defaultValue: string;
|
|
10
24
|
editable: boolean;
|
|
11
25
|
required: boolean;
|
|
12
|
-
step: number;
|
|
13
26
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
top?: undefined;
|
|
28
|
+
right?: undefined;
|
|
29
|
+
bottom?: undefined;
|
|
30
|
+
left?: undefined;
|
|
31
|
+
width?: undefined;
|
|
32
|
+
height?: undefined;
|
|
33
|
+
bgColor?: undefined;
|
|
34
|
+
size?: undefined;
|
|
18
35
|
};
|
|
19
|
-
stylesPanelSections: string[];
|
|
20
|
-
category: string;
|
|
21
|
-
packageName: string;
|
|
22
|
-
name: string;
|
|
23
|
-
tag: string;
|
|
24
|
-
description: string;
|
|
25
36
|
} | {
|
|
26
|
-
category: string;
|
|
27
|
-
packageName: string;
|
|
28
|
-
stylesPanelSections: string[];
|
|
29
37
|
name: string;
|
|
30
38
|
tag: string;
|
|
31
|
-
description: string;
|
|
32
|
-
} | {
|
|
33
39
|
category: string;
|
|
34
|
-
packageName: string;
|
|
35
|
-
stylesPanelSections: string[];
|
|
36
|
-
name: string;
|
|
37
|
-
tag: string;
|
|
38
|
-
description: string;
|
|
39
40
|
props: {
|
|
40
|
-
|
|
41
|
+
top: {
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
formType: string;
|
|
45
|
+
propType: string;
|
|
46
|
+
group: string;
|
|
47
|
+
defaultValue: number;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
};
|
|
51
|
+
right: {
|
|
52
|
+
label: string;
|
|
53
|
+
description: string;
|
|
54
|
+
formType: string;
|
|
55
|
+
propType: string;
|
|
56
|
+
group: string;
|
|
57
|
+
defaultValue: number;
|
|
58
|
+
editable: boolean;
|
|
59
|
+
required: boolean;
|
|
60
|
+
};
|
|
61
|
+
bottom: {
|
|
41
62
|
label: string;
|
|
42
63
|
description: string;
|
|
43
64
|
formType: string;
|
|
44
65
|
propType: string;
|
|
45
|
-
|
|
66
|
+
group: string;
|
|
67
|
+
defaultValue: number;
|
|
46
68
|
editable: boolean;
|
|
47
69
|
required: boolean;
|
|
70
|
+
};
|
|
71
|
+
left: {
|
|
72
|
+
label: string;
|
|
73
|
+
description: string;
|
|
74
|
+
formType: string;
|
|
75
|
+
propType: string;
|
|
48
76
|
group: string;
|
|
77
|
+
defaultValue: number;
|
|
78
|
+
editable: boolean;
|
|
79
|
+
required: boolean;
|
|
49
80
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
81
|
+
justifyContent?: undefined;
|
|
82
|
+
alignItems?: undefined;
|
|
83
|
+
width?: undefined;
|
|
84
|
+
height?: undefined;
|
|
85
|
+
bgColor?: undefined;
|
|
86
|
+
size?: undefined;
|
|
54
87
|
};
|
|
88
|
+
stylesPanelSections?: undefined;
|
|
55
89
|
} | {
|
|
56
|
-
category: string;
|
|
57
|
-
packageName: string;
|
|
58
|
-
stylesPanelSections: string[];
|
|
59
90
|
name: string;
|
|
60
91
|
tag: string;
|
|
61
|
-
description: string;
|
|
62
|
-
layout: {
|
|
63
|
-
flexDirection: string;
|
|
64
|
-
flex?: undefined;
|
|
65
|
-
};
|
|
66
|
-
} | {
|
|
67
|
-
stylesPanelSections: string[];
|
|
68
92
|
category: string;
|
|
69
|
-
|
|
70
|
-
name: string;
|
|
71
|
-
tag: string;
|
|
72
|
-
description: string;
|
|
73
|
-
layout: {
|
|
74
|
-
flex: number;
|
|
75
|
-
flexDirection?: undefined;
|
|
76
|
-
};
|
|
77
|
-
} | {
|
|
93
|
+
stylesPanelSections: string[];
|
|
78
94
|
props: {
|
|
79
|
-
|
|
95
|
+
width: {
|
|
80
96
|
label: string;
|
|
81
97
|
description: string;
|
|
82
98
|
formType: string;
|
|
83
99
|
propType: string;
|
|
84
|
-
|
|
100
|
+
group: string;
|
|
101
|
+
defaultValue: number;
|
|
85
102
|
editable: boolean;
|
|
86
103
|
required: boolean;
|
|
104
|
+
};
|
|
105
|
+
height: {
|
|
106
|
+
label: string;
|
|
107
|
+
description: string;
|
|
108
|
+
formType: string;
|
|
109
|
+
propType: string;
|
|
87
110
|
group: string;
|
|
111
|
+
defaultValue: number;
|
|
112
|
+
editable: boolean;
|
|
113
|
+
required: boolean;
|
|
88
114
|
};
|
|
89
|
-
|
|
115
|
+
bgColor: {
|
|
90
116
|
label: string;
|
|
91
117
|
description: string;
|
|
92
118
|
formType: string;
|
|
93
119
|
propType: string;
|
|
94
|
-
defaultValue: boolean;
|
|
95
120
|
editable: boolean;
|
|
96
121
|
required: boolean;
|
|
122
|
+
defaultValue: string;
|
|
97
123
|
group: string;
|
|
98
124
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
justifyContent?: undefined;
|
|
126
|
+
alignItems?: undefined;
|
|
127
|
+
top?: undefined;
|
|
128
|
+
right?: undefined;
|
|
129
|
+
bottom?: undefined;
|
|
130
|
+
left?: undefined;
|
|
131
|
+
size?: undefined;
|
|
102
132
|
};
|
|
103
|
-
|
|
104
|
-
packageName: string;
|
|
105
|
-
stylesPanelSections: string[];
|
|
133
|
+
} | {
|
|
106
134
|
name: string;
|
|
107
135
|
tag: string;
|
|
108
|
-
|
|
109
|
-
|
|
136
|
+
category: string;
|
|
137
|
+
stylesPanelSections: string[];
|
|
110
138
|
props: {
|
|
111
|
-
|
|
139
|
+
size: {
|
|
140
|
+
label: string;
|
|
141
|
+
description: string;
|
|
142
|
+
formType: string;
|
|
143
|
+
propType: string;
|
|
144
|
+
group: string;
|
|
145
|
+
defaultValue: number;
|
|
146
|
+
editable: boolean;
|
|
147
|
+
required: boolean;
|
|
148
|
+
};
|
|
149
|
+
bgColor: {
|
|
112
150
|
label: string;
|
|
113
151
|
description: string;
|
|
114
152
|
formType: string;
|
|
115
153
|
propType: string;
|
|
116
|
-
defaultValue: boolean;
|
|
117
154
|
editable: boolean;
|
|
118
155
|
required: boolean;
|
|
156
|
+
defaultValue: string;
|
|
119
157
|
group: string;
|
|
120
158
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
159
|
+
justifyContent?: undefined;
|
|
160
|
+
alignItems?: undefined;
|
|
161
|
+
top?: undefined;
|
|
162
|
+
right?: undefined;
|
|
163
|
+
bottom?: undefined;
|
|
164
|
+
left?: undefined;
|
|
165
|
+
width?: undefined;
|
|
166
|
+
height?: undefined;
|
|
125
167
|
};
|
|
126
|
-
category: string;
|
|
127
|
-
packageName: string;
|
|
128
|
-
stylesPanelSections: string[];
|
|
129
|
-
name: string;
|
|
130
|
-
tag: string;
|
|
131
|
-
description: string;
|
|
132
168
|
})[];
|
|
133
169
|
//# sourceMappingURL=Layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Layout.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsMrB,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
props: {
|
|
3
|
+
ratio: {
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
formType: string;
|
|
7
|
+
propType: string;
|
|
8
|
+
group: string;
|
|
9
|
+
defaultValue: null;
|
|
10
|
+
editable: boolean;
|
|
11
|
+
required: boolean;
|
|
12
|
+
step: number;
|
|
13
|
+
};
|
|
14
|
+
centerContent?: undefined;
|
|
15
|
+
isDisabled?: undefined;
|
|
16
|
+
isInvalid?: undefined;
|
|
17
|
+
reversed?: undefined;
|
|
18
|
+
};
|
|
19
|
+
stylesPanelSections: string[];
|
|
20
|
+
category: string;
|
|
21
|
+
packageName: string;
|
|
22
|
+
name: string;
|
|
23
|
+
tag: string;
|
|
24
|
+
description: string;
|
|
25
|
+
} | {
|
|
26
|
+
category: string;
|
|
27
|
+
packageName: string;
|
|
28
|
+
stylesPanelSections: string[];
|
|
29
|
+
name: string;
|
|
30
|
+
tag: string;
|
|
31
|
+
description: string;
|
|
32
|
+
} | {
|
|
33
|
+
category: string;
|
|
34
|
+
packageName: string;
|
|
35
|
+
stylesPanelSections: string[];
|
|
36
|
+
name: string;
|
|
37
|
+
tag: string;
|
|
38
|
+
description: string;
|
|
39
|
+
props: {
|
|
40
|
+
centerContent: {
|
|
41
|
+
label: string;
|
|
42
|
+
description: string;
|
|
43
|
+
formType: string;
|
|
44
|
+
propType: string;
|
|
45
|
+
defaultValue: boolean;
|
|
46
|
+
editable: boolean;
|
|
47
|
+
required: boolean;
|
|
48
|
+
group: string;
|
|
49
|
+
};
|
|
50
|
+
ratio?: undefined;
|
|
51
|
+
isDisabled?: undefined;
|
|
52
|
+
isInvalid?: undefined;
|
|
53
|
+
reversed?: undefined;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
category: string;
|
|
57
|
+
packageName: string;
|
|
58
|
+
stylesPanelSections: string[];
|
|
59
|
+
name: string;
|
|
60
|
+
tag: string;
|
|
61
|
+
description: string;
|
|
62
|
+
layout: {
|
|
63
|
+
flexDirection: string;
|
|
64
|
+
flex?: undefined;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
stylesPanelSections: string[];
|
|
68
|
+
category: string;
|
|
69
|
+
packageName: string;
|
|
70
|
+
name: string;
|
|
71
|
+
tag: string;
|
|
72
|
+
description: string;
|
|
73
|
+
layout: {
|
|
74
|
+
flex: number;
|
|
75
|
+
flexDirection?: undefined;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
props: {
|
|
79
|
+
isDisabled: {
|
|
80
|
+
label: string;
|
|
81
|
+
description: string;
|
|
82
|
+
formType: string;
|
|
83
|
+
propType: string;
|
|
84
|
+
defaultValue: boolean;
|
|
85
|
+
editable: boolean;
|
|
86
|
+
required: boolean;
|
|
87
|
+
group: string;
|
|
88
|
+
};
|
|
89
|
+
isInvalid: {
|
|
90
|
+
label: string;
|
|
91
|
+
description: string;
|
|
92
|
+
formType: string;
|
|
93
|
+
propType: string;
|
|
94
|
+
defaultValue: boolean;
|
|
95
|
+
editable: boolean;
|
|
96
|
+
required: boolean;
|
|
97
|
+
group: string;
|
|
98
|
+
};
|
|
99
|
+
ratio?: undefined;
|
|
100
|
+
centerContent?: undefined;
|
|
101
|
+
reversed?: undefined;
|
|
102
|
+
};
|
|
103
|
+
category: string;
|
|
104
|
+
packageName: string;
|
|
105
|
+
stylesPanelSections: string[];
|
|
106
|
+
name: string;
|
|
107
|
+
tag: string;
|
|
108
|
+
description: string;
|
|
109
|
+
} | {
|
|
110
|
+
props: {
|
|
111
|
+
reversed: {
|
|
112
|
+
label: string;
|
|
113
|
+
description: string;
|
|
114
|
+
formType: string;
|
|
115
|
+
propType: string;
|
|
116
|
+
defaultValue: boolean;
|
|
117
|
+
editable: boolean;
|
|
118
|
+
required: boolean;
|
|
119
|
+
group: string;
|
|
120
|
+
};
|
|
121
|
+
ratio?: undefined;
|
|
122
|
+
centerContent?: undefined;
|
|
123
|
+
isDisabled?: undefined;
|
|
124
|
+
isInvalid?: undefined;
|
|
125
|
+
};
|
|
126
|
+
category: string;
|
|
127
|
+
packageName: string;
|
|
128
|
+
stylesPanelSections: string[];
|
|
129
|
+
name: string;
|
|
130
|
+
tag: string;
|
|
131
|
+
description: string;
|
|
132
|
+
})[];
|
|
133
|
+
//# sourceMappingURL=Layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../../../src/mappings/NativeBase/Layout.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0HrB,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-258cfa.2+258cfa9",
|
|
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-258cfa.2+258cfa9",
|
|
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": "258cfa910e2606db46e99152e4499d8fb6e17174"
|
|
104
104
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ScrollView, View, StyleSheet, } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 }) => {
|
|
3
|
+
import { generateBorderStyles, TableStyleContext, } from "./index";
|
|
4
|
+
const Table = ({ borderWidth = 1, borderColor = "rgba(200, 200, 200, 1)", borderStyle = "solid", drawTopBorder = true, drawBottomBorder = false, drawStartBorder = false, drawEndBorder = false, cellVerticalPadding = 10, cellHorizontalPadding = 10, data, keyExtractor, renderItem, children: childrenProp, style, ...rest }) => {
|
|
6
5
|
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
7
6
|
if ((data && !renderItem) || (renderItem && !data)) {
|
|
8
7
|
throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
|
|
@@ -90,4 +89,4 @@ const styles = StyleSheet.create({
|
|
|
90
89
|
flex: 1,
|
|
91
90
|
},
|
|
92
91
|
});
|
|
93
|
-
export default
|
|
92
|
+
export default Table;
|
|
@@ -7,27 +7,23 @@ import {
|
|
|
7
7
|
StyleSheet,
|
|
8
8
|
ScrollViewProps,
|
|
9
9
|
} from "react-native";
|
|
10
|
-
import { Theme } from "../../styles/DefaultTheme";
|
|
11
|
-
import { withTheme } from "../../theming";
|
|
12
10
|
import {
|
|
13
11
|
generateBorderStyles,
|
|
14
12
|
TableProps,
|
|
15
13
|
TableStyleContext,
|
|
16
14
|
TableStyleProps,
|
|
17
|
-
} from "./
|
|
15
|
+
} from "./index";
|
|
18
16
|
|
|
19
17
|
export interface Props<T> extends TableProps, ScrollViewProps {
|
|
20
18
|
data?: Array<T>;
|
|
21
19
|
keyExtractor?: (item: T, index: number) => string;
|
|
22
20
|
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
23
21
|
style?: StyleProp<ViewStyle>;
|
|
24
|
-
theme: Theme;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
const Table = <T extends object>({
|
|
28
|
-
theme,
|
|
29
25
|
borderWidth = 1,
|
|
30
|
-
borderColor =
|
|
26
|
+
borderColor = "rgba(200, 200, 200, 1)",
|
|
31
27
|
borderStyle = "solid",
|
|
32
28
|
drawTopBorder = true,
|
|
33
29
|
drawBottomBorder = false,
|
|
@@ -173,4 +169,4 @@ const styles = StyleSheet.create({
|
|
|
173
169
|
},
|
|
174
170
|
});
|
|
175
171
|
|
|
176
|
-
export default
|
|
172
|
+
export default Table;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { generateBorderStyles, TableStyleContext
|
|
3
|
+
import { generateBorderStyles, TableStyleContext } from "./index";
|
|
4
4
|
const TableCell = ({ borderWidth, borderColor, borderStyle, drawTopBorder = false, drawBottomBorder = false, drawStartBorder = false, drawEndBorder = true, cellVerticalPadding, cellHorizontalPadding, children, style, }) => {
|
|
5
5
|
const parentContextValue = React.useContext(TableStyleContext);
|
|
6
6
|
const borderViewStyle = generateBorderStyles({
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
generateBorderStyles,
|
|
5
|
-
TableProps,
|
|
6
|
-
TableStyleContext,
|
|
7
|
-
} from "./TableCommon";
|
|
3
|
+
import { generateBorderStyles, TableProps, TableStyleContext } from "./index";
|
|
8
4
|
|
|
9
5
|
export interface Props extends TableProps {
|
|
10
6
|
style?: StyleProp<ViewStyle>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { generateBorderStyles, TableStyleContext, } from "./
|
|
3
|
+
import { generateBorderStyles, TableStyleContext, } from "./index";
|
|
4
4
|
import { withTheme } from "../../theming";
|
|
5
5
|
const TableRow = ({ borderWidth, borderColor, borderStyle, drawTopBorder = false, drawBottomBorder = true, drawStartBorder = true, drawEndBorder = false, cellVerticalPadding, cellHorizontalPadding, isTableHeader = false, children, style, theme, }) => {
|
|
6
6
|
const parentContextValue = React.useContext(TableStyleContext);
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const TableStyleContext = React.createContext({});
|
|
3
|
+
export function generateBorderStyles({ borderColor, borderWidth, borderStyle, drawTopBorder, drawBottomBorder, drawStartBorder, drawEndBorder, }) {
|
|
4
|
+
return {
|
|
5
|
+
borderColor,
|
|
6
|
+
borderStyle,
|
|
7
|
+
borderTopWidth: drawTopBorder ? borderWidth : 0,
|
|
8
|
+
borderBottomWidth: drawBottomBorder ? borderWidth : 0,
|
|
9
|
+
borderStartWidth: drawStartBorder ? borderWidth : 0,
|
|
10
|
+
borderEndWidth: drawEndBorder ? borderWidth : 0,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
1
13
|
export { default as Table } from "./Table";
|
|
2
14
|
export { default as TableRow } from "./TableRow";
|
|
3
15
|
export { default as TableCell } from "./TableCell";
|
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
type BorderStyle = "solid" | "dotted" | "dashed";
|
|
5
|
+
|
|
6
|
+
export const TableStyleContext = React.createContext<TableStyleProps>({});
|
|
7
|
+
|
|
8
|
+
export interface TableStyleProps {
|
|
9
|
+
borderWidth?: number;
|
|
10
|
+
borderColor?: string;
|
|
11
|
+
borderStyle?: BorderStyle;
|
|
12
|
+
cellVerticalPadding?: number;
|
|
13
|
+
cellHorizontalPadding?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TableProps extends TableStyleProps {
|
|
17
|
+
drawTopBorder?: boolean;
|
|
18
|
+
drawBottomBorder?: boolean;
|
|
19
|
+
drawStartBorder?: boolean;
|
|
20
|
+
drawEndBorder?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function generateBorderStyles({
|
|
24
|
+
borderColor,
|
|
25
|
+
borderWidth,
|
|
26
|
+
borderStyle,
|
|
27
|
+
drawTopBorder,
|
|
28
|
+
drawBottomBorder,
|
|
29
|
+
drawStartBorder,
|
|
30
|
+
drawEndBorder,
|
|
31
|
+
}: TableProps): ViewStyle {
|
|
32
|
+
return {
|
|
33
|
+
borderColor,
|
|
34
|
+
borderStyle,
|
|
35
|
+
borderTopWidth: drawTopBorder ? borderWidth : 0,
|
|
36
|
+
borderBottomWidth: drawBottomBorder ? borderWidth : 0,
|
|
37
|
+
borderStartWidth: drawStartBorder ? borderWidth : 0,
|
|
38
|
+
borderEndWidth: drawEndBorder ? borderWidth : 0,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
1
42
|
export { default as Table } from "./Table";
|
|
2
43
|
export { default as TableRow } from "./TableRow";
|
|
3
44
|
export { default as TableCell } from "./TableCell";
|