@draftbit/core 46.10.3-ccc53a.2 → 46.10.3-d37409.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/CheckboxGroupRow.js +23 -5
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +23 -6
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Table/Table.js +127 -0
- package/lib/commonjs/components/Table/TableCell.js +49 -0
- package/lib/commonjs/components/Table/TableCommon.js +30 -0
- package/lib/commonjs/components/Table/TableRow.js +61 -0
- package/lib/commonjs/components/Table/index.js +27 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/mappings/Table.js +140 -0
- package/lib/module/components/Table/Table.js +119 -0
- package/lib/module/components/Table/TableCell.js +41 -0
- package/lib/module/components/Table/TableCommon.js +21 -0
- package/lib/module/components/Table/TableRow.js +53 -0
- package/lib/module/components/Table/index.js +3 -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/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 +14 -0
- package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -0
- package/lib/typescript/src/components/Table/index.d.ts +4 -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/Table.d.ts +337 -0
- package/lib/typescript/src/mappings/Table.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Table/Table.js +97 -0
- package/src/components/Table/Table.tsx +180 -0
- package/src/components/Table/TableCell.js +31 -0
- package/src/components/Table/TableCell.tsx +63 -0
- package/src/components/Table/TableCommon.js +12 -0
- package/src/components/Table/TableCommon.ts +40 -0
- package/src/components/Table/TableRow.js +37 -0
- package/src/components/Table/TableRow.tsx +77 -0
- package/src/components/Table/index.js +3 -0
- package/src/components/Table/index.tsx +3 -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
|
@@ -13,8 +13,7 @@ var _utilities = require("../../utilities");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
|
|
17
|
-
let Direction;
|
|
16
|
+
var Direction;
|
|
18
17
|
exports.Direction = Direction;
|
|
19
18
|
(function (Direction) {
|
|
20
19
|
Direction["Row"] = "row";
|
|
@@ -72,13 +71,14 @@ const CheckboxGroupRow = _ref => {
|
|
|
72
71
|
textStyles,
|
|
73
72
|
viewStyles
|
|
74
73
|
} = (0, _utilities.extractStyles)(style);
|
|
75
|
-
return /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
74
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
76
75
|
onPress: handlePress,
|
|
77
76
|
style: [styles.mainParent, {
|
|
78
77
|
flexDirection: direction
|
|
79
78
|
}, viewStyles],
|
|
80
|
-
disabled: disabled
|
|
81
|
-
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
...rest
|
|
81
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
82
82
|
style: [styles.label, {
|
|
83
83
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
84
84
|
}, labelContainerStyle]
|
|
@@ -117,4 +117,22 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
var _default = CheckboxGroupRow;
|
|
120
|
+
exports.default = _default;center",
|
|
121
|
+
justifyContent: "space-around",
|
|
122
|
+
paddingStart: 20,
|
|
123
|
+
minHeight: 50,
|
|
124
|
+
paddingEnd: 20,
|
|
125
|
+
display: "flex",
|
|
126
|
+
..._reactNative.Platform.select({
|
|
127
|
+
web: {
|
|
128
|
+
cursor: "pointer",
|
|
129
|
+
userSelect: "none"
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
label: {
|
|
134
|
+
flex: 3
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
var _default = CheckboxGroupRow;
|
|
120
138
|
exports.default = _default;
|
|
@@ -14,8 +14,7 @@ var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
|
-
let Direction;
|
|
17
|
+
var Direction;
|
|
19
18
|
exports.Direction = Direction;
|
|
20
19
|
(function (Direction) {
|
|
21
20
|
Direction["Row"] = "row";
|
|
@@ -58,7 +57,6 @@ const CheckboxRow = _ref => {
|
|
|
58
57
|
setInternalValue(status);
|
|
59
58
|
}
|
|
60
59
|
}, [status]);
|
|
61
|
-
|
|
62
60
|
// This special logic is to handle weird APIs like Airtable that return
|
|
63
61
|
// true or undefined for a boolean
|
|
64
62
|
const previousDefaultValue = (0, _hooks.usePrevious)(defaultValue);
|
|
@@ -82,13 +80,14 @@ const CheckboxRow = _ref => {
|
|
|
82
80
|
textStyles,
|
|
83
81
|
viewStyles
|
|
84
82
|
} = (0, _utilities.extractStyles)(style);
|
|
85
|
-
return /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
83
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
86
84
|
onPress: handlePress,
|
|
87
85
|
style: [viewStyles, styles.mainParent, {
|
|
88
86
|
flexDirection: direction
|
|
89
87
|
}],
|
|
90
|
-
disabled: disabled
|
|
91
|
-
|
|
88
|
+
disabled: disabled,
|
|
89
|
+
...rest
|
|
90
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
92
91
|
style: [styles.label, {
|
|
93
92
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
94
93
|
}, labelContainerStyle]
|
|
@@ -125,4 +124,22 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
var _default = CheckboxRow;
|
|
127
|
+
exports.default = _default;ems: "center",
|
|
128
|
+
justifyContent: "space-around",
|
|
129
|
+
paddingStart: 20,
|
|
130
|
+
minHeight: 50,
|
|
131
|
+
paddingEnd: 20,
|
|
132
|
+
display: "flex",
|
|
133
|
+
..._reactNative.Platform.select({
|
|
134
|
+
web: {
|
|
135
|
+
cursor: "pointer",
|
|
136
|
+
userSelect: "none"
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
label: {
|
|
141
|
+
flex: 3
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
var _default = CheckboxRow;
|
|
128
145
|
exports.default = _default;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.checkboxGroupContext = exports.Direction = void 0;
|
|
7
7
|
exports.useCheckboxGroupContext = useCheckboxGroupContext;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
|
|
9
|
+
let Direction;
|
|
10
10
|
exports.Direction = Direction;
|
|
11
11
|
(function (Direction) {
|
|
12
12
|
Direction["Horizontal"] = "horizontal";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _theming = require("../../theming");
|
|
10
|
+
var _TableCommon = require("./TableCommon");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
//Comment
|
|
13
|
+
//
|
|
14
|
+
const Table = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme,
|
|
17
|
+
borderWidth = 1,
|
|
18
|
+
borderColor = theme.colors.divider,
|
|
19
|
+
borderStyle = "solid",
|
|
20
|
+
drawTopBorder = true,
|
|
21
|
+
drawBottomBorder = false,
|
|
22
|
+
drawStartBorder = false,
|
|
23
|
+
drawEndBorder = false,
|
|
24
|
+
cellVerticalPadding = 10,
|
|
25
|
+
cellHorizontalPadding = 10,
|
|
26
|
+
data,
|
|
27
|
+
keyExtractor,
|
|
28
|
+
renderItem,
|
|
29
|
+
children: childrenProp,
|
|
30
|
+
style,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref;
|
|
33
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
34
|
+
if (data && !renderItem || renderItem && !data) {
|
|
35
|
+
throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
|
|
36
|
+
}
|
|
37
|
+
if (data && renderItem && childrenProp) {
|
|
38
|
+
console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
|
|
39
|
+
}
|
|
40
|
+
const isTableHeader = _react.default.useCallback(object => {
|
|
41
|
+
return object.isTableHeader;
|
|
42
|
+
}, []);
|
|
43
|
+
const isRenderItem = data && renderItem;
|
|
44
|
+
|
|
45
|
+
//Uses 'renderItem' and 'data' to create an array of children
|
|
46
|
+
const dataAsChildren = _react.default.useMemo(() => {
|
|
47
|
+
if (!isRenderItem) return [];
|
|
48
|
+
return data.map((item, index) => {
|
|
49
|
+
const component = renderItem({
|
|
50
|
+
item,
|
|
51
|
+
index
|
|
52
|
+
});
|
|
53
|
+
if (!component) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const key = keyExtractor ? keyExtractor(item, index) : index.toString();
|
|
57
|
+
return /*#__PURE__*/_react.default.cloneElement(component, {
|
|
58
|
+
key
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}, [data, renderItem, keyExtractor, isRenderItem]);
|
|
62
|
+
const children = isRenderItem ? dataAsChildren : _react.default.Children.toArray(childrenProp);
|
|
63
|
+
const validChildren = _react.default.useMemo(() => children.filter(item => /*#__PURE__*/_react.default.isValidElement(item)), [children]);
|
|
64
|
+
const childrenWithoutHeader = _react.default.useMemo(() => {
|
|
65
|
+
const flattenedWithoutNestedHeaders = validChildren.map(item => {
|
|
66
|
+
const nestedChildren = _react.default.Children.toArray(item.props.children);
|
|
67
|
+
//Header can be nested in React.Fragment when in renderItem
|
|
68
|
+
const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
|
|
69
|
+
if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
|
|
70
|
+
//New element excluding header children
|
|
71
|
+
return /*#__PURE__*/_react.default.cloneElement(item, {
|
|
72
|
+
children: nestedChildren.filter(child => !isTableHeader(child.props))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return item;
|
|
76
|
+
});
|
|
77
|
+
return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
|
|
78
|
+
}, [validChildren, isTableHeader]);
|
|
79
|
+
const header = _react.default.useMemo(() => {
|
|
80
|
+
const flattenedPossibleHeaders = validChildren.map(item => {
|
|
81
|
+
const nestedChildren = _react.default.Children.toArray(item.props.children);
|
|
82
|
+
//Header can be nested in React.Fragment when in renderItem
|
|
83
|
+
const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
|
|
84
|
+
if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
|
|
85
|
+
return nestedHeaders[0];
|
|
86
|
+
}
|
|
87
|
+
return item;
|
|
88
|
+
});
|
|
89
|
+
const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
|
|
90
|
+
if (allHeaders.length) {
|
|
91
|
+
return allHeaders[0]; //Only 1 header rendered
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null;
|
|
95
|
+
}, [validChildren, isTableHeader]);
|
|
96
|
+
const contextValue = {
|
|
97
|
+
borderColor,
|
|
98
|
+
borderStyle,
|
|
99
|
+
borderWidth,
|
|
100
|
+
cellHorizontalPadding,
|
|
101
|
+
cellVerticalPadding
|
|
102
|
+
};
|
|
103
|
+
const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
|
|
104
|
+
borderColor,
|
|
105
|
+
borderWidth,
|
|
106
|
+
borderStyle,
|
|
107
|
+
drawTopBorder,
|
|
108
|
+
drawBottomBorder,
|
|
109
|
+
drawStartBorder,
|
|
110
|
+
drawEndBorder
|
|
111
|
+
});
|
|
112
|
+
return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
|
|
113
|
+
value: contextValue
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
115
|
+
style: [styles.container, borderViewStyle, style]
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, header), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, rest, childrenWithoutHeader)));
|
|
117
|
+
};
|
|
118
|
+
const styles = _reactNative.StyleSheet.create({
|
|
119
|
+
container: {
|
|
120
|
+
flex: 1
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
//Comment
|
|
125
|
+
//
|
|
126
|
+
var _default = (0, _theming.withTheme)(Table);
|
|
127
|
+
exports.default = _default;exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _TableCommon = require("./TableCommon");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const TableCell = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
borderWidth,
|
|
14
|
+
borderColor,
|
|
15
|
+
borderStyle,
|
|
16
|
+
drawTopBorder = false,
|
|
17
|
+
drawBottomBorder = false,
|
|
18
|
+
drawStartBorder = false,
|
|
19
|
+
drawEndBorder = true,
|
|
20
|
+
cellVerticalPadding,
|
|
21
|
+
cellHorizontalPadding,
|
|
22
|
+
children,
|
|
23
|
+
style
|
|
24
|
+
} = _ref;
|
|
25
|
+
const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
|
|
26
|
+
const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
|
|
27
|
+
borderColor: borderColor || parentContextValue.borderColor,
|
|
28
|
+
borderWidth: borderWidth || parentContextValue.borderWidth,
|
|
29
|
+
borderStyle: borderStyle || parentContextValue.borderStyle,
|
|
30
|
+
drawTopBorder,
|
|
31
|
+
drawBottomBorder,
|
|
32
|
+
drawStartBorder,
|
|
33
|
+
drawEndBorder
|
|
34
|
+
});
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
36
|
+
style: [styles.cellContainer, borderViewStyle, {
|
|
37
|
+
paddingVertical: cellVerticalPadding || parentContextValue.cellVerticalPadding,
|
|
38
|
+
paddingHorizontal: cellHorizontalPadding || parentContextValue.cellHorizontalPadding
|
|
39
|
+
}, style]
|
|
40
|
+
}, children);
|
|
41
|
+
};
|
|
42
|
+
const styles = _reactNative.StyleSheet.create({
|
|
43
|
+
cellContainer: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
flexDirection: "row"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _default = TableCell;
|
|
49
|
+
exports.default = _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TableStyleContext = void 0;
|
|
7
|
+
exports.generateBorderStyles = generateBorderStyles;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const TableStyleContext = /*#__PURE__*/_react.default.createContext({});
|
|
11
|
+
exports.TableStyleContext = TableStyleContext;
|
|
12
|
+
function generateBorderStyles(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
borderColor,
|
|
15
|
+
borderWidth,
|
|
16
|
+
borderStyle,
|
|
17
|
+
drawTopBorder,
|
|
18
|
+
drawBottomBorder,
|
|
19
|
+
drawStartBorder,
|
|
20
|
+
drawEndBorder
|
|
21
|
+
} = _ref;
|
|
22
|
+
return {
|
|
23
|
+
borderColor,
|
|
24
|
+
borderStyle,
|
|
25
|
+
borderTopWidth: drawTopBorder ? borderWidth : 0,
|
|
26
|
+
borderBottomWidth: drawBottomBorder ? borderWidth : 0,
|
|
27
|
+
borderStartWidth: drawStartBorder ? borderWidth : 0,
|
|
28
|
+
borderEndWidth: drawEndBorder ? borderWidth : 0
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _TableCommon = require("./TableCommon");
|
|
10
|
+
var _theming = require("../../theming");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const TableRow = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
borderWidth,
|
|
15
|
+
borderColor,
|
|
16
|
+
borderStyle,
|
|
17
|
+
drawTopBorder = false,
|
|
18
|
+
drawBottomBorder = true,
|
|
19
|
+
drawStartBorder = true,
|
|
20
|
+
drawEndBorder = false,
|
|
21
|
+
cellVerticalPadding,
|
|
22
|
+
cellHorizontalPadding,
|
|
23
|
+
isTableHeader = false,
|
|
24
|
+
children,
|
|
25
|
+
style,
|
|
26
|
+
theme
|
|
27
|
+
} = _ref;
|
|
28
|
+
const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
|
|
29
|
+
|
|
30
|
+
//Create context to use and pass to children based on own props or fall back to parent provided context
|
|
31
|
+
const contextValue = {
|
|
32
|
+
borderColor: borderColor || parentContextValue.borderColor,
|
|
33
|
+
borderStyle: borderStyle || parentContextValue.borderStyle,
|
|
34
|
+
borderWidth: borderWidth || parentContextValue.borderWidth,
|
|
35
|
+
cellHorizontalPadding: cellHorizontalPadding || parentContextValue.cellHorizontalPadding,
|
|
36
|
+
cellVerticalPadding: cellVerticalPadding || parentContextValue.cellVerticalPadding
|
|
37
|
+
};
|
|
38
|
+
const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
|
|
39
|
+
borderColor: contextValue.borderColor,
|
|
40
|
+
borderWidth: contextValue.borderWidth,
|
|
41
|
+
borderStyle: contextValue.borderStyle,
|
|
42
|
+
drawTopBorder,
|
|
43
|
+
drawBottomBorder,
|
|
44
|
+
drawStartBorder,
|
|
45
|
+
drawEndBorder
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
|
|
48
|
+
value: contextValue
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
50
|
+
style: [borderViewStyle, isTableHeader ? {
|
|
51
|
+
backgroundColor: theme.colors.primary
|
|
52
|
+
} : {}, style, styles.cellsContainer]
|
|
53
|
+
}, children));
|
|
54
|
+
};
|
|
55
|
+
const styles = _reactNative.StyleSheet.create({
|
|
56
|
+
cellsContainer: {
|
|
57
|
+
flexDirection: "row"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _default = (0, _theming.withTheme)(TableRow);
|
|
61
|
+
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Table", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Table.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "TableCell", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _TableCell.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "TableRow", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _TableRow.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _Table = _interopRequireDefault(require("./Table"));
|
|
25
|
+
var _TableRow = _interopRequireDefault(require("./TableRow"));
|
|
26
|
+
var _TableCell = _interopRequireDefault(require("./TableCell"));
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/commonjs/index.js
CHANGED
|
@@ -345,6 +345,24 @@ Object.defineProperty(exports, "TabViewItem", {
|
|
|
345
345
|
return _TabView.TabViewItem;
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
+
Object.defineProperty(exports, "Table", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () {
|
|
351
|
+
return _Table.Table;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(exports, "TableCell", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function () {
|
|
357
|
+
return _Table.TableCell;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "TableRow", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _Table.TableRow;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
348
366
|
Object.defineProperty(exports, "TextField", {
|
|
349
367
|
enumerable: true,
|
|
350
368
|
get: function () {
|
|
@@ -430,6 +448,7 @@ var _TabView = require("./components/TabView");
|
|
|
430
448
|
var _Markdown = _interopRequireDefault(require("./components/Markdown"));
|
|
431
449
|
var _BottomSheet = require("./components/BottomSheet");
|
|
432
450
|
var _YoutubePlayer = require("./components/YoutubePlayer");
|
|
451
|
+
var _Table = require("./components/Table");
|
|
433
452
|
var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
|
|
434
453
|
var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
|
|
435
454
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SEED_DATA = void 0;
|
|
7
|
+
var _types = require("@draftbit/types");
|
|
8
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
9
|
+
borderWidth: (0, _types.createStaticNumberProp)({
|
|
10
|
+
label: "Border Width",
|
|
11
|
+
description: "Specifies the width of the border. Passed down to child Table(Row/Cell) components unless overridden",
|
|
12
|
+
required: false,
|
|
13
|
+
defaultValue: null
|
|
14
|
+
}),
|
|
15
|
+
borderColor: (0, _types.createColorProp)({
|
|
16
|
+
label: "Border Color",
|
|
17
|
+
description: "Specifies the color of the border. Passed down to child Table(Row/Cell) components unless overridden",
|
|
18
|
+
defaultValue: null
|
|
19
|
+
}),
|
|
20
|
+
borderStyle: (0, _types.createTextEnumProp)({
|
|
21
|
+
label: "Border Style",
|
|
22
|
+
description: "Specifies the style of the border. Passed down to child Table(Row/Cell) components unless overridden",
|
|
23
|
+
options: ["solid", "dotted", "dashed"],
|
|
24
|
+
defaultValue: null
|
|
25
|
+
}),
|
|
26
|
+
drawTopBorder: (0, _types.createStaticBoolProp)({
|
|
27
|
+
label: "Draw Top Border",
|
|
28
|
+
description: "Whether to draw the top border at this layer of the Table tree or not",
|
|
29
|
+
defaultValue: false
|
|
30
|
+
}),
|
|
31
|
+
drawBottomBorder: (0, _types.createStaticBoolProp)({
|
|
32
|
+
label: "Draw Bottom Border",
|
|
33
|
+
description: "Whether to draw the bottom border at this layer of the Table tree or not",
|
|
34
|
+
defaultValue: false
|
|
35
|
+
}),
|
|
36
|
+
drawStartBorder: (0, _types.createStaticBoolProp)({
|
|
37
|
+
label: "Draw Start Border",
|
|
38
|
+
description: "Whether to draw the start border at this layer of the Table tree or not",
|
|
39
|
+
defaultValue: false
|
|
40
|
+
}),
|
|
41
|
+
drawEndBorder: (0, _types.createStaticBoolProp)({
|
|
42
|
+
label: "Draw End Border",
|
|
43
|
+
description: "Whether to draw the end border at this layer of the Table tree or not",
|
|
44
|
+
defaultValue: false
|
|
45
|
+
}),
|
|
46
|
+
cellVerticalPadding: (0, _types.createStaticNumberProp)({
|
|
47
|
+
label: "Cell Vertical Padding",
|
|
48
|
+
description: "Specifies the vertical padding of the cell. Passed down to TableCell components unless overridden",
|
|
49
|
+
required: false,
|
|
50
|
+
defaultValue: null
|
|
51
|
+
}),
|
|
52
|
+
cellHorizontalPadding: (0, _types.createStaticNumberProp)({
|
|
53
|
+
label: "Cell Horizontal Padding",
|
|
54
|
+
description: "Specifies the horizontal padding of the cell. Passed down to TableCell components unless overridden",
|
|
55
|
+
required: false,
|
|
56
|
+
defaultValue: null
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
const SEED_DATA = [{
|
|
60
|
+
name: "Table",
|
|
61
|
+
tag: "Table",
|
|
62
|
+
description: "Top level table container",
|
|
63
|
+
category: _types.COMPONENT_TYPES.table,
|
|
64
|
+
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects, _types.StylesPanelSections.Background, _types.StylesPanelSections.LayoutSelectedItem],
|
|
65
|
+
layout: {
|
|
66
|
+
flex: 1
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
...SHARED_SEED_DATA_PROPS,
|
|
70
|
+
borderWidth: {
|
|
71
|
+
...SHARED_SEED_DATA_PROPS.borderWidth,
|
|
72
|
+
defaultValue: 1
|
|
73
|
+
},
|
|
74
|
+
borderColor: {
|
|
75
|
+
...SHARED_SEED_DATA_PROPS.borderColor,
|
|
76
|
+
defaultValue: "divider"
|
|
77
|
+
},
|
|
78
|
+
borderStyle: {
|
|
79
|
+
...SHARED_SEED_DATA_PROPS.borderStyle,
|
|
80
|
+
defaultValue: "solid"
|
|
81
|
+
},
|
|
82
|
+
drawTopBorder: {
|
|
83
|
+
...SHARED_SEED_DATA_PROPS.drawTopBorder,
|
|
84
|
+
defaultValue: true
|
|
85
|
+
},
|
|
86
|
+
cellVerticalPadding: {
|
|
87
|
+
...SHARED_SEED_DATA_PROPS.cellVerticalPadding,
|
|
88
|
+
defaultValue: 10
|
|
89
|
+
},
|
|
90
|
+
cellHorizontalPadding: {
|
|
91
|
+
...SHARED_SEED_DATA_PROPS.cellHorizontalPadding,
|
|
92
|
+
defaultValue: 10
|
|
93
|
+
},
|
|
94
|
+
showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
|
|
95
|
+
label: "Show Vertical Scroll Indicator",
|
|
96
|
+
description: "When true, shows a vertical scroll indicator. The default value is true.",
|
|
97
|
+
defaultValue: true
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
name: "Table Row",
|
|
102
|
+
tag: "TableRow",
|
|
103
|
+
description: "Table Row container",
|
|
104
|
+
category: _types.COMPONENT_TYPES.table,
|
|
105
|
+
stylesPanelSections: [_types.StylesPanelSections.Background],
|
|
106
|
+
props: {
|
|
107
|
+
...SHARED_SEED_DATA_PROPS,
|
|
108
|
+
drawStartBorder: {
|
|
109
|
+
...SHARED_SEED_DATA_PROPS.drawStartBorder,
|
|
110
|
+
defaultValue: true
|
|
111
|
+
},
|
|
112
|
+
drawBottomBorder: {
|
|
113
|
+
...SHARED_SEED_DATA_PROPS.drawBottomBorder,
|
|
114
|
+
defaultValue: true
|
|
115
|
+
},
|
|
116
|
+
isTableHeader: (0, _types.createStaticBoolProp)({
|
|
117
|
+
label: "Header",
|
|
118
|
+
description: "Whether this row is a header or not (changes background and sticks while scrolling)",
|
|
119
|
+
defaultValue: false
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
name: "Table Cell",
|
|
124
|
+
tag: "TableCell",
|
|
125
|
+
description: "Table Cell container",
|
|
126
|
+
category: _types.COMPONENT_TYPES.table,
|
|
127
|
+
stylesPanelSections: [_types.StylesPanelSections.LayoutFlexItems, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.LayoutContent, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
128
|
+
layout: {
|
|
129
|
+
flex: 1,
|
|
130
|
+
flexDirection: "row"
|
|
131
|
+
},
|
|
132
|
+
props: {
|
|
133
|
+
...SHARED_SEED_DATA_PROPS,
|
|
134
|
+
drawEndBorder: {
|
|
135
|
+
...SHARED_SEED_DATA_PROPS.drawEndBorder,
|
|
136
|
+
defaultValue: true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}];
|
|
140
|
+
exports.SEED_DATA = SEED_DATA;
|