@draftbit/core 46.4.4-8a6164.2 → 46.4.4-8e5cf2.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/Container.js +17 -5
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -6
- package/lib/commonjs/components/Table/Table.js +35 -0
- package/lib/commonjs/components/Table/TableCell.js +50 -0
- package/lib/commonjs/components/Table/TableHeader.js +41 -0
- package/lib/commonjs/components/Table/TablePaginator.js +17 -0
- package/lib/commonjs/components/Table/TableRow.js +47 -0
- package/lib/commonjs/components/Table/TableTitle.js +60 -0
- package/lib/commonjs/components/Table/index.js +55 -0
- package/lib/commonjs/components/Text.js +6 -2
- package/lib/commonjs/components/TextField.js +5 -1
- package/lib/commonjs/index.js +38 -0
- package/lib/commonjs/mappings/Table.js +102 -0
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/commonjs/utilities.js +2 -2
- package/lib/module/components/DatePicker/DatePicker.js +1 -5
- package/lib/module/components/Table/Table.js +23 -0
- package/lib/module/components/Table/TableCell.js +37 -0
- package/lib/module/components/Table/TableHeader.js +27 -0
- package/lib/module/components/Table/TablePaginator.js +6 -0
- package/lib/module/components/Table/TableRow.js +33 -0
- package/lib/module/components/Table/TableTitle.js +47 -0
- package/lib/module/components/Table/index.js +6 -0
- package/lib/module/components/Text.js +6 -2
- package/lib/module/components/TextField.js +5 -1
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Table.js +93 -0
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/module/utilities.js +3 -3
- package/lib/typescript/src/components/Table/Table.d.ts +8 -0
- package/lib/typescript/src/components/Table/TableCell.d.ts +10 -0
- package/lib/typescript/src/components/Table/TableHeader.d.ts +12 -0
- package/lib/typescript/src/components/Table/TablePaginator.d.ts +3 -0
- package/lib/typescript/src/components/Table/TableRow.d.ts +12 -0
- package/lib/typescript/src/components/Table/TableTitle.d.ts +12 -0
- package/lib/typescript/src/components/Table/index.d.ts +6 -0
- package/lib/typescript/src/components/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextField.d.ts +2 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/Table.d.ts +148 -0
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/lib/typescript/src/utilities.d.ts +3 -3
- package/package.json +3 -3
- package/src/components/DatePicker/DatePicker.js +0 -3
- package/src/components/DatePicker/DatePicker.tsx +0 -4
- package/src/components/Table/Table.js +10 -0
- package/src/components/Table/Table.tsx +22 -0
- package/src/components/Table/TableCell.js +21 -0
- package/src/components/Table/TableCell.tsx +44 -0
- package/src/components/Table/TableHeader.js +11 -0
- package/src/components/Table/TableHeader.tsx +28 -0
- package/src/components/Table/TablePaginator.js +5 -0
- package/src/components/Table/TablePaginator.tsx +10 -0
- package/src/components/Table/TableRow.js +16 -0
- package/src/components/Table/TableRow.tsx +31 -0
- package/src/components/Table/TableTitle.js +28 -0
- package/src/components/Table/TableTitle.tsx +58 -0
- package/src/components/Table/index.js +6 -0
- package/src/components/Table/index.tsx +6 -0
- package/src/components/Text.js +8 -2
- package/src/components/Text.tsx +6 -1
- package/src/components/TextField.js +6 -1
- package/src/components/TextField.tsx +7 -1
- package/src/index.js +1 -0
- package/src/index.tsx +9 -0
- package/src/mappings/Table.js +136 -0
- package/src/mappings/Table.ts +144 -0
- package/src/mappings/TextField.js +1 -1
- package/src/mappings/TextField.ts +1 -1
- package/src/mappings/TextInput.js +1 -1
- package/src/mappings/TextInput.ts +1 -1
- package/src/utilities.js +5 -2
- package/src/utilities.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-8e5cf2.2+8e5cf29",
|
|
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.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-8e5cf2.2+8e5cf29",
|
|
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",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
]
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "8e5cf29f14b735059ccd00fe971e5f2c389e1500"
|
|
85
85
|
}
|
|
@@ -6,7 +6,6 @@ import { withTheme } from "../../theming";
|
|
|
6
6
|
import Portal from "../Portal/Portal";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
8
|
import DateTimePicker from "./DatePickerComponent";
|
|
9
|
-
import { extractStyles } from "../../utilities";
|
|
10
9
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
11
10
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
12
11
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -242,12 +241,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
242
241
|
},
|
|
243
242
|
],
|
|
244
243
|
};
|
|
245
|
-
const { textStyles } = extractStyles(style);
|
|
246
244
|
const inputStyles = [
|
|
247
245
|
styles.input,
|
|
248
246
|
inputStyle,
|
|
249
247
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
250
|
-
textStyles,
|
|
251
248
|
];
|
|
252
249
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
253
250
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -23,7 +23,6 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
-
import { extractStyles } from "../../utilities";
|
|
27
26
|
|
|
28
27
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
29
28
|
|
|
@@ -348,13 +347,10 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
348
347
|
],
|
|
349
348
|
};
|
|
350
349
|
|
|
351
|
-
const { textStyles } = extractStyles(style);
|
|
352
|
-
|
|
353
350
|
const inputStyles = [
|
|
354
351
|
styles.input,
|
|
355
352
|
inputStyle,
|
|
356
353
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
357
|
-
textStyles,
|
|
358
354
|
];
|
|
359
355
|
|
|
360
356
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
const Table = ({ children, style, ...rest }) => (React.createElement(View, { ...rest, style: [styles.wrapper, style] }, children));
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
wrapper: {
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export default Table;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface TableProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Table = ({ children, style, ...rest }: TableProps) => (
|
|
10
|
+
<View {...rest} style={[styles.wrapper, style]}>
|
|
11
|
+
{children}
|
|
12
|
+
</View>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
wrapper: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default Table;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
const TableCell = ({ children, style, numeric, value, ...rest }) => {
|
|
5
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
6
|
+
return (React.createElement(View, { ...rest, style: [styles.wrapper, numeric && styles.right, viewStyles] },
|
|
7
|
+
React.createElement(Text, { numberOfLines: 1, style: textStyles },
|
|
8
|
+
children,
|
|
9
|
+
value)));
|
|
10
|
+
};
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
wrapper: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
},
|
|
17
|
+
right: {
|
|
18
|
+
justifyContent: "flex-end",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export default TableCell;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
|
|
5
|
+
export interface TableCellProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
numeric?: boolean;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TableCell = ({
|
|
13
|
+
children,
|
|
14
|
+
style,
|
|
15
|
+
numeric,
|
|
16
|
+
value,
|
|
17
|
+
...rest
|
|
18
|
+
}: TableCellProps) => {
|
|
19
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
20
|
+
return (
|
|
21
|
+
<View
|
|
22
|
+
{...rest}
|
|
23
|
+
style={[styles.wrapper, numeric && styles.right, viewStyles]}
|
|
24
|
+
>
|
|
25
|
+
<Text numberOfLines={1} style={textStyles}>
|
|
26
|
+
{children}
|
|
27
|
+
{value}
|
|
28
|
+
</Text>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
wrapper: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
},
|
|
39
|
+
right: {
|
|
40
|
+
justifyContent: "flex-end",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default TableCell;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const TableHeader = ({ children, style, theme, ...rest }) => (React.createElement(View, { ...rest, style: [styles.wrapper, { borderBottomColor: theme.colors.medium }, style] }, children));
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
wrapper: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "row",
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export default withTheme(TableHeader);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { Theme } from "../../styles/DefaultTheme";
|
|
4
|
+
import { withTheme } from "../../theming";
|
|
5
|
+
|
|
6
|
+
export interface TableHeaderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
theme: Theme;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TableHeader = ({ children, style, theme, ...rest }: TableHeaderProps) => (
|
|
13
|
+
<View
|
|
14
|
+
{...rest}
|
|
15
|
+
style={[styles.wrapper, { borderBottomColor: theme.colors.medium }, style]}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
wrapper: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default withTheme(TableHeader);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const TableRow = ({ children, style, theme, ...rest }) => (React.createElement(View, { ...rest, style: [styles.container, { borderBottomColor: theme.colors.light }, style] },
|
|
5
|
+
React.createElement(View, { style: styles.content }, children)));
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
flexDirection: "row",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export default withTheme(TableRow);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { Theme } from "../../styles/DefaultTheme";
|
|
4
|
+
import { withTheme } from "../../theming";
|
|
5
|
+
export interface TableRowProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TableRow = ({ children, style, theme, ...rest }: TableRowProps) => (
|
|
12
|
+
<View
|
|
13
|
+
{...rest}
|
|
14
|
+
style={[styles.container, { borderBottomColor: theme.colors.light }, style]}
|
|
15
|
+
>
|
|
16
|
+
<View style={styles.content}>{children}</View>
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
},
|
|
25
|
+
content: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default withTheme(TableRow);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
const TableTitle = ({ children, style, numeric = false, isAscending = false, numberOfLines = 1, title, ...rest }) => {
|
|
5
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
6
|
+
return (React.createElement(View, { ...rest, style: [styles.wrapper, numeric && styles.right, viewStyles] },
|
|
7
|
+
React.createElement(Text, { style: [isAscending ? styles.sorted : { color: "gray" }, textStyles], numberOfLines: numberOfLines },
|
|
8
|
+
children,
|
|
9
|
+
title)));
|
|
10
|
+
};
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
wrapper: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
},
|
|
17
|
+
right: {
|
|
18
|
+
justifyContent: "flex-end",
|
|
19
|
+
},
|
|
20
|
+
sorted: {
|
|
21
|
+
// marginLeft: 8,
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
height: 24,
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default TableTitle;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
|
|
5
|
+
export interface TableCellProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
numeric?: boolean;
|
|
8
|
+
isAscending: boolean;
|
|
9
|
+
numberOfLines?: number;
|
|
10
|
+
title?: string;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TableTitle = ({
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
numeric = false,
|
|
18
|
+
isAscending = false,
|
|
19
|
+
numberOfLines = 1,
|
|
20
|
+
title,
|
|
21
|
+
...rest
|
|
22
|
+
}: TableCellProps) => {
|
|
23
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
24
|
+
return (
|
|
25
|
+
<View
|
|
26
|
+
{...rest}
|
|
27
|
+
style={[styles.wrapper, numeric && styles.right, viewStyles]}
|
|
28
|
+
>
|
|
29
|
+
<Text
|
|
30
|
+
style={[isAscending ? styles.sorted : { color: "gray" }, textStyles]}
|
|
31
|
+
numberOfLines={numberOfLines}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
{title}
|
|
35
|
+
</Text>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
wrapper: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
},
|
|
46
|
+
right: {
|
|
47
|
+
justifyContent: "flex-end",
|
|
48
|
+
},
|
|
49
|
+
sorted: {
|
|
50
|
+
// marginLeft: 8,
|
|
51
|
+
},
|
|
52
|
+
icon: {
|
|
53
|
+
height: 24,
|
|
54
|
+
justifyContent: "center",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default TableTitle;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Table } from "./Table";
|
|
2
|
+
export { default as TableHeader } from "./TableHeader";
|
|
3
|
+
export { default as TablePaginator } from "./TablePaginator";
|
|
4
|
+
export { default as TableRow } from "./TableRow";
|
|
5
|
+
export { default as TableCell } from "./TableCell";
|
|
6
|
+
export { default as TableTitle } from "./TableTitle";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Table } from "./Table";
|
|
2
|
+
export { default as TableHeader } from "./TableHeader";
|
|
3
|
+
export { default as TablePaginator } from "./TablePaginator";
|
|
4
|
+
export { default as TableRow } from "./TableRow";
|
|
5
|
+
export { default as TableCell } from "./TableCell";
|
|
6
|
+
export { default as TableTitle } from "./TableTitle";
|
package/src/components/Text.js
CHANGED
|
@@ -2,13 +2,19 @@ import * as React from "react";
|
|
|
2
2
|
import { Text as NativeText, I18nManager } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
class Text extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.state = {
|
|
8
|
+
nativeProps: {},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
5
11
|
setNativeProps(args) {
|
|
6
|
-
|
|
12
|
+
this.state.nativeProps = args || {};
|
|
7
13
|
}
|
|
8
14
|
render() {
|
|
9
15
|
const { style, ...rest } = this.props;
|
|
10
16
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
11
|
-
return (React.createElement(NativeText, { ...rest, ref: (c) => {
|
|
17
|
+
return (React.createElement(NativeText, { ...rest, ...this.state.nativeProps, ref: (c) => {
|
|
12
18
|
this._root = c;
|
|
13
19
|
}, style: [
|
|
14
20
|
{
|
package/src/components/Text.tsx
CHANGED
|
@@ -10,8 +10,12 @@ type Props = {
|
|
|
10
10
|
class Text extends React.Component<Props> {
|
|
11
11
|
_root: any;
|
|
12
12
|
|
|
13
|
+
state: any = {
|
|
14
|
+
nativeProps: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
13
17
|
setNativeProps(args: TextProps) {
|
|
14
|
-
|
|
18
|
+
this.state.nativeProps = args || {};
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
render() {
|
|
@@ -21,6 +25,7 @@ class Text extends React.Component<Props> {
|
|
|
21
25
|
return (
|
|
22
26
|
<NativeText
|
|
23
27
|
{...rest}
|
|
28
|
+
{...this.state.nativeProps}
|
|
24
29
|
ref={(c) => {
|
|
25
30
|
this._root = c;
|
|
26
31
|
}}
|
|
@@ -10,6 +10,7 @@ class TextField extends React.Component {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.state = {
|
|
13
|
+
nativeProps: {},
|
|
13
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
14
15
|
focused: false,
|
|
15
16
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -121,7 +122,10 @@ class TextField extends React.Component {
|
|
|
121
122
|
* @internal
|
|
122
123
|
*/
|
|
123
124
|
setNativeProps(args) {
|
|
124
|
-
|
|
125
|
+
this.setState((state) => ({
|
|
126
|
+
...state,
|
|
127
|
+
nativeState: args || {},
|
|
128
|
+
}));
|
|
125
129
|
}
|
|
126
130
|
isFocused() {
|
|
127
131
|
return this._root && this._root.isFocused();
|
|
@@ -381,6 +385,7 @@ class TextField extends React.Component {
|
|
|
381
385
|
underlineColorAndroid: "transparent",
|
|
382
386
|
style: inputStyles,
|
|
383
387
|
...rest,
|
|
388
|
+
...this.state.nativeProps,
|
|
384
389
|
value: this.state.value,
|
|
385
390
|
})),
|
|
386
391
|
rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
|
|
@@ -52,6 +52,7 @@ export type Props = {
|
|
|
52
52
|
IconSlot;
|
|
53
53
|
|
|
54
54
|
interface State {
|
|
55
|
+
nativeProps: any;
|
|
55
56
|
labeled: Animated.Value;
|
|
56
57
|
focused?: boolean;
|
|
57
58
|
placeholder?: string | undefined;
|
|
@@ -73,6 +74,7 @@ class TextField extends React.Component<Props, State> {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
state: State = {
|
|
77
|
+
nativeProps: {},
|
|
76
78
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
77
79
|
focused: false,
|
|
78
80
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -207,7 +209,10 @@ class TextField extends React.Component<Props, State> {
|
|
|
207
209
|
* @internal
|
|
208
210
|
*/
|
|
209
211
|
setNativeProps(args: Props) {
|
|
210
|
-
|
|
212
|
+
this.setState((state) => ({
|
|
213
|
+
...state,
|
|
214
|
+
nativeState: args || {},
|
|
215
|
+
}));
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
isFocused() {
|
|
@@ -566,6 +571,7 @@ class TextField extends React.Component<Props, State> {
|
|
|
566
571
|
underlineColorAndroid: "transparent",
|
|
567
572
|
style: inputStyles,
|
|
568
573
|
...rest,
|
|
574
|
+
...this.state.nativeProps,
|
|
569
575
|
value: this.state.value,
|
|
570
576
|
})}
|
|
571
577
|
</View>
|
package/src/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
+
export { Table, TableRow, TablePaginator, TableHeader, TableCell, TableTitle, } from "./components/Table";
|
|
34
35
|
/* Deprecated: Fix or Delete! */
|
|
35
36
|
export { default as CardBlock } from "./components/CardBlock";
|
|
36
37
|
export { default as CardContainer } from "./components/CardContainer";
|
package/src/index.tsx
CHANGED
|
@@ -51,6 +51,15 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
+
export {
|
|
55
|
+
Table,
|
|
56
|
+
TableRow,
|
|
57
|
+
TablePaginator,
|
|
58
|
+
TableHeader,
|
|
59
|
+
TableCell,
|
|
60
|
+
TableTitle,
|
|
61
|
+
} from "./components/Table";
|
|
62
|
+
|
|
54
63
|
/* Deprecated: Fix or Delete! */
|
|
55
64
|
export { default as CardBlock } from "./components/CardBlock";
|
|
56
65
|
export { default as CardContainer } from "./components/CardContainer";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, GROUPS, createBoolProp, createTextProp, createNumberProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = [
|
|
3
|
+
{
|
|
4
|
+
name: "Table",
|
|
5
|
+
tag: "Table",
|
|
6
|
+
category: COMPONENT_TYPES.container,
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.Background,
|
|
9
|
+
StylesPanelSections.Borders,
|
|
10
|
+
StylesPanelSections.Size,
|
|
11
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
12
|
+
StylesPanelSections.Position,
|
|
13
|
+
StylesPanelSections.Effects,
|
|
14
|
+
],
|
|
15
|
+
layout: {
|
|
16
|
+
width: "100%",
|
|
17
|
+
},
|
|
18
|
+
props: {},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "Table Row",
|
|
22
|
+
tag: "TableRow",
|
|
23
|
+
category: COMPONENT_TYPES.container,
|
|
24
|
+
stylesPanelSections: [
|
|
25
|
+
StylesPanelSections.Background,
|
|
26
|
+
StylesPanelSections.Borders,
|
|
27
|
+
StylesPanelSections.Size,
|
|
28
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
29
|
+
StylesPanelSections.Position,
|
|
30
|
+
StylesPanelSections.Effects,
|
|
31
|
+
],
|
|
32
|
+
layout: {
|
|
33
|
+
paddingLeft: 16,
|
|
34
|
+
paddingRight: 16,
|
|
35
|
+
borderBottomWidth: 1,
|
|
36
|
+
borderStyle: "solid",
|
|
37
|
+
},
|
|
38
|
+
props: {},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Table Cell",
|
|
42
|
+
tag: "TableCell",
|
|
43
|
+
category: COMPONENT_TYPES.container,
|
|
44
|
+
layout: {
|
|
45
|
+
paddingTop: 16,
|
|
46
|
+
paddingBottom: 16,
|
|
47
|
+
paddingLeft: 8,
|
|
48
|
+
paddingRight: 8,
|
|
49
|
+
},
|
|
50
|
+
stylesPanelSections: [
|
|
51
|
+
StylesPanelSections.Typography,
|
|
52
|
+
StylesPanelSections.Background,
|
|
53
|
+
StylesPanelSections.Borders,
|
|
54
|
+
StylesPanelSections.Size,
|
|
55
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
56
|
+
StylesPanelSections.Position,
|
|
57
|
+
StylesPanelSections.Effects,
|
|
58
|
+
],
|
|
59
|
+
props: {
|
|
60
|
+
numeric: createBoolProp({
|
|
61
|
+
label: "Is Numeric Cell?",
|
|
62
|
+
description: "Does the cell contain a numeric value?",
|
|
63
|
+
group: GROUPS.data,
|
|
64
|
+
}),
|
|
65
|
+
value: createTextProp({
|
|
66
|
+
label: "Cell Value",
|
|
67
|
+
description: "Table Cell Value",
|
|
68
|
+
group: GROUPS.data,
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "Table Header",
|
|
74
|
+
tag: "TableHeader",
|
|
75
|
+
category: COMPONENT_TYPES.container,
|
|
76
|
+
stylesPanelSections: [
|
|
77
|
+
StylesPanelSections.Background,
|
|
78
|
+
StylesPanelSections.Borders,
|
|
79
|
+
StylesPanelSections.Size,
|
|
80
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
81
|
+
StylesPanelSections.Position,
|
|
82
|
+
StylesPanelSections.Effects,
|
|
83
|
+
],
|
|
84
|
+
layout: {
|
|
85
|
+
paddingLeft: 16,
|
|
86
|
+
paddingRight: 16,
|
|
87
|
+
borderBottomWidth: 1,
|
|
88
|
+
borderStyle: "solid",
|
|
89
|
+
backgroundColor: "#EFEFEF",
|
|
90
|
+
},
|
|
91
|
+
props: {},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "Table Title",
|
|
95
|
+
tag: "TableTitle",
|
|
96
|
+
category: COMPONENT_TYPES.container,
|
|
97
|
+
stylesPanelSections: [
|
|
98
|
+
StylesPanelSections.Typography,
|
|
99
|
+
StylesPanelSections.Background,
|
|
100
|
+
StylesPanelSections.Borders,
|
|
101
|
+
StylesPanelSections.Size,
|
|
102
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
103
|
+
StylesPanelSections.Position,
|
|
104
|
+
StylesPanelSections.Effects,
|
|
105
|
+
],
|
|
106
|
+
layout: {
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
paddingTop: 16,
|
|
109
|
+
paddingBottom: 16,
|
|
110
|
+
paddingLeft: 8,
|
|
111
|
+
paddingRight: 8,
|
|
112
|
+
},
|
|
113
|
+
props: {
|
|
114
|
+
numeric: createBoolProp({
|
|
115
|
+
label: "Is Numeric Cell?",
|
|
116
|
+
description: "Does the cell contain a numeric value?",
|
|
117
|
+
group: GROUPS.data,
|
|
118
|
+
}),
|
|
119
|
+
value: createTextProp({
|
|
120
|
+
label: "Cell Value",
|
|
121
|
+
description: "Table Cell Value",
|
|
122
|
+
group: GROUPS.data,
|
|
123
|
+
}),
|
|
124
|
+
isAscending: createBoolProp({
|
|
125
|
+
label: "Is Ascending?",
|
|
126
|
+
description: "Does the cell contain a numeric value?",
|
|
127
|
+
group: GROUPS.data,
|
|
128
|
+
}),
|
|
129
|
+
numberOfLines: createNumberProp({
|
|
130
|
+
label: "Number of Lines",
|
|
131
|
+
description: "Number of Lines",
|
|
132
|
+
group: GROUPS.basic,
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|