@salesforce/design-system-react 0.10.35 → 0.10.39
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/assets/styles/table.css +70 -0
- package/components/builder-header/utilities.d.ts +20 -0
- package/components/card/__docs__/__snapshots__/storybook-stories.storyshot +20 -5
- package/components/combobox/__docs__/__snapshots__/storybook-stories.storyshot +178 -169
- package/components/combobox/__tests__/combobox.browser-test.jsx +4 -5
- package/components/combobox/combobox.jsx +20 -18
- package/components/component-docs.json +160 -0
- package/components/data-table/__docs__/__snapshots__/storybook-stories.storyshot +17997 -11862
- package/components/data-table/__docs__/storybook-stories.jsx +5 -1
- package/components/data-table/__examples__/advanced-single-select-fixed-header.jsx +1 -0
- package/components/data-table/__examples__/basic-fluid-headless.jsx +105 -0
- package/components/data-table/__examples__/interactive-elements.jsx +14 -0
- package/components/data-table/__examples__/joined-with-page-header.jsx +11 -18
- package/components/data-table/__examples__/resizable-columns.jsx +237 -0
- package/components/data-table/__tests__/data-table.browser-test.jsx +133 -0
- package/components/data-table/column.resizer.d.ts +1 -0
- package/components/data-table/component.json +11 -7
- package/components/data-table/index.jsx +431 -80
- package/components/data-table/private/head.jsx +8 -3
- package/components/data-table/private/header-cell.jsx +9 -1
- package/components/data-table.d.ts +8 -0
- package/components/date-picker/__tests__/__snapshots__/datepicker.dom-snapshot-test.jsx.snap +17 -17
- package/components/expression/__docs__/__snapshots__/storybook-stories.storyshot +90 -90
- package/components/global-header/__docs__/__snapshots__/storybook-stories.storyshot +9 -9
- package/components/index.d.ts +2 -0
- package/components/menu-dropdown/__docs__/__snapshots__/storybook-stories.storyshot +552 -26
- package/components/menu-dropdown/__docs__/storybook-stories.jsx +4 -16
- package/components/menu-dropdown/__examples__/checkmark.jsx +48 -31
- package/components/menu-dropdown/__tests__/dropdown.browser-test.jsx +12 -7
- package/components/modal/__tests__/modal.browser-test.jsx +4 -10
- package/components/portal-settings/__docs__/__snapshots__/storybook-stories.storyshot +6 -6
- package/components/progress-indicator/__docs__/__snapshots__/storybook-stories.storyshot +161 -14
- package/components/progress-indicator/private/step-vertical.jsx +28 -2
- package/components/setup-assistant/__docs__/__snapshots__/storybook-stories.storyshot +180 -13
- package/components/site-stories.js +16 -4
- package/components/utilities/menu-list/index.jsx +3 -0
- package/components/utilities/menu-list/item.jsx +5 -2
- package/components/vertical-navigation/__docs__/__snapshots__/storybook-stories.storyshot +326 -0
- package/components/vertical-navigation/__docs__/storybook-stories.jsx +4 -0
- package/components/vertical-navigation/__examples__/icons.jsx +70 -0
- package/components/vertical-navigation/__examples__/notifications.jsx +66 -0
- package/components/vertical-navigation/component.json +8 -0
- package/components/vertical-navigation/private/item.d.ts +2 -0
- package/components/vertical-navigation/private/item.jsx +23 -1
- package/docs/PULL_REQUEST_TEMPLATE.md +1 -1
- package/lib/assets/styles/table.css +70 -0
- package/lib/components/builder-header/utilities.d.ts +20 -0
- package/lib/components/card/__docs__/__snapshots__/storybook-stories.storyshot +20 -5
- package/lib/components/combobox/__docs__/__snapshots__/storybook-stories.storyshot +178 -169
- package/lib/components/combobox/__tests__/combobox.browser-test.jsx +4 -5
- package/lib/components/combobox/combobox.js +27 -23
- package/lib/components/component-docs.json +160 -0
- package/lib/components/data-table/__docs__/__snapshots__/storybook-stories.storyshot +17997 -11862
- package/lib/components/data-table/__docs__/storybook-stories.jsx +5 -1
- package/lib/components/data-table/__examples__/advanced-single-select-fixed-header.jsx +1 -0
- package/lib/components/data-table/__examples__/basic-fluid-headless.jsx +105 -0
- package/lib/components/data-table/__examples__/interactive-elements.jsx +14 -0
- package/lib/components/data-table/__examples__/joined-with-page-header.jsx +11 -18
- package/lib/components/data-table/__examples__/resizable-columns.jsx +237 -0
- package/lib/components/data-table/__tests__/data-table.browser-test.jsx +133 -0
- package/lib/components/data-table/column.resizer.d.ts +1 -0
- package/lib/components/data-table/component.json +11 -7
- package/lib/components/data-table/index.js +444 -107
- package/lib/components/data-table/private/head.js +8 -3
- package/lib/components/data-table/private/header-cell.js +3 -1
- package/lib/components/data-table.d.ts +8 -0
- package/lib/components/date-picker/__tests__/__snapshots__/datepicker.dom-snapshot-test.jsx.snap +17 -17
- package/lib/components/expression/__docs__/__snapshots__/storybook-stories.storyshot +90 -90
- package/lib/components/global-header/__docs__/__snapshots__/storybook-stories.storyshot +9 -9
- package/lib/components/index.d.ts +2 -0
- package/lib/components/menu-dropdown/__docs__/__snapshots__/storybook-stories.storyshot +552 -26
- package/lib/components/menu-dropdown/__docs__/storybook-stories.jsx +4 -16
- package/lib/components/menu-dropdown/__examples__/checkmark.jsx +48 -31
- package/lib/components/menu-dropdown/__tests__/dropdown.browser-test.jsx +12 -7
- package/lib/components/modal/__tests__/modal.browser-test.jsx +4 -10
- package/lib/components/portal-settings/__docs__/__snapshots__/storybook-stories.storyshot +6 -6
- package/lib/components/progress-indicator/__docs__/__snapshots__/storybook-stories.storyshot +161 -14
- package/lib/components/progress-indicator/private/step-vertical.js +18 -4
- package/lib/components/setup-assistant/__docs__/__snapshots__/storybook-stories.storyshot +180 -13
- package/lib/components/site-stories.js +12 -3
- package/lib/components/utilities/menu-list/index.js +5 -2
- package/lib/components/utilities/menu-list/item.js +3 -2
- package/lib/components/vertical-navigation/__docs__/__snapshots__/storybook-stories.storyshot +326 -0
- package/lib/components/vertical-navigation/__docs__/storybook-stories.jsx +4 -0
- package/lib/components/vertical-navigation/__examples__/icons.jsx +70 -0
- package/lib/components/vertical-navigation/__examples__/notifications.jsx +66 -0
- package/lib/components/vertical-navigation/component.json +8 -0
- package/lib/components/vertical-navigation/private/item.d.ts +2 -0
- package/lib/components/vertical-navigation/private/item.js +5 -1
- package/lib/docs/PULL_REQUEST_TEMPLATE.md +1 -1
- package/lib/package.json +19 -6
- package/module/assets/styles/table.css +70 -0
- package/module/components/builder-header/utilities.d.ts +20 -0
- package/module/components/card/__docs__/__snapshots__/storybook-stories.storyshot +20 -5
- package/module/components/combobox/__docs__/__snapshots__/storybook-stories.storyshot +178 -169
- package/module/components/combobox/__tests__/combobox.browser-test.js +5 -6
- package/module/components/combobox/__tests__/combobox.browser-test.js.map +1 -1
- package/module/components/combobox/combobox.js +27 -23
- package/module/components/combobox/combobox.js.map +1 -1
- package/module/components/component-docs.json +160 -0
- package/module/components/data-table/__docs__/__snapshots__/storybook-stories.storyshot +17997 -11862
- package/module/components/data-table/__docs__/storybook-stories.js +6 -0
- package/module/components/data-table/__docs__/storybook-stories.js.map +1 -1
- package/module/components/data-table/__examples__/advanced-single-select-fixed-header.js +1 -0
- package/module/components/data-table/__examples__/advanced-single-select-fixed-header.js.map +1 -1
- package/module/components/data-table/__examples__/basic-fluid-headless.js +152 -0
- package/module/components/data-table/__examples__/basic-fluid-headless.js.map +1 -0
- package/module/components/data-table/__examples__/interactive-elements.js +9 -0
- package/module/components/data-table/__examples__/interactive-elements.js.map +1 -1
- package/module/components/data-table/__examples__/joined-with-page-header.js +9 -20
- package/module/components/data-table/__examples__/joined-with-page-header.js.map +1 -1
- package/module/components/data-table/__examples__/resizable-columns.js +266 -0
- package/module/components/data-table/__examples__/resizable-columns.js.map +1 -0
- package/module/components/data-table/__tests__/data-table.browser-test.js +99 -0
- package/module/components/data-table/__tests__/data-table.browser-test.js.map +1 -1
- package/module/components/data-table/column.resizer.d.ts +1 -0
- package/module/components/data-table/component.json +11 -7
- package/module/components/data-table/index.js +443 -107
- package/module/components/data-table/index.js.map +1 -1
- package/module/components/data-table/private/head.js +8 -3
- package/module/components/data-table/private/head.js.map +1 -1
- package/module/components/data-table/private/header-cell.js +3 -1
- package/module/components/data-table/private/header-cell.js.map +1 -1
- package/module/components/data-table.d.ts +8 -0
- package/module/components/date-picker/__tests__/__snapshots__/datepicker.dom-snapshot-test.jsx.snap +17 -17
- package/module/components/expression/__docs__/__snapshots__/storybook-stories.storyshot +90 -90
- package/module/components/global-header/__docs__/__snapshots__/storybook-stories.storyshot +9 -9
- package/module/components/index.d.ts +2 -0
- package/module/components/menu-dropdown/__docs__/__snapshots__/storybook-stories.storyshot +552 -26
- package/module/components/menu-dropdown/__docs__/storybook-stories.js +9 -15
- package/module/components/menu-dropdown/__docs__/storybook-stories.js.map +1 -1
- package/module/components/menu-dropdown/__examples__/checkmark.js +53 -33
- package/module/components/menu-dropdown/__examples__/checkmark.js.map +1 -1
- package/module/components/menu-dropdown/__tests__/dropdown.browser-test.js +7 -4
- package/module/components/menu-dropdown/__tests__/dropdown.browser-test.js.map +1 -1
- package/module/components/modal/__tests__/modal.browser-test.js +4 -10
- package/module/components/modal/__tests__/modal.browser-test.js.map +1 -1
- package/module/components/portal-settings/__docs__/__snapshots__/storybook-stories.storyshot +6 -6
- package/module/components/progress-indicator/__docs__/__snapshots__/storybook-stories.storyshot +161 -14
- package/module/components/progress-indicator/private/step-vertical.js +18 -4
- package/module/components/progress-indicator/private/step-vertical.js.map +1 -1
- package/module/components/setup-assistant/__docs__/__snapshots__/storybook-stories.storyshot +180 -13
- package/module/components/site-stories.js +12 -3
- package/module/components/site-stories.js.map +1 -1
- package/module/components/utilities/menu-list/index.js +5 -2
- package/module/components/utilities/menu-list/index.js.map +1 -1
- package/module/components/utilities/menu-list/item.js +3 -2
- package/module/components/utilities/menu-list/item.js.map +1 -1
- package/module/components/vertical-navigation/__docs__/__snapshots__/storybook-stories.storyshot +326 -0
- package/module/components/vertical-navigation/__docs__/storybook-stories.js +10 -0
- package/module/components/vertical-navigation/__docs__/storybook-stories.js.map +1 -1
- package/module/components/vertical-navigation/__examples__/icons.js +149 -0
- package/module/components/vertical-navigation/__examples__/icons.js.map +1 -0
- package/module/components/vertical-navigation/__examples__/notifications.js +143 -0
- package/module/components/vertical-navigation/__examples__/notifications.js.map +1 -0
- package/module/components/vertical-navigation/component.json +8 -0
- package/module/components/vertical-navigation/private/item.d.ts +2 -0
- package/module/components/vertical-navigation/private/item.js +5 -1
- package/module/components/vertical-navigation/private/item.js.map +1 -1
- package/package.json +19 -6
- package/design-system-react-components.js +0 -62702
- package/design-system-react-components.js.map +0 -1
- package/design-system-react-components.min.js +0 -3
- package/design-system-react-components.min.js.LICENSE.txt +0 -83
- package/design-system-react-components.min.js.map +0 -1
- package/design-system-react.js +0 -73487
- package/design-system-react.js.map +0 -1
- package/design-system-react.min.js +0 -3
- package/design-system-react.min.js.LICENSE.txt +0 -83
- package/design-system-react.min.js.map +0 -1
- package/lib/design-system-react-components.min.js.LICENSE.txt +0 -83
- package/lib/design-system-react.min.js.LICENSE.txt +0 -83
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import DataTable from "../../../../components/data-table"; // `~` is replaced with design-system-react at runtime
|
|
31
|
+
|
|
32
|
+
import DataTableColumn from "../../../../components/data-table/column";
|
|
33
|
+
import DataTableCell from "../../../../components/data-table/cell";
|
|
34
|
+
import DataTableInteractiveLink from "../../../../components/data-table/interactive-link";
|
|
35
|
+
import IconSettings from "../../../../components/icon-settings";
|
|
36
|
+
|
|
37
|
+
var CustomDataTableCell = function CustomDataTableCell(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
props = _objectWithoutProperties(_ref, ["children"]);
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/React.createElement(DataTableCell, props, /*#__PURE__*/React.createElement(DataTableInteractiveLink, {
|
|
42
|
+
onClick: function onClick(event) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
}
|
|
45
|
+
}, children));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
CustomDataTableCell.displayName = DataTableCell.displayName;
|
|
49
|
+
var columns = [/*#__PURE__*/React.createElement(DataTableColumn, {
|
|
50
|
+
key: "opportunity",
|
|
51
|
+
label: "Opportunity Name",
|
|
52
|
+
property: "opportunityName"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(CustomDataTableCell, null)), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
54
|
+
key: "account-name",
|
|
55
|
+
label: "Account Name",
|
|
56
|
+
property: "accountName"
|
|
57
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
58
|
+
key: "close-date",
|
|
59
|
+
label: "Close Date",
|
|
60
|
+
property: "closeDate"
|
|
61
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
62
|
+
key: "stage",
|
|
63
|
+
label: "Stage",
|
|
64
|
+
property: "stage"
|
|
65
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
66
|
+
key: "confidence",
|
|
67
|
+
label: "Confidence",
|
|
68
|
+
property: "confidence"
|
|
69
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
70
|
+
key: "amount",
|
|
71
|
+
label: "Amount",
|
|
72
|
+
property: "amount"
|
|
73
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
74
|
+
key: "contact",
|
|
75
|
+
label: "Contact",
|
|
76
|
+
property: "contact"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(CustomDataTableCell, null))];
|
|
78
|
+
|
|
79
|
+
var Example = /*#__PURE__*/function (_React$Component) {
|
|
80
|
+
_inherits(Example, _React$Component);
|
|
81
|
+
|
|
82
|
+
var _super = _createSuper(Example);
|
|
83
|
+
|
|
84
|
+
function Example() {
|
|
85
|
+
var _this;
|
|
86
|
+
|
|
87
|
+
_classCallCheck(this, Example);
|
|
88
|
+
|
|
89
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
90
|
+
args[_key] = arguments[_key];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
94
|
+
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
96
|
+
sortColumn: 'opportunityName',
|
|
97
|
+
sortColumnDirection: {
|
|
98
|
+
opportunityName: 'asc'
|
|
99
|
+
},
|
|
100
|
+
items: [{
|
|
101
|
+
id: '896a6a60',
|
|
102
|
+
opportunityName: 'Acme - 1,200 Widgets',
|
|
103
|
+
accountName: 'Acme',
|
|
104
|
+
closeDate: '4/10/15',
|
|
105
|
+
stage: 'Value Proposition',
|
|
106
|
+
confidence: '70%',
|
|
107
|
+
amount: '$25,000,000',
|
|
108
|
+
contact: 'jrogers@acme.com'
|
|
109
|
+
}, {
|
|
110
|
+
id: '44da9dcd',
|
|
111
|
+
opportunityName: 'Acme - 200 Widgets',
|
|
112
|
+
accountName: 'Acme',
|
|
113
|
+
closeDate: '1/31/15',
|
|
114
|
+
stage: 'Prospecting',
|
|
115
|
+
confidence: '30%',
|
|
116
|
+
amount: '$5,000,000',
|
|
117
|
+
contact: 'bob@acme.com'
|
|
118
|
+
}, {
|
|
119
|
+
id: 'f988a721',
|
|
120
|
+
opportunityName: 'salesforce.com - 1,000 Widgets',
|
|
121
|
+
accountName: 'salesforce.com',
|
|
122
|
+
closeDate: '1/31/15 3:45PM',
|
|
123
|
+
stage: 'Id. Decision Makers',
|
|
124
|
+
confidence: '60%',
|
|
125
|
+
amount: '$25,000',
|
|
126
|
+
contact: 'nathan@salesforce.com'
|
|
127
|
+
}, {
|
|
128
|
+
id: 'd7679cdd',
|
|
129
|
+
opportunityName: 'Acme - 800 Widgets',
|
|
130
|
+
accountName: 'Acme',
|
|
131
|
+
closeDate: '6/11/18',
|
|
132
|
+
stage: 'Value Proposition',
|
|
133
|
+
confidence: '85%',
|
|
134
|
+
amount: '$970,000',
|
|
135
|
+
contact: 'jrogers@acme.com'
|
|
136
|
+
}, {
|
|
137
|
+
id: '0085f7a0',
|
|
138
|
+
opportunityName: 'Acme - 744 Widgets',
|
|
139
|
+
accountName: 'Acme',
|
|
140
|
+
closeDate: '4/15/17',
|
|
141
|
+
stage: 'Prospecting',
|
|
142
|
+
confidence: '56%',
|
|
143
|
+
amount: '$3,110,000',
|
|
144
|
+
contact: 'bob@acme.com'
|
|
145
|
+
}, {
|
|
146
|
+
id: 'b7acc778',
|
|
147
|
+
opportunityName: 'salesforce.com - 847 Widgets',
|
|
148
|
+
accountName: 'salesforce.com',
|
|
149
|
+
closeDate: '5/23/18 1:02PM',
|
|
150
|
+
stage: 'Id. Decision Makers',
|
|
151
|
+
confidence: '62%',
|
|
152
|
+
amount: '$18,000',
|
|
153
|
+
contact: 'nathan@salesforce.com'
|
|
154
|
+
}, {
|
|
155
|
+
id: '17991de5',
|
|
156
|
+
opportunityName: 'Acme - 1,621 Widgets',
|
|
157
|
+
accountName: 'Acme',
|
|
158
|
+
closeDate: '5/16/17',
|
|
159
|
+
stage: 'Value Proposition',
|
|
160
|
+
confidence: '70%',
|
|
161
|
+
amount: '$23,600,000',
|
|
162
|
+
contact: 'jrogers@acme.com'
|
|
163
|
+
}, {
|
|
164
|
+
id: '09b2cee9',
|
|
165
|
+
opportunityName: 'Acme - 430 Widgets',
|
|
166
|
+
accountName: 'Acme',
|
|
167
|
+
closeDate: '6/12/18',
|
|
168
|
+
stage: 'Prospecting',
|
|
169
|
+
confidence: '42%',
|
|
170
|
+
amount: '$4,222,222',
|
|
171
|
+
contact: 'bob@acme.com'
|
|
172
|
+
}, {
|
|
173
|
+
id: 'd0035700',
|
|
174
|
+
opportunityName: 'salesforce.com - 677 Widgets',
|
|
175
|
+
accountName: 'salesforce.com',
|
|
176
|
+
closeDate: '7/21/17 10:11AM',
|
|
177
|
+
stage: 'Id. Decision Makers',
|
|
178
|
+
confidence: '42%',
|
|
179
|
+
amount: '$24,200',
|
|
180
|
+
contact: 'nathan@salesforce.com'
|
|
181
|
+
}, {
|
|
182
|
+
id: '4a526f0c',
|
|
183
|
+
opportunityName: 'Acme - 1,444 Widgets',
|
|
184
|
+
accountName: 'Acme',
|
|
185
|
+
closeDate: '3/18/18',
|
|
186
|
+
stage: 'Value Proposition',
|
|
187
|
+
confidence: '66%',
|
|
188
|
+
amount: '$22,000,000',
|
|
189
|
+
contact: 'jrogers@acme.com'
|
|
190
|
+
}, {
|
|
191
|
+
id: '9a5dbdb2',
|
|
192
|
+
opportunityName: 'Acme - 320 Widgets',
|
|
193
|
+
accountName: 'Acme',
|
|
194
|
+
closeDate: '1/31/18',
|
|
195
|
+
stage: 'Prospecting',
|
|
196
|
+
confidence: '36%',
|
|
197
|
+
amount: '$4,322,000',
|
|
198
|
+
contact: 'bob@acme.com'
|
|
199
|
+
}, {
|
|
200
|
+
id: '356dbb52',
|
|
201
|
+
opportunityName: 'salesforce.com - 4,000 Widgets',
|
|
202
|
+
accountName: 'salesforce.com',
|
|
203
|
+
closeDate: '2/21/17 8:33PM',
|
|
204
|
+
stage: 'Id. Decision Makers',
|
|
205
|
+
confidence: '72%',
|
|
206
|
+
amount: '$15,000',
|
|
207
|
+
contact: 'nathan@salesforce.com'
|
|
208
|
+
}]
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
return _this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_createClass(Example, [{
|
|
215
|
+
key: "render",
|
|
216
|
+
value: function render() {
|
|
217
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h3", {
|
|
218
|
+
className: "slds-text-heading_medium slds-m-vertical_medium"
|
|
219
|
+
}, "With keyboard navigation"), /*#__PURE__*/React.createElement(IconSettings, {
|
|
220
|
+
iconPath: "/assets/icons"
|
|
221
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
style: {
|
|
223
|
+
height: '200px'
|
|
224
|
+
}
|
|
225
|
+
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
226
|
+
items: this.state.items,
|
|
227
|
+
id: "DataTableExample-4-resizable-cols",
|
|
228
|
+
resizable: true,
|
|
229
|
+
keyboardNavigation: true,
|
|
230
|
+
fixedLayout: true,
|
|
231
|
+
resizableOptions: {
|
|
232
|
+
onResize: function onResize(columnsResized) {
|
|
233
|
+
console.log(JSON.stringify(columnsResized));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}, columns)))), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h3", {
|
|
237
|
+
className: "slds-text-heading_medium slds-m-vertical_medium"
|
|
238
|
+
}, "Resizeable: Columns 0 and 3 fixed"), /*#__PURE__*/React.createElement(IconSettings, {
|
|
239
|
+
iconPath: "/assets/icons"
|
|
240
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
241
|
+
style: {
|
|
242
|
+
height: '200px'
|
|
243
|
+
}
|
|
244
|
+
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
245
|
+
items: this.state.items,
|
|
246
|
+
id: "DataTableExample-2-resizable-cols",
|
|
247
|
+
fixedLayout: true,
|
|
248
|
+
resizable: true,
|
|
249
|
+
keyboardNavigation: true,
|
|
250
|
+
resizableOptions: {
|
|
251
|
+
onResize: function onResize(columnsResized) {
|
|
252
|
+
console.log(JSON.stringify(columnsResized));
|
|
253
|
+
},
|
|
254
|
+
disabledColumns: [0, 3]
|
|
255
|
+
}
|
|
256
|
+
}, columns)))));
|
|
257
|
+
}
|
|
258
|
+
}]);
|
|
259
|
+
|
|
260
|
+
return Example;
|
|
261
|
+
}(React.Component);
|
|
262
|
+
|
|
263
|
+
_defineProperty(Example, "displayName", 'DataTableExample');
|
|
264
|
+
|
|
265
|
+
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
|
|
266
|
+
//# sourceMappingURL=resizable-columns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/data-table/__examples__/resizable-columns.jsx"],"names":["React","DataTable","DataTableColumn","DataTableCell","DataTableInteractiveLink","IconSettings","CustomDataTableCell","children","props","event","preventDefault","displayName","columns","Example","sortColumn","sortColumnDirection","opportunityName","items","id","accountName","closeDate","stage","confidence","amount","contact","height","state","onResize","columnsResized","console","log","JSON","stringify","disabledColumns","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,SAAP,MAAsB,mCAAtB,C,CAAiD;;AACjD,OAAOC,eAAP,MAA4B,0CAA5B;AACA,OAAOC,aAAP,MAA0B,wCAA1B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AACA,OAAOC,YAAP,MAAyB,sCAAzB;;AAEA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB;AAAA,MAAGC,QAAH,QAAGA,QAAH;AAAA,MAAgBC,KAAhB;;AAAA,sBAC3B,oBAAC,aAAD,EAAm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AIC,QAAA,kBAAkB,MAJnB;AAKC,QAAA,WAAW,MALZ;AAMC,QAAA,gBAAgB,EAAE;AACjBU,UAAAA,QAAQ,EAAE,kBAACC,cAAD,EAAoB;AAC7BC,YAAAA,OAAO,CAACC,GAAR,CAAYC,IAAI,CAACC,SAAL,CAAeJ,cAAf,CAAZ;AACA;AAHgB;AANnB,SAYEhB,OAZF,CADD,CADD,CAJD,CADD,eAwBC,oBAAC,KAAD,CAAO,QAAP,qBACC;AAAI,QAAA,SAAS,EAAC;AAAd,6CADD,eAIC,oBAAC,YAAD;AAAc,QAAA,QAAQ,EAAC;AAAvB,sBACC;AAAK,QAAA,KAAK,EAAE;AAAEa,UAAAA,MAAM,EAAE;AAAV;AAAZ,sBACC,oBAAC,SAAD;AACC,QAAA,KAAK,EAAE,KAAKC,KAAL,CAAWT,KADnB;AAEC,QAAA,EAAE,EAAC,mCAFJ;AAGC,QAAA,WAAW,MAHZ;AAIC,QAAA,SAAS,MAJV;AAKC,QAAA,kBAAkB,MALnB;AAMC,QAAA,gBAAgB,EAAE;AACjBU,UAAAA,QAAQ,EAAE,kBAACC,cAAD,EAAoB;AAC7BC,YAAAA,OAAO,CAACC,GAAR,CAAYC,IAAI,CAACC,SAAL,CAAeJ,cAAf,CAAZ;AACA,WAHgB;AAIjBK,UAAAA,eAAe,EAAE,CAAC,CAAD,EAAI,CAAJ;AAJA;AANnB,SAaErB,OAbF,CADD,CADD,CAJD,CAxBD,CADD;AAmDA;;;;EAxLoBZ,KAAK,CAACkC,S;;gBAAtBrB,O,iBACgB,kB;;AA0LtB,eAAeA,OAAf,C,CAAwB","sourcesContent":["import React from 'react';\n\nimport DataTable from '~/components/data-table'; // `~` is replaced with design-system-react at runtime\nimport DataTableColumn from '~/components/data-table/column';\nimport DataTableCell from '~/components/data-table/cell';\nimport DataTableInteractiveLink from '~/components/data-table/interactive-link';\nimport IconSettings from '~/components/icon-settings';\n\nconst CustomDataTableCell = ({ children, ...props }) => (\n\t<DataTableCell {...props}>\n\t\t<DataTableInteractiveLink\n\t\t\tonClick={(event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</DataTableInteractiveLink>\n\t</DataTableCell>\n);\nCustomDataTableCell.displayName = DataTableCell.displayName;\n\nconst columns = [\n\t<DataTableColumn\n\t\tkey=\"opportunity\"\n\t\tlabel=\"Opportunity Name\"\n\t\tproperty=\"opportunityName\"\n\t>\n\t\t<CustomDataTableCell />\n\t</DataTableColumn>,\n\n\t<DataTableColumn\n\t\tkey=\"account-name\"\n\t\tlabel=\"Account Name\"\n\t\tproperty=\"accountName\"\n\t/>,\n\n\t<DataTableColumn key=\"close-date\" label=\"Close Date\" property=\"closeDate\" />,\n\n\t<DataTableColumn key=\"stage\" label=\"Stage\" property=\"stage\" />,\n\n\t<DataTableColumn key=\"confidence\" label=\"Confidence\" property=\"confidence\" />,\n\n\t<DataTableColumn key=\"amount\" label=\"Amount\" property=\"amount\" />,\n\n\t<DataTableColumn key=\"contact\" label=\"Contact\" property=\"contact\">\n\t\t<CustomDataTableCell />\n\t</DataTableColumn>,\n];\n\nclass Example extends React.Component {\n\tstatic displayName = 'DataTableExample';\n\n\tstate = {\n\t\tsortColumn: 'opportunityName',\n\t\tsortColumnDirection: {\n\t\t\topportunityName: 'asc',\n\t\t},\n\t\titems: [\n\t\t\t{\n\t\t\t\tid: '896a6a60',\n\t\t\t\topportunityName: 'Acme - 1,200 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '4/10/15',\n\t\t\t\tstage: 'Value Proposition',\n\t\t\t\tconfidence: '70%',\n\t\t\t\tamount: '$25,000,000',\n\t\t\t\tcontact: 'jrogers@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '44da9dcd',\n\t\t\t\topportunityName: 'Acme - 200 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '1/31/15',\n\t\t\t\tstage: 'Prospecting',\n\t\t\t\tconfidence: '30%',\n\t\t\t\tamount: '$5,000,000',\n\t\t\t\tcontact: 'bob@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'f988a721',\n\t\t\t\topportunityName: 'salesforce.com - 1,000 Widgets',\n\t\t\t\taccountName: 'salesforce.com',\n\t\t\t\tcloseDate: '1/31/15 3:45PM',\n\t\t\t\tstage: 'Id. Decision Makers',\n\t\t\t\tconfidence: '60%',\n\t\t\t\tamount: '$25,000',\n\t\t\t\tcontact: 'nathan@salesforce.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'd7679cdd',\n\t\t\t\topportunityName: 'Acme - 800 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '6/11/18',\n\t\t\t\tstage: 'Value Proposition',\n\t\t\t\tconfidence: '85%',\n\t\t\t\tamount: '$970,000',\n\t\t\t\tcontact: 'jrogers@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '0085f7a0',\n\t\t\t\topportunityName: 'Acme - 744 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '4/15/17',\n\t\t\t\tstage: 'Prospecting',\n\t\t\t\tconfidence: '56%',\n\t\t\t\tamount: '$3,110,000',\n\t\t\t\tcontact: 'bob@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'b7acc778',\n\t\t\t\topportunityName: 'salesforce.com - 847 Widgets',\n\t\t\t\taccountName: 'salesforce.com',\n\t\t\t\tcloseDate: '5/23/18 1:02PM',\n\t\t\t\tstage: 'Id. Decision Makers',\n\t\t\t\tconfidence: '62%',\n\t\t\t\tamount: '$18,000',\n\t\t\t\tcontact: 'nathan@salesforce.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '17991de5',\n\t\t\t\topportunityName: 'Acme - 1,621 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '5/16/17',\n\t\t\t\tstage: 'Value Proposition',\n\t\t\t\tconfidence: '70%',\n\t\t\t\tamount: '$23,600,000',\n\t\t\t\tcontact: 'jrogers@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '09b2cee9',\n\t\t\t\topportunityName: 'Acme - 430 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '6/12/18',\n\t\t\t\tstage: 'Prospecting',\n\t\t\t\tconfidence: '42%',\n\t\t\t\tamount: '$4,222,222',\n\t\t\t\tcontact: 'bob@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'd0035700',\n\t\t\t\topportunityName: 'salesforce.com - 677 Widgets',\n\t\t\t\taccountName: 'salesforce.com',\n\t\t\t\tcloseDate: '7/21/17 10:11AM',\n\t\t\t\tstage: 'Id. Decision Makers',\n\t\t\t\tconfidence: '42%',\n\t\t\t\tamount: '$24,200',\n\t\t\t\tcontact: 'nathan@salesforce.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '4a526f0c',\n\t\t\t\topportunityName: 'Acme - 1,444 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '3/18/18',\n\t\t\t\tstage: 'Value Proposition',\n\t\t\t\tconfidence: '66%',\n\t\t\t\tamount: '$22,000,000',\n\t\t\t\tcontact: 'jrogers@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '9a5dbdb2',\n\t\t\t\topportunityName: 'Acme - 320 Widgets',\n\t\t\t\taccountName: 'Acme',\n\t\t\t\tcloseDate: '1/31/18',\n\t\t\t\tstage: 'Prospecting',\n\t\t\t\tconfidence: '36%',\n\t\t\t\tamount: '$4,322,000',\n\t\t\t\tcontact: 'bob@acme.com',\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: '356dbb52',\n\t\t\t\topportunityName: 'salesforce.com - 4,000 Widgets',\n\t\t\t\taccountName: 'salesforce.com',\n\t\t\t\tcloseDate: '2/21/17 8:33PM',\n\t\t\t\tstage: 'Id. Decision Makers',\n\t\t\t\tconfidence: '72%',\n\t\t\t\tamount: '$15,000',\n\t\t\t\tcontact: 'nathan@salesforce.com',\n\t\t\t},\n\t\t],\n\t};\n\n\trender() {\n\t\treturn (\n\t\t\t<React.Fragment>\n\t\t\t\t<React.Fragment>\n\t\t\t\t\t<h3 className=\"slds-text-heading_medium slds-m-vertical_medium\">\n\t\t\t\t\t\tWith keyboard navigation\n\t\t\t\t\t</h3>\n\t\t\t\t\t<IconSettings iconPath=\"/assets/icons\">\n\t\t\t\t\t\t<div style={{ height: '200px' }}>\n\t\t\t\t\t\t\t<DataTable\n\t\t\t\t\t\t\t\titems={this.state.items}\n\t\t\t\t\t\t\t\tid=\"DataTableExample-4-resizable-cols\"\n\t\t\t\t\t\t\t\tresizable\n\t\t\t\t\t\t\t\tkeyboardNavigation\n\t\t\t\t\t\t\t\tfixedLayout\n\t\t\t\t\t\t\t\tresizableOptions={{\n\t\t\t\t\t\t\t\t\tonResize: (columnsResized) => {\n\t\t\t\t\t\t\t\t\t\tconsole.log(JSON.stringify(columnsResized));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{columns}\n\t\t\t\t\t\t\t</DataTable>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</IconSettings>\n\t\t\t\t</React.Fragment>\n\t\t\t\t<React.Fragment>\n\t\t\t\t\t<h3 className=\"slds-text-heading_medium slds-m-vertical_medium\">\n\t\t\t\t\t\tResizeable: Columns 0 and 3 fixed\n\t\t\t\t\t</h3>\n\t\t\t\t\t<IconSettings iconPath=\"/assets/icons\">\n\t\t\t\t\t\t<div style={{ height: '200px' }}>\n\t\t\t\t\t\t\t<DataTable\n\t\t\t\t\t\t\t\titems={this.state.items}\n\t\t\t\t\t\t\t\tid=\"DataTableExample-2-resizable-cols\"\n\t\t\t\t\t\t\t\tfixedLayout\n\t\t\t\t\t\t\t\tresizable\n\t\t\t\t\t\t\t\tkeyboardNavigation\n\t\t\t\t\t\t\t\tresizableOptions={{\n\t\t\t\t\t\t\t\t\tonResize: (columnsResized) => {\n\t\t\t\t\t\t\t\t\t\tconsole.log(JSON.stringify(columnsResized));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdisabledColumns: [0, 3],\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{columns}\n\t\t\t\t\t\t\t</DataTable>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</IconSettings>\n\t\t\t\t</React.Fragment>\n\t\t\t</React.Fragment>\n\t\t);\n\t}\n}\n\nexport default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime\n"],"file":"resizable-columns.js"}
|
|
@@ -610,6 +610,105 @@ describe('DataTable: ', function describeFunction() {
|
|
|
610
610
|
expect(this.dom.querySelector('table.slds-table').className.search('slds-table_header-fixed') >= 0).to.eql(true);
|
|
611
611
|
expect(this.dom.querySelectorAll('thead .slds-cell-fixed').length).to.eql(4);
|
|
612
612
|
});
|
|
613
|
+
it('Renders a fixedHeader table with column resizing functionality as expected', function () {
|
|
614
|
+
renderTable( /*#__PURE__*/React.createElement(DataTable, _extends({}, defaultProps, {
|
|
615
|
+
fixedHeader: true,
|
|
616
|
+
fixedLayout: true,
|
|
617
|
+
resizable: true,
|
|
618
|
+
id: "DataTable-resizable-cols-Test"
|
|
619
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
620
|
+
isSorted: true,
|
|
621
|
+
label: "Name",
|
|
622
|
+
primaryColumn: true,
|
|
623
|
+
property: "name",
|
|
624
|
+
sortable: true,
|
|
625
|
+
sortDirection: "asc"
|
|
626
|
+
}), /*#__PURE__*/React.createElement(DataTableColumn, {
|
|
627
|
+
label: "Count",
|
|
628
|
+
property: "count"
|
|
629
|
+
}), /*#__PURE__*/React.createElement(DataTableRowActions, {
|
|
630
|
+
options: [{
|
|
631
|
+
id: 0,
|
|
632
|
+
label: 'Add to Group',
|
|
633
|
+
value: '1'
|
|
634
|
+
}, {
|
|
635
|
+
id: 1,
|
|
636
|
+
label: 'Publish',
|
|
637
|
+
value: '2'
|
|
638
|
+
}],
|
|
639
|
+
onAction: function onAction() {},
|
|
640
|
+
dropdown: /*#__PURE__*/React.createElement(Dropdown, {
|
|
641
|
+
length: "5"
|
|
642
|
+
})
|
|
643
|
+
}))).call(this); // actions column is not resizable
|
|
644
|
+
|
|
645
|
+
expect(this.dom.querySelectorAll('.grip-resizable').length).to.eql(4);
|
|
646
|
+
expect(this.dom.querySelectorAll('.grip-container').length).to.eql(1);
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
describe('Column resizing', function describeFunction2() {
|
|
650
|
+
beforeEach(mountComponent( /*#__PURE__*/React.createElement(DataTable, _extends({}, defaultProps, {
|
|
651
|
+
fixedLayout: true,
|
|
652
|
+
keyboardNavigation: true,
|
|
653
|
+
resizable: true,
|
|
654
|
+
resizableOptions: {
|
|
655
|
+
resizeMode: 'overflow',
|
|
656
|
+
onResize: function onResize() {}
|
|
657
|
+
}
|
|
658
|
+
}), [].concat(_toConsumableArray(columns.map(function (columnProps) {
|
|
659
|
+
return /*#__PURE__*/React.createElement(DataTableColumn, _extends({}, columnProps, {
|
|
660
|
+
key: columnProps.property
|
|
661
|
+
}));
|
|
662
|
+
})), [/*#__PURE__*/React.createElement(DataTableRowActions, {
|
|
663
|
+
key: "actions",
|
|
664
|
+
options: [{
|
|
665
|
+
id: 0,
|
|
666
|
+
label: 'Add to Group',
|
|
667
|
+
value: '1'
|
|
668
|
+
}, {
|
|
669
|
+
id: 1,
|
|
670
|
+
label: 'Publish',
|
|
671
|
+
value: '2'
|
|
672
|
+
}],
|
|
673
|
+
onAction: function onAction() {},
|
|
674
|
+
dropdown: /*#__PURE__*/React.createElement(Dropdown, {
|
|
675
|
+
length: "5"
|
|
676
|
+
})
|
|
677
|
+
})]))));
|
|
678
|
+
afterEach(unmountComponent);
|
|
679
|
+
it('Resize functionality should work with left key', function () {
|
|
680
|
+
var initial = this.dom.querySelectorAll('th')[0].style.width;
|
|
681
|
+
var cell = this.wrapper.find('td').first();
|
|
682
|
+
cell.simulate('focus');
|
|
683
|
+
expect(this.wrapper.find('td').first().prop('tabIndex')).to.equal('0');
|
|
684
|
+
cell.simulate('keyDown', keyObjects.UP);
|
|
685
|
+
cell = this.wrapper.find('th').at(0);
|
|
686
|
+
expect(this.wrapper.find('th').first().prop('tabIndex')).to.equal('0');
|
|
687
|
+
cell.simulate('keyDown', keyObjects.ENTER);
|
|
688
|
+
cell.simulate('keyDown', keyObjects.LEFT);
|
|
689
|
+
cell.simulate('keyDown', keyObjects.LEFT);
|
|
690
|
+
cell.simulate('keyDown', keyObjects.LEFT);
|
|
691
|
+
cell.simulate('keyDown', keyObjects.ESCAPE);
|
|
692
|
+
expect("".concat(parseInt(initial, 10) - 30, "px")).to.equal(this.dom.querySelectorAll('th')[0].style.width);
|
|
693
|
+
});
|
|
694
|
+
it('Resize functionality should work with right key', function () {
|
|
695
|
+
var initial = this.dom.querySelectorAll('th')[0].style.width;
|
|
696
|
+
var cell = this.wrapper.find('td').first();
|
|
697
|
+
cell.simulate('focus');
|
|
698
|
+
expect(this.wrapper.find('td').first().prop('tabIndex')).to.equal('0');
|
|
699
|
+
cell.simulate('keyDown', keyObjects.UP);
|
|
700
|
+
cell = this.wrapper.find('th').at(0);
|
|
701
|
+
expect(this.wrapper.find('th').first().prop('tabIndex')).to.equal('0');
|
|
702
|
+
cell.simulate('keyDown', keyObjects.ENTER);
|
|
703
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
704
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
705
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
706
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
707
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
708
|
+
cell.simulate('keyDown', keyObjects.RIGHT);
|
|
709
|
+
cell.simulate('keyDown', keyObjects.ESCAPE);
|
|
710
|
+
expect("".concat(parseInt(initial, 10) + 60, "px")).to.equal(this.dom.querySelectorAll('th')[0].style.width);
|
|
711
|
+
});
|
|
613
712
|
});
|
|
614
713
|
describe('w/ Infinite Scrolling', function describeFunction2() {
|
|
615
714
|
afterEach(removeTable);
|