@ltht-react/table 2.0.119 → 2.0.121
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/README.md +15 -15
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/organisms/questionnaire-table-methods.js +11 -2
- package/lib/organisms/questionnaire-table-methods.js.map +1 -1
- package/package.json +8 -8
- package/src/atoms/questionnaire-withdrawn-table-cell.tsx +15 -15
- package/src/index.tsx +8 -7
- package/src/molecules/table-cell.tsx +93 -93
- package/src/molecules/table-component.tsx +146 -146
- package/src/molecules/table-methods.tsx +234 -234
- package/src/molecules/table-styled-components.tsx +233 -233
- package/src/molecules/table.tsx +161 -161
- package/src/molecules/useDimensionRef.tsx +37 -37
- package/src/molecules/useScrollRef.tsx +36 -36
- package/src/organisms/generic-table.tsx +33 -33
- package/src/organisms/questionnaire-table-methods.tsx +349 -334
- package/src/organisms/questionnaire-table.tsx +55 -55
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# Select
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
|
-
### Import
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import Select from '@ltht-react/table'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
<Table />
|
|
15
|
-
```
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
### Import
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import Select from '@ltht-react/table'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<Table />
|
|
15
|
+
```
|
package/lib/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ import QuestionnaireTable from './organisms/questionnaire-table';
|
|
|
4
4
|
import { AdminActionsForQuestionnaire } from './organisms/questionnaire-table-methods';
|
|
5
5
|
export default Table;
|
|
6
6
|
export { Header, TableData, DataEntity, CellProps, GenericTable, QuestionnaireTable, AdminActionsForQuestionnaire };
|
|
7
|
+
export { default as mapQuestionnaireToTableData } from './organisms/questionnaire-table-methods';
|
package/lib/index.js
CHANGED
|
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.QuestionnaireTable = exports.GenericTable = void 0;
|
|
6
|
+
exports.mapQuestionnaireToTableData = exports.QuestionnaireTable = exports.GenericTable = void 0;
|
|
7
7
|
var table_1 = __importDefault(require("./molecules/table"));
|
|
8
8
|
var generic_table_1 = __importDefault(require("./organisms/generic-table"));
|
|
9
9
|
exports.GenericTable = generic_table_1.default;
|
|
10
10
|
var questionnaire_table_1 = __importDefault(require("./organisms/questionnaire-table"));
|
|
11
11
|
exports.QuestionnaireTable = questionnaire_table_1.default;
|
|
12
12
|
exports.default = table_1.default;
|
|
13
|
+
var questionnaire_table_methods_1 = require("./organisms/questionnaire-table-methods");
|
|
14
|
+
Object.defineProperty(exports, "mapQuestionnaireToTableData", { enumerable: true, get: function () { return __importDefault(questionnaire_table_methods_1).default; } });
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,4DAAmF;AACnF,4EAAoD;AAKD,uBAL5C,uBAAY,CAK4C;AAJ/D,wFAAgE;AAIC,6BAJ1D,6BAAkB,CAI0D;AADnF,kBAAe,eAAK,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,4DAAmF;AACnF,4EAAoD;AAKD,uBAL5C,uBAAY,CAK4C;AAJ/D,wFAAgE;AAIC,6BAJ1D,6BAAkB,CAI0D;AADnF,kBAAe,eAAK,CAAA;AAEpB,uFAAgG;AAAvF,2JAAA,OAAO,OAA+B"}
|
|
@@ -28,6 +28,11 @@ var types_1 = require("@ltht-react/types");
|
|
|
28
28
|
var utils_1 = require("@ltht-react/utils");
|
|
29
29
|
var styles_1 = require("@ltht-react/styles");
|
|
30
30
|
var questionnaire_withdrawn_table_cell_1 = __importDefault(require("../atoms/questionnaire-withdrawn-table-cell"));
|
|
31
|
+
var DEFAULT_VERTICAL_HEADER_CELL_STYLE = {
|
|
32
|
+
maxWidth: '15rem',
|
|
33
|
+
textWrap: 'wrap',
|
|
34
|
+
textAlign: 'left',
|
|
35
|
+
};
|
|
31
36
|
var withdrawnWrapper = function (text) { return (0, jsx_runtime_1.jsx)(questionnaire_withdrawn_table_cell_1.default, { text: text }); };
|
|
32
37
|
var mapQuestionnaireDefinitionAndResponsesToTableData = function (definition, questionnaireResponses, axis, adminActions) {
|
|
33
38
|
var definitionItems = (0, utils_1.EnsureMaybeArray)((0, utils_1.EnsureMaybe)(definition.item, []));
|
|
@@ -151,7 +156,7 @@ var buildVerticalCellRows = function (definitionItems, records, adminActions) {
|
|
|
151
156
|
});
|
|
152
157
|
if (adminActions) {
|
|
153
158
|
var actionsDataEntity_1 = {};
|
|
154
|
-
actionsDataEntity_1.property = { text: 'Actions' };
|
|
159
|
+
actionsDataEntity_1.property = { text: 'Actions', parentStyle: DEFAULT_VERTICAL_HEADER_CELL_STYLE };
|
|
155
160
|
records.forEach(function (record) {
|
|
156
161
|
var adminActionsForThisDataEntity = adminActions.find(function (actionForForm) { return actionForForm.questionnaire === record.id; });
|
|
157
162
|
if (adminActionsForThisDataEntity) {
|
|
@@ -169,7 +174,11 @@ var buildVerticalCellRowsRecursive = function (definitionItems, records, dataEnt
|
|
|
169
174
|
var updatedDataEntity = __assign({}, dataEntity);
|
|
170
175
|
definitionItems.forEach(function (definitionItem) {
|
|
171
176
|
var _a;
|
|
172
|
-
|
|
177
|
+
var containsChildItems = !!definitionItem.item && definitionItem.item.length > 0;
|
|
178
|
+
updatedDataEntity.property = {
|
|
179
|
+
text: (_a = definitionItem.text) !== null && _a !== void 0 ? _a : '',
|
|
180
|
+
parentStyle: __assign(__assign({}, DEFAULT_VERTICAL_HEADER_CELL_STYLE), { fontWeight: containsChildItems ? 'bold' : 'normal' }),
|
|
181
|
+
};
|
|
173
182
|
if (definitionItem.linkId) {
|
|
174
183
|
records.forEach(function (record) {
|
|
175
184
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaire-table-methods.js","sourceRoot":"","sources":["../../src/organisms/questionnaire-table-methods.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"questionnaire-table-methods.js","sourceRoot":"","sources":["../../src/organisms/questionnaire-table-methods.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2CAS0B;AAC1B,2CAAsF;AACtF,6CAAkE;AAGlE,mHAAyF;AAEzF,IAAM,kCAAkC,GAAkB;IACxD,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;CAClB,CAAA;AAED,IAAM,gBAAgB,GAAG,UAAC,IAAY,IAAkB,OAAA,uBAAC,4CAA+B,IAAC,IAAI,EAAE,IAAI,GAAI,EAA/C,CAA+C,CAAA;AAEvG,IAAM,iDAAiD,GAAG,UACxD,UAAyB,EACzB,sBAA+C,EAC/C,IAAU,EACV,YAA6C;IAE7C,IAAM,eAAe,GAAG,IAAA,wBAAgB,EACtC,IAAA,mBAAW,EAA6B,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAC7D,CAAA;IAED,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,SAAS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AC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;QACxD,OAAO;YACL,uBAAuB,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;YACvF,IAAI,EAAE,aAAa;SACpB,CAAA;IACH,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QAChC,OAAO;YACL,uBAAuB,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YACxG,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE;SACrC,CAAA;IACH,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QAChC,OAAO;YACL,uBAAuB,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YACxG,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE;SACrC,CAAA;IACH,CAAC;IACD,OAAO;QACL,IAAI,EAAE,EAAE;KACT,CAAA;AACH,CAAC,CAAA;AAOD,kBAAe,iDAAiD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/table",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.121",
|
|
4
4
|
"description": "ltht-react Table component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/icon": "^2.0.
|
|
33
|
-
"@ltht-react/menu": "^2.0.
|
|
34
|
-
"@ltht-react/styles": "^2.0.
|
|
35
|
-
"@ltht-react/types": "^2.0.
|
|
36
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.121",
|
|
32
|
+
"@ltht-react/icon": "^2.0.121",
|
|
33
|
+
"@ltht-react/menu": "^2.0.121",
|
|
34
|
+
"@ltht-react/styles": "^2.0.121",
|
|
35
|
+
"@ltht-react/types": "^2.0.121",
|
|
36
|
+
"@ltht-react/utils": "^2.0.121",
|
|
37
37
|
"@tanstack/react-table": "^8.10.7",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
39
|
"react-uuid": "^2.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a912ee8b6f06a02bf6d5c95424ff0ed9979f244d"
|
|
42
42
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
const StyledText = styled.div`
|
|
5
|
-
text-decoration: line-through;
|
|
6
|
-
color: gray;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
const QuestionnaireWithdrawnTableCell: FC<WithdrawnCellProps> = ({ text }) => <StyledText>{text ?? ''}</StyledText>
|
|
10
|
-
|
|
11
|
-
export interface WithdrawnCellProps {
|
|
12
|
-
text?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default QuestionnaireWithdrawnTableCell
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
const StyledText = styled.div`
|
|
5
|
+
text-decoration: line-through;
|
|
6
|
+
color: gray;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
const QuestionnaireWithdrawnTableCell: FC<WithdrawnCellProps> = ({ text }) => <StyledText>{text ?? ''}</StyledText>
|
|
10
|
+
|
|
11
|
+
export interface WithdrawnCellProps {
|
|
12
|
+
text?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default QuestionnaireWithdrawnTableCell
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import Table, { Header, DataEntity, TableData, CellProps } from './molecules/table'
|
|
2
|
-
import GenericTable from './organisms/generic-table'
|
|
3
|
-
import QuestionnaireTable from './organisms/questionnaire-table'
|
|
4
|
-
import { AdminActionsForQuestionnaire } from './organisms/questionnaire-table-methods'
|
|
5
|
-
|
|
6
|
-
export default Table
|
|
7
|
-
export { Header, TableData, DataEntity, CellProps, GenericTable, QuestionnaireTable, AdminActionsForQuestionnaire }
|
|
1
|
+
import Table, { Header, DataEntity, TableData, CellProps } from './molecules/table'
|
|
2
|
+
import GenericTable from './organisms/generic-table'
|
|
3
|
+
import QuestionnaireTable from './organisms/questionnaire-table'
|
|
4
|
+
import { AdminActionsForQuestionnaire } from './organisms/questionnaire-table-methods'
|
|
5
|
+
|
|
6
|
+
export default Table
|
|
7
|
+
export { Header, TableData, DataEntity, CellProps, GenericTable, QuestionnaireTable, AdminActionsForQuestionnaire }
|
|
8
|
+
export { default as mapQuestionnaireToTableData } from './organisms/questionnaire-table-methods'
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import { Button } from '@ltht-react/button'
|
|
3
|
-
import styled from '@emotion/styled'
|
|
4
|
-
import Icon, { IconButton, IconProps } from '@ltht-react/icon'
|
|
5
|
-
import ActionMenu, { ActionMenuOption } from '@ltht-react/menu'
|
|
6
|
-
import { PopUp, getZIndex, BTN_COLOURS } from '@ltht-react/styles'
|
|
7
|
-
import { Axis } from '@ltht-react/types'
|
|
8
|
-
|
|
9
|
-
const StyledIconText = styled.span`
|
|
10
|
-
margin-left: 0.4rem;
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
// TODO: This component is still a WIP and will be re-factored soon!
|
|
14
|
-
// May be best to split it out into different components, the important part is unifying Type used by React-Table so the mapping can be simplified
|
|
15
|
-
// It will need to facilitate the Actions list capability Jonny Dyson has requested
|
|
16
|
-
// Betters ways of handling the customComponentOverride will be considered too
|
|
17
|
-
const TableCell: FC<CellProps> = ({
|
|
18
|
-
adminActions,
|
|
19
|
-
isButton = false,
|
|
20
|
-
text,
|
|
21
|
-
iconProps,
|
|
22
|
-
headerAxis = 'x',
|
|
23
|
-
clickHandler,
|
|
24
|
-
customComponentOverride,
|
|
25
|
-
}) => {
|
|
26
|
-
if (customComponentOverride) {
|
|
27
|
-
return customComponentOverride
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (adminActions) {
|
|
31
|
-
if (adminActions.length === 0) {
|
|
32
|
-
return <></>
|
|
33
|
-
}
|
|
34
|
-
return (
|
|
35
|
-
<ActionMenu
|
|
36
|
-
actions={adminActions}
|
|
37
|
-
menuButtonOptions={{
|
|
38
|
-
type: 'button',
|
|
39
|
-
text: '',
|
|
40
|
-
buttonProps: {
|
|
41
|
-
styling: {
|
|
42
|
-
buttonStyle: 'standard',
|
|
43
|
-
padding: headerAxis === 'x' ? '0.3rem 0.5rem' : '0.15rem 0.3rem',
|
|
44
|
-
},
|
|
45
|
-
icon: (
|
|
46
|
-
<Icon {...{ type: headerAxis === 'x' ? 'ellipsis-vertical' : 'ellipsis-horizontal', size: 'medium' }} />
|
|
47
|
-
),
|
|
48
|
-
iconPlacement: 'center',
|
|
49
|
-
color: `${BTN_COLOURS.DANGER.VALUE}`,
|
|
50
|
-
},
|
|
51
|
-
}}
|
|
52
|
-
popupStyle={{ zIndex: getZIndex(PopUp) }}
|
|
53
|
-
popupPlacement={headerAxis === 'x' ? 'bottom-start' : 'right-start'}
|
|
54
|
-
/>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (isButton) {
|
|
59
|
-
return <Button value={text} icon={iconProps && <Icon {...iconProps} />} onClick={clickHandler} />
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (clickHandler && iconProps) {
|
|
63
|
-
return <IconButton iconProps={iconProps} text={text} onClick={clickHandler} />
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (iconProps) {
|
|
67
|
-
return (
|
|
68
|
-
<>
|
|
69
|
-
<Icon {...iconProps} />
|
|
70
|
-
{text && <StyledIconText>{text}</StyledIconText>}
|
|
71
|
-
</>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (text) {
|
|
76
|
-
return <div>{text ?? ''}</div>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return <></>
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface CellProps {
|
|
83
|
-
adminActions?: ActionMenuOption[]
|
|
84
|
-
isButton?: boolean
|
|
85
|
-
text?: string
|
|
86
|
-
iconProps?: IconProps
|
|
87
|
-
clickHandler?: React.MouseEventHandler<HTMLButtonElement>
|
|
88
|
-
customComponentOverride?: JSX.Element
|
|
89
|
-
parentStyle?: React.CSSProperties
|
|
90
|
-
headerAxis?: Axis
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default TableCell
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import { Button } from '@ltht-react/button'
|
|
3
|
+
import styled from '@emotion/styled'
|
|
4
|
+
import Icon, { IconButton, IconProps } from '@ltht-react/icon'
|
|
5
|
+
import ActionMenu, { ActionMenuOption } from '@ltht-react/menu'
|
|
6
|
+
import { PopUp, getZIndex, BTN_COLOURS } from '@ltht-react/styles'
|
|
7
|
+
import { Axis } from '@ltht-react/types'
|
|
8
|
+
|
|
9
|
+
const StyledIconText = styled.span`
|
|
10
|
+
margin-left: 0.4rem;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
// TODO: This component is still a WIP and will be re-factored soon!
|
|
14
|
+
// May be best to split it out into different components, the important part is unifying Type used by React-Table so the mapping can be simplified
|
|
15
|
+
// It will need to facilitate the Actions list capability Jonny Dyson has requested
|
|
16
|
+
// Betters ways of handling the customComponentOverride will be considered too
|
|
17
|
+
const TableCell: FC<CellProps> = ({
|
|
18
|
+
adminActions,
|
|
19
|
+
isButton = false,
|
|
20
|
+
text,
|
|
21
|
+
iconProps,
|
|
22
|
+
headerAxis = 'x',
|
|
23
|
+
clickHandler,
|
|
24
|
+
customComponentOverride,
|
|
25
|
+
}) => {
|
|
26
|
+
if (customComponentOverride) {
|
|
27
|
+
return customComponentOverride
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (adminActions) {
|
|
31
|
+
if (adminActions.length === 0) {
|
|
32
|
+
return <></>
|
|
33
|
+
}
|
|
34
|
+
return (
|
|
35
|
+
<ActionMenu
|
|
36
|
+
actions={adminActions}
|
|
37
|
+
menuButtonOptions={{
|
|
38
|
+
type: 'button',
|
|
39
|
+
text: '',
|
|
40
|
+
buttonProps: {
|
|
41
|
+
styling: {
|
|
42
|
+
buttonStyle: 'standard',
|
|
43
|
+
padding: headerAxis === 'x' ? '0.3rem 0.5rem' : '0.15rem 0.3rem',
|
|
44
|
+
},
|
|
45
|
+
icon: (
|
|
46
|
+
<Icon {...{ type: headerAxis === 'x' ? 'ellipsis-vertical' : 'ellipsis-horizontal', size: 'medium' }} />
|
|
47
|
+
),
|
|
48
|
+
iconPlacement: 'center',
|
|
49
|
+
color: `${BTN_COLOURS.DANGER.VALUE}`,
|
|
50
|
+
},
|
|
51
|
+
}}
|
|
52
|
+
popupStyle={{ zIndex: getZIndex(PopUp) }}
|
|
53
|
+
popupPlacement={headerAxis === 'x' ? 'bottom-start' : 'right-start'}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (isButton) {
|
|
59
|
+
return <Button value={text} icon={iconProps && <Icon {...iconProps} />} onClick={clickHandler} />
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (clickHandler && iconProps) {
|
|
63
|
+
return <IconButton iconProps={iconProps} text={text} onClick={clickHandler} />
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (iconProps) {
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
<Icon {...iconProps} />
|
|
70
|
+
{text && <StyledIconText>{text}</StyledIconText>}
|
|
71
|
+
</>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (text) {
|
|
76
|
+
return <div>{text ?? ''}</div>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return <></>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface CellProps {
|
|
83
|
+
adminActions?: ActionMenuOption[]
|
|
84
|
+
isButton?: boolean
|
|
85
|
+
text?: string
|
|
86
|
+
iconProps?: IconProps
|
|
87
|
+
clickHandler?: React.MouseEventHandler<HTMLButtonElement>
|
|
88
|
+
customComponentOverride?: JSX.Element
|
|
89
|
+
parentStyle?: React.CSSProperties
|
|
90
|
+
headerAxis?: Axis
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default TableCell
|