@salesforce/design-system-react 0.10.43 → 0.10.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/components/brand-band/__examples__/{lightning-blue-theme.jsx → group-image.jsx} +1 -11
- package/components/brand-band/__examples__/no-image.jsx +1 -2
- package/{lib/components/brand-band/__examples__/lightning-blue-theme.jsx → components/brand-band/__examples__/user-image.jsx} +1 -11
- package/components/brand-band/check-props.js +18 -0
- package/components/brand-band/component.json +8 -4
- package/components/brand-band/index.jsx +23 -66
- package/components/brand-band.d.ts +1 -26
- package/components/button/__tests__/button.browser-test.jsx +0 -1
- package/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/components/combobox/combobox.d.ts +3 -0
- package/components/combobox/combobox.jsx +7 -1
- package/components/component-docs.json +14 -39
- package/components/data-table/cell.jsx +2 -2
- package/components/data-table/index.jsx +134 -85
- package/components/data-table/private/context-helper.js +26 -14
- package/components/data-table/private/head.jsx +269 -260
- package/components/data-table/private/header-cell.jsx +204 -230
- package/components/data-table/private/row.jsx +140 -105
- package/components/data-table/row-actions.jsx +2 -2
- package/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
- package/components/pill-container/private/selected-listbox.jsx +1 -0
- package/components/site-stories.js +8 -4
- package/components/slider.d.ts +10 -4
- package/components/utilities/truncate/index.jsx +1 -1
- package/lib/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/lib/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/lib/components/brand-band/__examples__/group-image.jsx +12 -0
- package/lib/components/brand-band/__examples__/no-image.jsx +1 -2
- package/lib/components/brand-band/__examples__/user-image.jsx +12 -0
- package/lib/components/brand-band/check-props.js +29 -0
- package/lib/components/brand-band/component.json +8 -4
- package/lib/components/brand-band/index.js +9 -50
- package/lib/components/brand-band.d.ts +1 -26
- package/lib/components/button/__tests__/button.browser-test.jsx +0 -1
- package/lib/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/lib/components/combobox/combobox.d.ts +3 -0
- package/lib/components/combobox/combobox.js +9 -2
- package/lib/components/component-docs.json +14 -39
- package/lib/components/data-table/cell.js +6 -6
- package/lib/components/data-table/index.js +131 -99
- package/lib/components/data-table/private/context-helper.js +13 -14
- package/lib/components/data-table/private/head.js +233 -252
- package/lib/components/data-table/private/header-cell.js +185 -221
- package/lib/components/data-table/private/row.js +97 -89
- package/lib/components/data-table/row-actions.js +6 -6
- package/lib/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
- package/lib/components/pill-container/private/selected-listbox.js +3 -0
- package/lib/components/site-stories.js +6 -3
- package/lib/components/slider.d.ts +10 -4
- package/lib/components/utilities/truncate/index.js +2 -2
- package/lib/package.json +14 -10
- package/module/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/module/components/brand-band/__docs__/storybook-stories.js +6 -3
- package/module/components/brand-band/__docs__/storybook-stories.js.map +1 -1
- package/module/components/brand-band/__examples__/{lightning-blue-theme.js → group-image.js} +4 -9
- package/module/components/brand-band/__examples__/group-image.js.map +1 -0
- package/module/components/brand-band/__examples__/no-image.js +2 -4
- package/module/components/brand-band/__examples__/no-image.js.map +1 -1
- package/module/components/brand-band/__examples__/user-image.js +52 -0
- package/module/components/brand-band/__examples__/user-image.js.map +1 -0
- package/module/components/brand-band/check-props.js +20 -0
- package/module/components/brand-band/check-props.js.map +1 -0
- package/module/components/brand-band/component.json +8 -4
- package/module/components/brand-band/index.js +10 -51
- package/module/components/brand-band/index.js.map +1 -1
- package/module/components/brand-band.d.ts +1 -26
- package/module/components/button/__tests__/button.browser-test.js +0 -1
- package/module/components/button/__tests__/button.browser-test.js.map +1 -1
- package/module/components/combobox/__tests__/combobox.browser-test.js +22 -0
- package/module/components/combobox/__tests__/combobox.browser-test.js.map +1 -1
- package/module/components/combobox/combobox.d.ts +3 -0
- package/module/components/combobox/combobox.js +9 -2
- package/module/components/combobox/combobox.js.map +1 -1
- package/module/components/component-docs.json +14 -39
- package/module/components/data-table/cell.js +6 -6
- package/module/components/data-table/cell.js.map +1 -1
- package/module/components/data-table/index.js +124 -95
- package/module/components/data-table/index.js.map +1 -1
- package/module/components/data-table/private/context-helper.js +12 -12
- package/module/components/data-table/private/context-helper.js.map +1 -1
- package/module/components/data-table/private/head.js +230 -255
- package/module/components/data-table/private/head.js.map +1 -1
- package/module/components/data-table/private/header-cell.js +184 -225
- package/module/components/data-table/private/header-cell.js.map +1 -1
- package/module/components/data-table/private/row.js +95 -87
- package/module/components/data-table/private/row.js.map +1 -1
- package/module/components/data-table/row-actions.js +6 -6
- package/module/components/data-table/row-actions.js.map +1 -1
- package/module/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
- package/module/components/pill-container/private/selected-listbox.js +3 -0
- package/module/components/pill-container/private/selected-listbox.js.map +1 -1
- package/module/components/site-stories.js +6 -3
- package/module/components/site-stories.js.map +1 -1
- package/module/components/slider.d.ts +10 -4
- package/module/components/utilities/truncate/index.js +1 -1
- package/module/components/utilities/truncate/index.js.map +1 -1
- package/package.json +14 -10
- package/module/components/brand-band/__examples__/lightning-blue-theme.js.map +0 -1
|
@@ -1148,17 +1148,8 @@
|
|
|
1148
1148
|
"dependencies": []
|
|
1149
1149
|
},
|
|
1150
1150
|
"brand-band": {
|
|
1151
|
-
"description": "The brand band provides theming capability that adds personality and improves information density and contrast
|
|
1151
|
+
"description": "The brand band provides theming capability that adds personality and improves information density and contrast.",
|
|
1152
1152
|
"methods": [
|
|
1153
|
-
{
|
|
1154
|
-
"name": "injectLightningBlueStyles",
|
|
1155
|
-
"docblock": null,
|
|
1156
|
-
"modifiers": [
|
|
1157
|
-
"static"
|
|
1158
|
-
],
|
|
1159
|
-
"params": [],
|
|
1160
|
-
"returns": null
|
|
1161
|
-
},
|
|
1162
1153
|
{
|
|
1163
1154
|
"name": "getId",
|
|
1164
1155
|
"docblock": null,
|
|
@@ -1211,6 +1202,14 @@
|
|
|
1211
1202
|
{
|
|
1212
1203
|
"value": "'none'",
|
|
1213
1204
|
"computed": false
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
"value": "'group'",
|
|
1208
|
+
"computed": false
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"value": "'user'",
|
|
1212
|
+
"computed": false
|
|
1214
1213
|
}
|
|
1215
1214
|
]
|
|
1216
1215
|
},
|
|
@@ -1273,34 +1272,6 @@
|
|
|
1273
1272
|
},
|
|
1274
1273
|
"required": false,
|
|
1275
1274
|
"description": "Custom styles to be passed to the component"
|
|
1276
|
-
},
|
|
1277
|
-
"styleContainer": {
|
|
1278
|
-
"type": {
|
|
1279
|
-
"name": "object"
|
|
1280
|
-
},
|
|
1281
|
-
"required": false,
|
|
1282
|
-
"description": "Custom styles to be passed to the component container"
|
|
1283
|
-
},
|
|
1284
|
-
"theme": {
|
|
1285
|
-
"type": {
|
|
1286
|
-
"name": "enum",
|
|
1287
|
-
"value": [
|
|
1288
|
-
{
|
|
1289
|
-
"value": "'default'",
|
|
1290
|
-
"computed": false
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
"value": "'lightning-blue'",
|
|
1294
|
-
"computed": false
|
|
1295
|
-
}
|
|
1296
|
-
]
|
|
1297
|
-
},
|
|
1298
|
-
"required": false,
|
|
1299
|
-
"description": "Different brand band styling.\nNOTE: using 'lightning-blue' may result in incorrect styling depending on server CSP settings. See opening component documentation above for details.",
|
|
1300
|
-
"defaultValue": {
|
|
1301
|
-
"value": "'default'",
|
|
1302
|
-
"computed": false
|
|
1303
|
-
}
|
|
1304
1275
|
}
|
|
1305
1276
|
},
|
|
1306
1277
|
"route": "brand-band",
|
|
@@ -4987,6 +4958,10 @@
|
|
|
4987
4958
|
"name": "string",
|
|
4988
4959
|
"required": false
|
|
4989
4960
|
},
|
|
4961
|
+
"title": {
|
|
4962
|
+
"name": "string",
|
|
4963
|
+
"required": false
|
|
4964
|
+
},
|
|
4990
4965
|
"type": {
|
|
4991
4966
|
"name": "string",
|
|
4992
4967
|
"required": false
|
|
@@ -5004,7 +4979,7 @@
|
|
|
5004
4979
|
}
|
|
5005
4980
|
},
|
|
5006
4981
|
"required": false,
|
|
5007
|
-
"description": "**Array of item objects in the dropdown menu.**\nEach object can contain:\n* `icon`: An `Icon` component. (not used in read-only variant)\n* `id`: A unique identifier string.\n* `label`: A primary string of text for a menu item or group separator.\n* `subTitle`: A secondary string of text added for clarity. (optional)\n* `type`: 'separator' is the only type currently used\n* `disabled`: Set to true to disable this menu item.\n* `tooltipContent`: Content that is displayed in tooltip when item is disabled\n```\n{\n\tid: '2',\n\tlabel: 'Salesforce.com, Inc.',\n\tsubTitle: 'Account • San Francisco',\n\ttype: 'account',\n disabled: true,\n tooltipContent: \"You don't have permission to select this item.\"\n},\n```\nNote: At the moment, Combobox does not support two consecutive separators. _Tested with snapshot testing._"
|
|
4982
|
+
"description": "**Array of item objects in the dropdown menu.**\nEach object can contain:\n* `icon`: An `Icon` component. (not used in read-only variant)\n* `id`: A unique identifier string.\n* `label`: A primary string of text for a menu item or group separator.\n* `subTitle`: A secondary string of text added for clarity. (optional)\n* `title`: A string of text shown as the title of the selected item (optional)\n* `type`: 'separator' is the only type currently used\n* `disabled`: Set to true to disable this menu item.\n* `tooltipContent`: Content that is displayed in tooltip when item is disabled\n```\n{\n\tid: '2',\n\tlabel: 'Salesforce.com, Inc.',\n\tsubTitle: 'Account • San Francisco',\n\ttitle: 'Salesforce',\n\ttype: 'account',\n disabled: true,\n tooltipContent: \"You don't have permission to select this item.\"\n},\n```\nNote: At the moment, Combobox does not support two consecutive separators. _Tested with snapshot testing._"
|
|
5008
4983
|
},
|
|
5009
4984
|
"menuItemVisibleLength": {
|
|
5010
4985
|
"type": {
|
|
@@ -17,7 +17,7 @@ var _cellContext = _interopRequireDefault(require("./private/cell-context"));
|
|
|
17
17
|
|
|
18
18
|
var _tableContext = _interopRequireDefault(require("./private/table-context"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _contextHelper = _interopRequireDefault(require("./private/context-helper"));
|
|
21
21
|
|
|
22
22
|
var _constants = require("../../utilities/constants");
|
|
23
23
|
|
|
@@ -41,11 +41,11 @@ var DataTableCell = function DataTableCell(props) {
|
|
|
41
41
|
var tableContext = (0, _react.useContext)(_tableContext.default);
|
|
42
42
|
var cellContext = (0, _react.useContext)(_cellContext.default);
|
|
43
43
|
|
|
44
|
-
var
|
|
45
|
-
tabIndex =
|
|
46
|
-
hasFocus =
|
|
47
|
-
handleFocus =
|
|
48
|
-
handleKeyDown =
|
|
44
|
+
var _useContextHelper = (0, _contextHelper.default)(tableContext, cellContext, props.fixedLayout),
|
|
45
|
+
tabIndex = _useContextHelper.tabIndex,
|
|
46
|
+
hasFocus = _useContextHelper.hasFocus,
|
|
47
|
+
handleFocus = _useContextHelper.handleFocus,
|
|
48
|
+
handleKeyDown = _useContextHelper.handleKeyDown;
|
|
49
49
|
|
|
50
50
|
var childText = /*#__PURE__*/_react.default.isValidElement(props.children) ? props.children.props.children : props.children;
|
|
51
51
|
|
|
@@ -17,7 +17,11 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
17
17
|
|
|
18
18
|
var _lodash = _interopRequireDefault(require("lodash.assign"));
|
|
19
19
|
|
|
20
|
-
var _lodash2 = _interopRequireDefault(require("lodash.
|
|
20
|
+
var _lodash2 = _interopRequireDefault(require("lodash.isequal"));
|
|
21
|
+
|
|
22
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
23
|
+
|
|
24
|
+
var _lodash3 = _interopRequireDefault(require("lodash.reject"));
|
|
21
25
|
|
|
22
26
|
var _columnResizer = _interopRequireDefault(require("column-resizer"));
|
|
23
27
|
|
|
@@ -57,10 +61,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
57
61
|
|
|
58
62
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
59
63
|
|
|
60
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
61
|
-
|
|
62
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
63
|
-
|
|
64
64
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
65
65
|
|
|
66
66
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -69,10 +69,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
|
|
|
69
69
|
|
|
70
70
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
71
71
|
|
|
72
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
73
|
-
|
|
74
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
75
|
-
|
|
76
72
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
77
73
|
|
|
78
74
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -105,6 +101,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
105
101
|
|
|
106
102
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
107
103
|
|
|
104
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
105
|
+
|
|
106
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
107
|
+
|
|
108
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
109
|
+
|
|
110
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
111
|
+
|
|
108
112
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
109
113
|
|
|
110
114
|
// Safely get the length of an array, returning 0 for invalid input.
|
|
@@ -132,6 +136,88 @@ var defaultProps = {
|
|
|
132
136
|
draggingClass: 'slds-table-column-resizer'
|
|
133
137
|
}
|
|
134
138
|
};
|
|
139
|
+
var getAssistiveText = (0, _memoizeOne.default)(function (assistiveText, actionsHeaderText, columnSortText, columnSortedAscendingText, columnSortedDescendingText, selectAllRowsText, selectRowText) {
|
|
140
|
+
var result = _objectSpread(_objectSpread({}, defaultProps.assistiveText), assistiveText);
|
|
141
|
+
|
|
142
|
+
if (actionsHeaderText) {
|
|
143
|
+
result.actionsHeader = actionsHeaderText;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (selectAllRowsText) {
|
|
147
|
+
result.selectAllRows = selectAllRowsText;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (columnSortedAscendingText) {
|
|
151
|
+
result.columnSortedAscending = columnSortedAscendingText;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (columnSortedDescendingText) {
|
|
155
|
+
result.columnSortedDescending = columnSortedDescendingText;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (columnSortText) {
|
|
159
|
+
result.columnSort = columnSortText;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (selectRowText) {
|
|
163
|
+
result.selectRow = selectRowText;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return result;
|
|
167
|
+
}, _lodash2.default);
|
|
168
|
+
var getColumnsAndRowActions = (0, _memoizeOne.default)(function (children, id, fixedHeader, fixedLayout, items, search) {
|
|
169
|
+
var columns = [];
|
|
170
|
+
var RowActions = null;
|
|
171
|
+
|
|
172
|
+
_react.default.Children.forEach(children, function (child) {
|
|
173
|
+
if (child && child.type.displayName === _column.default.displayName) {
|
|
174
|
+
var _child$props = child.props,
|
|
175
|
+
columnChildren = _child$props.children,
|
|
176
|
+
columnProps = _objectWithoutProperties(_child$props, ["children"]);
|
|
177
|
+
|
|
178
|
+
var props = _objectSpread({
|
|
179
|
+
fixedLayout: fixedLayout,
|
|
180
|
+
search: search,
|
|
181
|
+
items: items
|
|
182
|
+
}, columnProps);
|
|
183
|
+
|
|
184
|
+
if (id) {
|
|
185
|
+
props.id = id;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var Cell;
|
|
189
|
+
|
|
190
|
+
if (columnChildren && columnChildren.type.displayName === _constants.DATA_TABLE_CELL) {
|
|
191
|
+
Cell = columnChildren.type;
|
|
192
|
+
(0, _lodash.default)(props, columnChildren.props);
|
|
193
|
+
} else {
|
|
194
|
+
Cell = _cell.default;
|
|
195
|
+
} // eslint-disable-next-line fp/no-mutating-methods
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
columns.push({
|
|
199
|
+
Cell: Cell,
|
|
200
|
+
props: props
|
|
201
|
+
});
|
|
202
|
+
} else if (child && child.type.displayName === _rowActions.default.displayName) {
|
|
203
|
+
var dropdown = child.props.dropdown;
|
|
204
|
+
var dropdownPropOverrides = {};
|
|
205
|
+
|
|
206
|
+
if (fixedHeader) {
|
|
207
|
+
dropdownPropOverrides.menuPosition = 'overflowBoundaryElement';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
RowActions = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
211
|
+
dropdown: dropdown ? /*#__PURE__*/_react.default.cloneElement(dropdown, dropdownPropOverrides) : null
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
columns: columns,
|
|
218
|
+
RowActions: RowActions
|
|
219
|
+
};
|
|
220
|
+
}, _lodash2.default);
|
|
135
221
|
/**
|
|
136
222
|
* DataTables support the display of structured data in rows and columns with an HTML table. To sort, filter or paginate the table, simply update the data passed in the items to the table and it will re-render itself appropriately. The table will throw a sort event as needed, and helper components for paging and filtering are coming soon.
|
|
137
223
|
*
|
|
@@ -153,6 +239,27 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
153
239
|
|
|
154
240
|
_this = _super.call(this, props);
|
|
155
241
|
|
|
242
|
+
_defineProperty(_assertThisInitialized(_this), "getTableContext", (0, _memoizeOne.default)(function (state, isKeyboardNavigation) {
|
|
243
|
+
return {
|
|
244
|
+
activeCell: state.activeCell,
|
|
245
|
+
activeElement: state.activeElement,
|
|
246
|
+
mode: state.mode,
|
|
247
|
+
tableHasFocus: state.tableHasFocus,
|
|
248
|
+
changeActiveCell: _this.changeActiveCell,
|
|
249
|
+
changeActiveElement: _this.changeActiveElement,
|
|
250
|
+
handleKeyDown: _this.handleKeyDown,
|
|
251
|
+
registerInteractiveElement: _this.registerInteractiveElement,
|
|
252
|
+
allowKeyboardNavigation: state.allowKeyboardNavigation,
|
|
253
|
+
setAllowKeyboardNavigation: function setAllowKeyboardNavigation(allowKeyboardNavigation) {
|
|
254
|
+
if (isKeyboardNavigation) {
|
|
255
|
+
_this.setState({
|
|
256
|
+
allowKeyboardNavigation: allowKeyboardNavigation
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
|
|
156
263
|
_defineProperty(_assertThisInitialized(_this), "handleToggleAll", function (e, _ref) {
|
|
157
264
|
var checked = _ref.checked;
|
|
158
265
|
|
|
@@ -186,7 +293,7 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
186
293
|
if (selected) {
|
|
187
294
|
selection = _this.props.selectRows === 'radio' ? [item] : [].concat(_toConsumableArray(_this.props.selection), [item]);
|
|
188
295
|
} else {
|
|
189
|
-
selection = (0,
|
|
296
|
+
selection = (0, _lodash3.default)(_this.props.selection, item);
|
|
190
297
|
}
|
|
191
298
|
|
|
192
299
|
_this.props.onChange(selection, e);
|
|
@@ -199,7 +306,7 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
199
306
|
if (selected) {
|
|
200
307
|
_selection2 = _this.props.selectRows === 'radio' ? [item] : [].concat(_toConsumableArray(_this.props.selection), [item]);
|
|
201
308
|
} else {
|
|
202
|
-
_selection2 = (0,
|
|
309
|
+
_selection2 = (0, _lodash3.default)(_this.props.selection, item);
|
|
203
310
|
}
|
|
204
311
|
|
|
205
312
|
_this.props.onRowChange(e, {
|
|
@@ -356,10 +463,6 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
356
463
|
this.loadMoreIfNeeded();
|
|
357
464
|
}
|
|
358
465
|
|
|
359
|
-
if (this.props.items !== prevProps.items) {
|
|
360
|
-
this.interactiveElements = {};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
466
|
if (this.state.allowKeyboardNavigation && !prevState.allowKeyboardNavigation) {
|
|
364
467
|
// When re-enabling keyboard navigation (e.g. when a dropdown closes), mark that
|
|
365
468
|
// focus has returned to the table. This must wait until after `allowKeyboardNavigation`
|
|
@@ -436,6 +539,14 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
436
539
|
|
|
437
540
|
return null;
|
|
438
541
|
}
|
|
542
|
+
}, {
|
|
543
|
+
key: "UNSAFE_componentWillUpdate",
|
|
544
|
+
value: // eslint-disable-next-line camelcase
|
|
545
|
+
function UNSAFE_componentWillUpdate(nextProps) {
|
|
546
|
+
if (this.props.items !== nextProps.items) {
|
|
547
|
+
this.interactiveElements = {};
|
|
548
|
+
}
|
|
549
|
+
}
|
|
439
550
|
}, {
|
|
440
551
|
key: "isResizable",
|
|
441
552
|
value: function isResizable() {
|
|
@@ -843,73 +954,12 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
843
954
|
var canSelectRows = this.props.selectRows && numNonHeaderRows > 0 ? this.props.selectRows : false;
|
|
844
955
|
var allSelected = canSelectRows && numNonHeaderRows === numSelected;
|
|
845
956
|
var indeterminateSelected = canSelectRows && numNonHeaderRows !== numSelected && numSelected !== 0;
|
|
846
|
-
var columns = [];
|
|
847
|
-
var RowActions = null;
|
|
848
|
-
|
|
849
|
-
_react.default.Children.forEach(this.props.children, function (child) {
|
|
850
|
-
if (child && child.type.displayName === _column.default.displayName) {
|
|
851
|
-
var _child$props = child.props,
|
|
852
|
-
children = _child$props.children,
|
|
853
|
-
columnProps = _objectWithoutProperties(_child$props, ["children"]);
|
|
854
|
-
|
|
855
|
-
var props = (0, _lodash.default)({}, _this4.props); // eslint-disable-next-line fp/no-delete
|
|
856
957
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
if (children && children.type.displayName === _constants.DATA_TABLE_CELL) {
|
|
862
|
-
Cell = children.type;
|
|
863
|
-
(0, _lodash.default)(props, children.props);
|
|
864
|
-
} else {
|
|
865
|
-
Cell = _cell.default;
|
|
866
|
-
} // eslint-disable-next-line fp/no-mutating-methods
|
|
958
|
+
var _getColumnsAndRowActi = getColumnsAndRowActions(this.props.children, this.props.id, this.getFixedHeader(), this.props.fixedLayout, this.props.items, this.props.search),
|
|
959
|
+
columns = _getColumnsAndRowActi.columns,
|
|
960
|
+
RowActions = _getColumnsAndRowActi.RowActions;
|
|
867
961
|
|
|
868
|
-
|
|
869
|
-
columns.push({
|
|
870
|
-
Cell: Cell,
|
|
871
|
-
props: props,
|
|
872
|
-
dataTableProps: _this4.props
|
|
873
|
-
});
|
|
874
|
-
} else if (child && child.type.displayName === _rowActions.default.displayName) {
|
|
875
|
-
var dropdown = child.props.dropdown;
|
|
876
|
-
var dropdownPropOverrides = {};
|
|
877
|
-
|
|
878
|
-
if (_this4.getFixedHeader()) {
|
|
879
|
-
dropdownPropOverrides.menuPosition = 'overflowBoundaryElement';
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
RowActions = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
883
|
-
dropdown: dropdown ? /*#__PURE__*/_react.default.cloneElement(dropdown, dropdownPropOverrides) : null
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
var assistiveText = _objectSpread(_objectSpread({}, defaultProps.assistiveText), this.props.assistiveText);
|
|
889
|
-
|
|
890
|
-
if (this.props.assistiveTextForActionsHeader) {
|
|
891
|
-
assistiveText.actionsHeader = this.props.assistiveTextForActionsHeader;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
if (this.props.assistiveTextForSelectAllRows) {
|
|
895
|
-
assistiveText.selectAllRows = this.props.assistiveTextForSelectAllRows;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
if (this.props.assistiveTextForColumnSortedAscending) {
|
|
899
|
-
assistiveText.columnSortedAscending = this.props.assistiveTextForColumnSortedAscending;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
if (this.props.assistiveTextForColumnSortedDescending) {
|
|
903
|
-
assistiveText.columnSortedDescending = this.props.assistiveTextForColumnSortedDescending;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
if (this.props.assistiveTextForColumnSort) {
|
|
907
|
-
assistiveText.columnSort = this.props.assistiveTextForColumnSort;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
if (this.props.assistiveTextForSelectRow) {
|
|
911
|
-
assistiveText.selectRow = this.props.assistiveTextForSelectRow;
|
|
912
|
-
}
|
|
962
|
+
var assistiveText = getAssistiveText(this.props.assistiveText, this.props.assistiveTextForActionsHeader, this.props.assistiveTextForSelectAllRows, this.props.assistiveTextForColumnSortedAscending, this.props.assistiveTextForColumnSortedDescending, this.props.assistiveTextForColumnSort, this.props.assistiveTextForSelectRow);
|
|
913
963
|
|
|
914
964
|
if (this.props.selectRows && this.props.selectRows !== 'radio') {
|
|
915
965
|
ariaProps['aria-multiselectable'] = 'true';
|
|
@@ -921,27 +971,9 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
921
971
|
column: this.headerRefs.column.slice(0, columns.length),
|
|
922
972
|
select: canSelectRows ? this.headerRefs.select : []
|
|
923
973
|
};
|
|
924
|
-
var tableContext = {
|
|
925
|
-
activeCell: this.state.activeCell,
|
|
926
|
-
activeElement: this.state.activeElement,
|
|
927
|
-
mode: this.state.mode,
|
|
928
|
-
tableHasFocus: this.state.tableHasFocus,
|
|
929
|
-
changeActiveCell: this.changeActiveCell,
|
|
930
|
-
changeActiveElement: this.changeActiveElement,
|
|
931
|
-
handleKeyDown: this.handleKeyDown,
|
|
932
|
-
registerInteractiveElement: this.registerInteractiveElement,
|
|
933
|
-
allowKeyboardNavigation: this.state.allowKeyboardNavigation,
|
|
934
|
-
setAllowKeyboardNavigation: function setAllowKeyboardNavigation(allowKeyboardNavigation) {
|
|
935
|
-
if (_this4.getKeyboardNavigation()) {
|
|
936
|
-
_this4.setState({
|
|
937
|
-
allowKeyboardNavigation: allowKeyboardNavigation
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
974
|
|
|
943
975
|
var component = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_tableContext.default.Provider, {
|
|
944
|
-
value:
|
|
976
|
+
value: this.getTableContext(this.state, this.getKeyboardNavigation())
|
|
945
977
|
}, /*#__PURE__*/_react.default.createElement("table", _extends({}, ariaProps, {
|
|
946
978
|
className: (0, _classnames.default)('slds-table', {
|
|
947
979
|
'slds-table_fixed-layout': this.getFixedLayout(),
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = useTableContextHelper;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
7
9
|
|
|
8
10
|
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
|
|
9
11
|
|
|
@@ -12,22 +14,21 @@ exports.default = void 0;
|
|
|
12
14
|
/**
|
|
13
15
|
* Calculates data table keyboard navigation state based on currently selected cell
|
|
14
16
|
*/
|
|
15
|
-
|
|
17
|
+
function useTableContextHelper(tableContext, cellContext, fixedLayout) {
|
|
16
18
|
var isActive = tableContext.activeCell.rowIndex === cellContext.rowIndex && tableContext.activeCell.columnIndex === cellContext.columnIndex;
|
|
17
19
|
var hasFocus = fixedLayout && tableContext.tableHasFocus && isActive;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
var changeActiveCell = tableContext.changeActiveCell,
|
|
21
|
+
handleTableKeyDown = tableContext.handleKeyDown;
|
|
22
|
+
var handleFocus = (0, _react.useCallback)(function () {
|
|
20
23
|
if (fixedLayout && tableContext.allowKeyboardNavigation) {
|
|
21
|
-
|
|
24
|
+
changeActiveCell(cellContext.rowIndex, cellContext.columnIndex);
|
|
22
25
|
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
26
|
+
}, [fixedLayout, tableContext.allowKeyboardNavigation, changeActiveCell, cellContext.rowIndex, cellContext.columnIndex]);
|
|
27
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
26
28
|
if (fixedLayout && tableContext.allowKeyboardNavigation) {
|
|
27
|
-
|
|
29
|
+
handleTableKeyDown(event);
|
|
28
30
|
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
+
}, [fixedLayout, tableContext.allowKeyboardNavigation, handleTableKeyDown]);
|
|
31
32
|
var tabIndex = fixedLayout && isActive && !tableContext.activeElement && tableContext.allowKeyboardNavigation ? '0' : undefined;
|
|
32
33
|
return {
|
|
33
34
|
tabIndex: tabIndex,
|
|
@@ -35,6 +36,4 @@ var _default = function _default(tableContext, cellContext, fixedLayout) {
|
|
|
35
36
|
handleFocus: handleFocus,
|
|
36
37
|
handleKeyDown: handleKeyDown
|
|
37
38
|
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
exports.default = _default;
|
|
39
|
+
}
|