@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": {
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types'; // ### classNames
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import CellContext from './private/cell-context';
|
|
10
10
|
import TableContext from './private/table-context';
|
|
11
|
-
import
|
|
11
|
+
import useContextHelper from './private/context-helper'; // ## Constants
|
|
12
12
|
|
|
13
13
|
import { DATA_TABLE_CELL } from '../../utilities/constants';
|
|
14
14
|
/**
|
|
@@ -19,11 +19,11 @@ var DataTableCell = function DataTableCell(props) {
|
|
|
19
19
|
var tableContext = useContext(TableContext);
|
|
20
20
|
var cellContext = useContext(CellContext);
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
tabIndex =
|
|
24
|
-
hasFocus =
|
|
25
|
-
handleFocus =
|
|
26
|
-
handleKeyDown =
|
|
22
|
+
var _useContextHelper = useContextHelper(tableContext, cellContext, props.fixedLayout),
|
|
23
|
+
tabIndex = _useContextHelper.tabIndex,
|
|
24
|
+
hasFocus = _useContextHelper.hasFocus,
|
|
25
|
+
handleFocus = _useContextHelper.handleFocus,
|
|
26
|
+
handleKeyDown = _useContextHelper.handleKeyDown;
|
|
27
27
|
|
|
28
28
|
var childText = /*#__PURE__*/React.isValidElement(props.children) ? props.children.props.children : props.children;
|
|
29
29
|
var contents = /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../.tmp-es/components/data-table/cell.jsx"],"names":["React","useContext","PropTypes","classNames","CellContext","TableContext","
|
|
1
|
+
{"version":3,"sources":["../../../.tmp-es/components/data-table/cell.jsx"],"names":["React","useContext","PropTypes","classNames","CellContext","TableContext","useContextHelper","DATA_TABLE_CELL","DataTableCell","props","tableContext","cellContext","fixedLayout","tabIndex","hasFocus","handleFocus","handleKeyDown","childText","isValidElement","children","contents","title","className","ref","node","focus","cell","label","width","headerId","primaryColumn","displayName","propTypes","oneOfType","string","array","object","bool","item","property"],"mappings":"AAAA;;AACA;AAEA;AACA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB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AAAA,SAAS,EAAEpB,SAAS,CAAC+B,SAAV,CAAoB,CAC9B/B,SAAS,CAACiC,KADoB,EAE9BjC,SAAS,CAACkC,MAFoB,EAG9BlC,SAAS,CAACgC,MAHoB,CAApB,CARc;;AAazB;AACD;AACA;AACCtB,EAAAA,WAAW,EAAEV,SAAS,CAACmC,IAhBE;;AAiBzB;AACD;AACA;AACCC,EAAAA,IAAI,EAAEpC,SAAS,CAACkC,MApBS;;AAqBzB;AACD;AACA;AACCN,EAAAA,aAAa,EAAE5B,SAAS,CAACmC,IAxBA;;AAyBzB;AACD;AACA;AACCE,EAAAA,QAAQ,EAAErC,SAAS,CAACgC,MA5BK;;AA6BzB;AACD;AACA;AACCb,EAAAA,KAAK,EAAEnB,SAAS,CAACgC,MAhCQ;;AAiCzB;AACD;AACA;AACCN,EAAAA,KAAK,EAAE1B,SAAS,CAACgC;AApCQ,CAA1B;AAuCA,eAAe1B,aAAf","sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// ### React\nimport React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\n\n// ### classNames\nimport classNames from 'classnames';\n\nimport CellContext from './private/cell-context';\nimport TableContext from './private/table-context';\nimport useContextHelper from './private/context-helper';\n\n// ## Constants\nimport { DATA_TABLE_CELL } from '../../utilities/constants';\n\n/**\n * The default Cell renderer for the DataTable. Pass in any React component with the same `displayName` which takes the same props to provide custom rendering.\n */\nconst DataTableCell = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = useContext(CellContext);\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\tconst childText = React.isValidElement(props.children)\n\t\t? props.children.props.children\n\t\t: props.children;\n\tconst contents = (\n\t\t<div\n\t\t\tclassName={classNames({\n\t\t\t\t'slds-truncate': props.fixedLayout,\n\t\t\t})}\n\t\t\ttitle={props.title || childText}\n\t\t>\n\t\t\t{props.children}\n\t\t</div>\n\t);\n\n\tconst className = classNames(props.className, {\n\t\t'slds-has-focus': hasFocus,\n\t});\n\tconst ref = (node) => {\n\t\tif (node && hasFocus) {\n\t\t\tnode.focus();\n\t\t}\n\t};\n\tlet cell = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t<td\n\t\t\tclassName={className}\n\t\t\tdata-label={props.label}\n\t\t\tonFocus={handleFocus}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tref={ref}\n\t\t\trole={props.fixedLayout ? 'gridcell' : null}\n\t\t\tstyle={props.width ? { width: props.width } : null}\n\t\t\ttabIndex={tabIndex}\n\t\t\theaders={props.headerId}\n\t\t>\n\t\t\t{contents}\n\t\t</td>\n\t);\n\n\tif (props.primaryColumn) {\n\t\tcell = (\n\t\t\t<th\n\t\t\t\tclassName={className}\n\t\t\t\tref={ref}\n\t\t\t\tdata-label={props.label}\n\t\t\t\trole={props.fixedLayout ? 'gridcell' : null}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\tstyle={props.width ? { width: props.width } : null}\n\t\t\t\tonFocus={handleFocus}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t>\n\t\t\t\t{contents}\n\t\t\t</th>\n\t\t);\n\t}\n\n\treturn cell;\n};\n\n// ### Display Name\n// Always use the canonical component name as the React display name.\nDataTableCell.displayName = DATA_TABLE_CELL;\n\n// ### Prop Types\nDataTableCell.propTypes = {\n\t/**\n\t * The contents of the cell. This can be simple text or DOM nodes. Equivalent to `props.item[props.property]`\n\t */\n\tchildren: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),\n\t/**\n\t * Class names to be added to the cell.\n\t */\n\tclassName: PropTypes.oneOfType([\n\t\tPropTypes.array,\n\t\tPropTypes.object,\n\t\tPropTypes.string,\n\t]),\n\t/**\n\t * Use this if you are creating an advanced table (selectable, sortable, or resizable rows)\n\t */\n\tfixedLayout: PropTypes.bool,\n\t/**\n\t * The item from the items which represents this row.\n\t */\n\titem: PropTypes.object,\n\t/**\n\t * The primary column for a row. This is almost always the first column.\n\t */\n\tprimaryColumn: PropTypes.bool,\n\t/**\n\t * The property of this item to display.\n\t */\n\tproperty: PropTypes.string,\n\t/**\n\t * Shows on hover. Useful for truncated cells.\n\t */\n\ttitle: PropTypes.string,\n\t/**\n\t * Width of column. This is required for advanced/fixed layout tables. Please provide units. (`rems` are recommended)\n\t */\n\twidth: PropTypes.string,\n};\n\nexport default DataTableCell;\n"],"file":"cell.js"}
|
|
@@ -2,10 +2,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
6
|
|
|
11
7
|
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."); }
|
|
@@ -14,10 +10,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
|
|
|
14
10
|
|
|
15
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
12
|
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
21
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
22
14
|
|
|
23
15
|
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."); }
|
|
@@ -50,6 +42,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
50
42
|
|
|
51
43
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
52
44
|
|
|
45
|
+
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; }
|
|
46
|
+
|
|
47
|
+
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; }
|
|
48
|
+
|
|
49
|
+
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; }
|
|
50
|
+
|
|
51
|
+
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; }
|
|
52
|
+
|
|
53
53
|
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; }
|
|
54
54
|
|
|
55
55
|
/* eslint-disable max-lines */
|
|
@@ -67,6 +67,8 @@ import PropTypes from 'prop-types'; // ### shortid
|
|
|
67
67
|
import shortid from 'shortid';
|
|
68
68
|
import classNames from 'classnames';
|
|
69
69
|
import assign from 'lodash.assign';
|
|
70
|
+
import isEqual from 'lodash.isequal';
|
|
71
|
+
import memoize from 'memoize-one';
|
|
70
72
|
import reject from 'lodash.reject'; // This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
|
|
71
73
|
|
|
72
74
|
import ColumnResizer from 'column-resizer';
|
|
@@ -112,6 +114,86 @@ var defaultProps = {
|
|
|
112
114
|
draggingClass: 'slds-table-column-resizer'
|
|
113
115
|
}
|
|
114
116
|
};
|
|
117
|
+
var getAssistiveText = memoize(function (assistiveText, actionsHeaderText, columnSortText, columnSortedAscendingText, columnSortedDescendingText, selectAllRowsText, selectRowText) {
|
|
118
|
+
var result = _objectSpread(_objectSpread({}, defaultProps.assistiveText), assistiveText);
|
|
119
|
+
|
|
120
|
+
if (actionsHeaderText) {
|
|
121
|
+
result.actionsHeader = actionsHeaderText;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (selectAllRowsText) {
|
|
125
|
+
result.selectAllRows = selectAllRowsText;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (columnSortedAscendingText) {
|
|
129
|
+
result.columnSortedAscending = columnSortedAscendingText;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (columnSortedDescendingText) {
|
|
133
|
+
result.columnSortedDescending = columnSortedDescendingText;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (columnSortText) {
|
|
137
|
+
result.columnSort = columnSortText;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (selectRowText) {
|
|
141
|
+
result.selectRow = selectRowText;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return result;
|
|
145
|
+
}, isEqual);
|
|
146
|
+
var getColumnsAndRowActions = memoize(function (children, id, fixedHeader, fixedLayout, items, search) {
|
|
147
|
+
var columns = [];
|
|
148
|
+
var RowActions = null;
|
|
149
|
+
React.Children.forEach(children, function (child) {
|
|
150
|
+
if (child && child.type.displayName === DataTableColumn.displayName) {
|
|
151
|
+
var _child$props = child.props,
|
|
152
|
+
columnChildren = _child$props.children,
|
|
153
|
+
columnProps = _objectWithoutProperties(_child$props, ["children"]);
|
|
154
|
+
|
|
155
|
+
var props = _objectSpread({
|
|
156
|
+
fixedLayout: fixedLayout,
|
|
157
|
+
search: search,
|
|
158
|
+
items: items
|
|
159
|
+
}, columnProps);
|
|
160
|
+
|
|
161
|
+
if (id) {
|
|
162
|
+
props.id = id;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
var Cell;
|
|
166
|
+
|
|
167
|
+
if (columnChildren && columnChildren.type.displayName === DATA_TABLE_CELL) {
|
|
168
|
+
Cell = columnChildren.type;
|
|
169
|
+
assign(props, columnChildren.props);
|
|
170
|
+
} else {
|
|
171
|
+
Cell = DataTableCell;
|
|
172
|
+
} // eslint-disable-next-line fp/no-mutating-methods
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
columns.push({
|
|
176
|
+
Cell: Cell,
|
|
177
|
+
props: props
|
|
178
|
+
});
|
|
179
|
+
} else if (child && child.type.displayName === DataTableRowActions.displayName) {
|
|
180
|
+
var dropdown = child.props.dropdown;
|
|
181
|
+
var dropdownPropOverrides = {};
|
|
182
|
+
|
|
183
|
+
if (fixedHeader) {
|
|
184
|
+
dropdownPropOverrides.menuPosition = 'overflowBoundaryElement';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
RowActions = /*#__PURE__*/React.cloneElement(child, {
|
|
188
|
+
dropdown: dropdown ? /*#__PURE__*/React.cloneElement(dropdown, dropdownPropOverrides) : null
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return {
|
|
193
|
+
columns: columns,
|
|
194
|
+
RowActions: RowActions
|
|
195
|
+
};
|
|
196
|
+
}, isEqual);
|
|
115
197
|
/**
|
|
116
198
|
* 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.
|
|
117
199
|
*
|
|
@@ -133,6 +215,27 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
133
215
|
|
|
134
216
|
_this = _super.call(this, props);
|
|
135
217
|
|
|
218
|
+
_defineProperty(_assertThisInitialized(_this), "getTableContext", memoize(function (state, isKeyboardNavigation) {
|
|
219
|
+
return {
|
|
220
|
+
activeCell: state.activeCell,
|
|
221
|
+
activeElement: state.activeElement,
|
|
222
|
+
mode: state.mode,
|
|
223
|
+
tableHasFocus: state.tableHasFocus,
|
|
224
|
+
changeActiveCell: _this.changeActiveCell,
|
|
225
|
+
changeActiveElement: _this.changeActiveElement,
|
|
226
|
+
handleKeyDown: _this.handleKeyDown,
|
|
227
|
+
registerInteractiveElement: _this.registerInteractiveElement,
|
|
228
|
+
allowKeyboardNavigation: state.allowKeyboardNavigation,
|
|
229
|
+
setAllowKeyboardNavigation: function setAllowKeyboardNavigation(allowKeyboardNavigation) {
|
|
230
|
+
if (isKeyboardNavigation) {
|
|
231
|
+
_this.setState({
|
|
232
|
+
allowKeyboardNavigation: allowKeyboardNavigation
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}));
|
|
238
|
+
|
|
136
239
|
_defineProperty(_assertThisInitialized(_this), "handleToggleAll", function (e, _ref) {
|
|
137
240
|
var checked = _ref.checked;
|
|
138
241
|
|
|
@@ -336,10 +439,6 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
336
439
|
this.loadMoreIfNeeded();
|
|
337
440
|
}
|
|
338
441
|
|
|
339
|
-
if (this.props.items !== prevProps.items) {
|
|
340
|
-
this.interactiveElements = {};
|
|
341
|
-
}
|
|
342
|
-
|
|
343
442
|
if (this.state.allowKeyboardNavigation && !prevState.allowKeyboardNavigation) {
|
|
344
443
|
// When re-enabling keyboard navigation (e.g. when a dropdown closes), mark that
|
|
345
444
|
// focus has returned to the table. This must wait until after `allowKeyboardNavigation`
|
|
@@ -416,6 +515,14 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
416
515
|
|
|
417
516
|
return null;
|
|
418
517
|
}
|
|
518
|
+
}, {
|
|
519
|
+
key: "UNSAFE_componentWillUpdate",
|
|
520
|
+
value: // eslint-disable-next-line camelcase
|
|
521
|
+
function UNSAFE_componentWillUpdate(nextProps) {
|
|
522
|
+
if (this.props.items !== nextProps.items) {
|
|
523
|
+
this.interactiveElements = {};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
419
526
|
}, {
|
|
420
527
|
key: "isResizable",
|
|
421
528
|
value: function isResizable() {
|
|
@@ -823,72 +930,12 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
823
930
|
var canSelectRows = this.props.selectRows && numNonHeaderRows > 0 ? this.props.selectRows : false;
|
|
824
931
|
var allSelected = canSelectRows && numNonHeaderRows === numSelected;
|
|
825
932
|
var indeterminateSelected = canSelectRows && numNonHeaderRows !== numSelected && numSelected !== 0;
|
|
826
|
-
var columns = [];
|
|
827
|
-
var RowActions = null;
|
|
828
|
-
React.Children.forEach(this.props.children, function (child) {
|
|
829
|
-
if (child && child.type.displayName === DataTableColumn.displayName) {
|
|
830
|
-
var _child$props = child.props,
|
|
831
|
-
children = _child$props.children,
|
|
832
|
-
columnProps = _objectWithoutProperties(_child$props, ["children"]);
|
|
833
|
-
|
|
834
|
-
var props = assign({}, _this4.props); // eslint-disable-next-line fp/no-delete
|
|
835
|
-
|
|
836
|
-
delete props.children;
|
|
837
|
-
assign(props, columnProps);
|
|
838
|
-
var Cell;
|
|
839
|
-
|
|
840
|
-
if (children && children.type.displayName === DATA_TABLE_CELL) {
|
|
841
|
-
Cell = children.type;
|
|
842
|
-
assign(props, children.props);
|
|
843
|
-
} else {
|
|
844
|
-
Cell = DataTableCell;
|
|
845
|
-
} // eslint-disable-next-line fp/no-mutating-methods
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
columns.push({
|
|
849
|
-
Cell: Cell,
|
|
850
|
-
props: props,
|
|
851
|
-
dataTableProps: _this4.props
|
|
852
|
-
});
|
|
853
|
-
} else if (child && child.type.displayName === DataTableRowActions.displayName) {
|
|
854
|
-
var dropdown = child.props.dropdown;
|
|
855
|
-
var dropdownPropOverrides = {};
|
|
856
933
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
934
|
+
var _getColumnsAndRowActi = getColumnsAndRowActions(this.props.children, this.props.id, this.getFixedHeader(), this.props.fixedLayout, this.props.items, this.props.search),
|
|
935
|
+
columns = _getColumnsAndRowActi.columns,
|
|
936
|
+
RowActions = _getColumnsAndRowActi.RowActions;
|
|
860
937
|
|
|
861
|
-
|
|
862
|
-
dropdown: dropdown ? /*#__PURE__*/React.cloneElement(dropdown, dropdownPropOverrides) : null
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
|
|
867
|
-
var assistiveText = _objectSpread(_objectSpread({}, defaultProps.assistiveText), this.props.assistiveText);
|
|
868
|
-
|
|
869
|
-
if (this.props.assistiveTextForActionsHeader) {
|
|
870
|
-
assistiveText.actionsHeader = this.props.assistiveTextForActionsHeader;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
if (this.props.assistiveTextForSelectAllRows) {
|
|
874
|
-
assistiveText.selectAllRows = this.props.assistiveTextForSelectAllRows;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
if (this.props.assistiveTextForColumnSortedAscending) {
|
|
878
|
-
assistiveText.columnSortedAscending = this.props.assistiveTextForColumnSortedAscending;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
if (this.props.assistiveTextForColumnSortedDescending) {
|
|
882
|
-
assistiveText.columnSortedDescending = this.props.assistiveTextForColumnSortedDescending;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (this.props.assistiveTextForColumnSort) {
|
|
886
|
-
assistiveText.columnSort = this.props.assistiveTextForColumnSort;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
if (this.props.assistiveTextForSelectRow) {
|
|
890
|
-
assistiveText.selectRow = this.props.assistiveTextForSelectRow;
|
|
891
|
-
}
|
|
938
|
+
var assistiveText = getAssistiveText(this.props.assistiveText, this.props.assistiveTextForActionsHeader, this.props.assistiveTextForSelectAllRows, this.props.assistiveTextForColumnSortedAscending, this.props.assistiveTextForColumnSortedDescending, this.props.assistiveTextForColumnSort, this.props.assistiveTextForSelectRow);
|
|
892
939
|
|
|
893
940
|
if (this.props.selectRows && this.props.selectRows !== 'radio') {
|
|
894
941
|
ariaProps['aria-multiselectable'] = 'true';
|
|
@@ -900,26 +947,8 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
900
947
|
column: this.headerRefs.column.slice(0, columns.length),
|
|
901
948
|
select: canSelectRows ? this.headerRefs.select : []
|
|
902
949
|
};
|
|
903
|
-
var tableContext = {
|
|
904
|
-
activeCell: this.state.activeCell,
|
|
905
|
-
activeElement: this.state.activeElement,
|
|
906
|
-
mode: this.state.mode,
|
|
907
|
-
tableHasFocus: this.state.tableHasFocus,
|
|
908
|
-
changeActiveCell: this.changeActiveCell,
|
|
909
|
-
changeActiveElement: this.changeActiveElement,
|
|
910
|
-
handleKeyDown: this.handleKeyDown,
|
|
911
|
-
registerInteractiveElement: this.registerInteractiveElement,
|
|
912
|
-
allowKeyboardNavigation: this.state.allowKeyboardNavigation,
|
|
913
|
-
setAllowKeyboardNavigation: function setAllowKeyboardNavigation(allowKeyboardNavigation) {
|
|
914
|
-
if (_this4.getKeyboardNavigation()) {
|
|
915
|
-
_this4.setState({
|
|
916
|
-
allowKeyboardNavigation: allowKeyboardNavigation
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
950
|
var component = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
922
|
-
value:
|
|
951
|
+
value: this.getTableContext(this.state, this.getKeyboardNavigation())
|
|
923
952
|
}, /*#__PURE__*/React.createElement("table", _extends({}, ariaProps, {
|
|
924
953
|
className: classNames('slds-table', {
|
|
925
954
|
'slds-table_fixed-layout': this.getFixedLayout(),
|