@carbon/ibm-products 2.44.0 → 2.45.0-rc.1
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/css/index-full-carbon.css +118 -15
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +203 -5
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +118 -15
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +118 -15
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Coachmark/Coachmark.js +12 -7
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
- package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/CreateFullPage/CreateFullPage.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/es/components/Datagrid/types/index.d.ts +28 -6
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/es/components/Datagrid/useStickyColumn.js +12 -9
- package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/es/components/EditInPlace/EditInPlace.js +21 -10
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +11 -6
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/es/components/SidePanel/SidePanel.js +17 -21
- package/es/components/SidePanel/motion/variants.d.ts +4 -6
- package/es/components/SidePanel/motion/variants.js +10 -11
- package/es/components/Tearsheet/TearsheetShell.js +3 -1
- package/es/components/WebTerminal/WebTerminal.js +10 -12
- package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/Coachmark/Coachmark.js +12 -7
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +27 -12
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/lib/components/Datagrid/types/index.d.ts +28 -6
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/lib/components/Datagrid/useStickyColumn.js +12 -9
- package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/lib/components/EditInPlace/EditInPlace.js +21 -10
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +11 -6
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/SidePanel/SidePanel.js +16 -20
- package/lib/components/SidePanel/motion/variants.d.ts +4 -6
- package/lib/components/SidePanel/motion/variants.js +10 -11
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/components/WebTerminal/WebTerminal.js +10 -12
- package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/settings.d.ts +1 -1
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
- package/scss/components/Datagrid/_datagrid.scss +0 -4
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
- package/scss/components/OptionsTile/_options-tile.scss +6 -6
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
- package/telemetry.yml +12 -2
- package/es/global/js/utils/window.d.ts +0 -2
- package/es/global/js/utils/window.js +0 -12
- package/lib/global/js/utils/window.d.ts +0 -2
- package/lib/global/js/utils/window.js +0 -16
@@ -1,9 +1,11 @@
|
|
1
1
|
export default ConditionPreview;
|
2
|
-
declare function ConditionPreview({ previewType }: {
|
2
|
+
declare function ConditionPreview({ previewType, group }: {
|
3
3
|
previewType: any;
|
4
|
+
group: any;
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
5
6
|
declare namespace ConditionPreview {
|
6
7
|
namespace propTypes {
|
8
|
+
let group: PropTypes.Requireable<object>;
|
7
9
|
let previewType: PropTypes.Requireable<string>;
|
8
10
|
}
|
9
11
|
}
|
@@ -16,6 +16,8 @@ var index = require('../../../node_modules/prop-types/index.js');
|
|
16
16
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
17
17
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
18
18
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
19
|
+
var useTranslations = require('../utils/useTranslations.js');
|
20
|
+
var icons = require('@carbon/react/icons');
|
19
21
|
|
20
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
23
|
|
@@ -23,28 +25,39 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
25
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
24
26
|
|
25
27
|
var ConditionPreview = function ConditionPreview(_ref) {
|
26
|
-
var
|
28
|
+
var _ConditionBuilderItem, _ConditionBuilderItem2, _ConditionBuilderItem3;
|
29
|
+
var previewType = _ref.previewType,
|
30
|
+
group = _ref.group;
|
27
31
|
var _useState = React.useState(false),
|
28
32
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
29
33
|
animate = _useState2[0],
|
30
34
|
setAnimate = _useState2[1];
|
35
|
+
var _useTranslations = useTranslations.useTranslations(['valueText', 'operatorText', 'propertyText', 'ifText']),
|
36
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 4),
|
37
|
+
propertyText = _useTranslations2[0],
|
38
|
+
operatorText = _useTranslations2[1],
|
39
|
+
valueText = _useTranslations2[2],
|
40
|
+
ifText = _useTranslations2[3];
|
31
41
|
React.useEffect(function () {
|
32
42
|
setAnimate(true);
|
33
43
|
}, []);
|
34
44
|
var getConditionSection = function getConditionSection() {
|
35
|
-
return /*#__PURE__*/React__default["default"].createElement("div",
|
36
|
-
|
37
|
-
}
|
38
|
-
label:
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
46
|
+
className: "".concat(DataConfigs.blockClass, "__preview-condition")
|
47
|
+
}, _ConditionBuilderItem || (_ConditionBuilderItem = /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
48
|
+
label: propertyText,
|
49
|
+
renderIcon: icons.Bee
|
50
|
+
})), _ConditionBuilderItem2 || (_ConditionBuilderItem2 = /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
51
|
+
label: operatorText
|
52
|
+
})), _ConditionBuilderItem3 || (_ConditionBuilderItem3 = /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
53
|
+
label: valueText
|
54
|
+
})));
|
42
55
|
};
|
43
56
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, previewType == 'newGroup' && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
44
57
|
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
45
58
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
46
59
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
47
|
-
label:
|
60
|
+
label: group.groupOperator
|
48
61
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
49
62
|
"aria-hidden": true,
|
50
63
|
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
@@ -52,32 +65,36 @@ var ConditionPreview = function ConditionPreview(_ref) {
|
|
52
65
|
className: "".concat(DataConfigs.blockClass, "__gap")
|
53
66
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
54
67
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
55
|
-
label:
|
68
|
+
label: ifText
|
56
69
|
})), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default["default"].createElement("div", {
|
57
70
|
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
58
71
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
59
72
|
className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
|
60
73
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
61
|
-
label:
|
74
|
+
label: group.groupOperator,
|
62
75
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
63
76
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap")
|
64
77
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
65
78
|
className: "".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper")
|
66
79
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
67
80
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__groupConnector"),
|
68
|
-
operator:
|
81
|
+
operator: ifText
|
69
82
|
}), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default["default"].createElement("div", {
|
70
83
|
className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
|
71
84
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
72
85
|
className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
|
73
86
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
74
|
-
label:
|
87
|
+
label: group.groupOperator,
|
75
88
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
76
89
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap")
|
77
90
|
}), getConditionSection())));
|
78
91
|
};
|
79
92
|
var ConditionPreview$1 = ConditionPreview;
|
80
93
|
ConditionPreview.propTypes = {
|
94
|
+
/**
|
95
|
+
* current conditional group
|
96
|
+
*/
|
97
|
+
group: index["default"].object,
|
81
98
|
/**
|
82
99
|
* type of review to be displayed
|
83
100
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
export function handleKeyDown(evt: any, conditionBuilderRef: any): void;
|
1
|
+
export function handleKeyDown(evt: any, conditionBuilderRef: any, variant: any): void;
|
@@ -13,14 +13,22 @@ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHel
|
|
13
13
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
14
14
|
var util = require('./util.js');
|
15
15
|
|
16
|
-
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
|
16
|
+
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
|
17
17
|
var activeElement = document.activeElement;
|
18
|
+
if (excludeKeyPress(evt)) {
|
19
|
+
return;
|
20
|
+
}
|
18
21
|
if (activeElement.closest("[role=\"dialog\"]")) {
|
19
22
|
handleKeyPressForPopover(evt, activeElement.closest("[role=\"dialog\"]"));
|
20
23
|
} else {
|
21
|
-
handleKeyPressForMainContent(evt, conditionBuilderRef);
|
24
|
+
handleKeyPressForMainContent(evt, conditionBuilderRef, variant);
|
22
25
|
}
|
23
26
|
};
|
27
|
+
//skipping keyboard handling for date and time fields to get take carbon's
|
28
|
+
var excludeKeyPress = function excludeKeyPress(evt) {
|
29
|
+
var _evt$target$closest, _evt$target$closest2;
|
30
|
+
return !['Escape'].includes(evt.key) && (((_evt$target$closest = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-date"))) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.length) || ((_evt$target$closest2 = evt.target.closest(".".concat(DataConfigs.blockClass, "__item-time"))) === null || _evt$target$closest2 === void 0 ? void 0 : _evt$target$closest2.length));
|
31
|
+
};
|
24
32
|
var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
|
25
33
|
var _parentContainer$quer;
|
26
34
|
var key = evt.key;
|
@@ -66,8 +74,8 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
66
74
|
if (document.activeElement.type !== 'button') {
|
67
75
|
var _document$activeEleme2;
|
68
76
|
//for button , enter key is click which already handled by framework, else trigger click
|
69
|
-
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
|
70
77
|
util.focusThisField(evt);
|
78
|
+
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
|
71
79
|
}
|
72
80
|
}
|
73
81
|
break;
|
@@ -77,8 +85,70 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
77
85
|
break;
|
78
86
|
}
|
79
87
|
};
|
88
|
+
var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
|
89
|
+
switch (evt.key) {
|
90
|
+
case 'ArrowRight':
|
91
|
+
evt.preventDefault();
|
92
|
+
if (variant == 'tree') {
|
93
|
+
var _evt$target$closest3;
|
94
|
+
var allCellsInRow = Array.from((_evt$target$closest3 = evt.target.closest('[role="row"]')) === null || _evt$target$closest3 === void 0 ? void 0 : _evt$target$closest3.querySelectorAll('[role="gridcell"] button'));
|
95
|
+
if (evt.target.getAttribute('role') == 'row') {
|
96
|
+
//when current focus is on a row, then we need to enter inside and focus the first cell of that row
|
97
|
+
if (allCellsInRow.length === 1) {
|
98
|
+
handleRowNavigationTree(evt, conditionBuilderRef, variant);
|
99
|
+
//focus next row
|
100
|
+
} else {
|
101
|
+
var _allCellsInRow$;
|
102
|
+
(_allCellsInRow$ = allCellsInRow[0]) === null || _allCellsInRow$ === void 0 || _allCellsInRow$.focus();
|
103
|
+
}
|
104
|
+
} else {
|
105
|
+
//finding the next cell to be focussed
|
106
|
+
//next cell = current cell index + 1
|
107
|
+
|
108
|
+
var currentItemIndex = allCellsInRow.indexOf(evt.target);
|
109
|
+
if (currentItemIndex < allCellsInRow.length - 1) {
|
110
|
+
util.focusThisItem(allCellsInRow[currentItemIndex + 1]);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
} else {
|
114
|
+
handleCellNavigation(evt, conditionBuilderRef);
|
115
|
+
}
|
116
|
+
break;
|
117
|
+
case 'ArrowLeft':
|
118
|
+
evt.preventDefault();
|
119
|
+
if (variant == 'tree') {
|
120
|
+
if (evt.target.getAttribute('role') !== 'row') {
|
121
|
+
var _evt$target$closest4;
|
122
|
+
//when any cell is focussed, arrow left will select the previous cell or current row
|
123
|
+
|
124
|
+
var allItems = Array.from((_evt$target$closest4 = evt.target.closest('[role="row"]')) === null || _evt$target$closest4 === void 0 ? void 0 : _evt$target$closest4.querySelectorAll('[role="gridcell"] button'));
|
125
|
+
var _currentItemIndex = allItems.indexOf(evt.target);
|
126
|
+
if (_currentItemIndex > 0) {
|
127
|
+
util.focusThisItem(allItems[_currentItemIndex - 1]);
|
128
|
+
} else {
|
129
|
+
//focus the row
|
130
|
+
var wrapper = evt.target.closest("[role=\"row\"]");
|
131
|
+
wrapper.focus();
|
132
|
+
}
|
133
|
+
}
|
134
|
+
} else {
|
135
|
+
handleCellNavigation(evt, conditionBuilderRef);
|
136
|
+
}
|
137
|
+
break;
|
138
|
+
case 'ArrowUp':
|
139
|
+
case 'ArrowDown':
|
140
|
+
evt.preventDefault();
|
141
|
+
if (variant == 'tree') {
|
142
|
+
handleRowNavigationTree(evt, conditionBuilderRef, variant);
|
143
|
+
} else {
|
144
|
+
handleRowNavigation(evt, conditionBuilderRef, variant);
|
145
|
+
}
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
};
|
80
149
|
var getRows = function getRows(conditionBuilderRef) {
|
81
|
-
|
150
|
+
var _conditionBuilderRef$;
|
151
|
+
return Array.from((_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 ? void 0 : _conditionBuilderRef$.querySelectorAll('[role="row"]'));
|
82
152
|
};
|
83
153
|
var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
|
84
154
|
var rows = getRows(conditionBuilderRef);
|
@@ -86,14 +156,39 @@ var getRowIndex = function getRowIndex(element, conditionBuilderRef) {
|
|
86
156
|
return row.contains(element);
|
87
157
|
});
|
88
158
|
};
|
89
|
-
var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef) {
|
159
|
+
var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef, variant) {
|
90
160
|
var rows = getRows(conditionBuilderRef);
|
91
161
|
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
92
|
-
navigateToNextRowCell(evt, currentRowIndex, rows);
|
162
|
+
navigateToNextRowCell(evt, currentRowIndex, rows, variant);
|
93
163
|
};
|
94
|
-
|
95
|
-
var
|
96
|
-
|
164
|
+
function handleRowNavigationTree(evt, conditionBuilderRef, variant) {
|
165
|
+
var rows = getRows(conditionBuilderRef);
|
166
|
+
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
167
|
+
var nextRowIndex = currentRowIndex;
|
168
|
+
if (evt.target.getAttribute('role') == 'row') {
|
169
|
+
if (['ArrowDown', 'ArrowRight'].includes(evt.key)) {
|
170
|
+
nextRowIndex += 1;
|
171
|
+
} else if (evt.key === 'ArrowUp') {
|
172
|
+
nextRowIndex -= 1;
|
173
|
+
}
|
174
|
+
|
175
|
+
//maintaining selection for first and last rows
|
176
|
+
if (nextRowIndex < 0) {
|
177
|
+
nextRowIndex = 0;
|
178
|
+
} else if (nextRowIndex >= rows.length) {
|
179
|
+
nextRowIndex = rows.length - 1;
|
180
|
+
}
|
181
|
+
if (nextRowIndex !== currentRowIndex) {
|
182
|
+
rows[currentRowIndex].setAttribute('tabindex', '-1');
|
183
|
+
rows[nextRowIndex].setAttribute('tabindex', '0');
|
184
|
+
rows[nextRowIndex].focus();
|
185
|
+
}
|
186
|
+
} else {
|
187
|
+
navigateToNextRowCell(evt, currentRowIndex, rows, variant);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex, rows, variant) {
|
191
|
+
//when the current focussed element is a cell of any row, arrow up/down will focus the next row same cell.
|
97
192
|
|
98
193
|
var nextRowIndex = currentRowIndex;
|
99
194
|
if (evt.key === 'ArrowUp') {
|
@@ -104,25 +199,22 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
|
|
104
199
|
}
|
105
200
|
var nextRow = rows[nextRowIndex];
|
106
201
|
var itemName = evt.target.dataset.name;
|
107
|
-
nextRow
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
|
114
|
-
if (evt.key === 'ArrowRight') {
|
115
|
-
util.traverseClockVise(eachElem, index, allElements);
|
116
|
-
} else {
|
117
|
-
util.traverseReverse(eachElem, index, allElements);
|
118
|
-
}
|
119
|
-
});
|
120
|
-
break;
|
121
|
-
case 'ArrowUp':
|
122
|
-
case 'ArrowDown':
|
123
|
-
handleRowNavigation(evt, conditionBuilderRef);
|
124
|
-
break;
|
202
|
+
if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
|
203
|
+
var _nextRow$querySelecto;
|
204
|
+
nextRow === null || nextRow === void 0 || (_nextRow$querySelecto = nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) === null || _nextRow$querySelecto === void 0 || _nextRow$querySelecto.focus();
|
205
|
+
} else if (variant === 'tree') {
|
206
|
+
//when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
|
207
|
+
nextRow === null || nextRow === void 0 || nextRow.focus();
|
125
208
|
}
|
126
209
|
};
|
210
|
+
var handleCellNavigation = function handleCellNavigation(evt, conditionBuilderRef) {
|
211
|
+
conditionBuilderRef.current.querySelectorAll("[role=\"gridcell\"] button").forEach(function (eachElem, index, allElements) {
|
212
|
+
if (evt.key === 'ArrowRight') {
|
213
|
+
util.traverseClockVise(eachElem, index, allElements);
|
214
|
+
} else {
|
215
|
+
util.traverseReverse(eachElem, index, allElements);
|
216
|
+
}
|
217
|
+
});
|
218
|
+
};
|
127
219
|
|
128
220
|
exports.handleKeyDown = handleKeyDown;
|
@@ -0,0 +1 @@
|
|
1
|
+
export function useTranslations(translationKeys: any): any;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var React = require('react');
|
13
|
+
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
14
|
+
var translationObject = require('../ConditionBuilderContext/translationObject.js');
|
15
|
+
|
16
|
+
var useTranslations = function useTranslations(translationKeys) {
|
17
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
18
|
+
translateWithId = _useContext.translateWithId;
|
19
|
+
return translationKeys.map(function (translationKey) {
|
20
|
+
if (translateWithId !== null && translateWithId !== void 0 && translateWithId(translationKey)) {
|
21
|
+
return translateWithId(translationKey);
|
22
|
+
} else if (translationObject.translationsObject[translationKey]) {
|
23
|
+
return translationObject.translationsObject[translationKey];
|
24
|
+
} else {
|
25
|
+
return translationKey;
|
26
|
+
}
|
27
|
+
});
|
28
|
+
};
|
29
|
+
|
30
|
+
exports.useTranslations = useTranslations;
|
@@ -52,16 +52,7 @@ var checkForHoldingKey = function checkForHoldingKey(evt, key) {
|
|
52
52
|
}
|
53
53
|
return evt[key];
|
54
54
|
};
|
55
|
-
var checkDuplicateAction = function checkDuplicateAction(actionState, selectedId, currentActionId) {
|
56
|
-
if (selectedId !== currentActionId && actionState.find(function (eachAction) {
|
57
|
-
return eachAction.id === selectedId;
|
58
|
-
})) {
|
59
|
-
return true;
|
60
|
-
}
|
61
|
-
return false;
|
62
|
-
};
|
63
55
|
|
64
|
-
exports.checkDuplicateAction = checkDuplicateAction;
|
65
56
|
exports.checkForHoldingKey = checkForHoldingKey;
|
66
57
|
exports.focusThisField = focusThisField;
|
67
58
|
exports.focusThisItem = focusThisItem;
|
@@ -98,6 +98,7 @@ exports.CreateFullPage = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
98
98
|
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
99
99
|
modalIsOpen = _useState10[0],
|
100
100
|
setModalIsOpen = _useState10[1];
|
101
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
101
102
|
var previousState = usePreviousValue.usePreviousValue({
|
102
103
|
currentStep: currentStep,
|
103
104
|
open: open
|
@@ -155,8 +156,7 @@ exports.CreateFullPage = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
155
156
|
useResetCreateComponent.useResetCreateComponent({
|
156
157
|
firstIncludedStep: firstIncludedStep,
|
157
158
|
previousState: previousState,
|
158
|
-
|
159
|
-
open: open,
|
159
|
+
open: true,
|
160
160
|
setCurrentStep: setCurrentStep,
|
161
161
|
stepData: stepData,
|
162
162
|
/**@ts-ignore */
|
@@ -20,6 +20,10 @@ interface DataSpreadsheetProps {
|
|
20
20
|
* The data that will build the column headers
|
21
21
|
*/
|
22
22
|
columns?: readonly Column<object>[];
|
23
|
+
/**
|
24
|
+
* Disable column swapping, default false
|
25
|
+
*/
|
26
|
+
disableColumnSwapping?: boolean;
|
23
27
|
/**
|
24
28
|
* The spreadsheet data that will be rendered in the body of the spreadsheet component
|
25
29
|
*/
|
@@ -50,6 +54,10 @@ interface DataSpreadsheetProps {
|
|
50
54
|
* The event handler that is called when the selection area values change
|
51
55
|
*/
|
52
56
|
onSelectionAreaChange?: () => void;
|
57
|
+
/**
|
58
|
+
* Read-only table
|
59
|
+
*/
|
60
|
+
readOnlyTable?: boolean;
|
53
61
|
/**
|
54
62
|
* Position of the custom row numbering component
|
55
63
|
*/
|
@@ -41,7 +41,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
41
41
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
42
42
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
43
43
|
|
44
|
-
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
44
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "disableColumnSwapping", "readOnlyTable", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
45
45
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
46
46
|
var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
|
47
47
|
var componentName = 'DataSpreadsheet';
|
@@ -78,6 +78,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
78
78
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
79
79
|
renderRowHeader = _ref.renderRowHeader,
|
80
80
|
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
81
|
+
_ref$disableColumnSwa = _ref.disableColumnSwapping,
|
82
|
+
disableColumnSwapping = _ref$disableColumnSwa === void 0 ? false : _ref$disableColumnSwa,
|
83
|
+
_ref$readOnlyTable = _ref.readOnlyTable,
|
84
|
+
readOnlyTable = _ref$readOnlyTable === void 0 ? false : _ref$readOnlyTable,
|
81
85
|
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
82
86
|
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
83
87
|
theme = _ref.theme,
|
@@ -436,17 +440,14 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
436
440
|
}
|
437
441
|
}, [handleInitialArrowPress, updateActiveCellCoordinates, activeCellCoordinates, columns, rows]);
|
438
442
|
var handleKeyPressEvent = React.useCallback(function (event) {
|
439
|
-
commonEventHandlers.handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent);
|
440
|
-
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
|
443
|
+
commonEventHandlers.handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent, readOnlyTable);
|
444
|
+
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, readOnlyTable]);
|
441
445
|
var startEditMode = function startEditMode() {
|
446
|
+
var _activeCellFullData$r;
|
442
447
|
setIsEditing(true);
|
443
448
|
setClickAndHoldActive(false);
|
444
449
|
var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
|
445
|
-
var activeCellValue;
|
446
|
-
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
447
|
-
var _activeCellFullData$r;
|
448
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$r = activeCellFullData.row.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value : null;
|
449
|
-
}
|
450
|
+
var activeCellValue = activeCellFullData === null || activeCellFullData === void 0 || (_activeCellFullData$r = activeCellFullData.row) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[Number(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value;
|
450
451
|
setCellEditorValue(activeCellValue || '');
|
451
452
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
452
453
|
cellEditorRulerRef.current.textContent = activeCellValue;
|
@@ -508,7 +509,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
508
509
|
// Go into edit mode if 'Enter' key is pressed on activeCellRef
|
509
510
|
var handleActiveCellKeyDown = function handleActiveCellKeyDown(event) {
|
510
511
|
var key = event.key;
|
511
|
-
if (key === 'Enter' && !activeCellInsideSelectionArea) {
|
512
|
+
if (key === 'Enter' && !activeCellInsideSelectionArea && !readOnlyTable) {
|
512
513
|
if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header') {
|
513
514
|
startEditMode();
|
514
515
|
}
|
@@ -564,8 +565,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
564
565
|
};
|
565
566
|
|
566
567
|
// Go into edit mode if double click is detected on activeCellRef
|
567
|
-
var handleActiveCellDoubleClick = function handleActiveCellDoubleClick() {
|
568
|
-
|
568
|
+
var handleActiveCellDoubleClick = function handleActiveCellDoubleClick(readOnlyTable) {
|
569
|
+
if (!readOnlyTable) {
|
570
|
+
startEditMode();
|
571
|
+
}
|
569
572
|
};
|
570
573
|
useSpreadsheetEdit.useSpreadsheetEdit({
|
571
574
|
isEditing: isEditing,
|
@@ -645,6 +648,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
645
648
|
setSelectionAreas: setSelectionAreas,
|
646
649
|
setCurrentMatcher: setCurrentMatcher,
|
647
650
|
setSelectionAreaData: setSelectionAreaData,
|
651
|
+
disableColumnSwapping: disableColumnSwapping,
|
652
|
+
readOnlyTable: readOnlyTable,
|
648
653
|
totalVisibleColumns: totalVisibleColumns,
|
649
654
|
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
650
655
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
@@ -693,7 +698,9 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
693
698
|
onMouseUp: handleActiveCellMouseUp,
|
694
699
|
onClick: handleActiveCellClick,
|
695
700
|
onKeyDown: handleActiveCellKeyDown,
|
696
|
-
onDoubleClick:
|
701
|
+
onDoubleClick: function onDoubleClick() {
|
702
|
+
return handleActiveCellDoubleClick(readOnlyTable);
|
703
|
+
},
|
697
704
|
onMouseEnter: handleActiveCellMouseEnter,
|
698
705
|
ref: activeCellRef,
|
699
706
|
className: cx__default["default"]("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
|
@@ -769,6 +776,10 @@ exports.DataSpreadsheet.propTypes = {
|
|
769
776
|
* Sets the number of empty rows to be created when there is no data provided
|
770
777
|
*/
|
771
778
|
defaultEmptyRowCount: index["default"].number,
|
779
|
+
/**
|
780
|
+
* Disable column swapping, default false
|
781
|
+
*/
|
782
|
+
disableColumnSwapping: index["default"].bool,
|
772
783
|
/**
|
773
784
|
* Check if spreadsheet is using custom row header component attached
|
774
785
|
*/
|
@@ -789,6 +800,10 @@ exports.DataSpreadsheet.propTypes = {
|
|
789
800
|
* The event handler that is called when the selection area values change
|
790
801
|
*/
|
791
802
|
onSelectionAreaChange: index["default"].func,
|
803
|
+
/**
|
804
|
+
* Read-only table
|
805
|
+
*/
|
806
|
+
readOnlyTable: index["default"].bool,
|
792
807
|
/**
|
793
808
|
* Component next to numbering rows
|
794
809
|
*/
|
@@ -16,6 +16,10 @@ interface DataSpreadsheetHeaderProps {
|
|
16
16
|
* Specifies the cell height
|
17
17
|
*/
|
18
18
|
cellSize?: Size;
|
19
|
+
/**
|
20
|
+
* Disable column swapping, default false
|
21
|
+
*/
|
22
|
+
disableColumnSwapping?: boolean;
|
19
23
|
/**
|
20
24
|
* All of the spreadsheet columns
|
21
25
|
*/
|
@@ -36,6 +40,10 @@ interface DataSpreadsheetHeaderProps {
|
|
36
40
|
* Headers provided from useTable hook
|
37
41
|
*/
|
38
42
|
headerGroups?: any[];
|
43
|
+
/**
|
44
|
+
* Read-only table
|
45
|
+
*/
|
46
|
+
readOnlyTable?: boolean;
|
39
47
|
/**
|
40
48
|
* All of the spreadsheet row data
|
41
49
|
*/
|
@@ -45,6 +45,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
45
45
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
46
46
|
setCurrentMatcher = _ref.setCurrentMatcher,
|
47
47
|
setSelectionAreas = _ref.setSelectionAreas,
|
48
|
+
readOnlyTable = _ref.readOnlyTable,
|
49
|
+
disableColumnSwapping = _ref.disableColumnSwapping,
|
48
50
|
setSelectionAreaData = _ref.setSelectionAreaData,
|
49
51
|
rows = _ref.rows,
|
50
52
|
totalVisibleColumns = _ref.totalVisibleColumns,
|
@@ -203,8 +205,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
203
205
|
"data-row-index": "header",
|
204
206
|
"data-column-index": index,
|
205
207
|
tabIndex: -1,
|
206
|
-
onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
|
207
|
-
onMouseUp: selectedHeader && typeof setSelectedHeaderReorderActive === 'function' ? function () {
|
208
|
+
onMouseDown: selectedHeader && !readOnlyTable && !disableColumnSwapping ? handleHeaderMouseDown(index) : undefined,
|
209
|
+
onMouseUp: selectedHeader && !readOnlyTable && !disableColumnSwapping && typeof setSelectedHeaderReorderActive === 'function' ? function () {
|
208
210
|
return setSelectedHeaderReorderActive(false);
|
209
211
|
} : undefined,
|
210
212
|
onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
|
@@ -212,7 +214,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
212
214
|
height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
213
215
|
width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
|
214
216
|
},
|
215
|
-
className: cx__default["default"]("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
|
217
|
+
className: cx__default["default"]("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--active-header-disabledSwapping"), disableColumnSwapping || readOnlyTable), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
|
216
218
|
type: "button"
|
217
219
|
}, column.render('Header')));
|
218
220
|
}));
|
@@ -248,6 +250,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
248
250
|
rowHeaderWidth: index["default"].number,
|
249
251
|
width: index["default"].number
|
250
252
|
}),
|
253
|
+
/**
|
254
|
+
* Disable column swapping, default false
|
255
|
+
*/
|
256
|
+
disableColumnSwapping: index["default"].bool,
|
251
257
|
/**
|
252
258
|
* Whether or not a click/hold is active on a header cell
|
253
259
|
*/
|
@@ -256,6 +262,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
256
262
|
* Headers provided from useTable hook
|
257
263
|
*/
|
258
264
|
headerGroups: index["default"].arrayOf(index["default"].object),
|
265
|
+
/**
|
266
|
+
* Read-only table
|
267
|
+
*/
|
268
|
+
readOnlyTable: index["default"].bool,
|
259
269
|
/**
|
260
270
|
* All of the spreadsheet row data
|
261
271
|
*/
|
@@ -16,10 +16,6 @@ export interface DatagridProps {
|
|
16
16
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
17
17
|
*/
|
18
18
|
datagridState: DataGridState;
|
19
|
-
/**
|
20
|
-
* Table title
|
21
|
-
*/
|
22
|
-
title?: string;
|
23
19
|
}
|
24
20
|
/**
|
25
21
|
* The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
|
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
25
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
26
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
27
27
|
|
28
|
-
var _excluded = ["datagridState", "
|
28
|
+
var _excluded = ["datagridState", "ariaToolbarLabel"];
|
29
29
|
var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
|
30
30
|
var componentName = 'Datagrid';
|
31
31
|
/**
|
@@ -33,7 +33,6 @@ var componentName = 'Datagrid';
|
|
33
33
|
*/
|
34
34
|
exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
35
35
|
var datagridState = _ref.datagridState,
|
36
|
-
title = _ref.title,
|
37
36
|
ariaToolbarLabel = _ref.ariaToolbarLabel,
|
38
37
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
39
38
|
if (!datagridState) {
|
@@ -49,7 +48,6 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
|
|
49
48
|
state = datagridState.state;
|
50
49
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
51
50
|
var props = {
|
52
|
-
title: title,
|
53
51
|
datagridState: datagridState,
|
54
52
|
ariaToolbarLabel: ariaToolbarLabel
|
55
53
|
};
|
@@ -82,9 +80,5 @@ exports.Datagrid.propTypes = {
|
|
82
80
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
83
81
|
*/
|
84
82
|
/**@ts-ignore */
|
85
|
-
datagridState: index["default"].object.isRequired
|
86
|
-
/**
|
87
|
-
* Table title
|
88
|
-
*/
|
89
|
-
title: index["default"].string
|
83
|
+
datagridState: index["default"].object.isRequired
|
90
84
|
};
|