@carbon/ibm-products 2.41.1-canary.5 → 2.41.1-canary.9
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +6 -0
- 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 +6 -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-without-carbon.css +6 -0
- 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 +6 -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/Datagrid/Datagrid/DatagridContent.js +21 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +12 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts +3 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +5 -5
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +7 -0
- package/es/components/Datagrid/useCustomizeColumns.js +0 -4
- package/es/components/Datagrid/useEditableCell.js +1 -1
- package/es/components/Datagrid/useInlineEdit.d.ts +1 -1
- package/es/components/Datagrid/useInlineEdit.js +9 -16
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/es/components/FeatureFlags/index.d.ts +37 -0
- package/es/components/FeatureFlags/index.js +151 -0
- package/es/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/es/components/ProductiveCard/ProductiveCard.js +9 -9
- package/es/components/index.d.ts +1 -0
- package/es/feature-flags.d.ts +1 -0
- package/es/global/js/hooks/usePortalTarget.js +4 -2
- package/es/index.js +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +49 -29
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +13 -19
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts +3 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +5 -5
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +7 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +0 -4
- package/lib/components/Datagrid/useEditableCell.js +1 -1
- package/lib/components/Datagrid/useInlineEdit.d.ts +1 -1
- package/lib/components/Datagrid/useInlineEdit.js +8 -15
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
- package/lib/components/FeatureFlags/index.d.ts +37 -0
- package/lib/components/FeatureFlags/index.js +162 -0
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +115 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +9 -9
- package/lib/components/index.d.ts +1 -0
- package/lib/feature-flags.d.ts +1 -0
- package/lib/global/js/hooks/usePortalTarget.js +4 -2
- package/lib/index.js +4 -0
- package/package.json +7 -3
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +6 -0
@@ -9,8 +9,10 @@ import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPlugin
|
|
9
9
|
import { useState, useEffect, useCallback } from 'react';
|
10
10
|
import { pkg } from '../../../settings.js';
|
11
11
|
import { createPortal } from 'react-dom';
|
12
|
+
import { useFeatureFlag } from '../../../components/FeatureFlags/index.js';
|
12
13
|
|
13
14
|
var usePortalTarget = function usePortalTarget(portalTargetIn) {
|
15
|
+
var enablePortalTarget = useFeatureFlag('default-portal-target-body');
|
14
16
|
var _useState = useState(null),
|
15
17
|
_useState2 = _slicedToArray(_useState, 2),
|
16
18
|
portalTarget = _useState2[0],
|
@@ -19,11 +21,11 @@ var usePortalTarget = function usePortalTarget(portalTargetIn) {
|
|
19
21
|
if (portalTargetIn) {
|
20
22
|
setPortalTarget(portalTargetIn);
|
21
23
|
} else {
|
22
|
-
if (pkg.isFeatureEnabled('default-portal-target-body')) {
|
24
|
+
if (pkg.isFeatureEnabled('default-portal-target-body') || enablePortalTarget) {
|
23
25
|
setPortalTarget(document.body);
|
24
26
|
}
|
25
27
|
}
|
26
|
-
}, [portalTargetIn]);
|
28
|
+
}, [portalTargetIn, enablePortalTarget]);
|
27
29
|
var renderPortalUse = useCallback(function (children) {
|
28
30
|
return portalTarget ? /*#__PURE__*/createPortal(children, portalTarget) : children;
|
29
31
|
}, [portalTarget]);
|
package/es/index.js
CHANGED
@@ -133,3 +133,4 @@ export { FilterPanelLabel } from './components/FilterPanel/FilterPanelLabel/Filt
|
|
133
133
|
export { FilterPanelSearch } from './components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js';
|
134
134
|
export { ConditionBuilder } from './components/ConditionBuilder/ConditionBuilder.js';
|
135
135
|
export { GetStartedCard } from './components/GetStartedCard/GetStartedCard.js';
|
136
|
+
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
@@ -17,12 +17,13 @@ var constants = require('./addons/Filtering/constants.js');
|
|
17
17
|
var DatagridBody = require('./DatagridBody.js');
|
18
18
|
var DatagridHead = require('./DatagridHead.js');
|
19
19
|
var DatagridToolbar = require('./DatagridToolbar.js');
|
20
|
-
var index = require('../../../node_modules/prop-types/index.js');
|
20
|
+
var index$1 = require('../../../node_modules/prop-types/index.js');
|
21
21
|
var cx = require('classnames');
|
22
22
|
var handleGridFocus = require('./addons/InlineEdit/handleGridFocus.js');
|
23
23
|
var handleGridKeyPress = require('./addons/InlineEdit/handleGridKeyPress.js');
|
24
24
|
var layout = require('@carbon/layout');
|
25
25
|
var FilterProvider = require('./addons/Filtering/FilterProvider.js');
|
26
|
+
var index = require('../../FeatureFlags/index.js');
|
26
27
|
var InlineEditContext = require('./addons/InlineEdit/InlineEditContext/InlineEditContext.js');
|
27
28
|
var useClickOutside = require('../../../global/js/hooks/useClickOutside.js');
|
28
29
|
var useMultipleKeyTracking = require('../../DataSpreadsheet/hooks/useMultipleKeyTracking.js');
|
@@ -50,7 +51,8 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
50
51
|
panelOpen = _useContext2.panelOpen;
|
51
52
|
var activeCellId = inlineEditState.activeCellId,
|
52
53
|
gridActive = inlineEditState.gridActive,
|
53
|
-
editId = inlineEditState.editId
|
54
|
+
editId = inlineEditState.editId,
|
55
|
+
featureFlags = inlineEditState.featureFlags;
|
54
56
|
var getTableProps = datagridState.getTableProps,
|
55
57
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
56
58
|
withVirtualScroll = datagridState.withVirtualScroll,
|
@@ -78,6 +80,24 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
78
80
|
var contentRows = DatagridPagination && page || rows;
|
79
81
|
var gridAreaRef = React.useRef();
|
80
82
|
var multiKeyTrackingRef = React.useRef();
|
83
|
+
var enableEditableCell = index.useFeatureFlag('enable-datagrid-useEditableCell');
|
84
|
+
var enableInlineEdit = index.useFeatureFlag('enable-datagrid-useInlineEdit');
|
85
|
+
var enableCustomizeCols = index.useFeatureFlag('enable-datagrid-useCustomizeColumns');
|
86
|
+
React.useEffect(function () {
|
87
|
+
dispatch({
|
88
|
+
type: 'SET_FEATURE_FLAGS',
|
89
|
+
payload: {
|
90
|
+
'enable-datagrid-useEditableCell': enableEditableCell,
|
91
|
+
'enable-datagrid-useInlineEdit': enableInlineEdit,
|
92
|
+
'enable-datagrid-useCustomizeColumns': enableCustomizeCols
|
93
|
+
}
|
94
|
+
});
|
95
|
+
}, [dispatch, enableEditableCell, enableCustomizeCols, enableInlineEdit]);
|
96
|
+
React.useEffect(function () {
|
97
|
+
if (featureFlags && (featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useEditableCell'] || featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useInlineEdit'])) {
|
98
|
+
console.error("Datagrid useEditableCell/useInlineEdit extension has not been enabled via feature flag.");
|
99
|
+
}
|
100
|
+
}, [featureFlags]);
|
81
101
|
useClickOutside.useClickOutside(gridAreaRef, function (target) {
|
82
102
|
if (!withInlineEdit) {
|
83
103
|
return;
|
@@ -184,34 +204,34 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
184
204
|
}));
|
185
205
|
};
|
186
206
|
DatagridContent.propTypes = {
|
187
|
-
ariaToolbarLabel: index["default"].string,
|
188
|
-
datagridState: index["default"].shape({
|
189
|
-
getTableProps: index["default"].func,
|
190
|
-
getFilterFlyoutProps: index["default"].func,
|
191
|
-
withVirtualScroll: index["default"].bool,
|
192
|
-
DatagridActions: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
193
|
-
DatagridPagination: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
194
|
-
CustomizeColumnsTearsheet: index["default"].oneOfType([index["default"].element, index["default"].func]),
|
195
|
-
isFetching: index["default"].bool,
|
196
|
-
skeletonRowCount: index["default"].number,
|
197
|
-
fullHeightDatagrid: index["default"].bool,
|
198
|
-
filterProps: index["default"].object,
|
199
|
-
variableRowHeight: index["default"].bool,
|
200
|
-
useDenseHeader: index["default"].bool,
|
201
|
-
withInlineEdit: index["default"].bool,
|
202
|
-
verticalAlign: index["default"].string,
|
203
|
-
gridTitle: index["default"].node,
|
204
|
-
gridDescription: index["default"].node,
|
205
|
-
page: index["default"].arrayOf(index["default"].object),
|
206
|
-
rows: index["default"].arrayOf(index["default"].object),
|
207
|
-
tableId: index["default"].string,
|
208
|
-
totalColumnsWidth: index["default"].number,
|
209
|
-
gridRef: index["default"].object,
|
210
|
-
setAllFilters: index["default"].func,
|
211
|
-
getFilterProps: index["default"].func,
|
212
|
-
state: index["default"].object
|
207
|
+
ariaToolbarLabel: index$1["default"].string,
|
208
|
+
datagridState: index$1["default"].shape({
|
209
|
+
getTableProps: index$1["default"].func,
|
210
|
+
getFilterFlyoutProps: index$1["default"].func,
|
211
|
+
withVirtualScroll: index$1["default"].bool,
|
212
|
+
DatagridActions: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
213
|
+
DatagridPagination: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
214
|
+
CustomizeColumnsTearsheet: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
|
215
|
+
isFetching: index$1["default"].bool,
|
216
|
+
skeletonRowCount: index$1["default"].number,
|
217
|
+
fullHeightDatagrid: index$1["default"].bool,
|
218
|
+
filterProps: index$1["default"].object,
|
219
|
+
variableRowHeight: index$1["default"].bool,
|
220
|
+
useDenseHeader: index$1["default"].bool,
|
221
|
+
withInlineEdit: index$1["default"].bool,
|
222
|
+
verticalAlign: index$1["default"].string,
|
223
|
+
gridTitle: index$1["default"].node,
|
224
|
+
gridDescription: index$1["default"].node,
|
225
|
+
page: index$1["default"].arrayOf(index$1["default"].object),
|
226
|
+
rows: index$1["default"].arrayOf(index$1["default"].object),
|
227
|
+
tableId: index$1["default"].string,
|
228
|
+
totalColumnsWidth: index$1["default"].number,
|
229
|
+
gridRef: index$1["default"].object,
|
230
|
+
setAllFilters: index$1["default"].func,
|
231
|
+
getFilterProps: index$1["default"].func,
|
232
|
+
state: index$1["default"].object
|
213
233
|
}),
|
214
|
-
title: index["default"].string
|
234
|
+
title: index$1["default"].string
|
215
235
|
};
|
216
236
|
|
217
237
|
exports.DatagridContent = DatagridContent;
|
@@ -13,26 +13,11 @@ var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBa
|
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../../../node_modules/prop-types/index.js');
|
15
15
|
var CustomizeColumnsTearsheet = require('./CustomizeColumnsTearsheet.js');
|
16
|
+
var InlineEditContext = require('../InlineEdit/InlineEditContext/InlineEditContext.js');
|
16
17
|
|
17
|
-
function
|
18
|
-
if (e && e.__esModule) return e;
|
19
|
-
var n = Object.create(null);
|
20
|
-
if (e) {
|
21
|
-
Object.keys(e).forEach(function (k) {
|
22
|
-
if (k !== 'default') {
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () { return e[k]; }
|
27
|
-
});
|
28
|
-
}
|
29
|
-
});
|
30
|
-
}
|
31
|
-
n["default"] = e;
|
32
|
-
return Object.freeze(n);
|
33
|
-
}
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
34
19
|
|
35
|
-
var
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
36
21
|
|
37
22
|
var _excluded = ["onSaveColumnPrefs", "isTearsheetOpen", "setIsTearsheetOpen", "labels"];
|
38
23
|
var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
@@ -43,7 +28,16 @@ var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
|
43
28
|
setIsTearsheetOpen = _instance$customizeCo.setIsTearsheetOpen,
|
44
29
|
labels = _instance$customizeCo.labels,
|
45
30
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_instance$customizeCo, _excluded);
|
46
|
-
|
31
|
+
var _useContext = React.useContext(InlineEditContext.InlineEditContext),
|
32
|
+
state = _useContext.state;
|
33
|
+
var _ref2 = state || {},
|
34
|
+
featureFlags = _ref2.featureFlags;
|
35
|
+
React.useEffect(function () {
|
36
|
+
if (featureFlags && !(featureFlags !== null && featureFlags !== void 0 && featureFlags['enable-datagrid-useCustomizeColumns'])) {
|
37
|
+
console.error("Datagrid useCustomizeColumns extension has not been enabled via feature flag.");
|
38
|
+
}
|
39
|
+
}, [featureFlags]);
|
40
|
+
return /*#__PURE__*/React__default["default"].createElement(CustomizeColumnsTearsheet["default"], _rollupPluginBabelHelpers["extends"]({}, rest, labels, {
|
47
41
|
isOpen: isTearsheetOpen,
|
48
42
|
setIsTearsheetOpen: setIsTearsheetOpen,
|
49
43
|
columnDefinitions: instance.allColumns,
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export function InlineEditButton({ label, renderIcon: Icon,
|
1
|
+
export function InlineEditButton({ label, renderIcon: Icon, labelIcon: LabelIcon, placeholder, disabledCell, nonEditCell, isActiveCell, columnConfig, type, }: {
|
2
2
|
label: any;
|
3
3
|
renderIcon: any;
|
4
|
-
disabled: any;
|
5
4
|
labelIcon: any;
|
6
5
|
placeholder: any;
|
6
|
+
disabledCell: any;
|
7
7
|
nonEditCell: any;
|
8
8
|
isActiveCell: any;
|
9
9
|
columnConfig: any;
|
@@ -12,7 +12,7 @@ export function InlineEditButton({ label, renderIcon: Icon, disabled, labelIcon:
|
|
12
12
|
export namespace InlineEditButton {
|
13
13
|
namespace propTypes {
|
14
14
|
let columnConfig: PropTypes.Requireable<object>;
|
15
|
-
let
|
15
|
+
let disabledCell: PropTypes.Requireable<boolean>;
|
16
16
|
let isActiveCell: PropTypes.Requireable<boolean>;
|
17
17
|
let label: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
18
18
|
let labelIcon: PropTypes.Requireable<object>;
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -24,18 +24,18 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
|
|
24
24
|
var InlineEditButton = function InlineEditButton(_ref) {
|
25
25
|
var label = _ref.label,
|
26
26
|
Icon = _ref.renderIcon,
|
27
|
-
disabled = _ref.disabled,
|
28
27
|
LabelIcon = _ref.labelIcon,
|
29
28
|
placeholder = _ref.placeholder,
|
29
|
+
disabledCell = _ref.disabledCell,
|
30
30
|
nonEditCell = _ref.nonEditCell,
|
31
31
|
isActiveCell = _ref.isActiveCell,
|
32
32
|
columnConfig = _ref.columnConfig,
|
33
33
|
type = _ref.type;
|
34
34
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
35
|
-
className: cx__default["default"]("".concat(blockClass, "__inline-edit-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit-button--disabled"),
|
35
|
+
className: cx__default["default"]("".concat(blockClass, "__inline-edit-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit-button--disabled"), disabledCell), "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection')),
|
36
36
|
tabIndex: isActiveCell ? 0 : -1,
|
37
|
-
"data-disabled":
|
38
|
-
"aria-disabled":
|
37
|
+
"data-disabled": disabledCell,
|
38
|
+
"aria-disabled": disabledCell,
|
39
39
|
role: "button",
|
40
40
|
title: label
|
41
41
|
}, LabelIcon && /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -50,7 +50,7 @@ var InlineEditButton = function InlineEditButton(_ref) {
|
|
50
50
|
};
|
51
51
|
InlineEditButton.propTypes = {
|
52
52
|
columnConfig: index["default"].object,
|
53
|
-
|
53
|
+
disabledCell: index["default"].bool,
|
54
54
|
isActiveCell: index["default"].bool,
|
55
55
|
label: index["default"].oneOfType([index["default"].string, index["default"].number]),
|
56
56
|
labelIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
export function InlineEditCell({ cell, config, instance, placeholder, tabIndex, value, nonEditCell, type, }: {
|
1
|
+
export function InlineEditCell({ cell, config, disabledCell, instance, placeholder, tabIndex, value, nonEditCell, type, }: {
|
2
2
|
cell: any;
|
3
3
|
config: any;
|
4
|
+
disabledCell?: boolean | undefined;
|
4
5
|
instance: any;
|
5
6
|
placeholder?: string | undefined;
|
6
7
|
tabIndex: any;
|
@@ -12,6 +13,7 @@ export namespace InlineEditCell {
|
|
12
13
|
namespace propTypes {
|
13
14
|
let cell: PropTypes.Requireable<object>;
|
14
15
|
let config: PropTypes.Requireable<object>;
|
16
|
+
let disabledCell: PropTypes.Requireable<boolean>;
|
15
17
|
let instance: PropTypes.Requireable<PropTypes.InferProps<{
|
16
18
|
columns: PropTypes.Requireable<(object | null | undefined)[]>;
|
17
19
|
onDataUpdate: PropTypes.Requireable<(...args: any[]) => any>;
|
@@ -31,6 +31,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
31
31
|
var _config$validator, _value$text;
|
32
32
|
var cell = _ref.cell,
|
33
33
|
config = _ref.config,
|
34
|
+
_ref$disabledCell = _ref.disabledCell,
|
35
|
+
disabledCell = _ref$disabledCell === void 0 ? false : _ref$disabledCell,
|
34
36
|
instance = _ref.instance,
|
35
37
|
_ref$placeholder = _ref.placeholder,
|
36
38
|
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
@@ -328,6 +330,11 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
328
330
|
return icons.Calendar;
|
329
331
|
}
|
330
332
|
};
|
333
|
+
var renderRegularCell = function renderRegularCell() {
|
334
|
+
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, inputProps, {
|
335
|
+
id: cellId
|
336
|
+
}));
|
337
|
+
};
|
331
338
|
var renderDateCell = function renderDateCell() {
|
332
339
|
var _config$inputProps, _outerButtonElement$c;
|
333
340
|
var datePickerPreparedProps = propsHelper.prepareProps(config.inputProps, ['datePickerInputProps']);
|
@@ -443,15 +450,16 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
443
450
|
"data-cell-id": cellId,
|
444
451
|
"data-column-index": columnIndex,
|
445
452
|
"data-row-index": cell.row.index,
|
446
|
-
"data-disabled":
|
453
|
+
"data-disabled": disabledCell,
|
447
454
|
"data-inline-type": type,
|
448
455
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
449
456
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
450
|
-
className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)))
|
451
|
-
}, !inEditMode && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
|
457
|
+
className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
|
458
|
+
}, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
|
452
459
|
isActiveCell: cellId === activeCellId,
|
453
460
|
renderIcon: setRenderIcon(),
|
454
461
|
label: type === 'selection' ? (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value : type === 'date' ? buildDate(value) : value,
|
462
|
+
disabledCell: disabledCell,
|
455
463
|
labelIcon: (value === null || value === void 0 ? void 0 : value.icon) || null,
|
456
464
|
placeholder: placeholder,
|
457
465
|
tabIndex: tabIndex,
|
@@ -464,6 +472,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
464
472
|
InlineEditCell.propTypes = {
|
465
473
|
cell: index["default"].object,
|
466
474
|
config: index["default"].object,
|
475
|
+
disabledCell: index["default"].bool,
|
467
476
|
instance: index["default"].shape({
|
468
477
|
columns: index["default"].arrayOf(index["default"].object),
|
469
478
|
onDataUpdate: index["default"].func,
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js
CHANGED
@@ -81,6 +81,13 @@ var inlineEditReducer = function inlineEditReducer(state, action) {
|
|
81
81
|
}
|
82
82
|
break;
|
83
83
|
}
|
84
|
+
case 'SET_FEATURE_FLAGS':
|
85
|
+
{
|
86
|
+
var _action$payload2;
|
87
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
88
|
+
featureFlags: (_action$payload2 = action.payload) !== null && _action$payload2 !== void 0 ? _action$payload2 : {}
|
89
|
+
});
|
90
|
+
}
|
84
91
|
default:
|
85
92
|
return state;
|
86
93
|
}
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
|
-
var settings = require('../../settings.js');
|
15
14
|
var ButtonWrapper = require('./Datagrid/addons/CustomizeColumns/ButtonWrapper.js');
|
16
15
|
var TearsheetWrapper = require('./Datagrid/addons/CustomizeColumns/TearsheetWrapper.js');
|
17
16
|
|
@@ -36,9 +35,6 @@ function _interopNamespace(e) {
|
|
36
35
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
37
36
|
|
38
37
|
var useCustomizeColumns = function useCustomizeColumns(hooks) {
|
39
|
-
React__namespace.useEffect(function () {
|
40
|
-
settings.pkg.checkReportFeatureEnabled('Datagrid.useCustomizeColumns');
|
41
|
-
}, []);
|
42
38
|
var _React$useState = React__namespace.useState(false),
|
43
39
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
44
40
|
isTearsheetOpen = _React$useState2[0],
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var useInlineEdit = require('./useInlineEdit.js');
|
13
13
|
|
14
14
|
var useEditableCell = function useEditableCell(hooks) {
|
15
|
-
useInlineEdit["default"](hooks
|
15
|
+
useInlineEdit["default"](hooks);
|
16
16
|
};
|
17
17
|
var useEditableCell$1 = useEditableCell;
|
18
18
|
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export default useInlineEdit;
|
2
|
-
declare function useInlineEdit(hooks: any
|
2
|
+
declare function useInlineEdit(hooks: any): void;
|
@@ -9,7 +9,6 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
12
|
var React = require('react');
|
14
13
|
var settings = require('../../settings.js');
|
15
14
|
var cx = require('classnames');
|
@@ -21,27 +20,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
20
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
22
21
|
|
23
22
|
var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
|
24
|
-
var useInlineEdit = function useInlineEdit(hooks
|
25
|
-
React.useEffect(function () {
|
26
|
-
if (!usingEditableCell) {
|
27
|
-
settings.pkg.checkReportFeatureEnabled('Datagrid.useInlineEdit');
|
28
|
-
}
|
29
|
-
if (usingEditableCell) {
|
30
|
-
settings.pkg.checkReportFeatureEnabled('Datagrid.useEditableCell');
|
31
|
-
}
|
32
|
-
}, [usingEditableCell]);
|
23
|
+
var useInlineEdit = function useInlineEdit(hooks) {
|
33
24
|
var addInlineEdit = function addInlineEdit(props, _ref) {
|
34
|
-
var _cell$column;
|
25
|
+
var _cell$column, _cell$column2;
|
35
26
|
var cell = _ref.cell,
|
36
27
|
instance = _ref.instance;
|
37
28
|
var columnInlineEditConfig = cell.column.inlineEdit;
|
38
29
|
var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 || (_cell$column = _cell$column.inlineEdit) === null || _cell$column === void 0 ? void 0 : _cell$column.type;
|
30
|
+
var isDisabled = (_cell$column2 = cell.column) === null || _cell$column2 === void 0 ? void 0 : _cell$column2.isDisabled;
|
39
31
|
var renderInlineEditComponent = function renderInlineEditComponent(type) {
|
40
32
|
return /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
|
41
33
|
config: columnInlineEditConfig,
|
42
34
|
tabIndex: -1,
|
43
35
|
value: cell.value,
|
44
36
|
cell: cell,
|
37
|
+
isDisabled: isDisabled,
|
45
38
|
instance: instance,
|
46
39
|
type: type
|
47
40
|
});
|
@@ -52,15 +45,15 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
|
|
52
45
|
}];
|
53
46
|
}
|
54
47
|
return [props, {
|
55
|
-
className: cx__default["default"]("".concat(blockClass, "__cell"),
|
48
|
+
className: cx__default["default"]("".concat(blockClass, "__cell"), "".concat(blockClass, "__cell-inline-edit")),
|
56
49
|
role: 'gridcell',
|
57
|
-
children:
|
50
|
+
children: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), !inlineEditType && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
|
58
51
|
config: columnInlineEditConfig,
|
59
52
|
tabIndex: -1,
|
60
53
|
value: cell.value,
|
61
54
|
cell: cell,
|
62
55
|
instance: instance,
|
63
|
-
|
56
|
+
disabledCell: isDisabled,
|
64
57
|
nonEditCell: true,
|
65
58
|
type: "text"
|
66
59
|
}))
|
@@ -69,7 +62,7 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
|
|
69
62
|
hooks.getCellProps.push(addInlineEdit);
|
70
63
|
hooks.useInstance.push(function (instance) {
|
71
64
|
Object.assign(instance, {
|
72
|
-
withInlineEdit:
|
65
|
+
withInlineEdit: true
|
73
66
|
});
|
74
67
|
});
|
75
68
|
};
|
@@ -14,6 +14,7 @@ type ActionIcon = {
|
|
14
14
|
iconDescription: string;
|
15
15
|
href?: string;
|
16
16
|
};
|
17
|
+
type PlacementType = 'top' | 'bottom';
|
17
18
|
interface EditUpdateCardsProps {
|
18
19
|
/**
|
19
20
|
* Icons that are displayed on card. Refer to design documentation for implementation guidelines
|
@@ -22,7 +23,7 @@ interface EditUpdateCardsProps {
|
|
22
23
|
/**
|
23
24
|
* Determines if the action icons are on the top or bottom of the card
|
24
25
|
*/
|
25
|
-
actionsPlacement?:
|
26
|
+
actionsPlacement?: PlacementType;
|
26
27
|
/**
|
27
28
|
* Optional label for the top of the card.
|
28
29
|
*/
|
@@ -66,7 +67,7 @@ interface EditUpdateCardsProps {
|
|
66
67
|
/**
|
67
68
|
* Determines if the primary button is on the top or bottom of the card
|
68
69
|
*/
|
69
|
-
primaryButtonPlacement?:
|
70
|
+
primaryButtonPlacement?: PlacementType;
|
70
71
|
/**
|
71
72
|
* The text that's displayed in the primary button
|
72
73
|
*/
|
@@ -86,7 +87,7 @@ interface EditUpdateCardsProps {
|
|
86
87
|
/**
|
87
88
|
* Determines if the secondary button is on the top or bottom of the card
|
88
89
|
*/
|
89
|
-
secondaryButtonPlacement?:
|
90
|
+
secondaryButtonPlacement?: PlacementType;
|
90
91
|
/**
|
91
92
|
* The text that's displayed in the secondary button
|
92
93
|
*/
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* Supports an object of feature flag values with the `flags` prop, merging them
|
3
|
+
* along with the current `FeatureFlagContext` to provide consumers to check if
|
4
|
+
* a feature flag is enabled or disabled in a given React tree
|
5
|
+
*/
|
6
|
+
export function FeatureFlags({ children, flags }: {
|
7
|
+
children: any;
|
8
|
+
flags?: {} | undefined;
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
10
|
+
export namespace FeatureFlags {
|
11
|
+
namespace propTypes {
|
12
|
+
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
13
|
+
let flags: PropTypes.Requireable<{
|
14
|
+
[x: string]: boolean | null | undefined;
|
15
|
+
}>;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
20
|
+
* or disable feature flags in a given React tree
|
21
|
+
*/
|
22
|
+
export const FeatureFlagContext: React.Context<any>;
|
23
|
+
/**
|
24
|
+
* Access all feature flag information for the given FeatureFlagContext
|
25
|
+
*
|
26
|
+
* @returns {FeatureFlagScope}
|
27
|
+
*/
|
28
|
+
export function useFeatureFlags(): FeatureFlagScope;
|
29
|
+
/**
|
30
|
+
* Access whether a given flag is enabled or disabled in a given
|
31
|
+
* FeatureFlagContext
|
32
|
+
*
|
33
|
+
* @returns {boolean}
|
34
|
+
*/
|
35
|
+
export function useFeatureFlag(flag: any): boolean;
|
36
|
+
import PropTypes from 'prop-types';
|
37
|
+
import React from 'react';
|