@salesforce/design-system-react 0.10.41 → 0.10.45
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.jsx +4 -1
- package/components/component-docs.json +13 -38
- package/components/data-table/cell.jsx +2 -2
- package/components/data-table/index.jsx +130 -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/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/components/icon/__examples__/color-success.jsx +24 -0
- package/components/icon/__examples__/colors.jsx +10 -2
- package/components/icon/index.jsx +2 -0
- package/components/icon.d.ts +1 -1
- package/components/site-stories.js +8 -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.js +6 -2
- package/lib/components/component-docs.json +13 -38
- package/lib/components/data-table/cell.js +6 -6
- package/lib/components/data-table/index.js +127 -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/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/lib/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/lib/components/icon/__examples__/color-success.jsx +24 -0
- package/lib/components/icon/__examples__/colors.jsx +10 -2
- package/lib/components/icon/index.js +2 -1
- package/lib/components/icon.d.ts +1 -1
- package/lib/components/site-stories.js +6 -3
- package/lib/components/utilities/truncate/index.js +2 -2
- package/lib/package.json +13 -9
- 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.js +6 -2
- package/module/components/combobox/combobox.js.map +1 -1
- package/module/components/component-docs.json +13 -38
- 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 +120 -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/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/module/components/icon/__docs__/storybook-stories.js +3 -0
- package/module/components/icon/__docs__/storybook-stories.js.map +1 -1
- package/module/components/icon/__examples__/color-success.js +64 -0
- package/module/components/icon/__examples__/color-success.js.map +1 -0
- package/module/components/icon/__examples__/colors.js +11 -2
- package/module/components/icon/__examples__/colors.js.map +1 -1
- package/module/components/icon/index.js +2 -1
- package/module/components/icon/index.js.map +1 -1
- package/module/components/icon.d.ts +1 -1
- package/module/components/site-stories.js +6 -3
- package/module/components/site-stories.js.map +1 -1
- package/module/components/utilities/truncate/index.js +1 -1
- package/module/components/utilities/truncate/index.js.map +1 -1
- package/package.json +13 -9
- 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",
|
|
@@ -9534,6 +9505,10 @@
|
|
|
9534
9505
|
{
|
|
9535
9506
|
"value": "'warning'",
|
|
9536
9507
|
"computed": false
|
|
9508
|
+
},
|
|
9509
|
+
{
|
|
9510
|
+
"value": "'success'",
|
|
9511
|
+
"computed": false
|
|
9537
9512
|
}
|
|
9538
9513
|
]
|
|
9539
9514
|
},
|
|
@@ -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,C,CAEA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,WAAP,MAAwB,wBAAxB;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AACA,OAAOC,gBAAP,MAA6B,0BAA7B,C,CAEA;;AACA,SAASC,eAAT,QAAgC,2BAAhC;AAEA;AACA;AACA;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAW;AAChC,MAAMC,YAAY,GAAGT,UAAU,CAACI,YAAD,CAA/B;AACA,MAAMM,WAAW,GAAGV,UAAU,CAACG,WAAD,CAA9B;;AACA,0BAA2DE,gBAAgB,CAC1EI,YAD0E,EAE1EC,WAF0E,EAG1EF,KAAK,CAACG,WAHoE,CAA3E;AAAA,MAAQC,QAAR,qBAAQA,QAAR;AAAA,MAAkBC,QAAlB,qBAAkBA,QAAlB;AAAA,MAA4BC,WAA5B,qBAA4BA,WAA5B;AAAA,MAAyCC,aAAzC,qBAAyCA,aAAzC;;AAKA,MAAMC,SAAS,GAAG,aAAAjB,KAAK,CAACkB,cAAN,CAAqBT,KAAK,CAACU,QAA3B,IACfV,KAAK,CAACU,QAAN,CAAeV,KAAf,CAAqBU,QADN,GAEfV,KAAK,CAACU,QAFT;AAGA,MAAMC,QAAQ,gBACb;AACC,IAAA,SAAS,EAAEjB,UAAU,CAAC;AACrB,uBAAiBM,KAAK,CAACG;AADF,KAAD,CADtB;AAIC,IAAA,KAAK,EAAEH,KAAK,CAACY,KAAN,IAAeJ;AAJvB,KAMER,KAAK,CAACU,QANR,CADD;AAWA,MAAMG,SAAS,GAAGnB,UAAU,CAACM,KAAK,CAACa,SAAP,EAAkB;AAC7C,sBAAkBR;AAD2B,GAAlB,CAA5B;;AAGA,MAAMS,GAAG,GAAG,SAANA,GAAM,CAACC,IAAD,EAAU;AACrB,QAAIA,IAAI,IAAIV,QAAZ,EAAsB;AACrBU,MAAAA,IAAI,CAACC,KAAL;AACA;AACD,GAJD;;AAKA,MAAIC,IAAI;AAAA;AACP;AACA;AACC,IAAA,SAAS,EAAEJ,SADZ;AAEC,kBAAYb,KAAK,CAACkB,KAFnB;AAGC,IAAA,OAAO,EAAEZ,WAHV;AAIC,IAAA,SAAS,EAAEC,aAJZ;AAKC,IAAA,GAAG,EAAEO,GALN;AAMC,IAAA,IAAI,EAAEd,KAAK,CAACG,WAAN,GAAoB,UAApB,GAAiC,IANxC;AAOC,IAAA,KAAK,EAAEH,KAAK,CAACmB,KAAN,GAAc;AAAEA,MAAAA,KAAK,EAAEnB,KAAK,CAACmB;AAAf,KAAd,GAAuC,IAP/C;AAQC,IAAA,QAAQ,EAAEf,QARX;AASC,IAAA,OAAO,EAAEJ,KAAK,CAACoB;AAThB,KAWET,QAXF,CAFD;;AAiBA,MAAIX,KAAK,CAACqB,aAAV,EAAyB;AACxBJ,IAAAA,IAAI,gBACH;AACC,MAAA,SAAS,EAAEJ,SADZ;AAEC,MAAA,GAAG,EAAEC,GAFN;AAGC,oBAAYd,KAAK,CAACkB,KAHnB;AAIC,MAAA,IAAI,EAAElB,KAAK,CAACG,WAAN,GAAoB,UAApB,GAAiC,IAJxC;AAKC,MAAA,QAAQ,EAAEC,QALX;AAMC,MAAA,KAAK,EAAEJ,KAAK,CAACmB,KAAN,GAAc;AAAEA,QAAAA,KAAK,EAAEnB,KAAK,CAACmB;AAAf,OAAd,GAAuC,IAN/C;AAOC,MAAA,OAAO,EAAEb,WAPV;AAQC,MAAA,SAAS,EAAEC;AARZ,OAUEI,QAVF,CADD;AAcA;;AAED,SAAOM,IAAP;AACA,CAjED,C,CAmEA;AACA;;;AACAlB,aAAa,CAACuB,WAAd,GAA4BxB,eAA5B,C,CAEA;;AACAC,aAAa,CAACwB,SAAd,GAA0B;AACzB;AACD;AACA;AACCb,EAAAA,QAAQ,EAAEjB,SAAS,CAAC+B,SAAV,CAAoB,CAAC/B,SAAS,CAACsB,IAAX,EAAiBtB,SAAS,CAACgC,MAA3B,CAApB,CAJe;;AAKzB;AACD;AACA;AACCZ,EAAAA,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,82 @@ 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, 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
|
+
id: id
|
|
159
|
+
}, columnProps);
|
|
160
|
+
|
|
161
|
+
var Cell;
|
|
162
|
+
|
|
163
|
+
if (columnChildren && columnChildren.type.displayName === DATA_TABLE_CELL) {
|
|
164
|
+
Cell = columnChildren.type;
|
|
165
|
+
assign(props, columnChildren.props);
|
|
166
|
+
} else {
|
|
167
|
+
Cell = DataTableCell;
|
|
168
|
+
} // eslint-disable-next-line fp/no-mutating-methods
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
columns.push({
|
|
172
|
+
Cell: Cell,
|
|
173
|
+
props: props
|
|
174
|
+
});
|
|
175
|
+
} else if (child && child.type.displayName === DataTableRowActions.displayName) {
|
|
176
|
+
var dropdown = child.props.dropdown;
|
|
177
|
+
var dropdownPropOverrides = {};
|
|
178
|
+
|
|
179
|
+
if (fixedHeader) {
|
|
180
|
+
dropdownPropOverrides.menuPosition = 'overflowBoundaryElement';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
RowActions = /*#__PURE__*/React.cloneElement(child, {
|
|
184
|
+
dropdown: dropdown ? /*#__PURE__*/React.cloneElement(dropdown, dropdownPropOverrides) : null
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
columns: columns,
|
|
190
|
+
RowActions: RowActions
|
|
191
|
+
};
|
|
192
|
+
}, isEqual);
|
|
115
193
|
/**
|
|
116
194
|
* 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
195
|
*
|
|
@@ -133,6 +211,27 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
133
211
|
|
|
134
212
|
_this = _super.call(this, props);
|
|
135
213
|
|
|
214
|
+
_defineProperty(_assertThisInitialized(_this), "getTableContext", memoize(function (state, isKeyboardNavigation) {
|
|
215
|
+
return {
|
|
216
|
+
activeCell: state.activeCell,
|
|
217
|
+
activeElement: state.activeElement,
|
|
218
|
+
mode: state.mode,
|
|
219
|
+
tableHasFocus: state.tableHasFocus,
|
|
220
|
+
changeActiveCell: _this.changeActiveCell,
|
|
221
|
+
changeActiveElement: _this.changeActiveElement,
|
|
222
|
+
handleKeyDown: _this.handleKeyDown,
|
|
223
|
+
registerInteractiveElement: _this.registerInteractiveElement,
|
|
224
|
+
allowKeyboardNavigation: state.allowKeyboardNavigation,
|
|
225
|
+
setAllowKeyboardNavigation: function setAllowKeyboardNavigation(allowKeyboardNavigation) {
|
|
226
|
+
if (isKeyboardNavigation) {
|
|
227
|
+
_this.setState({
|
|
228
|
+
allowKeyboardNavigation: allowKeyboardNavigation
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}));
|
|
234
|
+
|
|
136
235
|
_defineProperty(_assertThisInitialized(_this), "handleToggleAll", function (e, _ref) {
|
|
137
236
|
var checked = _ref.checked;
|
|
138
237
|
|
|
@@ -336,10 +435,6 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
336
435
|
this.loadMoreIfNeeded();
|
|
337
436
|
}
|
|
338
437
|
|
|
339
|
-
if (this.props.items !== prevProps.items) {
|
|
340
|
-
this.interactiveElements = {};
|
|
341
|
-
}
|
|
342
|
-
|
|
343
438
|
if (this.state.allowKeyboardNavigation && !prevState.allowKeyboardNavigation) {
|
|
344
439
|
// When re-enabling keyboard navigation (e.g. when a dropdown closes), mark that
|
|
345
440
|
// focus has returned to the table. This must wait until after `allowKeyboardNavigation`
|
|
@@ -416,6 +511,14 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
416
511
|
|
|
417
512
|
return null;
|
|
418
513
|
}
|
|
514
|
+
}, {
|
|
515
|
+
key: "UNSAFE_componentWillUpdate",
|
|
516
|
+
value: // eslint-disable-next-line camelcase
|
|
517
|
+
function UNSAFE_componentWillUpdate(nextProps) {
|
|
518
|
+
if (this.props.items !== nextProps.items) {
|
|
519
|
+
this.interactiveElements = {};
|
|
520
|
+
}
|
|
521
|
+
}
|
|
419
522
|
}, {
|
|
420
523
|
key: "isResizable",
|
|
421
524
|
value: function isResizable() {
|
|
@@ -823,72 +926,12 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
823
926
|
var canSelectRows = this.props.selectRows && numNonHeaderRows > 0 ? this.props.selectRows : false;
|
|
824
927
|
var allSelected = canSelectRows && numNonHeaderRows === numSelected;
|
|
825
928
|
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
|
-
|
|
857
|
-
if (_this4.getFixedHeader()) {
|
|
858
|
-
dropdownPropOverrides.menuPosition = 'overflowBoundaryElement';
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
RowActions = /*#__PURE__*/React.cloneElement(child, {
|
|
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
929
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
930
|
+
var _getColumnsAndRowActi = getColumnsAndRowActions(this.props.children, this.props.id, this.getFixedHeader(), this.props.fixedLayout, this.props.search),
|
|
931
|
+
columns = _getColumnsAndRowActi.columns,
|
|
932
|
+
RowActions = _getColumnsAndRowActi.RowActions;
|
|
888
933
|
|
|
889
|
-
|
|
890
|
-
assistiveText.selectRow = this.props.assistiveTextForSelectRow;
|
|
891
|
-
}
|
|
934
|
+
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
935
|
|
|
893
936
|
if (this.props.selectRows && this.props.selectRows !== 'radio') {
|
|
894
937
|
ariaProps['aria-multiselectable'] = 'true';
|
|
@@ -900,26 +943,8 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
900
943
|
column: this.headerRefs.column.slice(0, columns.length),
|
|
901
944
|
select: canSelectRows ? this.headerRefs.select : []
|
|
902
945
|
};
|
|
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
946
|
var component = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
922
|
-
value:
|
|
947
|
+
value: this.getTableContext(this.state, this.getKeyboardNavigation())
|
|
923
948
|
}, /*#__PURE__*/React.createElement("table", _extends({}, ariaProps, {
|
|
924
949
|
className: classNames('slds-table', {
|
|
925
950
|
'slds-table_fixed-layout': this.getFixedLayout(),
|