@instructure/ui-table 8.8.1-snapshot.3 → 8.9.0
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/CHANGELOG.md +6 -0
- package/es/Table/Body/index.js +17 -29
- package/{src/Table/Cell/types.ts → es/Table/Body/props.js} +14 -8
- package/es/Table/Cell/index.js +17 -29
- package/{src/Table/types.ts → es/Table/Cell/props.js} +12 -11
- package/es/Table/ColHeader/index.js +22 -63
- package/es/Table/ColHeader/props.js +66 -0
- package/es/Table/Head/index.js +18 -29
- package/{src/Table/Body/types.ts → es/Table/Head/props.js} +13 -8
- package/es/Table/Row/index.js +17 -29
- package/{src/Table/ColHeader/types.ts → es/Table/Row/props.js} +16 -12
- package/es/Table/RowHeader/index.js +16 -27
- package/{src/Table/Head/types.ts → es/Table/RowHeader/props.js} +11 -6
- package/es/Table/index.js +23 -62
- package/es/Table/props.js +66 -0
- package/lib/Table/Body/index.js +17 -30
- package/lib/Table/Body/props.js +50 -0
- package/lib/Table/Cell/index.js +17 -29
- package/lib/Table/Cell/props.js +47 -0
- package/lib/Table/ColHeader/index.js +22 -63
- package/lib/Table/ColHeader/props.js +77 -0
- package/lib/Table/Head/index.js +18 -30
- package/lib/Table/Head/props.js +49 -0
- package/lib/Table/Row/index.js +17 -30
- package/lib/Table/Row/props.js +54 -0
- package/lib/Table/RowHeader/index.js +16 -27
- package/lib/Table/RowHeader/props.js +46 -0
- package/lib/Table/index.js +22 -62
- package/lib/Table/props.js +81 -0
- package/package.json +17 -18
- package/src/Table/Body/index.tsx +8 -26
- package/src/Table/{Row/types.ts → Body/props.ts} +39 -3
- package/src/Table/Cell/index.tsx +9 -25
- package/src/Table/Cell/props.ts +62 -0
- package/src/Table/Cell/styles.ts +1 -1
- package/src/Table/ColHeader/index.tsx +9 -51
- package/src/Table/ColHeader/props.ts +94 -0
- package/src/Table/ColHeader/styles.ts +1 -1
- package/src/Table/Head/index.tsx +8 -24
- package/src/Table/Head/props.ts +62 -0
- package/src/Table/Row/index.tsx +9 -28
- package/src/Table/Row/props.ts +70 -0
- package/src/Table/Row/styles.ts +1 -1
- package/src/Table/RowHeader/index.tsx +9 -24
- package/src/Table/RowHeader/{types.ts → props.ts} +28 -3
- package/src/Table/RowHeader/styles.ts +1 -1
- package/src/Table/index.tsx +12 -51
- package/src/Table/props.ts +93 -0
- package/src/Table/styles.ts +1 -1
- package/src/index.ts +7 -7
- package/types/Table/Body/index.d.ts +13 -16
- package/types/Table/Body/index.d.ts.map +1 -1
- package/types/Table/Body/props.d.ts +17 -0
- package/types/Table/Body/props.d.ts.map +1 -0
- package/types/Table/Cell/index.d.ts +14 -14
- package/types/Table/Cell/index.d.ts.map +1 -1
- package/types/Table/Cell/props.d.ts +17 -0
- package/types/Table/Cell/props.d.ts.map +1 -0
- package/types/Table/Cell/styles.d.ts +1 -1
- package/types/Table/ColHeader/index.d.ts +22 -40
- package/types/Table/ColHeader/index.d.ts.map +1 -1
- package/types/Table/ColHeader/props.d.ts +21 -0
- package/types/Table/ColHeader/props.d.ts.map +1 -0
- package/types/Table/ColHeader/styles.d.ts +1 -1
- package/types/Table/Head/index.d.ts +11 -15
- package/types/Table/Head/index.d.ts.map +1 -1
- package/types/Table/Head/props.d.ts +16 -0
- package/types/Table/Head/props.d.ts.map +1 -0
- package/types/Table/Row/index.d.ts +14 -17
- package/types/Table/Row/index.d.ts.map +1 -1
- package/types/Table/Row/props.d.ts +17 -0
- package/types/Table/Row/props.d.ts.map +1 -0
- package/types/Table/Row/styles.d.ts +1 -1
- package/types/Table/RowHeader/index.d.ts +12 -13
- package/types/Table/RowHeader/index.d.ts.map +1 -1
- package/types/Table/RowHeader/props.d.ts +16 -0
- package/types/Table/RowHeader/props.d.ts.map +1 -0
- package/types/Table/RowHeader/styles.d.ts +1 -1
- package/types/Table/index.d.ts +18 -41
- package/types/Table/index.d.ts.map +1 -1
- package/types/Table/props.d.ts +19 -0
- package/types/Table/props.d.ts.map +1 -0
- package/types/Table/styles.d.ts +1 -1
- package/types/index.d.ts +7 -7
- package/LICENSE.md +0 -27
- package/es/Table/Body/types.js +0 -1
- package/es/Table/Cell/types.js +0 -1
- package/es/Table/ColHeader/types.js +0 -1
- package/es/Table/Head/types.js +0 -1
- package/es/Table/Row/types.js +0 -1
- package/es/Table/RowHeader/types.js +0 -1
- package/es/Table/types.js +0 -1
- package/lib/Table/Body/types.js +0 -1
- package/lib/Table/Cell/types.js +0 -1
- package/lib/Table/ColHeader/types.js +0 -1
- package/lib/Table/Head/types.js +0 -1
- package/lib/Table/Row/types.js +0 -1
- package/lib/Table/RowHeader/types.js +0 -1
- package/lib/Table/types.js +0 -1
- package/types/Table/Body/types.d.ts +0 -9
- package/types/Table/Body/types.d.ts.map +0 -1
- package/types/Table/Cell/types.d.ts +0 -9
- package/types/Table/Cell/types.d.ts.map +0 -1
- package/types/Table/ColHeader/types.d.ts +0 -12
- package/types/Table/ColHeader/types.d.ts.map +0 -1
- package/types/Table/Head/types.d.ts +0 -8
- package/types/Table/Head/types.d.ts.map +0 -1
- package/types/Table/Row/types.d.ts +0 -9
- package/types/Table/Row/types.d.ts.map +0 -1
- package/types/Table/RowHeader/types.d.ts +0 -7
- package/types/Table/RowHeader/types.d.ts.map +0 -1
- package/types/Table/types.d.ts +0 -12
- package/types/Table/types.d.ts.map +0 -1
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
9
|
+
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
|
12
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
13
|
+
|
14
|
+
var _Row = require("../Row");
|
15
|
+
|
16
|
+
/*
|
17
|
+
* The MIT License (MIT)
|
18
|
+
*
|
19
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
20
|
+
*
|
21
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
22
|
+
* of this software and associated documentation files (the "Software"), to deal
|
23
|
+
* in the Software without restriction, including without limitation the rights
|
24
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
25
|
+
* copies of the Software, and to permit persons to whom the Software is
|
26
|
+
* furnished to do so, subject to the following conditions:
|
27
|
+
*
|
28
|
+
* The above copyright notice and this permission notice shall be included in all
|
29
|
+
* copies or substantial portions of the Software.
|
30
|
+
*
|
31
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
32
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
33
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
34
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
35
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
36
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
37
|
+
* SOFTWARE.
|
38
|
+
*/
|
39
|
+
const propTypes = {
|
40
|
+
/**
|
41
|
+
* `Table.Row`
|
42
|
+
*/
|
43
|
+
children: _Children.Children.oneOf([_Row.Row]),
|
44
|
+
isStacked: _propTypes.default.bool,
|
45
|
+
renderSortLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
46
|
+
};
|
47
|
+
exports.propTypes = propTypes;
|
48
|
+
const allowedProps = ['children', 'isStacked', 'renderSortLabel'];
|
49
|
+
exports.allowedProps = allowedProps;
|
package/lib/Table/Row/index.js
CHANGED
@@ -9,16 +9,12 @@ exports.Row = exports.default = void 0;
|
|
9
9
|
|
10
10
|
var _react = require("react");
|
11
11
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
|
-
|
14
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
15
13
|
|
16
14
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
17
15
|
|
18
16
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
19
17
|
|
20
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
21
|
-
|
22
18
|
var _View = require("@instructure/ui-view/lib/View");
|
23
19
|
|
24
20
|
var _emotion = require("@instructure/emotion");
|
@@ -33,6 +29,8 @@ var _RowHeader = require("../RowHeader");
|
|
33
29
|
|
34
30
|
var _Cell = require("../Cell");
|
35
31
|
|
32
|
+
var _props = require("./props");
|
33
|
+
|
36
34
|
var _dec, _class, _class2, _temp;
|
37
35
|
|
38
36
|
/**
|
@@ -42,27 +40,28 @@ id: Table.Row
|
|
42
40
|
---
|
43
41
|
**/
|
44
42
|
let Row = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Row extends _react.Component {
|
45
|
-
/* eslint-disable react/require-default-props */
|
46
|
-
|
47
|
-
/* eslint-enable react/require-default-props */
|
48
43
|
componentDidMount() {
|
49
|
-
|
44
|
+
var _this$props$makeStyle, _this$props;
|
45
|
+
|
46
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
50
47
|
}
|
51
48
|
|
52
|
-
componentDidUpdate(
|
53
|
-
|
49
|
+
componentDidUpdate() {
|
50
|
+
var _this$props$makeStyle2, _this$props2;
|
51
|
+
|
52
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
54
53
|
}
|
55
54
|
|
56
55
|
render() {
|
57
|
-
const _this$
|
58
|
-
children = _this$
|
59
|
-
styles = _this$
|
60
|
-
isStacked = _this$
|
61
|
-
headers = _this$
|
56
|
+
const _this$props3 = this.props,
|
57
|
+
children = _this$props3.children,
|
58
|
+
styles = _this$props3.styles,
|
59
|
+
isStacked = _this$props3.isStacked,
|
60
|
+
headers = _this$props3.headers;
|
62
61
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Row.propTypes), Row), {
|
63
62
|
as: isStacked ? 'div' : 'tr',
|
64
|
-
css: styles.row,
|
65
|
-
role: isStacked ? 'row' :
|
63
|
+
css: styles === null || styles === void 0 ? void 0 : styles.row,
|
64
|
+
role: isStacked ? 'row' : void 0
|
66
65
|
}), _react.Children.toArray(children).filter(Boolean).map((child, index) => {
|
67
66
|
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_ColHeader.ColHeader])) {
|
68
67
|
return child;
|
@@ -87,19 +86,7 @@ let Row = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
|
|
87
86
|
}));
|
88
87
|
}
|
89
88
|
|
90
|
-
}, _class2.displayName = "Row", _class2.componentId = 'Table.Row', _class2.propTypes = {
|
91
|
-
/**
|
92
|
-
* `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
|
93
|
-
*/
|
94
|
-
// eslint-disable-next-line react/require-default-props
|
95
|
-
makeStyles: _propTypes.default.func,
|
96
|
-
// eslint-disable-next-line react/require-default-props
|
97
|
-
styles: _propTypes.default.object,
|
98
|
-
children: _Children.Children.oneOf([_ColHeader.ColHeader, _RowHeader.RowHeader, _Cell.Cell]),
|
99
|
-
hover: _propTypes.default.bool,
|
100
|
-
isStacked: _propTypes.default.bool,
|
101
|
-
headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
|
102
|
-
}, _class2.defaultProps = {
|
89
|
+
}, _class2.displayName = "Row", _class2.componentId = 'Table.Row', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
103
90
|
children: null
|
104
91
|
}, _temp)) || _class);
|
105
92
|
exports.Row = Row;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
9
|
+
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
|
12
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
13
|
+
|
14
|
+
var _ColHeader = require("../ColHeader");
|
15
|
+
|
16
|
+
var _RowHeader = require("../RowHeader");
|
17
|
+
|
18
|
+
var _Cell = require("../Cell");
|
19
|
+
|
20
|
+
/*
|
21
|
+
* The MIT License (MIT)
|
22
|
+
*
|
23
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
24
|
+
*
|
25
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
26
|
+
* of this software and associated documentation files (the "Software"), to deal
|
27
|
+
* in the Software without restriction, including without limitation the rights
|
28
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
29
|
+
* copies of the Software, and to permit persons to whom the Software is
|
30
|
+
* furnished to do so, subject to the following conditions:
|
31
|
+
*
|
32
|
+
* The above copyright notice and this permission notice shall be included in all
|
33
|
+
* copies or substantial portions of the Software.
|
34
|
+
*
|
35
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
36
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
37
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
38
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
39
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
40
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
41
|
+
* SOFTWARE.
|
42
|
+
*/
|
43
|
+
const propTypes = {
|
44
|
+
/**
|
45
|
+
* `Table.ColHeader`, `Table.RowHeader` or `Table.Cell`
|
46
|
+
*/
|
47
|
+
children: _Children.Children.oneOf([_ColHeader.ColHeader, _RowHeader.RowHeader, _Cell.Cell]),
|
48
|
+
hover: _propTypes.default.bool,
|
49
|
+
isStacked: _propTypes.default.bool,
|
50
|
+
headers: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]))
|
51
|
+
};
|
52
|
+
exports.propTypes = propTypes;
|
53
|
+
const allowedProps = ['children', 'hover', 'isStacked', 'headers'];
|
54
|
+
exports.allowedProps = allowedProps;
|
@@ -9,8 +9,6 @@ exports.RowHeader = exports.default = void 0;
|
|
9
9
|
|
10
10
|
var _react = require("react");
|
11
11
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
|
-
|
14
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
15
13
|
|
16
14
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
@@ -23,6 +21,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
23
21
|
|
24
22
|
var _theme = _interopRequireDefault(require("./theme"));
|
25
23
|
|
24
|
+
var _props = require("./props");
|
25
|
+
|
26
26
|
var _dec, _class, _class2, _temp;
|
27
27
|
|
28
28
|
/**
|
@@ -32,43 +32,32 @@ id: Table.RowHeader
|
|
32
32
|
---
|
33
33
|
**/
|
34
34
|
let RowHeader = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class RowHeader extends _react.Component {
|
35
|
-
/* eslint-disable react/require-default-props */
|
36
|
-
|
37
|
-
/* eslint-enable react/require-default-props */
|
38
35
|
componentDidMount() {
|
39
|
-
|
36
|
+
var _this$props$makeStyle, _this$props;
|
37
|
+
|
38
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
40
39
|
}
|
41
40
|
|
42
|
-
componentDidUpdate(
|
43
|
-
|
41
|
+
componentDidUpdate() {
|
42
|
+
var _this$props$makeStyle2, _this$props2;
|
43
|
+
|
44
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
44
45
|
}
|
45
46
|
|
46
47
|
render() {
|
47
|
-
const _this$
|
48
|
-
children = _this$
|
49
|
-
isStacked = _this$
|
50
|
-
styles = _this$
|
48
|
+
const _this$props3 = this.props,
|
49
|
+
children = _this$props3.children,
|
50
|
+
isStacked = _this$props3.isStacked,
|
51
|
+
styles = _this$props3.styles;
|
51
52
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, RowHeader.propTypes), RowHeader), {
|
52
53
|
as: isStacked ? 'div' : 'th',
|
53
|
-
css: styles.rowHeader,
|
54
|
+
css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
|
54
55
|
scope: "row",
|
55
|
-
role: isStacked ? 'rowheader' :
|
56
|
+
role: isStacked ? 'rowheader' : void 0
|
56
57
|
}), (0, _callRenderProp.callRenderProp)(children));
|
57
58
|
}
|
58
59
|
|
59
|
-
}, _class2.displayName = "RowHeader", _class2.componentId = 'Table.RowHeader', _class2.propTypes = {
|
60
|
-
// eslint-disable-next-line react/require-default-props
|
61
|
-
makeStyles: _propTypes.default.func,
|
62
|
-
// eslint-disable-next-line react/require-default-props
|
63
|
-
styles: _propTypes.default.object,
|
64
|
-
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
65
|
-
isStacked: _propTypes.default.bool,
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Control the text alignment in row header
|
69
|
-
*/
|
70
|
-
textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
|
71
|
-
}, _class2.defaultProps = {
|
60
|
+
}, _class2.displayName = "RowHeader", _class2.componentId = 'Table.RowHeader', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
72
61
|
textAlign: 'start',
|
73
62
|
children: null
|
74
63
|
}, _temp)) || _class);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
9
|
+
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
|
12
|
+
/*
|
13
|
+
* The MIT License (MIT)
|
14
|
+
*
|
15
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
16
|
+
*
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
18
|
+
* of this software and associated documentation files (the "Software"), to deal
|
19
|
+
* in the Software without restriction, including without limitation the rights
|
20
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
21
|
+
* copies of the Software, and to permit persons to whom the Software is
|
22
|
+
* furnished to do so, subject to the following conditions:
|
23
|
+
*
|
24
|
+
* The above copyright notice and this permission notice shall be included in all
|
25
|
+
* copies or substantial portions of the Software.
|
26
|
+
*
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
28
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
29
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
30
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
31
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
32
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
33
|
+
* SOFTWARE.
|
34
|
+
*/
|
35
|
+
const propTypes = {
|
36
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
37
|
+
isStacked: _propTypes.default.bool,
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Control the text alignment in row header
|
41
|
+
*/
|
42
|
+
textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
|
43
|
+
};
|
44
|
+
exports.propTypes = propTypes;
|
45
|
+
const allowedProps = ['children', 'isStacked', 'textAlign'];
|
46
|
+
exports.allowedProps = allowedProps;
|
package/lib/Table/index.js
CHANGED
@@ -11,16 +11,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
11
11
|
|
12
12
|
var _react = require("react");
|
13
13
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
|
-
|
16
14
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
17
15
|
|
18
16
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
19
17
|
|
20
18
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
21
19
|
|
22
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
23
|
-
|
24
20
|
var _View = require("@instructure/ui-view/lib/View");
|
25
21
|
|
26
22
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
@@ -43,6 +39,8 @@ var _RowHeader = require("./RowHeader");
|
|
43
39
|
|
44
40
|
var _Cell = require("./Cell");
|
45
41
|
|
42
|
+
var _props = require("./props");
|
43
|
+
|
46
44
|
var _dec, _class, _class2, _temp;
|
47
45
|
|
48
46
|
/**
|
@@ -52,11 +50,15 @@ category: components
|
|
52
50
|
**/
|
53
51
|
let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Table extends _react.Component {
|
54
52
|
componentDidMount() {
|
55
|
-
|
53
|
+
var _this$props$makeStyle, _this$props;
|
54
|
+
|
55
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
56
56
|
}
|
57
57
|
|
58
|
-
componentDidUpdate(
|
59
|
-
|
58
|
+
componentDidUpdate() {
|
59
|
+
var _this$props$makeStyle2, _this$props2;
|
60
|
+
|
61
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
60
62
|
}
|
61
63
|
|
62
64
|
getHeaders() {
|
@@ -82,23 +84,23 @@ let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
82
84
|
}
|
83
85
|
|
84
86
|
render() {
|
85
|
-
const _this$
|
86
|
-
margin = _this$
|
87
|
-
elementRef = _this$
|
88
|
-
layout = _this$
|
89
|
-
caption = _this$
|
90
|
-
children = _this$
|
91
|
-
hover = _this$
|
92
|
-
styles = _this$
|
87
|
+
const _this$props3 = this.props,
|
88
|
+
margin = _this$props3.margin,
|
89
|
+
elementRef = _this$props3.elementRef,
|
90
|
+
layout = _this$props3.layout,
|
91
|
+
caption = _this$props3.caption,
|
92
|
+
children = _this$props3.children,
|
93
|
+
hover = _this$props3.hover,
|
94
|
+
styles = _this$props3.styles;
|
93
95
|
const isStacked = layout === 'stacked';
|
94
96
|
const headers = isStacked ? this.getHeaders() : null;
|
95
97
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Table.propTypes), Table), {
|
96
98
|
as: isStacked ? 'div' : 'table',
|
97
99
|
margin: margin,
|
98
100
|
elementRef: elementRef,
|
99
|
-
css: styles.table,
|
100
|
-
role: isStacked ? 'table' :
|
101
|
-
"aria-label": isStacked ? caption :
|
101
|
+
css: styles === null || styles === void 0 ? void 0 : styles.table,
|
102
|
+
role: isStacked ? 'table' : void 0,
|
103
|
+
"aria-label": isStacked ? caption : void 0
|
102
104
|
}), !isStacked && (0, _emotion.jsx)("caption", null, (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, caption)), _react.Children.map(children, child => {
|
103
105
|
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Head.Head])) {
|
104
106
|
return (0, _safeCloneElement.safeCloneElement)(child, {
|
@@ -120,52 +122,10 @@ let Table = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
120
122
|
}));
|
121
123
|
}
|
122
124
|
|
123
|
-
}, _class2.displayName = "Table", _class2.componentId = 'Table', _class2.propTypes = {
|
124
|
-
// eslint-disable-next-line react/require-default-props
|
125
|
-
makeStyles: _propTypes.default.func,
|
126
|
-
// eslint-disable-next-line react/require-default-props
|
127
|
-
styles: _propTypes.default.object,
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Provide a screen reader friendly description. Anything passed to this
|
131
|
-
* prop will be wrapped by `<ScreenReaderContent>` when it is rendered.
|
132
|
-
*/
|
133
|
-
caption: _propTypes.default.node.isRequired,
|
134
|
-
|
135
|
-
/**
|
136
|
-
* Build table via `Table.Head` and `Table.Body`
|
137
|
-
*/
|
138
|
-
children: _Children.Children.oneOf([_Head.Head, _Body.Body]),
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
142
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
143
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
144
|
-
*/
|
145
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Provide a reference to the underlying html element
|
149
|
-
*/
|
150
|
-
elementRef: _propTypes.default.func,
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Highlight each row on hover
|
154
|
-
*/
|
155
|
-
hover: _propTypes.default.bool,
|
156
|
-
|
157
|
-
/**
|
158
|
-
* `auto` lets the browser determine table column widths based on cell content,
|
159
|
-
* while `fixed` forces columns of equal width. `stacked` renders table in one
|
160
|
-
* column to be more readable on narrow screens
|
161
|
-
*/
|
162
|
-
layout: _propTypes.default.oneOf(['auto', 'fixed', 'stacked'])
|
163
|
-
}, _class2.defaultProps = {
|
125
|
+
}, _class2.displayName = "Table", _class2.componentId = 'Table', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
164
126
|
children: null,
|
165
127
|
hover: false,
|
166
|
-
layout: 'auto'
|
167
|
-
margin: void 0,
|
168
|
-
elementRef: void 0
|
128
|
+
layout: 'auto'
|
169
129
|
}, _class2.Head = _Head.Head, _class2.Body = _Body.Body, _class2.Row = _Row.Row, _class2.ColHeader = _ColHeader.ColHeader, _class2.RowHeader = _RowHeader.RowHeader, _class2.Cell = _Cell.Cell, _temp)) || _class);
|
170
130
|
exports.Table = Table;
|
171
131
|
var _default = Table;
|