@atlaskit/link-datasource 6.6.0 → 6.7.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 +17 -0
- package/dist/cjs/ui/common/modal/datasource-context/index.js +4 -2
- package/dist/cjs/ui/common/modal/datasources-table-in-modal-preview/index.js +5 -1
- package/dist/cjs/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.js +22 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/cjs/ui/issue-like-table/column-picker/index.js +15 -2
- package/dist/cjs/ui/issue-like-table/index.compiled.css +3 -0
- package/dist/cjs/ui/issue-like-table/index.js +138 -85
- package/dist/cjs/ui/issue-like-table/table-settings-menu/index.compiled.css +6 -0
- package/dist/cjs/ui/issue-like-table/table-settings-menu/index.js +96 -0
- package/dist/cjs/ui/issue-like-table/table-settings-menu/messages.js +24 -0
- package/dist/es2019/ui/common/modal/datasource-context/index.js +4 -2
- package/dist/es2019/ui/common/modal/datasources-table-in-modal-preview/index.js +5 -1
- package/dist/es2019/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.js +22 -0
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/es2019/ui/issue-like-table/column-picker/index.js +33 -18
- package/dist/es2019/ui/issue-like-table/index.compiled.css +3 -0
- package/dist/es2019/ui/issue-like-table/index.js +52 -4
- package/dist/es2019/ui/issue-like-table/table-settings-menu/index.compiled.css +6 -0
- package/dist/es2019/ui/issue-like-table/table-settings-menu/index.js +76 -0
- package/dist/es2019/ui/issue-like-table/table-settings-menu/messages.js +18 -0
- package/dist/esm/ui/common/modal/datasource-context/index.js +4 -2
- package/dist/esm/ui/common/modal/datasources-table-in-modal-preview/index.js +5 -1
- package/dist/esm/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.js +22 -0
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/esm/ui/issue-like-table/column-picker/index.js +14 -1
- package/dist/esm/ui/issue-like-table/index.compiled.css +3 -0
- package/dist/esm/ui/issue-like-table/index.js +139 -86
- package/dist/esm/ui/issue-like-table/table-settings-menu/index.compiled.css +6 -0
- package/dist/esm/ui/issue-like-table/table-settings-menu/index.js +87 -0
- package/dist/esm/ui/issue-like-table/table-settings-menu/messages.js +18 -0
- package/dist/types/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.d.ts +1 -1
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +2 -2
- package/dist/types/ui/datasource-table-view/types.d.ts +1 -1
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/table-settings-menu/index.d.ts +8 -0
- package/dist/types/ui/issue-like-table/table-settings-menu/messages.d.ts +17 -0
- package/dist/types/ui/issue-like-table/types.d.ts +6 -0
- package/examples-helpers/buildAssetsIssuesTable.tsx +2 -0
- package/examples-helpers/buildConfluenceSearchTable.tsx +2 -0
- package/examples-helpers/buildIssueLikeTable.tsx +2 -0
- package/examples-helpers/buildJiraIssuesTable.tsx +2 -0
- package/examples-helpers/useAssetsTableProps.tsx +6 -0
- package/examples-helpers/useCommonTableProps.tsx +5 -2
- package/package.json +7 -3
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.hasAvailableTableSettings = exports.TableSettingsMenu = void 0;
|
|
10
|
+
require("./index.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
var _reactIntl = require("react-intl");
|
|
16
|
+
var _new = require("@atlaskit/button/new");
|
|
17
|
+
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
18
|
+
var _popup = require("@atlaskit/popup/popup");
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
21
|
+
var _toggle = _interopRequireDefault(require("@atlaskit/toggle/toggle"));
|
|
22
|
+
var _messages = require("./messages");
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
|
+
var styles = {
|
|
25
|
+
menu: "_1rjcu2gc _1bsb1mjv",
|
|
26
|
+
setting: "_bfhksm61 _ca0q1b66 _u5f3utpp _n3td1b66 _19bvutpp"
|
|
27
|
+
};
|
|
28
|
+
var hasAvailableTableSettings = exports.hasAvailableTableSettings = function hasAvailableTableSettings(_ref) {
|
|
29
|
+
var wrapTextSetting = _ref.wrapTextSetting;
|
|
30
|
+
return Boolean(wrapTextSetting);
|
|
31
|
+
};
|
|
32
|
+
var TableSettingsMenu = exports.TableSettingsMenu = function TableSettingsMenu(props) {
|
|
33
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
34
|
+
formatMessage = _useIntl.formatMessage;
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
+
isOpen = _useState2[0],
|
|
38
|
+
setIsOpen = _useState2[1];
|
|
39
|
+
var wrapTextToggleId = (0, _react.useId)();
|
|
40
|
+
if (!hasAvailableTableSettings(props)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
var wrapTextSetting = props.wrapTextSetting;
|
|
44
|
+
var wrapTextLabel = formatMessage(_messages.tableSettingsMenuMessages.wrapTextOnAllColumns);
|
|
45
|
+
return /*#__PURE__*/React.createElement(_popup.Popup, {
|
|
46
|
+
isOpen: isOpen,
|
|
47
|
+
onClose: function onClose() {
|
|
48
|
+
return setIsOpen(false);
|
|
49
|
+
},
|
|
50
|
+
placement: "bottom-end",
|
|
51
|
+
shouldFlip: true,
|
|
52
|
+
testId: "table-settings-menu",
|
|
53
|
+
zIndex: _constants.layers.modal(),
|
|
54
|
+
role: "dialog",
|
|
55
|
+
label: formatMessage(_messages.tableSettingsMenuMessages.tableSettings),
|
|
56
|
+
trigger: function trigger(triggerProps) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(_new.IconButton, {
|
|
58
|
+
ref: triggerProps.ref,
|
|
59
|
+
"aria-controls": triggerProps['aria-controls'],
|
|
60
|
+
"aria-expanded": triggerProps['aria-expanded'],
|
|
61
|
+
"aria-haspopup": triggerProps['aria-haspopup'],
|
|
62
|
+
icon: _showMoreHorizontal.default,
|
|
63
|
+
isSelected: isOpen,
|
|
64
|
+
isTooltipDisabled: false,
|
|
65
|
+
label: formatMessage(_messages.tableSettingsMenuMessages.moreActions),
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
return setIsOpen(function (currentIsOpen) {
|
|
68
|
+
return !currentIsOpen;
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
spacing: "default"
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
content: function content(_ref2) {
|
|
75
|
+
var setInitialFocusRef = _ref2.setInitialFocusRef;
|
|
76
|
+
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
77
|
+
xcss: styles.menu
|
|
78
|
+
}, wrapTextSetting && /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
79
|
+
xcss: styles.setting
|
|
80
|
+
}, /*#__PURE__*/React.createElement(_compiled.Inline, {
|
|
81
|
+
alignBlock: "center",
|
|
82
|
+
spread: "space-between"
|
|
83
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
84
|
+
htmlFor: wrapTextToggleId
|
|
85
|
+
}, wrapTextLabel), /*#__PURE__*/React.createElement(_toggle.default, {
|
|
86
|
+
ref: function ref(element) {
|
|
87
|
+
setInitialFocusRef(element);
|
|
88
|
+
},
|
|
89
|
+
id: wrapTextToggleId,
|
|
90
|
+
isChecked: wrapTextSetting.isChecked,
|
|
91
|
+
onChange: wrapTextSetting.onChange,
|
|
92
|
+
testId: "table-settings-menu-wrap-text-toggle"
|
|
93
|
+
}))));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tableSettingsMenuMessages = void 0;
|
|
7
|
+
var _reactIntl = require("react-intl");
|
|
8
|
+
var tableSettingsMenuMessages = exports.tableSettingsMenuMessages = (0, _reactIntl.defineMessages)({
|
|
9
|
+
moreActions: {
|
|
10
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.moreActions',
|
|
11
|
+
description: 'Tooltip and accessibility label for the table settings meatball menu button',
|
|
12
|
+
defaultMessage: 'More actions'
|
|
13
|
+
},
|
|
14
|
+
tableSettings: {
|
|
15
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.tableSettings',
|
|
16
|
+
description: 'Accessibility label for the table settings popup',
|
|
17
|
+
defaultMessage: 'Table settings'
|
|
18
|
+
},
|
|
19
|
+
wrapTextOnAllColumns: {
|
|
20
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.wrapTextOnAllColumns',
|
|
21
|
+
description: 'Label for the toggle that wraps text in every table column',
|
|
22
|
+
defaultMessage: 'Wrap text in all columns'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -22,7 +22,8 @@ export const DatasourceContextProvider = ({
|
|
|
22
22
|
} = useColumnResize(initialColumnCustomSizes);
|
|
23
23
|
const {
|
|
24
24
|
wrappedColumnKeys,
|
|
25
|
-
onWrappedColumnChange
|
|
25
|
+
onWrappedColumnChange,
|
|
26
|
+
onWrappedColumnsChange
|
|
26
27
|
} = useColumnWrapping(initialWrappedColumnKeys);
|
|
27
28
|
const tableState = useDatasourceTableState({
|
|
28
29
|
datasourceId,
|
|
@@ -49,10 +50,11 @@ export const DatasourceContextProvider = ({
|
|
|
49
50
|
onColumnResize,
|
|
50
51
|
wrappedColumnKeys,
|
|
51
52
|
onWrappedColumnChange,
|
|
53
|
+
onWrappedColumnsChange,
|
|
52
54
|
parameters,
|
|
53
55
|
setParameters,
|
|
54
56
|
onInsert: onInsert
|
|
55
|
-
}), [datasourceId, isValidParameters, tableState, visibleColumnCount, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, parameters, onInsert]);
|
|
57
|
+
}), [datasourceId, isValidParameters, tableState, visibleColumnCount, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, onWrappedColumnsChange, parameters, onInsert]);
|
|
56
58
|
return /*#__PURE__*/React.createElement(DatasourceContext.Provider, {
|
|
57
59
|
value: contextValue
|
|
58
60
|
}, children);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { DatasourceAction } from '../../../../analytics/types';
|
|
4
5
|
import { useUserInteractions } from '../../../../contexts/user-interactions';
|
|
5
6
|
import { IssueLikeDataTableView } from '../../../issue-like-table';
|
|
@@ -10,6 +11,7 @@ const Table = props => {
|
|
|
10
11
|
onColumnResize,
|
|
11
12
|
wrappedColumnKeys,
|
|
12
13
|
onWrappedColumnChange,
|
|
14
|
+
onWrappedColumnsChange,
|
|
13
15
|
visibleColumnKeys,
|
|
14
16
|
onVisibleColumnKeysChange,
|
|
15
17
|
tableState: {
|
|
@@ -44,6 +46,8 @@ const Table = props => {
|
|
|
44
46
|
onColumnResize: onColumnResize,
|
|
45
47
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
46
48
|
onWrappedColumnChange: onWrappedColumnChange
|
|
47
|
-
})
|
|
49
|
+
}, fg('platform_lp_sllv_table_settings_menu') ? {
|
|
50
|
+
onWrappedColumnsChange
|
|
51
|
+
} : {}));
|
|
48
52
|
};
|
|
49
53
|
export default Table;
|
package/dist/es2019/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
3
|
export const useColumnWrapping = (initialWrappedColumnKeys = []) => {
|
|
3
4
|
const [wrappedColumnKeys, setWrappedColumnKeys] = useState(initialWrappedColumnKeys);
|
|
4
5
|
const onWrappedColumnChange = useCallback((key, isWrapped) => {
|
|
@@ -10,6 +11,27 @@ export const useColumnWrapping = (initialWrappedColumnKeys = []) => {
|
|
|
10
11
|
}
|
|
11
12
|
setWrappedColumnKeys(Array.from(set));
|
|
12
13
|
}, [wrappedColumnKeys]);
|
|
14
|
+
const onWrappedColumnChangeWithLatestState = useCallback((key, isWrapped) => {
|
|
15
|
+
setWrappedColumnKeys(currentWrappedColumnKeys => {
|
|
16
|
+
const nextWrappedColumnKeys = new Set(currentWrappedColumnKeys);
|
|
17
|
+
if (isWrapped) {
|
|
18
|
+
nextWrappedColumnKeys.add(key);
|
|
19
|
+
} else {
|
|
20
|
+
nextWrappedColumnKeys.delete(key);
|
|
21
|
+
}
|
|
22
|
+
return Array.from(nextWrappedColumnKeys);
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
const onWrappedColumnsChange = useCallback(nextWrappedColumnKeys => {
|
|
26
|
+
setWrappedColumnKeys(nextWrappedColumnKeys);
|
|
27
|
+
}, []);
|
|
28
|
+
if (fg('platform_lp_sllv_table_settings_menu')) {
|
|
29
|
+
return {
|
|
30
|
+
wrappedColumnKeys,
|
|
31
|
+
onWrappedColumnChange: onWrappedColumnChangeWithLatestState,
|
|
32
|
+
onWrappedColumnsChange
|
|
33
|
+
};
|
|
34
|
+
}
|
|
13
35
|
return {
|
|
14
36
|
wrappedColumnKeys,
|
|
15
37
|
onWrappedColumnChange
|
|
@@ -41,6 +41,7 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
41
41
|
onColumnResize,
|
|
42
42
|
wrappedColumnKeys,
|
|
43
43
|
onWrappedColumnChange,
|
|
44
|
+
onWrappedColumnsChange,
|
|
44
45
|
scrollableContainerHeight = DefaultScrollableContainerHeight
|
|
45
46
|
}) => {
|
|
46
47
|
// Local copy lets us apply in-session sort mutations without mutating external parameters.
|
|
@@ -221,7 +222,10 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
221
222
|
sortState
|
|
222
223
|
} : {}, {
|
|
223
224
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
224
|
-
onWrappedColumnChange: onWrappedColumnChange
|
|
225
|
+
onWrappedColumnChange: onWrappedColumnChange
|
|
226
|
+
}, onWrappedColumnsChange && fg('platform_lp_sllv_table_settings_menu') ? {
|
|
227
|
+
onWrappedColumnsChange
|
|
228
|
+
} : {}, {
|
|
225
229
|
scrollableContainerHeight: isInPDFRender ? undefined : fg('lp_enable_datasource-table-view_height_override') ? scrollableContainerHeight : DefaultScrollableContainerHeight,
|
|
226
230
|
extensionKey: extensionKey
|
|
227
231
|
})) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
@@ -4,9 +4,11 @@ import "./index.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
|
-
import Button from '@atlaskit/button/
|
|
7
|
+
import Button, { IconButton } from '@atlaskit/button/new';
|
|
8
8
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
9
9
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
10
|
+
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
12
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
13
|
import { createFilter } from '@atlaskit/react-select/filters';
|
|
12
14
|
import { PopupSelect } from '@atlaskit/select/popup-select';
|
|
@@ -123,22 +125,35 @@ export const ColumnPicker = ({
|
|
|
123
125
|
target: ({
|
|
124
126
|
isOpen,
|
|
125
127
|
...triggerProps
|
|
126
|
-
}) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
}) => {
|
|
129
|
+
if (fg('platform_lp_sllv_table_settings_menu')) {
|
|
130
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({}, triggerProps, {
|
|
131
|
+
appearance: "default",
|
|
132
|
+
icon: TableColumnsDistributeIcon,
|
|
133
|
+
isSelected: isOpen,
|
|
134
|
+
isTooltipDisabled: false,
|
|
135
|
+
label: intl.formatMessage(columnPickerMessages.tooltip),
|
|
136
|
+
spacing: "default",
|
|
137
|
+
testId: "column-picker-trigger-button"
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
141
|
+
content: intl.formatMessage(columnPickerMessages.tooltip)
|
|
142
|
+
}, tooltipProps => /*#__PURE__*/React.createElement(Button, _extends({}, tooltipProps, triggerProps, {
|
|
143
|
+
isSelected: isOpen,
|
|
144
|
+
spacing: "compact",
|
|
145
|
+
appearance: 'default',
|
|
146
|
+
testId: "column-picker-trigger-button",
|
|
147
|
+
iconAfter: () => /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
148
|
+
label: "down",
|
|
149
|
+
size: "small"
|
|
150
|
+
})
|
|
151
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
152
|
+
as: "span",
|
|
153
|
+
xcss: styles.customizeIcon
|
|
154
|
+
}, /*#__PURE__*/React.createElement(CustomizeIcon, {
|
|
155
|
+
label: "customize"
|
|
156
|
+
}))));
|
|
157
|
+
}
|
|
143
158
|
});
|
|
144
159
|
};
|
|
@@ -51,6 +51,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
|
|
|
51
51
|
.ProseMirror .pm-table-wrapper>table thead ._1pmc1b66{padding-right:var(--ds-space-050,4px)}
|
|
52
52
|
.ProseMirror .pm-table-wrapper>table thead ._1pmsusvi:last-of-type{box-sizing:border-box}
|
|
53
53
|
.ProseMirror .pm-table-wrapper>table thead ._1wwnusvi{box-sizing:border-box}
|
|
54
|
+
.ProseMirror .pm-table-wrapper>table thead ._2k5114em:last-of-type{width:95px}
|
|
54
55
|
.ProseMirror .pm-table-wrapper>table thead ._2k51ys9h:last-of-type{width:5pc}
|
|
55
56
|
.ProseMirror .pm-table-wrapper>table thead ._6dd7v77o{padding-bottom:var(--ds-space-025,2px)}
|
|
56
57
|
.ProseMirror .pm-table-wrapper>table thead ._7cz2v77o{padding-top:var(--ds-space-025,2px)}
|
|
@@ -118,6 +119,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
|
|
|
118
119
|
._kqsw1if8{position:sticky}
|
|
119
120
|
._kqswh2mm{position:relative}
|
|
120
121
|
._lura1osq [data-testid=datasource-header-content--container]{width:100%}
|
|
122
|
+
._mgul14em:last-of-type{width:95px}
|
|
121
123
|
._mgulys9h:last-of-type{width:5pc}
|
|
122
124
|
._ml92nkob:last-of-type{vertical-align:middle}
|
|
123
125
|
._mrkbidpf{border-bottom-left-radius:0}
|
|
@@ -159,6 +161,7 @@ thead.has-column-picker ._10i2idpf:nth-last-of-type(2){border-right:0}.ProseMirr
|
|
|
159
161
|
.pm-table-wrapper>table thead ._3mvc1tcg{line-height:24px}
|
|
160
162
|
.pm-table-wrapper>table thead ._7okwusvi:last-of-type{box-sizing:border-box}
|
|
161
163
|
.pm-table-wrapper>table thead ._7s0n1if8:last-of-type{position:sticky}
|
|
164
|
+
.pm-table-wrapper>table thead ._efqo14em:last-of-type{width:95px}
|
|
162
165
|
.pm-table-wrapper>table thead ._efqoys9h:last-of-type{width:5pc}
|
|
163
166
|
.pm-table-wrapper>table thead ._gdprpxbi:last-of-type{padding-right:var(--ds-space-200,1pc)}
|
|
164
167
|
.pm-table-wrapper>table thead ._mowjusic:last-of-type{text-align:right}
|
|
@@ -20,13 +20,14 @@ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/r
|
|
|
20
20
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
21
21
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/utils/combine';
|
|
22
22
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
|
|
23
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
23
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
24
24
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
25
25
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
26
26
|
import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
27
27
|
import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
|
|
28
28
|
import { NoResults } from '../common/error-state/no-results';
|
|
29
29
|
import { ColumnPicker } from './column-picker';
|
|
30
|
+
import { hasAvailableTableSettings, TableSettingsMenu } from './table-settings-menu';
|
|
30
31
|
import { DragColumnPreview } from './drag-column-preview';
|
|
31
32
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
32
33
|
import TableEmptyState from './empty-state';
|
|
@@ -38,6 +39,7 @@ import { COLUMN_BASE_WIDTH, getFieldLabelById, getWidthCss } from './utils';
|
|
|
38
39
|
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
39
40
|
const tableHeadStyles = null;
|
|
40
41
|
const columnPickerWidth = 80;
|
|
42
|
+
const columnPickerWithSettingsWidth = 95;
|
|
41
43
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
|
|
42
44
|
const ColumnPickerHeader = forwardRef(({
|
|
43
45
|
as: C = "th",
|
|
@@ -50,9 +52,24 @@ const ColumnPickerHeader = forwardRef(({
|
|
|
50
52
|
className: ax(["_1bqmidpf _2eacidpf _1rmlidpf _13xs13hi _19xw13hi _ex0g13hi _1rag1uh4 _1ul51uh4 _12ch1uh4 _12ruusvi _1pmsusvi _7okwusvi _mgulys9h _2k51ys9h _efqoys9h _1xzrzo7u _1ejpzo7u _1fmczo7u _77i31if8 _zjk41if8 _7s0n1if8 _3t471vc6 _9g2k1vc6 _1h0z1vc6 _1o59pxbi _1l3vpxbi _gdprpxbi _ml92nkob _1nfwnkob _11ljnkob _1ixkusic _s1peusic _mowjusic", __cmplp.className])
|
|
51
53
|
}));
|
|
52
54
|
});
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
|
|
53
56
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
57
|
ColumnPickerHeader.displayName = 'ColumnPickerHeader';
|
|
55
58
|
}
|
|
59
|
+
const ColumnPickerHeaderWithSettings = forwardRef(({
|
|
60
|
+
as: C = "th",
|
|
61
|
+
style: __cmpls,
|
|
62
|
+
...__cmplp
|
|
63
|
+
}, __cmplr) => {
|
|
64
|
+
return /*#__PURE__*/React.createElement(C, _extends({}, __cmplp, {
|
|
65
|
+
style: __cmpls,
|
|
66
|
+
ref: __cmplr,
|
|
67
|
+
className: ax(["_1bqmidpf _2eacidpf _1rmlidpf _13xs13hi _19xw13hi _ex0g13hi _1rag1uh4 _1ul51uh4 _12ch1uh4 _12ruusvi _1pmsusvi _7okwusvi _mgul14em _2k5114em _efqo14em _1xzrzo7u _1ejpzo7u _1fmczo7u _77i31if8 _zjk41if8 _7s0n1if8 _3t471vc6 _9g2k1vc6 _1h0z1vc6 _1o59pxbi _1l3vpxbi _gdprpxbi _ml92nkob _1nfwnkob _11ljnkob _1ixkusic _s1peusic _mowjusic", __cmplp.className])
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
ColumnPickerHeaderWithSettings.displayName = 'ColumnPickerHeaderWithSettings';
|
|
72
|
+
}
|
|
56
73
|
const truncateStyles = null;
|
|
57
74
|
const wrappedStyles = null;
|
|
58
75
|
const richTextCellStyles = null;
|
|
@@ -215,6 +232,7 @@ export const IssueLikeDataTableView = ({
|
|
|
215
232
|
onColumnSort,
|
|
216
233
|
wrappedColumnKeys,
|
|
217
234
|
onWrappedColumnChange,
|
|
235
|
+
onWrappedColumnsChange,
|
|
218
236
|
sortState,
|
|
219
237
|
status,
|
|
220
238
|
hasNextPage,
|
|
@@ -249,6 +267,25 @@ export const IssueLikeDataTableView = ({
|
|
|
249
267
|
const visibleSortedColumns = useMemo(() => visibleColumnKeys.map(visibleKey => orderedColumns.find(({
|
|
250
268
|
key
|
|
251
269
|
}) => visibleKey === key)).filter(Boolean), [orderedColumns, visibleColumnKeys]);
|
|
270
|
+
const isWrapTextSettingAvailable = Boolean(onWrappedColumnsChange) && fg('platform_lp_sllv_table_settings_menu');
|
|
271
|
+
let areAllVisibleColumnsWrapped = false;
|
|
272
|
+
if (isWrapTextSettingAvailable) {
|
|
273
|
+
areAllVisibleColumnsWrapped = visibleColumnKeys.length > 0 && visibleColumnKeys.every(columnKey => wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(columnKey));
|
|
274
|
+
}
|
|
275
|
+
const handleWrapTextOnAllColumnsChange = useCallback(() => {
|
|
276
|
+
if (!onWrappedColumnsChange) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const nextWrappedColumnKeys = areAllVisibleColumnsWrapped ? (wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 ? wrappedColumnKeys : []).filter(columnKey => !visibleColumnKeys.includes(columnKey)) : Array.from(new Set([...(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 ? wrappedColumnKeys : []), ...visibleColumnKeys]));
|
|
280
|
+
onWrappedColumnsChange(nextWrappedColumnKeys);
|
|
281
|
+
}, [areAllVisibleColumnsWrapped, onWrappedColumnsChange, visibleColumnKeys, wrappedColumnKeys]);
|
|
282
|
+
const tableSettingsMenuProps = {
|
|
283
|
+
wrapTextSetting: isWrapTextSettingAvailable ? {
|
|
284
|
+
isChecked: areAllVisibleColumnsWrapped,
|
|
285
|
+
onChange: handleWrapTextOnAllColumnsChange
|
|
286
|
+
} : undefined
|
|
287
|
+
};
|
|
288
|
+
const shouldShowTableSettingsMenu = hasAvailableTableSettings(tableSettingsMenuProps);
|
|
252
289
|
|
|
253
290
|
// TODO seems like this component can't handle some combination of incremental data retrieval.
|
|
254
291
|
// If data comes first, then columns and then visibleColumnKeys it blows up,
|
|
@@ -256,7 +293,7 @@ export const IssueLikeDataTableView = ({
|
|
|
256
293
|
const columnsWidthsSum = useMemo(() => visibleSortedColumns.map(({
|
|
257
294
|
key,
|
|
258
295
|
type
|
|
259
|
-
}) => (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type)).reduce((sum, width) => width + sum, 0) + (onVisibleColumnKeysChange ? columnPickerWidth : 0), [columnCustomSizes, onVisibleColumnKeysChange, visibleSortedColumns]);
|
|
296
|
+
}) => (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type)).reduce((sum, width) => width + sum, 0) + (onVisibleColumnKeysChange && shouldShowTableSettingsMenu ? columnPickerWithSettingsWidth : onVisibleColumnKeysChange ? columnPickerWidth : 0), [columnCustomSizes, onVisibleColumnKeysChange, shouldShowTableSettingsMenu, visibleSortedColumns]);
|
|
260
297
|
const shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
261
298
|
const tableContainerWidth = Math.ceil(((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().width) || 0);
|
|
262
299
|
const getColumnWidth = useCallback((key, type, isLastCell) => {
|
|
@@ -613,12 +650,23 @@ export const IssueLikeDataTableView = ({
|
|
|
613
650
|
})
|
|
614
651
|
}), heading);
|
|
615
652
|
}
|
|
616
|
-
}), onVisibleColumnKeysChange && /*#__PURE__*/React.createElement(
|
|
653
|
+
}), onVisibleColumnKeysChange && (shouldShowTableSettingsMenu ? /*#__PURE__*/React.createElement(ColumnPickerHeaderWithSettings, null, /*#__PURE__*/React.createElement(Inline, {
|
|
654
|
+
alignBlock: "center",
|
|
655
|
+
alignInline: "end",
|
|
656
|
+
space: "space.050"
|
|
657
|
+
}, /*#__PURE__*/React.createElement(ColumnPicker, {
|
|
658
|
+
columns: shouldDisplayColumnsInPicker ? orderedColumns : [],
|
|
659
|
+
selectedColumnKeys: shouldDisplayColumnsInPicker ? visibleColumnKeys : [],
|
|
660
|
+
onSelectedColumnKeysChange: onSelectedColumnKeysChange,
|
|
661
|
+
onOpen: handlePickerOpen
|
|
662
|
+
}), /*#__PURE__*/React.createElement(TableSettingsMenu, {
|
|
663
|
+
wrapTextSetting: tableSettingsMenuProps.wrapTextSetting
|
|
664
|
+
}))) : /*#__PURE__*/React.createElement(ColumnPickerHeader, null, /*#__PURE__*/React.createElement(ColumnPicker, {
|
|
617
665
|
columns: shouldDisplayColumnsInPicker ? orderedColumns : [],
|
|
618
666
|
selectedColumnKeys: shouldDisplayColumnsInPicker ? visibleColumnKeys : [],
|
|
619
667
|
onSelectedColumnKeysChange: onSelectedColumnKeysChange,
|
|
620
668
|
onOpen: handlePickerOpen
|
|
621
|
-
})))), /*#__PURE__*/React.createElement("tbody", {
|
|
669
|
+
}))))), /*#__PURE__*/React.createElement("tbody", {
|
|
622
670
|
"data-testid": testId && `${testId}--body`,
|
|
623
671
|
className: ax(["_n7zlidpf"])
|
|
624
672
|
}, hasNoResults && /*#__PURE__*/React.createElement("tr", {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}._19bvutpp{padding-left:var(--ds-space-150,9pt)}
|
|
2
|
+
._1bsb1mjv{width:300px}
|
|
3
|
+
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
4
|
+
._ca0q1b66{padding-top:var(--ds-space-050,4px)}
|
|
5
|
+
._n3td1b66{padding-bottom:var(--ds-space-050,4px)}
|
|
6
|
+
._u5f3utpp{padding-right:var(--ds-space-150,9pt)}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useId, useState } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
import { IconButton } from '@atlaskit/button/new';
|
|
8
|
+
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
9
|
+
import { Popup } from '@atlaskit/popup/popup';
|
|
10
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
11
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
12
|
+
import Toggle from '@atlaskit/toggle/toggle';
|
|
13
|
+
import { tableSettingsMenuMessages } from './messages';
|
|
14
|
+
const styles = {
|
|
15
|
+
menu: "_1rjcu2gc _1bsb1mjv",
|
|
16
|
+
setting: "_bfhksm61 _ca0q1b66 _u5f3utpp _n3td1b66 _19bvutpp"
|
|
17
|
+
};
|
|
18
|
+
export const hasAvailableTableSettings = ({
|
|
19
|
+
wrapTextSetting
|
|
20
|
+
}) => Boolean(wrapTextSetting);
|
|
21
|
+
export const TableSettingsMenu = props => {
|
|
22
|
+
const {
|
|
23
|
+
formatMessage
|
|
24
|
+
} = useIntl();
|
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
+
const wrapTextToggleId = useId();
|
|
27
|
+
if (!hasAvailableTableSettings(props)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const {
|
|
31
|
+
wrapTextSetting
|
|
32
|
+
} = props;
|
|
33
|
+
const wrapTextLabel = formatMessage(tableSettingsMenuMessages.wrapTextOnAllColumns);
|
|
34
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
35
|
+
isOpen: isOpen,
|
|
36
|
+
onClose: () => setIsOpen(false),
|
|
37
|
+
placement: "bottom-end",
|
|
38
|
+
shouldFlip: true,
|
|
39
|
+
testId: "table-settings-menu",
|
|
40
|
+
zIndex: layers.modal(),
|
|
41
|
+
role: "dialog",
|
|
42
|
+
label: formatMessage(tableSettingsMenuMessages.tableSettings),
|
|
43
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement(IconButton, {
|
|
44
|
+
ref: triggerProps.ref,
|
|
45
|
+
"aria-controls": triggerProps['aria-controls'],
|
|
46
|
+
"aria-expanded": triggerProps['aria-expanded'],
|
|
47
|
+
"aria-haspopup": triggerProps['aria-haspopup'],
|
|
48
|
+
icon: ShowMoreHorizontalIcon,
|
|
49
|
+
isSelected: isOpen,
|
|
50
|
+
isTooltipDisabled: false,
|
|
51
|
+
label: formatMessage(tableSettingsMenuMessages.moreActions),
|
|
52
|
+
onClick: () => setIsOpen(currentIsOpen => !currentIsOpen),
|
|
53
|
+
spacing: "default"
|
|
54
|
+
}),
|
|
55
|
+
content: ({
|
|
56
|
+
setInitialFocusRef
|
|
57
|
+
}) => /*#__PURE__*/React.createElement(Box, {
|
|
58
|
+
xcss: styles.menu
|
|
59
|
+
}, wrapTextSetting && /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
xcss: styles.setting
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
62
|
+
alignBlock: "center",
|
|
63
|
+
spread: "space-between"
|
|
64
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
65
|
+
htmlFor: wrapTextToggleId
|
|
66
|
+
}, wrapTextLabel), /*#__PURE__*/React.createElement(Toggle, {
|
|
67
|
+
ref: element => {
|
|
68
|
+
setInitialFocusRef(element);
|
|
69
|
+
},
|
|
70
|
+
id: wrapTextToggleId,
|
|
71
|
+
isChecked: wrapTextSetting.isChecked,
|
|
72
|
+
onChange: wrapTextSetting.onChange,
|
|
73
|
+
testId: "table-settings-menu-wrap-text-toggle"
|
|
74
|
+
}))))
|
|
75
|
+
});
|
|
76
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export const tableSettingsMenuMessages = defineMessages({
|
|
3
|
+
moreActions: {
|
|
4
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.moreActions',
|
|
5
|
+
description: 'Tooltip and accessibility label for the table settings meatball menu button',
|
|
6
|
+
defaultMessage: 'More actions'
|
|
7
|
+
},
|
|
8
|
+
tableSettings: {
|
|
9
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.tableSettings',
|
|
10
|
+
description: 'Accessibility label for the table settings popup',
|
|
11
|
+
defaultMessage: 'Table settings'
|
|
12
|
+
},
|
|
13
|
+
wrapTextOnAllColumns: {
|
|
14
|
+
id: 'link-datasource.issue-like-table.table-settings-menu.wrapTextOnAllColumns',
|
|
15
|
+
description: 'Label for the toggle that wraps text in every table column',
|
|
16
|
+
defaultMessage: 'Wrap text in all columns'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -27,7 +27,8 @@ export var DatasourceContextProvider = function DatasourceContextProvider(_ref)
|
|
|
27
27
|
onColumnResize = _useColumnResize.onColumnResize;
|
|
28
28
|
var _useColumnWrapping = useColumnWrapping(initialWrappedColumnKeys),
|
|
29
29
|
wrappedColumnKeys = _useColumnWrapping.wrappedColumnKeys,
|
|
30
|
-
onWrappedColumnChange = _useColumnWrapping.onWrappedColumnChange
|
|
30
|
+
onWrappedColumnChange = _useColumnWrapping.onWrappedColumnChange,
|
|
31
|
+
onWrappedColumnsChange = _useColumnWrapping.onWrappedColumnsChange;
|
|
31
32
|
var tableState = useDatasourceTableState({
|
|
32
33
|
datasourceId: datasourceId,
|
|
33
34
|
parameters: isValidParameters(parameters) ? parameters : undefined,
|
|
@@ -53,11 +54,12 @@ export var DatasourceContextProvider = function DatasourceContextProvider(_ref)
|
|
|
53
54
|
onColumnResize: onColumnResize,
|
|
54
55
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
55
56
|
onWrappedColumnChange: onWrappedColumnChange,
|
|
57
|
+
onWrappedColumnsChange: onWrappedColumnsChange,
|
|
56
58
|
parameters: parameters,
|
|
57
59
|
setParameters: setParameters,
|
|
58
60
|
onInsert: onInsert
|
|
59
61
|
};
|
|
60
|
-
}, [datasourceId, isValidParameters, tableState, visibleColumnCount, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, parameters, onInsert]);
|
|
62
|
+
}, [datasourceId, isValidParameters, tableState, visibleColumnCount, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, onWrappedColumnsChange, parameters, onInsert]);
|
|
61
63
|
return /*#__PURE__*/React.createElement(DatasourceContext.Provider, {
|
|
62
64
|
value: contextValue
|
|
63
65
|
}, children);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { DatasourceAction } from '../../../../analytics/types';
|
|
4
5
|
import { useUserInteractions } from '../../../../contexts/user-interactions';
|
|
5
6
|
import { IssueLikeDataTableView } from '../../../issue-like-table';
|
|
@@ -10,6 +11,7 @@ var Table = function Table(props) {
|
|
|
10
11
|
onColumnResize = _useDatasourceContext.onColumnResize,
|
|
11
12
|
wrappedColumnKeys = _useDatasourceContext.wrappedColumnKeys,
|
|
12
13
|
onWrappedColumnChange = _useDatasourceContext.onWrappedColumnChange,
|
|
14
|
+
onWrappedColumnsChange = _useDatasourceContext.onWrappedColumnsChange,
|
|
13
15
|
visibleColumnKeys = _useDatasourceContext.visibleColumnKeys,
|
|
14
16
|
onVisibleColumnKeysChange = _useDatasourceContext.onVisibleColumnKeysChange,
|
|
15
17
|
_useDatasourceContext2 = _useDatasourceContext.tableState,
|
|
@@ -44,6 +46,8 @@ var Table = function Table(props) {
|
|
|
44
46
|
onColumnResize: onColumnResize,
|
|
45
47
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
46
48
|
onWrappedColumnChange: onWrappedColumnChange
|
|
47
|
-
})
|
|
49
|
+
}, fg('platform_lp_sllv_table_settings_menu') ? {
|
|
50
|
+
onWrappedColumnsChange: onWrappedColumnsChange
|
|
51
|
+
} : {}));
|
|
48
52
|
};
|
|
49
53
|
export default Table;
|
package/dist/esm/ui/common/modal/datasources-table-in-modal-preview/use-column-wrapping/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
export var useColumnWrapping = function useColumnWrapping() {
|
|
4
5
|
var initialWrappedColumnKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5
6
|
var _useState = useState(initialWrappedColumnKeys),
|
|
@@ -15,6 +16,27 @@ export var useColumnWrapping = function useColumnWrapping() {
|
|
|
15
16
|
}
|
|
16
17
|
setWrappedColumnKeys(Array.from(set));
|
|
17
18
|
}, [wrappedColumnKeys]);
|
|
19
|
+
var onWrappedColumnChangeWithLatestState = useCallback(function (key, isWrapped) {
|
|
20
|
+
setWrappedColumnKeys(function (currentWrappedColumnKeys) {
|
|
21
|
+
var nextWrappedColumnKeys = new Set(currentWrappedColumnKeys);
|
|
22
|
+
if (isWrapped) {
|
|
23
|
+
nextWrappedColumnKeys.add(key);
|
|
24
|
+
} else {
|
|
25
|
+
nextWrappedColumnKeys.delete(key);
|
|
26
|
+
}
|
|
27
|
+
return Array.from(nextWrappedColumnKeys);
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
var onWrappedColumnsChange = useCallback(function (nextWrappedColumnKeys) {
|
|
31
|
+
setWrappedColumnKeys(nextWrappedColumnKeys);
|
|
32
|
+
}, []);
|
|
33
|
+
if (fg('platform_lp_sllv_table_settings_menu')) {
|
|
34
|
+
return {
|
|
35
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
36
|
+
onWrappedColumnChange: onWrappedColumnChangeWithLatestState,
|
|
37
|
+
onWrappedColumnsChange: onWrappedColumnsChange
|
|
38
|
+
};
|
|
39
|
+
}
|
|
18
40
|
return {
|
|
19
41
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
20
42
|
onWrappedColumnChange: onWrappedColumnChange
|
|
@@ -42,6 +42,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
42
42
|
onColumnResize = _ref.onColumnResize,
|
|
43
43
|
wrappedColumnKeys = _ref.wrappedColumnKeys,
|
|
44
44
|
onWrappedColumnChange = _ref.onWrappedColumnChange,
|
|
45
|
+
onWrappedColumnsChange = _ref.onWrappedColumnsChange,
|
|
45
46
|
_ref$scrollableContai = _ref.scrollableContainerHeight,
|
|
46
47
|
scrollableContainerHeight = _ref$scrollableContai === void 0 ? DefaultScrollableContainerHeight : _ref$scrollableContai;
|
|
47
48
|
// Local copy lets us apply in-session sort mutations without mutating external parameters.
|
|
@@ -227,7 +228,10 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
227
228
|
sortState: sortState
|
|
228
229
|
} : {}, {
|
|
229
230
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
230
|
-
onWrappedColumnChange: onWrappedColumnChange
|
|
231
|
+
onWrappedColumnChange: onWrappedColumnChange
|
|
232
|
+
}, onWrappedColumnsChange && fg('platform_lp_sllv_table_settings_menu') ? {
|
|
233
|
+
onWrappedColumnsChange: onWrappedColumnsChange
|
|
234
|
+
} : {}, {
|
|
231
235
|
scrollableContainerHeight: isInPDFRender ? undefined : fg('lp_enable_datasource-table-view_height_override') ? scrollableContainerHeight : DefaultScrollableContainerHeight,
|
|
232
236
|
extensionKey: extensionKey
|
|
233
237
|
})) : /*#__PURE__*/React.createElement(EmptyState, {
|