@carbon/ibm-products 2.38.0-alpha.5 → 2.38.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-without-carbon-released-only.css +218 -0
- 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.css +218 -0
- 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/ActionSet/ActionSet.js +3 -2
- package/es/components/Checklist/Checklist.js +10 -10
- package/es/components/Checklist/ChecklistChart.d.ts +1 -1
- package/es/components/Checklist/ChecklistChart.js +6 -30
- package/es/components/Coachmark/Coachmark.d.ts +65 -2
- package/es/components/Coachmark/Coachmark.js +7 -10
- package/es/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
- package/es/components/Coachmark/CoachmarkDragbar.js +3 -1
- package/es/components/Coachmark/CoachmarkHeader.d.ts +27 -2
- package/es/components/Coachmark/CoachmarkHeader.js +0 -1
- package/es/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
- package/es/components/Coachmark/CoachmarkOverlay.js +18 -15
- package/es/components/Coachmark/CoachmarkTagline.d.ts +27 -2
- package/es/components/Coachmark/CoachmarkTagline.js +0 -1
- package/es/components/Coachmark/utils/enums.d.ts +20 -20
- package/es/components/Coachmark/utils/enums.js +22 -20
- package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -24
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +14 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
- package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
- package/es/components/SearchBar/SearchBar.d.ts +10 -1
- package/es/components/SearchBar/SearchBar.js +26 -20
- package/es/components/TagSet/TagSet.d.ts +87 -3
- package/es/components/TagSet/TagSet.js +20 -9
- package/es/components/TagSet/TagSetModal.d.ts +32 -26
- package/es/components/TagSet/TagSetModal.js +5 -5
- package/es/components/TagSet/TagSetOverflow.d.ts +45 -2
- package/es/components/TagSet/TagSetOverflow.js +14 -12
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
- package/es/components/WebTerminal/hooks/index.d.ts +16 -11
- package/es/components/WebTerminal/hooks/index.js +1 -1
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/node_modules/@carbon/colors/es/index.js +4 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/ActionSet/ActionSet.js +2 -1
- package/lib/components/Checklist/Checklist.js +10 -10
- package/lib/components/Checklist/ChecklistChart.d.ts +1 -1
- package/lib/components/Checklist/ChecklistChart.js +6 -30
- package/lib/components/Coachmark/Coachmark.d.ts +65 -2
- package/lib/components/Coachmark/Coachmark.js +6 -9
- package/lib/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
- package/lib/components/Coachmark/CoachmarkDragbar.js +3 -1
- package/lib/components/Coachmark/CoachmarkHeader.d.ts +27 -2
- package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
- package/lib/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
- package/lib/components/Coachmark/CoachmarkOverlay.js +18 -15
- package/lib/components/Coachmark/CoachmarkTagline.d.ts +27 -2
- package/lib/components/Coachmark/CoachmarkTagline.js +0 -1
- package/lib/components/Coachmark/utils/enums.d.ts +20 -20
- package/lib/components/Coachmark/utils/enums.js +22 -20
- package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +13 -23
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +13 -7
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
- package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
- package/lib/components/SearchBar/SearchBar.d.ts +10 -1
- package/lib/components/SearchBar/SearchBar.js +26 -18
- package/lib/components/TagSet/TagSet.d.ts +87 -3
- package/lib/components/TagSet/TagSet.js +20 -9
- package/lib/components/TagSet/TagSetModal.d.ts +32 -26
- package/lib/components/TagSet/TagSetModal.js +3 -3
- package/lib/components/TagSet/TagSetOverflow.d.ts +45 -2
- package/lib/components/TagSet/TagSetOverflow.js +14 -12
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
- package/lib/components/WebTerminal/hooks/index.d.ts +16 -11
- package/lib/components/WebTerminal/hooks/index.js +1 -1
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/node_modules/@carbon/colors/es/index.js +6 -0
- package/lib/settings.d.ts +1 -1
- package/package.json +3 -3
- package/scss/components/Checklist/_carbon-imports.scss +2 -2
- package/scss/components/_index-released-only-with-carbon.scss +2 -1
- package/scss/components/_index-released-only.scss +2 -1
- package/scss/components/_index-with-carbon.scss +1 -0
- package/telemetry.yml +5 -8
@@ -21,7 +21,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
21
21
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
23
|
|
24
|
-
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "
|
24
|
+
var _excluded = ["children", "className", "label", "renderIcon", "title", "type", "showToolTip", "condition", "popOverClassName", "config"];
|
25
25
|
var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
26
26
|
var children = _ref.children,
|
27
27
|
className = _ref.className,
|
@@ -30,7 +30,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
30
30
|
title = _ref.title,
|
31
31
|
type = _ref.type,
|
32
32
|
showToolTip = _ref.showToolTip,
|
33
|
-
|
33
|
+
condition = _ref.condition,
|
34
34
|
popOverClassName = _ref.popOverClassName,
|
35
35
|
config = _ref.config,
|
36
36
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -53,17 +53,17 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
53
53
|
* rest['data-name'] holds the current field name
|
54
54
|
* popoverToOpen hold the next popover to be opened if required
|
55
55
|
*/
|
56
|
-
if (
|
56
|
+
if (condition) {
|
57
57
|
var currentField = rest['data-name'];
|
58
58
|
//if any condition is changed, state prop is triggered
|
59
|
-
if (
|
59
|
+
if (condition.popoverToOpen && currentField !== condition.popoverToOpen) {
|
60
60
|
// close the previous popover
|
61
61
|
setOpen(false);
|
62
|
-
} else if (currentField == 'valueField' && type == 'option' &&
|
62
|
+
} else if (currentField == 'valueField' && type == 'option' && condition.operator !== 'one-of') {
|
63
63
|
//close the current popover if the field is valueField and is a single select dropdown. For all other inputs ,popover need to be open on value changes.
|
64
64
|
setOpen(false);
|
65
65
|
}
|
66
|
-
if (
|
66
|
+
if (condition.popoverToOpen == currentField) {
|
67
67
|
//current popover need to be opened
|
68
68
|
setOpen(true);
|
69
69
|
}
|
@@ -73,7 +73,7 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
73
73
|
setOpen(false);
|
74
74
|
}
|
75
75
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
76
|
-
}, [
|
76
|
+
}, [condition, label]);
|
77
77
|
React.useEffect(function () {
|
78
78
|
//this will focus the first input field in the popover
|
79
79
|
if (open && contentRef.current) {
|
@@ -121,6 +121,10 @@ ConditionBuilderItem.propTypes = {
|
|
121
121
|
* Provide an optional class to be applied to the containing node.
|
122
122
|
*/
|
123
123
|
className: index["default"].string,
|
124
|
+
/**
|
125
|
+
* current condition state object
|
126
|
+
*/
|
127
|
+
condition: index["default"].object,
|
124
128
|
/**
|
125
129
|
* this is the config object again the current property from inputConfig
|
126
130
|
*/
|
@@ -142,10 +146,6 @@ ConditionBuilderItem.propTypes = {
|
|
142
146
|
* show tool tip
|
143
147
|
*/
|
144
148
|
showToolTip: index["default"].bool,
|
145
|
-
/**
|
146
|
-
* current condition state object
|
147
|
-
*/
|
148
|
-
state: index["default"].object,
|
149
149
|
/**
|
150
150
|
* title of the popover
|
151
151
|
*/
|
@@ -5,20 +5,22 @@ export default ConditionGroupBuilder;
|
|
5
5
|
* All the inner components of group are called from here.
|
6
6
|
* @returns
|
7
7
|
*/
|
8
|
-
declare function ConditionGroupBuilder({
|
9
|
-
|
8
|
+
declare function ConditionGroupBuilder({ group, aria, onRemove, onChange, conditionBuilderRef, className, }: {
|
9
|
+
group: any;
|
10
10
|
aria: any;
|
11
11
|
onRemove: any;
|
12
12
|
onChange: any;
|
13
13
|
conditionBuilderRef: any;
|
14
|
+
className: any;
|
14
15
|
}): import("react/jsx-runtime").JSX.Element;
|
15
16
|
declare namespace ConditionGroupBuilder {
|
16
17
|
namespace propTypes {
|
17
18
|
let aria: PropTypes.Requireable<object>;
|
19
|
+
let className: PropTypes.Requireable<string>;
|
18
20
|
let conditionBuilderRef: PropTypes.Requireable<object>;
|
21
|
+
let group: PropTypes.Requireable<object>;
|
19
22
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
20
23
|
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
21
|
-
let state: PropTypes.Requireable<object>;
|
22
24
|
}
|
23
25
|
}
|
24
26
|
import PropTypes from 'prop-types';
|
@@ -14,6 +14,7 @@ var React = require('react');
|
|
14
14
|
var ConditionBlock = require('../ConditionBlock/ConditionBlock.js');
|
15
15
|
var index = require('../../../node_modules/prop-types/index.js');
|
16
16
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
17
|
+
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
17
18
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
20
|
|
@@ -26,17 +27,18 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
27
|
* @returns
|
27
28
|
*/
|
28
29
|
var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
29
|
-
var
|
30
|
-
var
|
30
|
+
var _group$conditions;
|
31
|
+
var group = _ref.group,
|
31
32
|
aria = _ref.aria,
|
32
33
|
onRemove = _ref.onRemove,
|
33
34
|
onChange = _ref.onChange,
|
34
|
-
conditionBuilderRef = _ref.conditionBuilderRef
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
conditionBuilderRef = _ref.conditionBuilderRef,
|
36
|
+
className = _ref.className;
|
37
|
+
var onRemoveHandler = function onRemoveHandler(conditionId, e) {
|
38
|
+
if (group.conditions.length > 1) {
|
39
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
40
|
+
conditions: group.conditions.filter(function (condition) {
|
41
|
+
return conditionId !== condition.id;
|
40
42
|
})
|
41
43
|
}));
|
42
44
|
handleFocusOnClose(e);
|
@@ -44,23 +46,27 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
44
46
|
onRemove();
|
45
47
|
}
|
46
48
|
};
|
47
|
-
var onChangeHandler = function onChangeHandler(
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
})
|
49
|
+
var onChangeHandler = function onChangeHandler(updatedCondition, conditionIndex) {
|
50
|
+
var updatedConditions = [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex)), [updatedCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)));
|
51
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
52
|
+
conditions: updatedConditions
|
52
53
|
}));
|
53
54
|
};
|
54
55
|
var addConditionHandler = function addConditionHandler(conditionIndex) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
var newCondition = {
|
57
|
+
property: undefined,
|
58
|
+
operator: '',
|
59
|
+
value: '',
|
60
|
+
popoverToOpen: 'propertyField',
|
61
|
+
id: uuidv4["default"]()
|
62
|
+
};
|
63
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
64
|
+
conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [newCondition], _rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(conditionIndex + 1)))
|
62
65
|
}));
|
63
66
|
};
|
67
|
+
var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
|
68
|
+
return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
|
69
|
+
};
|
64
70
|
var handleFocusOnClose = function handleFocusOnClose(e) {
|
65
71
|
var _e$currentTarget;
|
66
72
|
var previousClose = (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.closest('[role="row"]')) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.previousSibling) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.querySelector('[data-name="closeCondition"]');
|
@@ -69,40 +75,39 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
69
75
|
}
|
70
76
|
};
|
71
77
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
72
|
-
className: "
|
78
|
+
className: "".concat(className, " eachGroup")
|
73
79
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
74
80
|
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
75
81
|
role: "grid",
|
76
82
|
"aria-label": DataConfigs.translateWithId('condition_builder_group')
|
77
|
-
},
|
83
|
+
}, group === null || group === void 0 || (_group$conditions = group.conditions) === null || _group$conditions === void 0 ? void 0 : _group$conditions.map(function (eachCondition, conditionIndex) {
|
78
84
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
79
|
-
key:
|
85
|
+
key: eachCondition.id
|
80
86
|
}, eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder, {
|
87
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder__group"),
|
81
88
|
aria: {
|
82
89
|
level: aria.level + 1,
|
83
90
|
posinset: conditionIndex + 1,
|
84
|
-
setsize:
|
91
|
+
setsize: group.conditions.length
|
85
92
|
},
|
86
|
-
|
87
|
-
onChange: function onChange(
|
88
|
-
onChangeHandler(
|
93
|
+
group: eachCondition,
|
94
|
+
onChange: function onChange(updatedCondition) {
|
95
|
+
onChangeHandler(updatedCondition, conditionIndex);
|
89
96
|
},
|
90
97
|
onRemove: function onRemove(e) {
|
91
|
-
onRemoveHandler(
|
98
|
+
onRemoveHandler(eachCondition.id, e);
|
92
99
|
},
|
93
|
-
conditionBuilderRef: conditionBuilderRef
|
94
|
-
key: conditionIndex
|
100
|
+
conditionBuilderRef: conditionBuilderRef
|
95
101
|
}), !eachCondition.conditions && /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
|
96
|
-
|
97
|
-
conjunction: conditionIndex > 0 ? state.groupOperator : undefined,
|
102
|
+
conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
|
98
103
|
aria: {
|
99
104
|
level: aria.level + 1,
|
100
105
|
posinset: conditionIndex + 1,
|
101
|
-
setsize:
|
106
|
+
setsize: group.conditions.length
|
102
107
|
},
|
103
108
|
isStatement: conditionIndex == 0,
|
104
|
-
|
105
|
-
group:
|
109
|
+
condition: eachCondition,
|
110
|
+
group: group,
|
106
111
|
conditionIndex: conditionIndex,
|
107
112
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"),
|
108
113
|
onChange: function onChange(updatedConditions) {
|
@@ -110,18 +115,19 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
|
|
110
115
|
},
|
111
116
|
addConditionHandler: addConditionHandler,
|
112
117
|
onRemove: function onRemove(e) {
|
113
|
-
onRemoveHandler(
|
118
|
+
onRemoveHandler(eachCondition.id, e);
|
114
119
|
},
|
115
120
|
onConnectorOperatorChange: function onConnectorOperatorChange(op) {
|
116
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({},
|
121
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
117
122
|
groupOperator: op
|
118
123
|
}));
|
119
124
|
},
|
120
125
|
onStatementChange: function onStatementChange(updatedStatement) {
|
121
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({},
|
126
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
|
122
127
|
statement: updatedStatement
|
123
128
|
}));
|
124
|
-
}
|
129
|
+
},
|
130
|
+
isLastCondition: isLastCondition
|
125
131
|
}));
|
126
132
|
})));
|
127
133
|
};
|
@@ -131,10 +137,18 @@ ConditionGroupBuilder.propTypes = {
|
|
131
137
|
* object contains the aria attributes
|
132
138
|
*/
|
133
139
|
aria: index["default"].object,
|
140
|
+
/**
|
141
|
+
* Provide an class to be applied to the containing node.
|
142
|
+
*/
|
143
|
+
className: index["default"].string,
|
134
144
|
/**
|
135
145
|
* ref of condition builder
|
136
146
|
*/
|
137
147
|
conditionBuilderRef: index["default"].object,
|
148
|
+
/**
|
149
|
+
* group defines the current group
|
150
|
+
*/
|
151
|
+
group: index["default"].object,
|
138
152
|
/**
|
139
153
|
|
140
154
|
* callback to update the current condition of the state tree
|
@@ -143,11 +157,7 @@ ConditionGroupBuilder.propTypes = {
|
|
143
157
|
/**
|
144
158
|
* call back to remove the particular group from the state tree
|
145
159
|
*/
|
146
|
-
onRemove: index["default"].func
|
147
|
-
/**
|
148
|
-
* state defines the current group
|
149
|
-
*/
|
150
|
-
state: index["default"].object
|
160
|
+
onRemove: index["default"].func
|
151
161
|
};
|
152
162
|
|
153
163
|
exports["default"] = ConditionGroupBuilder$1;
|
@@ -23,6 +23,7 @@ var checkActiveHeaderCell = require('./utils/checkActiveHeaderCell.js');
|
|
23
23
|
var checkSelectedHeaderCell = require('./utils/checkSelectedHeaderCell.js');
|
24
24
|
var getSpreadsheetWidth = require('./utils/getSpreadsheetWidth.js');
|
25
25
|
var commonEventHandlers = require('./utils/commonEventHandlers.js');
|
26
|
+
var propsHelper = require('../../global/js/utils/props-helper.js');
|
26
27
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
27
28
|
var useSpreadsheetMouseUp = require('./hooks/useSpreadsheetMouseUp.js');
|
28
29
|
|
@@ -204,10 +205,6 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
204
205
|
}
|
205
206
|
}
|
206
207
|
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
|
207
|
-
//selectionAreas will be set when ever a selection area is made.
|
208
|
-
React.useEffect(function () {
|
209
|
-
removeDuplicateSelections();
|
210
|
-
}, [selectionAreas, removeDuplicateSelections]);
|
211
208
|
|
212
209
|
//this method will check for any duplicate selection area and remove.
|
213
210
|
//same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
|
@@ -246,6 +243,11 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
246
243
|
}
|
247
244
|
}, [ref, setSelectionAreas, setSelectionAreaData]);
|
248
245
|
|
246
|
+
//selectionAreas will be set when ever a selection area is made.
|
247
|
+
React.useEffect(function () {
|
248
|
+
removeDuplicateSelections();
|
249
|
+
}, [selectionAreas, removeDuplicateSelections]);
|
250
|
+
|
249
251
|
// onClick fn for each cell in the data spreadsheet body,
|
250
252
|
// adds the active cell highlight
|
251
253
|
|
@@ -308,9 +310,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
308
310
|
var row = rows[index];
|
309
311
|
if (rows && rows.length) {
|
310
312
|
prepareRow(row);
|
311
|
-
|
313
|
+
var rowProps = propsHelper.prepareProps(row.getRowProps({
|
312
314
|
style: style
|
313
|
-
}),
|
315
|
+
}), 'key');
|
316
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
317
|
+
key: _rollupPluginBabelHelpers.objectSpread2({}, row.getRowProps().key)
|
318
|
+
}, rowProps, {
|
314
319
|
className: cx__default["default"]("".concat(blockClass, "__tr")),
|
315
320
|
"data-row-index": index,
|
316
321
|
"aria-rowindex": index + 1,
|
@@ -331,10 +336,11 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
331
336
|
}
|
332
337
|
}, index + 1)), row.cells.map(function (cell, index) {
|
333
338
|
var _cell$column;
|
339
|
+
var cellProps = propsHelper.prepareProps(cell.getCellProps(), 'key');
|
334
340
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
335
341
|
key: "cell_".concat(index),
|
336
342
|
"aria-colindex": index + 1
|
337
|
-
},
|
343
|
+
}, cellProps, {
|
338
344
|
role: "gridcell",
|
339
345
|
style: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, cell.getCellProps().style), {}, {
|
340
346
|
display: 'grid',
|
@@ -21,6 +21,7 @@ var handleHeaderCellSelection = require('./utils/handleHeaderCellSelection.js');
|
|
21
21
|
var selectAllCells = require('./utils/selectAllCells.js');
|
22
22
|
var getSpreadsheetWidth = require('./utils/getSpreadsheetWidth.js');
|
23
23
|
var checkForHoldingKey = require('./utils/checkForHoldingKey.js');
|
24
|
+
var propsHelper = require('../../global/js/utils/props-helper.js');
|
24
25
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
25
26
|
var useSpreadsheetMouseMove = require('./hooks/useSpreadsheetMouseMove.js');
|
26
27
|
|
@@ -143,9 +144,10 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
143
144
|
className: cx__default["default"]("".concat(blockClass, "__header--container")),
|
144
145
|
role: "rowgroup"
|
145
146
|
}, headerGroups.map(function (headerGroup, index) {
|
147
|
+
var headerProps = propsHelper.prepareProps(headerGroup.getHeaderGroupProps(), 'key');
|
146
148
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
147
149
|
key: "header_".concat(index)
|
148
|
-
},
|
150
|
+
}, headerProps, {
|
149
151
|
style: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, headerGroup.getHeaderGroupProps().style), {}, {
|
150
152
|
width: getSpreadsheetWidth.getSpreadsheetWidth({
|
151
153
|
type: 'header',
|
@@ -175,12 +177,13 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
175
177
|
onClick: handleSelectAllClick,
|
176
178
|
className: cx__default["default"]("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
|
177
179
|
}, "\xA0")), headerGroup.headers.map(function (column, index) {
|
180
|
+
var colProps = propsHelper.prepareProps(column.getHeaderProps(), 'key');
|
178
181
|
var selectedHeader = checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'column', rows);
|
179
182
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
180
183
|
key: "column_".concat(index),
|
181
184
|
role: "columnheader",
|
182
185
|
className: "".concat(blockClass, "__columnheader")
|
183
|
-
},
|
186
|
+
}, colProps), /*#__PURE__*/React__default["default"].createElement("button", {
|
184
187
|
id: "".concat(blockClass, "__cell--header--").concat(index),
|
185
188
|
"data-row-index": "header",
|
186
189
|
"data-column-index": index,
|
@@ -19,12 +19,13 @@ var useMoveActiveCell = function useMoveActiveCell(_ref) {
|
|
19
19
|
createActiveCell = _ref.createActiveCell,
|
20
20
|
activeCellContent = _ref.activeCellContent,
|
21
21
|
isActiveHeaderCellChanged = _ref.isActiveHeaderCellChanged;
|
22
|
+
var performCreateActiveCell;
|
22
23
|
//new active cell is created when the activeCellContent changes or navigate through headers
|
23
24
|
// Otherwise new active cell will display the old value in a glance
|
24
25
|
React.useEffect(function () {
|
25
26
|
performCreateActiveCell();
|
26
27
|
}, [activeCellContent, performCreateActiveCell, isActiveHeaderCellChanged]);
|
27
|
-
|
28
|
+
performCreateActiveCell = React.useCallback(function () {
|
28
29
|
var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
|
29
30
|
var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
|
30
31
|
var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
|
@@ -1,5 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
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
|
+
import React, { ReactNode } from 'react';
|
8
|
+
interface EditTearsheetNarrowProps {
|
9
|
+
/**
|
10
|
+
* Provide the contents of the EditTearsheetNarrow.
|
11
|
+
*/
|
12
|
+
children: ReactNode;
|
13
|
+
/**
|
14
|
+
* Provide an optional class to be applied to the containing node.
|
15
|
+
*/
|
16
|
+
className?: string;
|
17
|
+
}
|
1
18
|
/**
|
2
19
|
* Use a narrow tearsheet as an alternative to a modal when there is scrolling. See usage guidance for further information.
|
3
20
|
*/
|
4
|
-
export let EditTearsheetNarrow: React.ForwardRefExoticComponent<React.RefAttributes<
|
5
|
-
|
21
|
+
export declare let EditTearsheetNarrow: React.ForwardRefExoticComponent<EditTearsheetNarrowProps & React.RefAttributes<HTMLDivElement>>;
|
22
|
+
export {};
|
@@ -5,6 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { PropsWithChildren } from 'react';
|
8
|
+
import PropTypes from 'prop-types';
|
8
9
|
type Scopes = string[] | object[];
|
9
10
|
interface SearchBarProps extends PropsWithChildren {
|
10
11
|
/** @type {string} Optional additional class name. */
|
@@ -22,7 +23,7 @@ interface SearchBarProps extends PropsWithChildren {
|
|
22
23
|
/** @type {Function} Function handler for when the user submits a search. */
|
23
24
|
onSubmit?: (event: any) => void;
|
24
25
|
/** @type {string} Placeholder text to be displayed in the search input. */
|
25
|
-
|
26
|
+
placeholderText: string;
|
26
27
|
/** @type {Function} Function to get the text for each scope to display in dropdown. */
|
27
28
|
scopeToString?: () => void;
|
28
29
|
/** @type {Array<any>} Array of allowed search scopes. */
|
@@ -50,4 +51,12 @@ interface SearchBarProps extends PropsWithChildren {
|
|
50
51
|
}
|
51
52
|
export declare let SearchBar: React.ForwardRefExoticComponent<SearchBarProps & React.RefAttributes<HTMLFormElement>>;
|
52
53
|
declare const conditionalScopePropValidator: (props: any, propName: any, componentName: any, ...rest: any[]) => Error | null;
|
54
|
+
export declare const deprecatedProps: {
|
55
|
+
/**
|
56
|
+
* **Deprecated**
|
57
|
+
*
|
58
|
+
* Provide accessible label text for the scopes MultiSelect.
|
59
|
+
*/
|
60
|
+
titleText: PropTypes.Requireable<string>;
|
61
|
+
};
|
53
62
|
export {};
|
@@ -22,7 +22,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
24
24
|
|
25
|
-
var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "
|
25
|
+
var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeholderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
|
26
26
|
|
27
27
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
28
28
|
var blockClass = "".concat(settings.pkg.prefix, "--search-bar");
|
@@ -48,7 +48,7 @@ exports.SearchBar = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
48
48
|
onChange = _ref$onChange === void 0 ? defaults.onChange : _ref$onChange,
|
49
49
|
_ref$onSubmit = _ref.onSubmit,
|
50
50
|
onSubmit = _ref$onSubmit === void 0 ? defaults.onSubmit : _ref$onSubmit,
|
51
|
-
|
51
|
+
placeholderText = _ref.placeholderText,
|
52
52
|
_ref$scopes = _ref.scopes,
|
53
53
|
scopes = _ref$scopes === void 0 ? [] : _ref$scopes,
|
54
54
|
scopesTypeLabel = _ref.scopesTypeLabel,
|
@@ -122,30 +122,32 @@ exports.SearchBar = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
122
122
|
setText(value);
|
123
123
|
onChange(eventObject);
|
124
124
|
};
|
125
|
+
var multiSelectProps = {
|
126
|
+
initialSelectedItems: selectedScopes,
|
127
|
+
items: scopes,
|
128
|
+
itemToString: scopeToString,
|
129
|
+
label: scopesTypeLabel,
|
130
|
+
sortItems: sortItems,
|
131
|
+
translateWithId: translateWithId
|
132
|
+
};
|
125
133
|
return /*#__PURE__*/React__default["default"].createElement("form", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
126
134
|
ref: ref
|
127
135
|
}, devtools.getDevtoolsProps(componentName), {
|
128
136
|
className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--hide-scopes-label"), hideScopesLabel)),
|
129
137
|
onSubmit: handleSubmit
|
130
|
-
}), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default["default"].createElement(react.MultiSelect, {
|
138
|
+
}), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default["default"].createElement(react.MultiSelect, _rollupPluginBabelHelpers["extends"]({}, multiSelectProps, {
|
131
139
|
id: "".concat(blockClass, "__multi-select"),
|
132
140
|
name: "search-scopes",
|
133
141
|
className: "".concat(blockClass, "__scopes"),
|
134
|
-
label: scopesTypeLabel,
|
135
142
|
onChange: handleSearchScopeChange,
|
136
|
-
initialSelectedItems: selectedScopes,
|
137
|
-
items: scopes,
|
138
|
-
itemToString: scopeToString,
|
139
|
-
translateWithId: translateWithId,
|
140
|
-
sortItems: sortItems,
|
141
143
|
size: "lg"
|
142
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
144
|
+
})) : null, /*#__PURE__*/React__default["default"].createElement(react.Search, {
|
143
145
|
className: "".concat(blockClass, "__input"),
|
144
146
|
closeButtonLabelText: clearButtonLabelText,
|
145
147
|
labelText: labelText || '',
|
146
148
|
name: "search-input",
|
147
149
|
onChange: handleInputChange,
|
148
|
-
placeholder:
|
150
|
+
placeholder: placeholderText,
|
149
151
|
value: text,
|
150
152
|
size: "lg"
|
151
153
|
}), /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
@@ -173,11 +175,19 @@ var conditionalScopePropValidator = function conditionalScopePropValidator(props
|
|
173
175
|
}
|
174
176
|
return index["default"].string.apply(index["default"], [props, propName, componentName].concat(rest));
|
175
177
|
};
|
178
|
+
var deprecatedProps = {
|
179
|
+
/**
|
180
|
+
* **Deprecated**
|
181
|
+
*
|
182
|
+
* Provide accessible label text for the scopes MultiSelect.
|
183
|
+
*/
|
184
|
+
titleText: index["default"].string
|
185
|
+
};
|
176
186
|
|
177
187
|
// The types and DocGen commentary for the component props,
|
178
188
|
// in alphabetical order (for consistency).
|
179
189
|
// See https://www.npmjs.com/package/prop-types#usage.
|
180
|
-
exports.SearchBar.propTypes = {
|
190
|
+
exports.SearchBar.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
181
191
|
/** @type {string} Optional additional class name. */
|
182
192
|
className: index["default"].string,
|
183
193
|
/** @type {string} The label text for the search text input. */
|
@@ -193,7 +203,7 @@ exports.SearchBar.propTypes = {
|
|
193
203
|
/** @type {Function} Function handler for when the user submits a search. */
|
194
204
|
onSubmit: index["default"].func,
|
195
205
|
/** @type {string} Placeholder text to be displayed in the search input. */
|
196
|
-
|
206
|
+
placeholderText: index["default"].string.isRequired,
|
197
207
|
/** @type {Function} Function to get the text for each scope to display in dropdown. */
|
198
208
|
scopeToString: index["default"].func,
|
199
209
|
/** @type {Array<any>} Array of allowed search scopes. */
|
@@ -215,14 +225,12 @@ exports.SearchBar.propTypes = {
|
|
215
225
|
|
216
226
|
/** @type {string} The label text for the search submit button. */
|
217
227
|
submitLabel: index["default"].string.isRequired,
|
218
|
-
/**
|
219
|
-
* Provide accessible label text for the scopes MultiSelect.
|
220
|
-
*/
|
221
|
-
titleText: index["default"].string,
|
222
228
|
/** @type {func} Callback function for translating MultiSelect's child ListBoxMenuIcon SVG title. */
|
223
229
|
translateWithId: index["default"].func,
|
224
230
|
// eslint-disable-line react/require-default-props
|
225
231
|
|
226
232
|
/** @type {string} Search query value. */
|
227
233
|
value: index["default"].string
|
228
|
-
};
|
234
|
+
}, deprecatedProps);
|
235
|
+
|
236
|
+
exports.deprecatedProps = deprecatedProps;
|
@@ -1,8 +1,92 @@
|
|
1
|
-
|
1
|
+
import React, { ReactNode, PropsWithChildren } from 'react';
|
2
|
+
import { TagBaseProps } from '@carbon/type';
|
3
|
+
type Align = 'start' | 'center' | 'end';
|
4
|
+
type OverflowAlign = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
|
5
|
+
type OverflowType = 'default' | 'tag';
|
6
|
+
type TagType = {
|
7
|
+
label: string;
|
8
|
+
type?: keyof typeof tagTypes;
|
9
|
+
} & TagBaseProps;
|
10
|
+
interface TagSetProps extends PropsWithChildren {
|
11
|
+
/**
|
12
|
+
* align the Tags displayed by the TagSet. Default start.
|
13
|
+
*/
|
14
|
+
align?: Align;
|
15
|
+
/**
|
16
|
+
* label text for the show all search. **Note: Required if more than 10 tags**
|
17
|
+
*/
|
18
|
+
allTagsModalSearchLabel?: string;
|
19
|
+
/**
|
20
|
+
* placeholder text for the show all search. **Note: Required if more than 10 tags**
|
21
|
+
*/
|
22
|
+
allTagsModalSearchPlaceholderText?: string;
|
23
|
+
/**
|
24
|
+
* portal target for the all tags modal
|
25
|
+
*/
|
26
|
+
allTagsModalTarget?: ReactNode;
|
27
|
+
/**
|
28
|
+
* title for the show all modal. **Note: Required if more than 10 tags**
|
29
|
+
*/
|
30
|
+
allTagsModalTitle?: string;
|
31
|
+
/**
|
32
|
+
* className
|
33
|
+
*/
|
34
|
+
className?: string;
|
35
|
+
/**
|
36
|
+
* Optional ref for custom resize container to measure available space
|
37
|
+
* Default will measure the available space of the TagSet container itself.
|
38
|
+
*/
|
39
|
+
containingElementRef?: React.RefObject<HTMLElement>;
|
40
|
+
/**
|
41
|
+
* maximum visible tags
|
42
|
+
*/
|
43
|
+
maxVisible?: number;
|
44
|
+
/**
|
45
|
+
* Specify offset amount for measure available space, only used when `containingElementSelector`
|
46
|
+
* is also provided
|
47
|
+
*/
|
48
|
+
measurementOffset?: number;
|
49
|
+
/**
|
50
|
+
* display tags in multiple lines
|
51
|
+
*/
|
52
|
+
multiline?: boolean;
|
53
|
+
/**
|
54
|
+
* Handler to get overflow tags
|
55
|
+
*/
|
56
|
+
onOverflowTagChange?: (value: ReactNode) => void;
|
57
|
+
/**
|
58
|
+
* overflowAlign from the standard tooltip. Default center.
|
59
|
+
*/
|
60
|
+
overflowAlign?: OverflowAlign;
|
61
|
+
/**
|
62
|
+
* overflowClassName for the tooltip popup
|
63
|
+
*/
|
64
|
+
overflowClassName?: string;
|
65
|
+
/**
|
66
|
+
* Type of rendering displayed inside of the tag overflow component
|
67
|
+
*/
|
68
|
+
overflowType?: OverflowType;
|
69
|
+
/**
|
70
|
+
* label for the overflow show all tags link.
|
71
|
+
*
|
72
|
+
* **Note:** Required if more than 10 tags
|
73
|
+
*/
|
74
|
+
showAllTagsLabel: string;
|
75
|
+
/**
|
76
|
+
* The tags to be shown in the TagSet. Each tag is specified as an object
|
77
|
+
* with properties: **label**\* (required) to supply the tag content, and
|
78
|
+
* other properties will be passed to the Carbon Tag component, such as
|
79
|
+
* **type**, **disabled**, **ref**, **className** , and any other Tag props.
|
80
|
+
*
|
81
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-tag--default
|
82
|
+
*/
|
83
|
+
tags?: TagType[];
|
84
|
+
}
|
85
|
+
export declare let TagSet: React.ForwardRefExoticComponent<TagSetProps & React.RefAttributes<HTMLDivElement>>;
|
2
86
|
/**
|
3
87
|
* The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
|
4
88
|
* @returns null if no problems
|
5
89
|
*/
|
6
|
-
export const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
|
90
|
+
export declare const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
|
91
|
+
declare const tagTypes: string[];
|
7
92
|
export default TagSet;
|
8
|
-
import React from 'react';
|