@carbon/ibm-products 1.23.1 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/components/Datagrid/styles/datagrid.css +83 -11
- package/css/components/Datagrid/styles/datagrid.css.map +1 -1
- package/css/components/Datagrid/styles/index.css +83 -15
- package/css/components/Datagrid/styles/index.css.map +1 -1
- package/css/components/Datagrid/styles/useExpandedRow.css +0 -3
- package/css/components/Datagrid/styles/useExpandedRow.css.map +1 -1
- package/css/index-full-carbon.css +235 -44
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -7
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +15 -28
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -7
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +235 -44
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -7
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +235 -44
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -7
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +1 -2
- package/es/components/AddSelect/AddSelectBody.js +5 -9
- package/es/components/AddSelect/AddSelectColumn.js +4 -1
- package/es/components/AddSelect/AddSelectList.js +1 -1
- package/es/components/AddSelect/AddSelectSidebar.js +4 -26
- package/es/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -2
- package/es/components/Datagrid/useExpandedRow.js +5 -12
- package/es/components/Datagrid/useOnRowClick.js +10 -3
- package/es/components/EditFullPage/EditFullPage.js +79 -0
- package/es/components/EditFullPage/index.js +7 -0
- package/es/components/EditTearsheet/EditTearsheet.js +205 -0
- package/es/components/EditTearsheet/EditTearsheetForm.js +103 -0
- package/es/components/EditTearsheet/index.js +8 -0
- package/es/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +230 -0
- package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +79 -0
- package/es/components/EditTearsheetNarrow/index.js +7 -0
- package/es/components/index.js +4 -1
- package/es/global/js/package-settings.js +4 -1
- package/lib/components/AddSelect/AddSelect.js +1 -2
- package/lib/components/AddSelect/AddSelectBody.js +5 -9
- package/lib/components/AddSelect/AddSelectColumn.js +3 -1
- package/lib/components/AddSelect/AddSelectList.js +1 -1
- package/lib/components/AddSelect/AddSelectSidebar.js +3 -26
- package/lib/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -1
- package/lib/components/Datagrid/useExpandedRow.js +5 -20
- package/lib/components/Datagrid/useOnRowClick.js +10 -3
- package/lib/components/EditFullPage/EditFullPage.js +85 -0
- package/lib/components/EditFullPage/index.js +13 -0
- package/lib/components/EditTearsheet/EditTearsheet.js +229 -0
- package/lib/components/EditTearsheet/EditTearsheetForm.js +122 -0
- package/lib/components/EditTearsheet/index.js +21 -0
- package/lib/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +254 -0
- package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +85 -0
- package/lib/components/EditTearsheetNarrow/index.js +13 -0
- package/lib/components/index.js +25 -1
- package/lib/global/js/package-settings.js +4 -1
- package/package.json +2 -2
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/Datagrid/_datagrid.scss +0 -1
- package/scss/components/Datagrid/_storybook-styles.scss +53 -0
- package/scss/components/Datagrid/styles/datagrid.scss +93 -12
- package/scss/components/Datagrid/styles/useExpandedRow.scss +0 -6
- package/scss/components/EditFullPage/_edit-full-page.scss +34 -0
- package/scss/components/EditFullPage/_index.scss +8 -0
- package/scss/components/EditFullPage/_storybook-styles.scss +10 -0
- package/scss/components/EditTearsheet/_edit-tearsheet.scss +132 -0
- package/scss/components/EditTearsheet/_index.scss +8 -0
- package/scss/components/EditTearsheet/_storybook-styles.scss +55 -0
- package/scss/components/EditTearsheetNarrow/_edit-tearsheet-narrow.scss +34 -0
- package/scss/components/EditTearsheetNarrow/_index.scss +8 -0
- package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +10 -0
- package/scss/components/InlineEdit/_inline-edit.scss +8 -20
- package/scss/components/NotificationsPanel/_notifications-panel.scss +1 -0
- package/scss/components/PageHeader/_page-header.scss +3 -1
- package/scss/components/StatusIcon/_status-icon.scss +1 -1
- package/scss/components/Tearsheet/_tearsheet.scss +2 -2
- package/scss/components/_index.scss +3 -0
@@ -0,0 +1,230 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
|
3
|
+
/* eslint-disable react/prop-types */
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2022, 2022
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
10
|
+
*/
|
11
|
+
import React, { useState } from 'react';
|
12
|
+
import { Button, Column, InlineNotification, RadioButtonGroup, RadioButton, Row, TextInput, Toggle, NumberInput } from 'carbon-components-react';
|
13
|
+
import cx from 'classnames';
|
14
|
+
import { pkg } from '../../../settings';
|
15
|
+
import { EditTearsheet } from '../EditTearsheet';
|
16
|
+
import { EditTearsheetForm } from '../EditTearsheetForm';
|
17
|
+
var blockClass = "".concat(pkg.prefix, "--tearsheet-edit-multi-form");
|
18
|
+
export var MultiFormEditTearsheet = function MultiFormEditTearsheet(_ref) {
|
19
|
+
var cancelButtonText = _ref.cancelButtonText,
|
20
|
+
className = _ref.className,
|
21
|
+
description = _ref.description,
|
22
|
+
influencerWidth = _ref.influencerWidth,
|
23
|
+
label = _ref.label,
|
24
|
+
submitButtonText = _ref.submitButtonText,
|
25
|
+
title = _ref.title;
|
26
|
+
|
27
|
+
var _useState = useState(false),
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
29
|
+
open = _useState2[0],
|
30
|
+
setOpen = _useState2[1];
|
31
|
+
|
32
|
+
var _useState3 = useState(false),
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
34
|
+
hasSubmitError = _useState4[0],
|
35
|
+
setHasSubmitError = _useState4[1];
|
36
|
+
|
37
|
+
var _useState5 = useState('Topic name here'),
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
39
|
+
formOneTextInputValue = _useState6[0],
|
40
|
+
setFormOneTextInputValue = _useState6[1];
|
41
|
+
|
42
|
+
var _useState7 = useState('Topic description here'),
|
43
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
44
|
+
topicDescriptionValue = _useState8[0],
|
45
|
+
setTopicDescriptionValue = _useState8[1];
|
46
|
+
|
47
|
+
var _useState9 = useState('Topic value here'),
|
48
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
49
|
+
topicVersionValue = _useState10[0],
|
50
|
+
setTopicVersionValue = _useState10[1];
|
51
|
+
|
52
|
+
var _useState11 = useState('Location here'),
|
53
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
54
|
+
topicLocationValue = _useState12[0],
|
55
|
+
setTopicLocationValue = _useState12[1];
|
56
|
+
|
57
|
+
var _useState13 = useState(1),
|
58
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
59
|
+
formTwoTextInputValue = _useState14[0],
|
60
|
+
setFormTwoTextInputValue = _useState14[1];
|
61
|
+
|
62
|
+
var _useState15 = useState('one-day'),
|
63
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
64
|
+
formThreeTextInputValue = _useState16[0],
|
65
|
+
setFormThreeTextInputValue = _useState16[1];
|
66
|
+
|
67
|
+
var _useState17 = useState(false),
|
68
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
69
|
+
isInvalid = _useState18[0],
|
70
|
+
setIsInvalid = _useState18[1];
|
71
|
+
|
72
|
+
var clearCreateData = function clearCreateData() {
|
73
|
+
setFormOneTextInputValue(formOneTextInputValue);
|
74
|
+
setTopicDescriptionValue(topicDescriptionValue);
|
75
|
+
setTopicVersionValue(topicVersionValue);
|
76
|
+
setTopicLocationValue(topicLocationValue);
|
77
|
+
setFormTwoTextInputValue(1);
|
78
|
+
setFormThreeTextInputValue('one-day');
|
79
|
+
setHasSubmitError(false);
|
80
|
+
setIsInvalid(false);
|
81
|
+
setOpen(false);
|
82
|
+
};
|
83
|
+
|
84
|
+
var handleModalClick = function handleModalClick() {
|
85
|
+
setOpen(!open);
|
86
|
+
};
|
87
|
+
|
88
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("style", null, ".".concat(blockClass, " { opacity: 0 }"), ";"), /*#__PURE__*/React.createElement(Button, {
|
89
|
+
onClick: handleModalClick
|
90
|
+
}, open ? 'Close EditTearsheet' : 'Open EditTearsheet'), /*#__PURE__*/React.createElement(EditTearsheet, {
|
91
|
+
influencerWidth: influencerWidth,
|
92
|
+
label: label,
|
93
|
+
className: cx(blockClass, className),
|
94
|
+
submitButtonText: submitButtonText,
|
95
|
+
cancelButtonText: cancelButtonText,
|
96
|
+
description: description,
|
97
|
+
title: title,
|
98
|
+
open: open,
|
99
|
+
onHandleModalClick: handleModalClick,
|
100
|
+
onClose: clearCreateData
|
101
|
+
}, /*#__PURE__*/React.createElement(EditTearsheetForm, {
|
102
|
+
title: "Topic name",
|
103
|
+
fieldsetLegendText: "Topic information",
|
104
|
+
subtitle: "This is the unique name used to recognize your topic",
|
105
|
+
description: "It will also be used by your producers and consumers as part of the connection information, so make it something easy to recognize."
|
106
|
+
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
107
|
+
xlg: 8,
|
108
|
+
lg: 8,
|
109
|
+
md: 8,
|
110
|
+
sm: 8
|
111
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
112
|
+
labelText: "Topic name",
|
113
|
+
placeholder: "Enter topic name",
|
114
|
+
id: "tearsheet-multi-form-story-text-input-multi-form-1",
|
115
|
+
value: formOneTextInputValue,
|
116
|
+
onChange: function onChange(event) {
|
117
|
+
if (event.target.value.length) {
|
118
|
+
setIsInvalid(false);
|
119
|
+
}
|
120
|
+
|
121
|
+
setFormOneTextInputValue(event.target.value);
|
122
|
+
},
|
123
|
+
invalid: isInvalid,
|
124
|
+
invalidText: "This is a required field",
|
125
|
+
onBlur: function onBlur() {
|
126
|
+
if (!formOneTextInputValue.length) {
|
127
|
+
setIsInvalid(true);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}), /*#__PURE__*/React.createElement(TextInput, {
|
131
|
+
labelText: "Topic description (optional)",
|
132
|
+
id: "tearsheet-multi-form-story-text-input-multi-form-1-input-2",
|
133
|
+
value: topicDescriptionValue,
|
134
|
+
placeholder: "Enter topic description",
|
135
|
+
onChange: function onChange(event) {
|
136
|
+
return setTopicDescriptionValue(event.target.value);
|
137
|
+
}
|
138
|
+
}), /*#__PURE__*/React.createElement(TextInput, {
|
139
|
+
labelText: "Topic version (optional)",
|
140
|
+
id: "tearsheet-multi-form-story-text-input-multi-form-1-input-3",
|
141
|
+
value: topicVersionValue,
|
142
|
+
placeholder: "Enter topic version",
|
143
|
+
onChange: function onChange(event) {
|
144
|
+
return setTopicVersionValue(event.target.value);
|
145
|
+
}
|
146
|
+
}), hasSubmitError && /*#__PURE__*/React.createElement(InlineNotification, {
|
147
|
+
kind: "error",
|
148
|
+
title: "Error",
|
149
|
+
subtitle: "Resolve errors to continue",
|
150
|
+
onClose: function onClose() {
|
151
|
+
return setHasSubmitError(!hasSubmitError);
|
152
|
+
}
|
153
|
+
}), /*#__PURE__*/React.createElement(Toggle, {
|
154
|
+
className: "".concat(blockClass, "__error--toggle"),
|
155
|
+
id: "simulated-error-toggle",
|
156
|
+
size: "sm",
|
157
|
+
labelText: "Simulate error",
|
158
|
+
onToggle: function onToggle() {
|
159
|
+
return setHasSubmitError(!hasSubmitError);
|
160
|
+
},
|
161
|
+
toggled: hasSubmitError
|
162
|
+
})))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
|
163
|
+
title: "Location",
|
164
|
+
subtitle: "Custom form subtitle",
|
165
|
+
fieldsetLegendText: "",
|
166
|
+
description: "Custom form description (see storybook implementation for new custom form capability)"
|
167
|
+
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
168
|
+
xlg: 8,
|
169
|
+
lg: 8,
|
170
|
+
md: 8,
|
171
|
+
sm: 8
|
172
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
173
|
+
value: topicLocationValue,
|
174
|
+
onChange: function onChange(event) {
|
175
|
+
return setTopicLocationValue(event.target.value);
|
176
|
+
},
|
177
|
+
id: "custom-form-input",
|
178
|
+
labelText: "Location",
|
179
|
+
placeholder: "Enter location"
|
180
|
+
})))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
|
181
|
+
title: "Partitions",
|
182
|
+
subtitle: "One or more partitions make up a topic. A partition is an ordered list of messages.",
|
183
|
+
description: "Partitions are distributed across the brokers in order to increase the scalability of your topic. You can also use them to distribute messages across the members of a consumer group.",
|
184
|
+
fieldsetLegendText: "Partition information"
|
185
|
+
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
186
|
+
xlg: 3,
|
187
|
+
lg: 3
|
188
|
+
}, /*#__PURE__*/React.createElement(NumberInput, {
|
189
|
+
id: "carbon-number",
|
190
|
+
min: 1,
|
191
|
+
max: 100,
|
192
|
+
value: formTwoTextInputValue,
|
193
|
+
label: "Partitions",
|
194
|
+
helperText: "1 partition is sufficient for getting started but, production systems often have more.",
|
195
|
+
invalidText: "Max partitions is 100, min is 1",
|
196
|
+
onChange: function onChange(event) {
|
197
|
+
return setFormTwoTextInputValue(event.imaginaryTarget.value);
|
198
|
+
}
|
199
|
+
})))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
|
200
|
+
title: "Message retention",
|
201
|
+
subtitle: "This is how long messages are retained before they are deleted.",
|
202
|
+
description: "If your messages are not read by a consumer within this time, they will be missed.",
|
203
|
+
fieldsetLegendText: "Message retention scheduling"
|
204
|
+
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
205
|
+
xlg: 8,
|
206
|
+
lg: 8,
|
207
|
+
md: 8,
|
208
|
+
sm: 8
|
209
|
+
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
210
|
+
legendText: "Message retention",
|
211
|
+
name: "radio-button-group",
|
212
|
+
defaultSelected: formThreeTextInputValue,
|
213
|
+
onChange: function onChange(value) {
|
214
|
+
return setFormThreeTextInputValue(value);
|
215
|
+
},
|
216
|
+
orientation: "vertical"
|
217
|
+
}, /*#__PURE__*/React.createElement(RadioButton, {
|
218
|
+
labelText: "A day",
|
219
|
+
value: "one-day",
|
220
|
+
id: "one-day"
|
221
|
+
}), /*#__PURE__*/React.createElement(RadioButton, {
|
222
|
+
labelText: "A week",
|
223
|
+
value: "one-week",
|
224
|
+
id: "one-week"
|
225
|
+
}), /*#__PURE__*/React.createElement(RadioButton, {
|
226
|
+
labelText: "A month",
|
227
|
+
value: "one-month",
|
228
|
+
id: "one-month"
|
229
|
+
})))))));
|
230
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "className"];
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2022, 2022
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
10
|
+
*/
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react'; // Other standard imports.
|
13
|
+
|
14
|
+
import PropTypes from 'prop-types';
|
15
|
+
import cx from 'classnames';
|
16
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
17
|
+
import { pkg
|
18
|
+
/*, carbon */
|
19
|
+
} from '../../settings'; // Carbon and package components we use.
|
20
|
+
|
21
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
22
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
|
+
|
24
|
+
var blockClass = "".concat(pkg.prefix, "--edit-tearsheet-narrow");
|
25
|
+
var componentName = 'EditTearsheetNarrow'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
26
|
+
// Default values can be included here and then assigned to the prop params,
|
27
|
+
// e.g. prop = defaults.prop,
|
28
|
+
// This gathers default values together neatly and ensures non-primitive
|
29
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
30
|
+
// Note that default values are not required for props that are 'required',
|
31
|
+
// nor for props where the component can apply undefined values reasonably.
|
32
|
+
// Default values should be provided when the component needs to make a choice
|
33
|
+
// or assumption when a prop is not supplied.
|
34
|
+
// Default values for props
|
35
|
+
// const defaults = {
|
36
|
+
// /* TODO: add defaults for relevant props if needed */
|
37
|
+
// };
|
38
|
+
|
39
|
+
/**
|
40
|
+
* TODO: A description of the component.
|
41
|
+
*/
|
42
|
+
|
43
|
+
export var EditTearsheetNarrow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
44
|
+
var children = _ref.children,
|
45
|
+
className = _ref.className,
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
47
|
+
|
48
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
49
|
+
className: cx(blockClass, // Apply the block class to the main HTML element
|
50
|
+
className, // Apply any supplied class names to the main HTML element.
|
51
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
52
|
+
{// switched classes dependant on props or state
|
53
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
54
|
+
}),
|
55
|
+
ref: ref,
|
56
|
+
role: "main"
|
57
|
+
}, getDevtoolsProps(componentName)), children);
|
58
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
59
|
+
|
60
|
+
EditTearsheetNarrow = pkg.checkComponentEnabled(EditTearsheetNarrow, componentName); // The display name of the component, used by React. Note that displayName
|
61
|
+
// is used in preference to relying on function.name.
|
62
|
+
|
63
|
+
EditTearsheetNarrow.displayName = componentName; // The types and DocGen commentary for the component props,
|
64
|
+
// in alphabetical order (for consistency).
|
65
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
66
|
+
|
67
|
+
EditTearsheetNarrow.propTypes = {
|
68
|
+
/**
|
69
|
+
* Provide the contents of the EditTearsheetNarrow.
|
70
|
+
*/
|
71
|
+
children: PropTypes.node.isRequired,
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Provide an optional class to be applied to the containing node.
|
75
|
+
*/
|
76
|
+
className: PropTypes.string
|
77
|
+
/* TODO: add types and DocGen for all props. */
|
78
|
+
|
79
|
+
};
|
package/es/components/index.js
CHANGED
@@ -37,4 +37,7 @@ export { EditSidePanel } from './EditSidePanel';
|
|
37
37
|
export { OptionsTile } from './OptionsTile';
|
38
38
|
export { InlineEdit } from './InlineEdit';
|
39
39
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
40
|
-
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle } from './Datagrid';
|
40
|
+
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle } from './Datagrid';
|
41
|
+
export { EditTearsheet } from './EditTearsheet';
|
42
|
+
export { EditTearsheetNarrow } from './EditTearsheetNarrow';
|
43
|
+
export { EditFullPage } from './EditFullPage';
|
@@ -65,7 +65,10 @@ var defaults = {
|
|
65
65
|
EditSidePanel: false,
|
66
66
|
CancelableTextEdit: false,
|
67
67
|
DataSpreadsheet: false,
|
68
|
-
Datagrid: false
|
68
|
+
Datagrid: false,
|
69
|
+
EditTearsheet: false,
|
70
|
+
EditTearsheetNarrow: false,
|
71
|
+
EditFullPage: false
|
69
72
|
/* new component flags here - comment used by generate CLI */
|
70
73
|
|
71
74
|
},
|
@@ -47,7 +47,7 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
47
47
|
return (0, _defineProperty2.default)({
|
48
48
|
id: item.id
|
49
49
|
}, modifierAttribute, item[modifierAttribute]);
|
50
|
-
}) :
|
50
|
+
}) : [];
|
51
51
|
return /*#__PURE__*/_react.default.createElement(_AddSelectBody.AddSelectBody, (0, _extends2.default)({}, props, {
|
52
52
|
className: blockClass,
|
53
53
|
ref: ref,
|
@@ -123,7 +123,6 @@ AddSelect.propTypes = {
|
|
123
123
|
* portal target for the all tags modal
|
124
124
|
*/
|
125
125
|
portalTarget: _propTypes.default.node,
|
126
|
-
removeIconDescription: _propTypes.default.string,
|
127
126
|
searchResultsLabel: _propTypes.default.string,
|
128
127
|
title: _propTypes.default.string.isRequired
|
129
128
|
};
|
@@ -51,7 +51,7 @@ var _usePath2 = _interopRequireDefault(require("./hooks/usePath"));
|
|
51
51
|
|
52
52
|
var _settings = require("../../settings");
|
53
53
|
|
54
|
-
var _excluded = ["className", "clearFiltersText", "closeIconDescription", "columnInputPlaceholder", "defaultModifiers", "description", "globalFilterOpts", "globalFiltersIconDescription", "globalFiltersPlaceholderText", "globalFiltersPrimaryButtonText", "globalFiltersSecondaryButtonText", "globalSearchLabel", "globalSearchPlaceholder", "globalSortBy", "influencerTitle", "items", "itemsLabel", "metaIconDescription", "metaPanelTitle", "multi", "navIconDescription", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "normalizedItems", "onClose", "onCloseButtonText", "onSubmit", "onSubmitButtonText", "open", "portalTarget", "
|
54
|
+
var _excluded = ["className", "clearFiltersText", "closeIconDescription", "columnInputPlaceholder", "defaultModifiers", "description", "globalFilterOpts", "globalFiltersIconDescription", "globalFiltersPlaceholderText", "globalFiltersPrimaryButtonText", "globalFiltersSecondaryButtonText", "globalSearchLabel", "globalSearchPlaceholder", "globalSortBy", "influencerTitle", "items", "itemsLabel", "metaIconDescription", "metaPanelTitle", "multi", "navIconDescription", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "normalizedItems", "onClose", "onCloseButtonText", "onSubmit", "onSubmitButtonText", "open", "portalTarget", "searchResultsLabel", "title", "useNormalizedItems"];
|
55
55
|
|
56
56
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
57
57
|
|
@@ -95,7 +95,6 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
95
95
|
onSubmitButtonText = _ref.onSubmitButtonText,
|
96
96
|
open = _ref.open,
|
97
97
|
portalTarget = _ref.portalTarget,
|
98
|
-
removeIconDescription = _ref.removeIconDescription,
|
99
98
|
searchResultsLabel = _ref.searchResultsLabel,
|
100
99
|
title = _ref.title,
|
101
100
|
useNormalizedItems = _ref.useNormalizedItems,
|
@@ -237,19 +236,17 @@ var AddSelectBody = function AddSelectBody(_ref) {
|
|
237
236
|
portalTarget: portalTarget
|
238
237
|
};
|
239
238
|
var sidebarProps = {
|
239
|
+
appliedModifiers: appliedModifiers,
|
240
240
|
closeIconDescription: closeIconDescription,
|
241
|
+
displayMetalPanel: displayMetalPanel,
|
241
242
|
influencerTitle: influencerTitle,
|
242
243
|
items: useNormalizedItems ? normalizedItems : items.entries,
|
243
244
|
metaPanelTitle: metaPanelTitle,
|
245
|
+
modifiers: items.modifiers,
|
244
246
|
multiSelection: multiSelection,
|
245
247
|
noSelectionDescription: noSelectionDescription,
|
246
248
|
noSelectionTitle: noSelectionTitle,
|
247
|
-
|
248
|
-
setMultiSelection: setMultiSelection,
|
249
|
-
displayMetalPanel: displayMetalPanel,
|
250
|
-
setDisplayMetaPanel: setDisplayMetaPanel,
|
251
|
-
modifiers: items.modifiers,
|
252
|
-
appliedModifiers: appliedModifiers
|
249
|
+
setDisplayMetaPanel: setDisplayMetaPanel
|
253
250
|
};
|
254
251
|
var displayColumnView = multi && useNormalizedItems && !searchTerm && !globalFiltersApplied; // main content
|
255
252
|
|
@@ -376,7 +373,6 @@ AddSelectBody.propTypes = {
|
|
376
373
|
onSubmitButtonText: _propTypes.default.string,
|
377
374
|
open: _propTypes.default.bool,
|
378
375
|
portalTarget: _propTypes.default.node,
|
379
|
-
removeIconDescription: _propTypes.default.string,
|
380
376
|
searchResultsLabel: _propTypes.default.string,
|
381
377
|
title: _propTypes.default.string,
|
382
378
|
useNormalizedItems: _propTypes.default.bool
|
@@ -132,7 +132,8 @@ var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
132
132
|
});
|
133
133
|
|
134
134
|
if (checked) {
|
135
|
-
|
135
|
+
var newSelections = (0, _toConsumableArray2.default)(new Set([].concat((0, _toConsumableArray2.default)(multiSelection), (0, _toConsumableArray2.default)(itemIds))));
|
136
|
+
setMultiSelection(newSelections);
|
136
137
|
} else {
|
137
138
|
var newItems = multiSelection.filter(function (i) {
|
138
139
|
return !itemIds.includes(i);
|
@@ -228,6 +229,7 @@ var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
228
229
|
className: "".concat(blockClass, "__tag-container")
|
229
230
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
230
231
|
id: "".concat((0, _uuidv.default)(), "-select-all"),
|
232
|
+
className: "".concat(colClass, "__select-all"),
|
231
233
|
checked: allSelected,
|
232
234
|
onChange: selectAllHandler,
|
233
235
|
labelText: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
@@ -146,7 +146,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
146
146
|
}, item.title), item.subtitle && /*#__PURE__*/_react.default.createElement("span", {
|
147
147
|
className: "".concat(blockClass, "-cell-subtitle")
|
148
148
|
}, item.subtitle)))), hasModifiers && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Dropdown, {
|
149
|
-
id: "".concat(item.id
|
149
|
+
id: "add-select-modifier-".concat(item.id),
|
150
150
|
type: "inline",
|
151
151
|
items: modifiers.options,
|
152
152
|
light: true,
|
@@ -13,8 +13,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
14
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
15
15
|
|
16
|
-
var _iconsReact = require("@carbon/icons-react");
|
17
|
-
|
18
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
19
17
|
|
20
18
|
var _NoDataEmptyState = require("../../components/EmptyStates/NoDataEmptyState");
|
@@ -40,19 +38,10 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
40
38
|
multiSelection = _ref.multiSelection,
|
41
39
|
noSelectionDescription = _ref.noSelectionDescription,
|
42
40
|
noSelectionTitle = _ref.noSelectionTitle,
|
43
|
-
|
44
|
-
setDisplayMetaPanel = _ref.setDisplayMetaPanel,
|
45
|
-
setMultiSelection = _ref.setMultiSelection;
|
41
|
+
setDisplayMetaPanel = _ref.setDisplayMetaPanel;
|
46
42
|
var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
|
47
43
|
var hasSelections = multiSelection.length > 0;
|
48
44
|
|
49
|
-
var handleItemRemove = function handleItemRemove(id) {
|
50
|
-
var newSelections = multiSelection.filter(function (v) {
|
51
|
-
return v !== id;
|
52
|
-
});
|
53
|
-
setMultiSelection(newSelections);
|
54
|
-
};
|
55
|
-
|
56
45
|
var getNewItem = function getNewItem(item) {
|
57
46
|
// certain properties should not be displayed in the sidebar
|
58
47
|
// eslint-disable-next-line no-unused-vars
|
@@ -85,17 +74,7 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
85
74
|
className: "".concat(blockClass, "-selected-item-subtitle")
|
86
75
|
}, item.subtitle)), hasModifiers && /*#__PURE__*/_react.default.createElement("div", null, appliedModifiers.find(function (modifier) {
|
87
76
|
return modifier.id === item.id;
|
88
|
-
})[modifiers.id])
|
89
|
-
renderIcon: _iconsReact.SubtractAlt32,
|
90
|
-
iconDescription: removeIconDescription,
|
91
|
-
hasIconOnly: true,
|
92
|
-
onClick: function onClick() {
|
93
|
-
return handleItemRemove(item.id);
|
94
|
-
},
|
95
|
-
kind: "ghost",
|
96
|
-
className: "".concat(blockClass, "-item-remove-button"),
|
97
|
-
size: "sm"
|
98
|
-
}));
|
77
|
+
})[modifiers.id]));
|
99
78
|
};
|
100
79
|
|
101
80
|
if (Object.keys(displayMetalPanel).length !== 0) {
|
@@ -153,8 +132,6 @@ AddSelectSidebar.propTypes = {
|
|
153
132
|
multiSelection: _propTypes.default.array,
|
154
133
|
noSelectionDescription: _propTypes.default.string,
|
155
134
|
noSelectionTitle: _propTypes.default.string,
|
156
|
-
|
157
|
-
setDisplayMetaPanel: _propTypes.default.func,
|
158
|
-
setMultiSelection: _propTypes.default.func
|
135
|
+
setDisplayMetaPanel: _propTypes.default.func
|
159
136
|
};
|
160
137
|
AddSelectSidebar.displayName = componentName;
|
@@ -63,16 +63,25 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
63
63
|
_datagridState$vertic = datagridState.verticalAlign,
|
64
64
|
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
65
65
|
variableRowHeight = datagridState.variableRowHeight,
|
66
|
-
className = datagridState.className
|
66
|
+
className = datagridState.className,
|
67
|
+
gridTitle = datagridState.gridTitle,
|
68
|
+
gridDescription = datagridState.gridDescription,
|
69
|
+
useDenseHeader = datagridState.useDenseHeader;
|
67
70
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
68
71
|
|
69
72
|
var dataGrid = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
70
|
-
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
|
71
|
-
|
72
|
-
|
73
|
+
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : ''),
|
74
|
+
title: gridTitle,
|
75
|
+
description: gridDescription
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
77
|
+
className: "".concat(blockClass, "__table-container")
|
78
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
|
79
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
80
|
+
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
81
|
+
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
73
82
|
}), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
74
83
|
rows: rows
|
75
|
-
})))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
84
|
+
}))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
76
85
|
instance: datagridState
|
77
86
|
}));
|
78
87
|
|
@@ -80,13 +89,9 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
80
89
|
id: tableId,
|
81
90
|
ref: ref,
|
82
91
|
className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
|
83
|
-
}, (0, _devtools.getDevtoolsProps)(componentName)),
|
84
|
-
className: "".concat(blockClass, "
|
85
|
-
}, leftPanel
|
86
|
-
className: "".concat(blockClass, "__datagridLeftPanel")
|
87
|
-
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement("div", {
|
88
|
-
className: "".concat(blockClass, "__datagridWithPanel")
|
89
|
-
}, dataGrid)), leftPanel === undefined && dataGrid);
|
92
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), leftPanel && /*#__PURE__*/_react.default.createElement("div", {
|
93
|
+
className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
|
94
|
+
}, dataGrid), leftPanel === undefined && dataGrid);
|
90
95
|
}); // Return a placeholder if not released and not enabled by feature flag
|
91
96
|
|
92
97
|
|
@@ -29,9 +29,11 @@ var TableRow = _carbonComponentsReact.DataTable.TableRow,
|
|
29
29
|
TableCell = _carbonComponentsReact.DataTable.TableCell; // eslint-disable-next-line react/prop-types
|
30
30
|
|
31
31
|
var DatagridRow = function DatagridRow(datagridState) {
|
32
|
+
var _cx;
|
33
|
+
|
32
34
|
var row = datagridState.row;
|
33
35
|
return /*#__PURE__*/_react.default.createElement(TableRow, (0, _extends2.default)({
|
34
|
-
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (0, _defineProperty2.default)(
|
36
|
+
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), (0, _defineProperty2.default)(_cx, "".concat(_settings.carbon.prefix, "--data-table--selected"), row.isSelected), _cx))
|
35
37
|
}, row.getRowProps(), {
|
36
38
|
key: row.id,
|
37
39
|
onMouseEnter: function onMouseEnter(event) {
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
@@ -13,37 +11,23 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
13
11
|
|
14
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
15
13
|
|
16
|
-
var _react =
|
14
|
+
var _react = require("react");
|
17
15
|
|
18
16
|
var _DatagridExpandedRow = _interopRequireDefault(require("./Datagrid/DatagridExpandedRow"));
|
19
17
|
|
20
18
|
var _useRowExpander = _interopRequireDefault(require("./useRowExpander"));
|
21
19
|
|
22
|
-
var _settings = require("../../settings");
|
23
|
-
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
-
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
|
-
|
28
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
29
21
|
|
30
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
31
23
|
|
32
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
33
|
-
|
34
|
-
var expansionRenderer = function expansionRenderer(_ref) {
|
35
|
-
var row = _ref.row;
|
36
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
37
|
-
className: "".concat(blockClass, "__expanded-row-content")
|
38
|
-
}, "Content for ", row.id);
|
39
|
-
};
|
40
|
-
|
41
24
|
var useExpandedRow = function useExpandedRow(hooks) {
|
42
25
|
(0, _useRowExpander.default)(hooks);
|
43
26
|
|
44
27
|
var useInstance = function useInstance(instance) {
|
45
28
|
var rows = instance.rows,
|
46
|
-
expandedContentHeight = instance.expandedContentHeight
|
29
|
+
expandedContentHeight = instance.expandedContentHeight,
|
30
|
+
ExpandedRowContentComponent = instance.ExpandedRowContentComponent;
|
47
31
|
|
48
32
|
var _useState = (0, _react.useState)({}),
|
49
33
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
@@ -58,7 +42,8 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
58
42
|
return _objectSpread(_objectSpread({}, row), {}, {
|
59
43
|
canExpand: row.original && !row.original.notExpandable,
|
60
44
|
expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
|
61
|
-
RowRenderer: (
|
45
|
+
// RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer),
|
46
|
+
RowRenderer: (0, _DatagridExpandedRow.default)(row.RowRenderer, ExpandedRowContentComponent)
|
62
47
|
});
|
63
48
|
});
|
64
49
|
Object.assign(instance, {
|
@@ -13,16 +13,23 @@ exports.default = void 0;
|
|
13
13
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
14
14
|
*/
|
15
15
|
var useOnRowClick = function useOnRowClick(hooks) {
|
16
|
-
var useInstance = function useInstance(
|
17
|
-
var onRowClick =
|
16
|
+
var useInstance = function useInstance(rowInstance) {
|
17
|
+
var onRowClick = rowInstance.onRowClick;
|
18
18
|
|
19
19
|
var getRowProps = function getRowProps(props, datagridState) {
|
20
20
|
var isFetching = datagridState.isFetching,
|
21
|
-
row = datagridState.row
|
21
|
+
row = datagridState.row,
|
22
|
+
instance = datagridState.instance;
|
23
|
+
var id = row.id,
|
24
|
+
toggleRowSelected = row.toggleRowSelected;
|
22
25
|
|
23
26
|
var onClick = function onClick() {
|
24
27
|
if (!isFetching && onRowClick) {
|
25
28
|
onRowClick(row);
|
29
|
+
instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
|
30
|
+
return toggleRow.toggleRowSelected(false);
|
31
|
+
});
|
32
|
+
toggleRowSelected(id, true);
|
26
33
|
}
|
27
34
|
};
|
28
35
|
|