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