@decisiv/ui-components 2.0.1-alpha.8 → 2.0.1-alpha.97
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/lib/atoms/BaseButton/index.d.ts.map +1 -1
- package/lib/atoms/BaseButton/index.js +1 -1
- package/lib/atoms/BooleanInput/index.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/index.js +19 -2
- package/lib/atoms/BooleanInput/index.test.js +17 -6
- package/lib/atoms/BooleanInput/types.d.ts +2 -0
- package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/types.js +5 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.js +2 -1
- package/lib/atoms/Calendar/hooks/useCalendar/index.test.js +5 -6
- package/lib/atoms/Calendar/index.d.ts.map +1 -1
- package/lib/atoms/Calendar/index.js +8 -1
- package/lib/atoms/Calendar/index.test.js +70 -40
- package/lib/atoms/Calendar/types.js +5 -1
- package/lib/atoms/InputField/Containers.d.ts +11 -6
- package/lib/atoms/InputField/Containers.d.ts.map +1 -1
- package/lib/atoms/InputField/Containers.js +6 -6
- package/lib/atoms/InputField/InputLabel.d.ts +1 -0
- package/lib/atoms/InputField/InputLabel.d.ts.map +1 -1
- package/lib/atoms/InputField/InputLabel.js +2 -1
- package/lib/atoms/InputField/index.d.ts +5 -0
- package/lib/atoms/InputField/index.d.ts.map +1 -1
- package/lib/atoms/InputField/index.js +21 -7
- package/lib/atoms/InputField/index.test.js +91 -0
- package/lib/atoms/InputField/schema.d.ts.map +1 -1
- package/lib/atoms/InputField/schema.js +1 -0
- package/lib/atoms/OptionsList/Category.d.ts +1 -1
- package/lib/atoms/OptionsList/Category.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Category.js +4 -2
- package/lib/atoms/OptionsList/Footer.d.ts +8 -0
- package/lib/atoms/OptionsList/Footer.d.ts.map +1 -0
- package/lib/atoms/OptionsList/Footer.js +72 -0
- package/lib/atoms/OptionsList/Option.d.ts.map +1 -1
- package/lib/atoms/OptionsList/Option.js +8 -5
- package/lib/atoms/OptionsList/index.d.ts.map +1 -1
- package/lib/atoms/OptionsList/index.js +43 -16
- package/lib/atoms/OptionsList/index.test.js +107 -11
- package/lib/atoms/OptionsList/schema.d.ts.map +1 -1
- package/lib/atoms/OptionsList/schema.js +4 -0
- package/lib/atoms/OptionsList/types.d.ts +14 -0
- package/lib/atoms/OptionsList/types.d.ts.map +1 -1
- package/lib/atoms/OptionsList/types.js +5 -1
- package/lib/atoms/RequiredIcon.d.ts +9 -0
- package/lib/atoms/RequiredIcon.d.ts.map +1 -0
- package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
- package/lib/components/Accordion/types.js +5 -1
- package/lib/components/Accordion/useAccordion/types.js +5 -1
- package/lib/components/Avatar/types.js +5 -1
- package/lib/components/Badge/constants.d.ts +2 -0
- package/lib/components/Badge/constants.d.ts.map +1 -0
- package/lib/components/Badge/constants.js +29 -0
- package/lib/components/Badge/index.d.ts.map +1 -1
- package/lib/components/Badge/index.js +12 -23
- package/lib/components/Badge/index.test.js +51 -8
- package/lib/components/Badge/schema.js +1 -1
- package/lib/components/Badge/types.d.ts +1 -1
- package/lib/components/Badge/types.d.ts.map +1 -1
- package/lib/components/Badge/types.js +7 -3
- package/lib/components/Breadcrumbs/types.js +5 -1
- package/lib/components/Button/schema.d.ts +6 -1
- package/lib/components/Button/schema.d.ts.map +1 -1
- package/lib/components/Button/schema.js +9 -4
- package/lib/components/Button/types.js +5 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Checkbox/index.js +3 -1
- package/lib/components/Checkbox/schema.d.ts.map +1 -1
- package/lib/components/Checkbox/schema.js +2 -0
- package/lib/components/Combobox/Target.d.ts.map +1 -1
- package/lib/components/Combobox/Target.js +45 -14
- package/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +193 -65
- package/lib/components/Combobox/index.test.js +358 -135
- package/lib/components/Combobox/schema.d.ts.map +1 -1
- package/lib/components/Combobox/schema.js +9 -2
- package/lib/components/Combobox/types.d.ts +12 -3
- package/lib/components/Combobox/types.d.ts.map +1 -1
- package/lib/components/Combobox/types.js +5 -1
- package/lib/components/DropdownList/index.d.ts +4 -0
- package/lib/components/DropdownList/index.d.ts.map +1 -1
- package/lib/components/DropdownList/index.js +76 -11
- package/lib/components/DropdownList/propTypes.d.ts +4 -0
- package/lib/components/DropdownList/propTypes.d.ts.map +1 -0
- package/lib/components/DropdownList/propTypes.js +42 -0
- package/lib/components/DropdownList/schema.d.ts.map +1 -1
- package/lib/components/DropdownList/schema.js +5 -0
- package/lib/components/DropdownList/types.d.ts +4 -1
- package/lib/components/DropdownList/types.d.ts.map +1 -1
- package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
- package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
- package/lib/components/Filter/IconWrapper/index.js +35 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
- package/lib/components/Filter/SimplePrimary/index.js +58 -0
- package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
- package/lib/components/Filter/StyledFilter.d.ts +4 -0
- package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
- package/lib/components/Filter/StyledFilter.js +39 -0
- package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
- package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
- package/lib/components/Filter/StyledLabel/index.js +30 -0
- package/lib/components/Filter/index.d.ts +27 -0
- package/lib/components/Filter/index.d.ts.map +1 -0
- package/lib/components/Filter/index.js +95 -0
- package/lib/components/Filter/index.test.js +41 -0
- package/lib/components/Filter/kind.d.ts +6 -0
- package/lib/components/Filter/kind.d.ts.map +1 -0
- package/lib/components/Filter/kind.js +45 -0
- package/lib/components/Filter/schema.d.ts +9 -0
- package/lib/components/Filter/schema.d.ts.map +1 -0
- package/lib/components/Filter/schema.js +32 -0
- package/lib/components/Filter/types.d.ts +17 -0
- package/lib/components/Filter/types.d.ts.map +1 -0
- package/lib/components/Filter/types.js +5 -0
- package/lib/components/JumpTo/JumpToMenu.d.ts +2 -2
- package/lib/components/JumpTo/JumpToMenu.d.ts.map +1 -1
- package/lib/components/JumpTo/JumpToMenu.js +3 -3
- package/lib/components/JumpTo/types.js +5 -1
- package/lib/components/LeftNav/Item/ClickArea.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ClickArea.js +2 -2
- package/lib/components/LeftNav/Item/ItemWrapper.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/ItemWrapper.js +3 -3
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts +7 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.d.ts.map +1 -0
- package/lib/components/LeftNav/Item/MenuItemWrapper.js +20 -0
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavCollapsedXItem/index.js +7 -5
- package/lib/components/LeftNav/Item/NavExpandedItem/index.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/NavExpandedItem/index.js +24 -13
- package/lib/components/LeftNav/Item/types.d.ts +1 -1
- package/lib/components/LeftNav/Item/types.d.ts.map +1 -1
- package/lib/components/LeftNav/Item/types.js +5 -1
- package/lib/components/LeftNav/index.test.js +13 -3
- package/lib/components/LeftNav/schema.d.ts.map +1 -1
- package/lib/components/LeftNav/schema.js +2 -0
- package/lib/components/LeftNav/types.d.ts +1 -0
- package/lib/components/LeftNav/types.d.ts.map +1 -1
- package/lib/components/LeftNav/types.js +5 -1
- package/lib/components/Link/index.d.ts +2 -2
- package/lib/components/Link/index.d.ts.map +1 -1
- package/lib/components/Link/index.js +1 -1
- package/lib/components/Link/index.test.js +8 -0
- package/lib/components/Link/schema.d.ts.map +1 -1
- package/lib/components/Link/schema.js +1 -1
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +3 -1
- package/lib/components/Menu/types.d.ts +2 -0
- package/lib/components/Menu/types.d.ts.map +1 -1
- package/lib/components/Menu/types.js +5 -1
- package/lib/components/Modal/components.d.ts +2 -2
- package/lib/components/Modal/index.d.ts.map +1 -1
- package/lib/components/Modal/index.js +5 -5
- package/lib/components/Modal/index.test.js +32 -0
- package/lib/components/Modal/schema.d.ts.map +1 -1
- package/lib/components/Modal/schema.js +2 -2
- package/lib/components/Modal/types.d.ts +2 -2
- package/lib/components/Modal/types.d.ts.map +1 -1
- package/lib/components/Modal/types.js +5 -1
- package/lib/components/Notifications/Notification/components.d.ts +3 -3
- package/lib/components/Notifications/Notification/components.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/components.js +12 -6
- package/lib/components/Notifications/Notification/index.d.ts +3 -6
- package/lib/components/Notifications/Notification/index.d.ts.map +1 -1
- package/lib/components/Notifications/Notification/index.js +19 -12
- package/lib/components/Notifications/Notification/index.test.js +38 -19
- package/lib/components/Notifications/NotificationsPanel/index.d.ts +2 -1
- package/lib/components/Notifications/NotificationsPanel/index.d.ts.map +1 -1
- package/lib/components/Notifications/NotificationsPanel/index.js +44 -21
- package/lib/components/Notifications/NotificationsPanel/schema.js +1 -1
- package/lib/components/Notifications/Notifier.test.js +79 -10
- package/lib/components/Notifications/constants.d.ts +2 -0
- package/lib/components/Notifications/constants.d.ts.map +1 -0
- package/lib/components/Notifications/constants.js +16 -0
- package/lib/components/Notifications/schema.d.ts.map +1 -1
- package/lib/components/Notifications/schema.js +2 -1
- package/lib/components/Notifications/useNotifications.d.ts +1 -0
- package/lib/components/Notifications/useNotifications.d.ts.map +1 -1
- package/lib/components/Notifications/useNotifications.js +3 -3
- package/lib/components/Notifications/useNotifications.test.js +7 -4
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +1 -0
- package/lib/components/Pagination/Pagination.test.js +9 -0
- package/lib/components/Pagination/types.js +5 -1
- package/lib/components/Popover/utils.d.ts +1 -1
- package/lib/components/Select/Target.js +1 -1
- package/lib/components/Select/index.d.ts.map +1 -1
- package/lib/components/Select/index.js +37 -1
- package/lib/components/Select/index.test.js +82 -23
- package/lib/components/Select/schema.d.ts.map +1 -1
- package/lib/components/Select/schema.js +7 -0
- package/lib/components/Select/types.d.ts +4 -1
- package/lib/components/Select/types.d.ts.map +1 -1
- package/lib/components/Select/types.js +5 -1
- package/lib/components/SelectDate/Target.js +1 -1
- package/lib/components/SelectDate/index.d.ts.map +1 -1
- package/lib/components/SelectDate/index.js +28 -1
- package/lib/components/SelectDate/index.test.js +108 -51
- package/lib/components/SelectDate/schema.d.ts.map +1 -1
- package/lib/components/SelectDate/schema.js +2 -0
- package/lib/components/SelectDate/types.d.ts +2 -0
- package/lib/components/SelectDate/types.d.ts.map +1 -1
- package/lib/components/SelectDate/types.js +5 -1
- package/lib/components/SelectDateRange/index.d.ts.map +1 -1
- package/lib/components/SelectDateRange/index.js +28 -1
- package/lib/components/SelectDateRange/index.test.js +115 -58
- package/lib/components/SelectDateRange/schema.d.ts.map +1 -1
- package/lib/components/SelectDateRange/schema.js +2 -0
- package/lib/components/SelectDateRange/types.js +5 -1
- package/lib/components/SelectMenu/index.d.ts +5 -0
- package/lib/components/SelectMenu/index.d.ts.map +1 -1
- package/lib/components/SelectMenu/index.js +27 -3
- package/lib/components/SelectMenu/schema.d.ts.map +1 -1
- package/lib/components/SelectMenu/schema.js +4 -0
- package/lib/components/Table/Body.d.ts.map +1 -1
- package/lib/components/Table/Body.js +182 -38
- package/lib/components/Table/Container.d.ts.map +1 -1
- package/lib/components/Table/Container.js +2 -2
- package/lib/components/Table/DataRow.d.ts.map +1 -1
- package/lib/components/Table/DataRow.js +43 -16
- package/lib/components/Table/DraggableWrapper.d.ts +5 -0
- package/lib/components/Table/DraggableWrapper.d.ts.map +1 -0
- package/lib/components/Table/DraggableWrapper.js +38 -0
- package/lib/components/Table/Grip.d.ts +4 -0
- package/lib/components/Table/Grip.d.ts.map +1 -0
- package/lib/components/Table/Grip.js +30 -0
- package/lib/components/Table/Head.d.ts +1 -1
- package/lib/components/Table/Head.d.ts.map +1 -1
- package/lib/components/Table/Head.js +11 -5
- package/lib/components/Table/HeaderCell/index.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/index.js +22 -8
- package/lib/components/Table/HeaderCell/types.d.ts +6 -1
- package/lib/components/Table/HeaderCell/types.d.ts.map +1 -1
- package/lib/components/Table/HeaderCell/types.js +5 -1
- package/lib/components/Table/Provider.d.ts +13 -4
- package/lib/components/Table/Provider.d.ts.map +1 -1
- package/lib/components/Table/Provider.js +45 -5
- package/lib/components/Table/index.d.ts.map +1 -1
- package/lib/components/Table/index.js +112 -18
- package/lib/components/Table/index.test.js +330 -84
- package/lib/components/Table/schema.columns.d.ts.map +1 -1
- package/lib/components/Table/schema.columns.js +6 -4
- package/lib/components/Table/schema.d.ts.map +1 -1
- package/lib/components/Table/schema.js +8 -6
- package/lib/components/Table/types.d.ts +34 -4
- package/lib/components/Table/types.d.ts.map +1 -1
- package/lib/components/Table/utils.d.ts +2 -8
- package/lib/components/Table/utils.d.ts.map +1 -1
- package/lib/components/Table/utils.js +21 -20
- package/lib/components/Tabs/types.js +5 -1
- package/lib/components/Tag/types.d.ts +1 -1
- package/lib/components/Tag/types.d.ts.map +1 -1
- package/lib/components/Tag/types.js +5 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextArea/index.js +1 -0
- package/lib/components/TextArea/index.test.js +5 -0
- package/lib/components/TextField/Input.js +1 -1
- package/lib/components/TextField/index.test.js +5 -0
- package/lib/components/Toggle/index.d.ts.map +1 -1
- package/lib/components/Toggle/index.js +4 -0
- package/lib/components/Toggle/index.test.js +39 -10
- package/lib/components/Toggle/types.js +5 -1
- package/lib/components/TopNav/BrandInfo/index.d.ts +2 -1
- package/lib/components/TopNav/BrandInfo/index.d.ts.map +1 -1
- package/lib/components/TopNav/BrandInfo/index.js +9 -1
- package/lib/components/TopNav/BrandInfo/schema.d.ts.map +1 -1
- package/lib/components/TopNav/BrandInfo/schema.js +4 -1
- package/lib/components/TopNav/index.test.js +28 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +9 -0
- package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/index.js +5 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/context.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/normalizer.js +1 -1
- package/lib/providers/ConfigProvider/utils/translations.d.ts +1 -1
- package/lib/providers/ConfigProvider/utils/translations.js +1 -1
- package/lib/providers/NotificationsProvider/index.d.ts +6 -5
- package/lib/providers/NotificationsProvider/index.d.ts.map +1 -1
- package/lib/providers/NotificationsProvider/index.js +47 -28
- package/lib/providers/NotificationsProvider/types.d.ts +4 -1
- package/lib/providers/NotificationsProvider/types.d.ts.map +1 -1
- package/lib/utils/joinClassnames.d.ts +3 -0
- package/lib/utils/joinClassnames.d.ts.map +1 -0
- package/lib/utils/joinClassnames.js +26 -0
- package/lib/utils/useFirstMount.d.ts +2 -0
- package/lib/utils/useFirstMount.d.ts.map +1 -0
- package/lib/utils/useFirstMount.js +19 -0
- package/lib/utils/useUpdateEffect.d.ts +4 -0
- package/lib/utils/useUpdateEffect.d.ts.map +1 -0
- package/lib/utils/useUpdateEffect.js +28 -0
- package/package.json +4 -2
- package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
- package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
|
@@ -10,6 +10,18 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
10
10
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
16
|
+
|
|
17
|
+
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
18
|
+
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
20
|
+
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
+
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
+
|
|
13
25
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
|
14
26
|
|
|
15
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -19,8 +31,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
19
31
|
/* eslint-disable react/prop-types */
|
|
20
32
|
var columns = [{
|
|
21
33
|
DataCell: function DataCell(_ref) {
|
|
22
|
-
var rowData = _ref.rowData
|
|
23
|
-
|
|
34
|
+
var rowData = _ref.rowData,
|
|
35
|
+
draggableProps = _ref.draggableProps;
|
|
36
|
+
return _react.default.createElement("span", draggableProps || {}, rowData.componentName);
|
|
24
37
|
},
|
|
25
38
|
name: 'componentName',
|
|
26
39
|
sortBy: jest.fn(),
|
|
@@ -76,6 +89,68 @@ var data = [{
|
|
|
76
89
|
releaseVersion: '-',
|
|
77
90
|
status: 'In Progress'
|
|
78
91
|
}];
|
|
92
|
+
var groupColumns = [{
|
|
93
|
+
DataCell: function DataCell(_ref4) {
|
|
94
|
+
var rowData = _ref4.rowData,
|
|
95
|
+
draggableProps = _ref4.draggableProps;
|
|
96
|
+
return _react.default.createElement("span", draggableProps || {}, rowData.name);
|
|
97
|
+
},
|
|
98
|
+
name: 'name',
|
|
99
|
+
title: 'Name'
|
|
100
|
+
}, {
|
|
101
|
+
DataCell: function DataCell(_ref5) {
|
|
102
|
+
var rowData = _ref5.rowData;
|
|
103
|
+
return _react.default.createElement("span", null, rowData.daysToHarvest);
|
|
104
|
+
},
|
|
105
|
+
name: 'daysToHarvest',
|
|
106
|
+
title: 'Days to Harvest'
|
|
107
|
+
}];
|
|
108
|
+
var groupData = [{
|
|
109
|
+
type: 'PlantFamily',
|
|
110
|
+
id: 'allium',
|
|
111
|
+
name: 'allium',
|
|
112
|
+
vegetables: [{
|
|
113
|
+
type: 'Vegetable',
|
|
114
|
+
id: 'onion',
|
|
115
|
+
daysToHarvest: '100-120',
|
|
116
|
+
name: 'onion'
|
|
117
|
+
}, {
|
|
118
|
+
type: 'Vegetable',
|
|
119
|
+
id: 'garlic',
|
|
120
|
+
daysToHarvest: '90',
|
|
121
|
+
name: 'garlic'
|
|
122
|
+
}]
|
|
123
|
+
}, {
|
|
124
|
+
type: 'PlantFamily',
|
|
125
|
+
id: 'crucifer',
|
|
126
|
+
name: 'crucifer',
|
|
127
|
+
vegetables: [{
|
|
128
|
+
type: 'Vegetable',
|
|
129
|
+
id: 'broccoli',
|
|
130
|
+
daysToHarvest: '60',
|
|
131
|
+
name: 'broccoli'
|
|
132
|
+
}, {
|
|
133
|
+
type: 'Vegetable',
|
|
134
|
+
id: 'kale',
|
|
135
|
+
daysToHarvest: '55',
|
|
136
|
+
name: 'kale'
|
|
137
|
+
}]
|
|
138
|
+
}, {
|
|
139
|
+
type: 'PlantFamily',
|
|
140
|
+
id: 'nightshade',
|
|
141
|
+
name: 'nightshade',
|
|
142
|
+
vegetables: [{
|
|
143
|
+
type: 'Vegetable',
|
|
144
|
+
id: 'potato',
|
|
145
|
+
daysToHarvest: '120',
|
|
146
|
+
name: 'potato'
|
|
147
|
+
}, {
|
|
148
|
+
type: 'Vegetable',
|
|
149
|
+
id: 'tomato',
|
|
150
|
+
daysToHarvest: '60',
|
|
151
|
+
name: 'tomato'
|
|
152
|
+
}]
|
|
153
|
+
}];
|
|
79
154
|
describe('Table', function () {
|
|
80
155
|
it('renders as expected', function () {
|
|
81
156
|
var _render = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
@@ -199,68 +274,6 @@ describe('Table', function () {
|
|
|
199
274
|
});
|
|
200
275
|
describe('with grouped data', function () {
|
|
201
276
|
it('renders as expected', function () {
|
|
202
|
-
var groupColumns = [{
|
|
203
|
-
DataCell: function DataCell(_ref4) {
|
|
204
|
-
var rowData = _ref4.rowData;
|
|
205
|
-
return _react.default.createElement("span", null, rowData.name);
|
|
206
|
-
},
|
|
207
|
-
name: 'name',
|
|
208
|
-
title: 'Name'
|
|
209
|
-
}, {
|
|
210
|
-
DataCell: function DataCell(_ref5) {
|
|
211
|
-
var rowData = _ref5.rowData;
|
|
212
|
-
return _react.default.createElement("span", null, rowData.daysToHarvest);
|
|
213
|
-
},
|
|
214
|
-
name: 'daysToHarvest',
|
|
215
|
-
title: 'Days to Harvest'
|
|
216
|
-
}];
|
|
217
|
-
var groupData = [{
|
|
218
|
-
type: 'PlantFamily',
|
|
219
|
-
id: 'allium',
|
|
220
|
-
name: 'allium',
|
|
221
|
-
vegetables: [{
|
|
222
|
-
type: 'Vegetable',
|
|
223
|
-
id: 'onion',
|
|
224
|
-
daysToHarvest: '100-120',
|
|
225
|
-
name: 'onion'
|
|
226
|
-
}, {
|
|
227
|
-
type: 'Vegetable',
|
|
228
|
-
id: 'garlic',
|
|
229
|
-
daysToHarvest: '90',
|
|
230
|
-
name: 'garlic'
|
|
231
|
-
}]
|
|
232
|
-
}, {
|
|
233
|
-
type: 'PlantFamily',
|
|
234
|
-
id: 'crucifer',
|
|
235
|
-
name: 'crucifer',
|
|
236
|
-
vegetables: [{
|
|
237
|
-
type: 'Vegetable',
|
|
238
|
-
id: 'broccoli',
|
|
239
|
-
daysToHarvest: '60',
|
|
240
|
-
name: 'broccoli'
|
|
241
|
-
}, {
|
|
242
|
-
type: 'Vegetable',
|
|
243
|
-
id: 'kale',
|
|
244
|
-
daysToHarvest: '55',
|
|
245
|
-
name: 'kale'
|
|
246
|
-
}]
|
|
247
|
-
}, {
|
|
248
|
-
type: 'PlantFamily',
|
|
249
|
-
id: 'nightshade',
|
|
250
|
-
name: 'nightshade',
|
|
251
|
-
vegetables: [{
|
|
252
|
-
type: 'Vegetable',
|
|
253
|
-
id: 'potato',
|
|
254
|
-
daysToHarvest: '120',
|
|
255
|
-
name: 'potato'
|
|
256
|
-
}, {
|
|
257
|
-
type: 'Vegetable',
|
|
258
|
-
id: 'tomato',
|
|
259
|
-
daysToHarvest: '60',
|
|
260
|
-
name: 'tomato'
|
|
261
|
-
}]
|
|
262
|
-
}];
|
|
263
|
-
|
|
264
277
|
var _render8 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
265
278
|
columns: groupColumns,
|
|
266
279
|
data: groupData,
|
|
@@ -276,28 +289,261 @@ describe('Table', function () {
|
|
|
276
289
|
});
|
|
277
290
|
});
|
|
278
291
|
describe('fixed columns', function () {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
292
|
+
it('renders columns with sticky styles', function () {
|
|
293
|
+
var columnsFixed = [].concat(columns);
|
|
294
|
+
var firstColumn = columnsFixed[0];
|
|
295
|
+
columnsFixed[0] = _objectSpread({}, firstColumn, {
|
|
296
|
+
fixed: true
|
|
297
|
+
});
|
|
298
|
+
var lastIndex = columnsFixed.length - 1;
|
|
299
|
+
var lastColumn = columnsFixed[lastIndex];
|
|
300
|
+
columnsFixed[lastIndex] = _objectSpread({}, lastColumn, {
|
|
301
|
+
fixed: true
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
var _render9 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
305
|
+
columns: columnsFixed,
|
|
306
|
+
data: data
|
|
307
|
+
})),
|
|
308
|
+
getByText = _render9.getByText,
|
|
309
|
+
container = _render9.container;
|
|
310
|
+
|
|
311
|
+
expect(getByText(firstColumn.title).closest('th')).toHaveStyle("\n position: sticky;\n left: 0px;\n ");
|
|
312
|
+
expect(getByText(lastColumn.title).closest('th')).toHaveStyle("\n position: sticky;\n right: 0px;\n ");
|
|
313
|
+
var firstRow = container.querySelector('tbody tr:first-child');
|
|
314
|
+
expect((0, _react2.getByText)(firstRow, data[0][firstColumn.name]).closest('td')).toHaveStyle("\n position: sticky;\n left: 0px;\n ");
|
|
315
|
+
expect((0, _react2.getByText)(firstRow, data[0][lastColumn.name]).closest('td')).toHaveStyle("\n position: sticky;\n right: 0px;\n ");
|
|
283
316
|
});
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
317
|
+
it('ignores columns in the middle', function () {
|
|
318
|
+
var columnsFixed = [].concat(columns);
|
|
319
|
+
var middleIndex = Math.trunc(columns.length / 2);
|
|
320
|
+
var middleColumn = columnsFixed[middleIndex];
|
|
321
|
+
columnsFixed[middleIndex] = _objectSpread({}, middleColumn, {
|
|
322
|
+
fixed: true
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
var _render10 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
326
|
+
columns: columnsFixed,
|
|
327
|
+
data: data,
|
|
328
|
+
scroll: "x"
|
|
329
|
+
})),
|
|
330
|
+
container = _render10.container;
|
|
331
|
+
|
|
332
|
+
var firstRow = container.querySelector('tbody tr:first-child');
|
|
333
|
+
expect((0, _react2.getByText)(firstRow, data[0][middleColumn.name]).closest('td')).not.toHaveStyle("\n position: sticky;\n ");
|
|
288
334
|
});
|
|
335
|
+
});
|
|
336
|
+
describe('Drag-and-Drop sorting', function () {
|
|
337
|
+
var dragItem = /*#__PURE__*/function () {
|
|
338
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(handle, times, direction, getByText) {
|
|
339
|
+
var directions, i;
|
|
340
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
341
|
+
while (1) {
|
|
342
|
+
switch (_context.prev = _context.next) {
|
|
343
|
+
case 0:
|
|
344
|
+
directions = {
|
|
345
|
+
down: 40,
|
|
346
|
+
up: 38
|
|
347
|
+
}; // use keyboard accessibility feat to drag items
|
|
289
348
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
349
|
+
handle.focus();
|
|
350
|
+
|
|
351
|
+
_react2.fireEvent.keyDown(handle, {
|
|
352
|
+
keyCode: 32
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
_context.next = 5;
|
|
356
|
+
return (0, _react2.waitForElement)(function () {
|
|
357
|
+
return getByText(/You have lifted an item/i);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
case 5:
|
|
361
|
+
i = 0;
|
|
362
|
+
|
|
363
|
+
case 6:
|
|
364
|
+
if (!(i < times)) {
|
|
365
|
+
_context.next = 13;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
_react2.fireEvent.keyDown(handle, {
|
|
370
|
+
keyCode: directions[direction]
|
|
371
|
+
}); // eslint-disable-next-line no-await-in-loop
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
_context.next = 10;
|
|
375
|
+
return (0, _react2.waitForElement)(function () {
|
|
376
|
+
return getByText(/You have moved the item/i);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
case 10:
|
|
380
|
+
i += 1;
|
|
381
|
+
_context.next = 6;
|
|
382
|
+
break;
|
|
383
|
+
|
|
384
|
+
case 13:
|
|
385
|
+
_react2.fireEvent.keyDown(handle, {
|
|
386
|
+
keyCode: 32
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
_context.next = 16;
|
|
390
|
+
return (0, _react2.waitForElement)(function () {
|
|
391
|
+
return getByText(/You have dropped the item/i);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
case 16:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context.stop();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, _callee);
|
|
400
|
+
}));
|
|
401
|
+
|
|
402
|
+
return function dragItem(_x, _x2, _x3, _x4) {
|
|
403
|
+
return _ref7.apply(this, arguments);
|
|
404
|
+
};
|
|
405
|
+
}();
|
|
406
|
+
|
|
407
|
+
it('calls onDragEnd prop when sorting with DnD', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
408
|
+
var onDragEnd, _render11, getByText;
|
|
409
|
+
|
|
410
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
411
|
+
while (1) {
|
|
412
|
+
switch (_context2.prev = _context2.next) {
|
|
413
|
+
case 0:
|
|
414
|
+
onDragEnd = jest.fn();
|
|
415
|
+
_render11 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
416
|
+
columns: columns,
|
|
417
|
+
data: data,
|
|
418
|
+
onDragEnd: onDragEnd
|
|
419
|
+
})), getByText = _render11.getByText;
|
|
420
|
+
_context2.next = 4;
|
|
421
|
+
return dragItem(getByText('Avatar'), 2, 'down', getByText);
|
|
422
|
+
|
|
423
|
+
case 4:
|
|
424
|
+
expect(onDragEnd).toHaveBeenCalledWith(0, 2);
|
|
425
|
+
|
|
426
|
+
case 5:
|
|
427
|
+
case "end":
|
|
428
|
+
return _context2.stop();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}, _callee2);
|
|
432
|
+
})));
|
|
433
|
+
describe('grouped data', function () {
|
|
434
|
+
// the beginning of the table is outside any group
|
|
435
|
+
it('does not call onDragEnd prop when moving item to the beginning', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
436
|
+
var onDragEnd, _render12, getByText;
|
|
437
|
+
|
|
438
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
439
|
+
while (1) {
|
|
440
|
+
switch (_context3.prev = _context3.next) {
|
|
441
|
+
case 0:
|
|
442
|
+
onDragEnd = jest.fn();
|
|
443
|
+
_render12 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
444
|
+
columns: groupColumns,
|
|
445
|
+
data: groupData,
|
|
446
|
+
onDragEnd: onDragEnd,
|
|
447
|
+
rowDataPath: "vegetables",
|
|
448
|
+
GroupHeader: function GroupHeader(_ref10) {
|
|
449
|
+
var name = _ref10.groupData.name;
|
|
450
|
+
return _react.default.createElement("span", null, name);
|
|
451
|
+
}
|
|
452
|
+
})), getByText = _render12.getByText;
|
|
453
|
+
_context3.next = 4;
|
|
454
|
+
return dragItem(getByText('garlic'), 2, 'up', getByText);
|
|
455
|
+
|
|
456
|
+
case 4:
|
|
457
|
+
expect(onDragEnd).not.toHaveBeenCalled();
|
|
458
|
+
|
|
459
|
+
case 5:
|
|
460
|
+
case "end":
|
|
461
|
+
return _context3.stop();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}, _callee3);
|
|
465
|
+
})));
|
|
466
|
+
it('calls onDragEnd prop when moving item to a group before', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
467
|
+
var onDragEnd, _render13, getByText;
|
|
468
|
+
|
|
469
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
470
|
+
while (1) {
|
|
471
|
+
switch (_context4.prev = _context4.next) {
|
|
472
|
+
case 0:
|
|
473
|
+
onDragEnd = jest.fn();
|
|
474
|
+
_render13 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
475
|
+
columns: groupColumns,
|
|
476
|
+
data: groupData,
|
|
477
|
+
onDragEnd: onDragEnd,
|
|
478
|
+
rowDataPath: "vegetables",
|
|
479
|
+
GroupHeader: function GroupHeader(_ref12) {
|
|
480
|
+
var name = _ref12.groupData.name;
|
|
481
|
+
return _react.default.createElement("span", null, name);
|
|
482
|
+
}
|
|
483
|
+
})), getByText = _render13.getByText;
|
|
484
|
+
_context4.next = 4;
|
|
485
|
+
return dragItem(getByText('kale'), 2, 'up', getByText);
|
|
486
|
+
|
|
487
|
+
case 4:
|
|
488
|
+
expect(onDragEnd).toHaveBeenCalledWith([1, 1], [0, 2]);
|
|
489
|
+
|
|
490
|
+
case 5:
|
|
491
|
+
case "end":
|
|
492
|
+
return _context4.stop();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}, _callee4);
|
|
496
|
+
})));
|
|
497
|
+
it('calls onDragEnd prop when moving item to a group after', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
498
|
+
var onDragEnd, _render14, getByText;
|
|
499
|
+
|
|
500
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
501
|
+
while (1) {
|
|
502
|
+
switch (_context5.prev = _context5.next) {
|
|
503
|
+
case 0:
|
|
504
|
+
onDragEnd = jest.fn();
|
|
505
|
+
_render14 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
506
|
+
columns: groupColumns,
|
|
507
|
+
data: groupData,
|
|
508
|
+
onDragEnd: onDragEnd,
|
|
509
|
+
rowDataPath: "vegetables",
|
|
510
|
+
GroupHeader: function GroupHeader(_ref14) {
|
|
511
|
+
var name = _ref14.groupData.name;
|
|
512
|
+
return _react.default.createElement("span", null, name);
|
|
513
|
+
}
|
|
514
|
+
})), getByText = _render14.getByText;
|
|
515
|
+
_context5.next = 4;
|
|
516
|
+
return dragItem(getByText('onion'), 2, 'down', getByText);
|
|
517
|
+
|
|
518
|
+
case 4:
|
|
519
|
+
expect(onDragEnd).toHaveBeenCalledWith([0, 0], [1, 0]);
|
|
520
|
+
|
|
521
|
+
case 5:
|
|
522
|
+
case "end":
|
|
523
|
+
return _context5.stop();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}, _callee5);
|
|
527
|
+
})));
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
describe('rendering custom header', function () {
|
|
531
|
+
it('renders a custom header', function () {
|
|
532
|
+
var firstColumn = columns[0],
|
|
533
|
+
rest = columns.slice(1);
|
|
534
|
+
var headerTitle = 'Custom header';
|
|
535
|
+
|
|
536
|
+
var _render15 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
537
|
+
columns: [_objectSpread({
|
|
538
|
+
HeaderCell: function HeaderCell() {
|
|
539
|
+
return _react.default.createElement("span", null, headerTitle);
|
|
540
|
+
}
|
|
541
|
+
}, firstColumn)].concat(_toConsumableArray(rest)),
|
|
542
|
+
data: data
|
|
543
|
+
})),
|
|
544
|
+
getByText = _render15.getByText;
|
|
545
|
+
|
|
546
|
+
expect(getByText(headerTitle)).toBeTruthy();
|
|
547
|
+
});
|
|
302
548
|
});
|
|
303
549
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.columns.d.ts","sourceRoot":"","sources":["../../../src/components/Table/schema.columns.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.columns.d.ts","sourceRoot":"","sources":["../../../src/components/Table/schema.columns.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAqC,CAAC;AAoClD,eAAe,MAAM,CAAC"}
|
|
@@ -12,13 +12,15 @@ var schema = (0, _reactDesc.describe)({
|
|
|
12
12
|
displayName: 'Table'
|
|
13
13
|
});
|
|
14
14
|
schema.propTypes = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
HeaderCell: _reactDesc.PropTypes.any.description('A React Component used to render a custom column header cell. See below for more details.').format('React Component'),
|
|
16
|
+
DataCell: _reactDesc.PropTypes.any.description("A React Component used to render data inside one of the column's data cells. See below for more details.").format('React Component').isRequired,
|
|
17
|
+
getCellAttrs: _reactDesc.PropTypes.func.description("A function that returns additional attributes for the rendered `<td>`. Receives the row's data and the column's name as arguments. See below for function signature."),
|
|
18
|
+
getHeaderCellAttrs: _reactDesc.PropTypes.func.description('A function that returns additional attributes for the rendered `<th>` within the `<thead>`. Receives the column name as argument. See below for function signature.'),
|
|
19
|
+
getCellKey: _reactDesc.PropTypes.func.description("A function that returns a unique, stable key for each cell based on the row's data and the column's name. Receives the row's data and the column's name as arguments. Defaults to `columnName`. See below for function signature."),
|
|
18
20
|
name: _reactDesc.PropTypes.string.description('The name of this column. Must be unique to the table.').isRequired,
|
|
19
21
|
sortBy: _reactDesc.PropTypes.func.description("If included (with a title), makes a column sortable. Will be called with the new sorting type when a user clicks on the column's header. Should cause the data provided to the table to update based on the new sorting type."),
|
|
20
22
|
title: _reactDesc.PropTypes.string.description("The text displayed in a column's header."),
|
|
21
|
-
fixed: _reactDesc.PropTypes.
|
|
23
|
+
fixed: _reactDesc.PropTypes.bool.description('If true the column will be kept visible when scrolling horizontally, it will stick to the left when the column is at the beginning of the array and to the right when at the end. Fixed columns can be grouped at the beginning or at the end of the array, if set to a column in the middle it will be ignored. Horizontal scroll in table is required.')
|
|
22
24
|
};
|
|
23
25
|
var _default = schema;
|
|
24
26
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Table/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Table/schema.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,KAAqC,CAAC;AAkElD,eAAe,MAAM,CAAC"}
|
|
@@ -23,7 +23,7 @@ var schema = (0, _reactDesc.describe)({
|
|
|
23
23
|
displayName: 'Table'
|
|
24
24
|
});
|
|
25
25
|
schema.propTypes = {
|
|
26
|
-
GroupHeader: _reactDesc.PropTypes.any.description('A React Component used to render a header within the table for grouped data. Required if `rowDataPath` is provided.').format('React Component'),
|
|
26
|
+
GroupHeader: _reactDesc.PropTypes.any.description('A React Component used to render a header within the table for grouped data. Required if `rowDataPath` is provided. Receives `groupData` as prop.').format('React Component'),
|
|
27
27
|
columns: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.object).description('An array of column configuration objects (described in more detail below). Columns will be displayed in the order of the array.').isRequired,
|
|
28
28
|
data: _reactDesc.PropTypes.arrayOf(_reactDesc.PropTypes.object).description('An array of row data objects. Row data can contain basically anything. Rows will be displayed in the order of the array.').isRequired,
|
|
29
29
|
defaultSort: _reactDesc.PropTypes.shape({
|
|
@@ -31,15 +31,17 @@ schema.propTypes = {
|
|
|
31
31
|
sortingType: _reactDesc.PropTypes.oneOf([_useSortableHeaders.ASCENDING, _useSortableHeaders.DESCENDING, _useSortableHeaders.UNSORTED]).description('The initial sort type.')
|
|
32
32
|
}).description("Indicates that the provided data is initially sorted on the given column, in the specified direction. The column's onSort handler will NOT be called; it is assumed that the data has been sorted prior to the initial render."),
|
|
33
33
|
footer: _reactDesc.PropTypes.any.description("A React Component used to render a footer area beneath the table rows. This component is not included in the 'height' if set.").format('React Component'),
|
|
34
|
-
getGroupHeaderAttrs: _reactDesc.PropTypes.func.description(
|
|
35
|
-
getRowAttrs: _reactDesc.PropTypes.func.description(
|
|
36
|
-
getRowKey: _reactDesc.PropTypes.func.description("A function that returns a unique, stable key for each row based on that row's data. Defaults to `rowData['key']` or `rowData['id']`."),
|
|
34
|
+
getGroupHeaderAttrs: _reactDesc.PropTypes.func.description("A function that returns additional attributes for the `<th>` rendered as a row group header. Receives the row's data as argument. See below for function signature."),
|
|
35
|
+
getRowAttrs: _reactDesc.PropTypes.func.description("A function that returns additional attributes for the rendered `<tr>` within the `<tbody>`. Receives 2 arguments: the row's data and an options object. See below for function signature."),
|
|
36
|
+
getRowKey: _reactDesc.PropTypes.func.description("A function that returns a unique, stable key for each row based on that row's data. Receives 2 arguments: the row's data and an options object. Defaults to `rowData['key']` or `rowData['id']`. See below for function signature."),
|
|
37
37
|
height: _reactDesc.PropTypes.string.description('A pass through CSS value for the height of the table.'),
|
|
38
38
|
kind: _reactDesc.PropTypes.oneOf(['primary', 'secondary']).description('A flag controlling the kind of table displayed.').defaultValue('primary'),
|
|
39
39
|
rowDataPath: _reactDesc.PropTypes.string.description('A valid path to an array of rowData objects within a groupData object. Required if `GroupHeader` is provided.'),
|
|
40
|
-
scroll: _reactDesc.PropTypes.oneOf(['x', 'y']).description('A responsive modifier used to control scrolling on the table.
|
|
40
|
+
scroll: _reactDesc.PropTypes.oneOf(['x', 'y']).description('A responsive modifier used to control scrolling on the table.'),
|
|
41
41
|
size: _reactDesc.PropTypes.oneOf(['_'].concat(_toConsumableArray(Object.keys(_breakpointObserver.sizes)))).description('Defines the breakpoint to use (for use in reactive design).'),
|
|
42
|
-
variant: _reactDesc.PropTypes.oneOf(['comfortable', 'compact']).description('A flag controlling the variant of the table displayed.').defaultValue('comfortable')
|
|
42
|
+
variant: _reactDesc.PropTypes.oneOf(['comfortable', 'compact']).description('A flag controlling the variant of the table displayed.').defaultValue('comfortable'),
|
|
43
|
+
onDragEnd: _reactDesc.PropTypes.func.description("If present enables Drag-and-Drop sorting. A function called after the order of rows changes when a row is dragged and dropped, it is called with 2 arguments: the index from where it's dragged and the index to where it's dropped, if there are grouped rows each argument is an array where the first element is the group index and the second the row index inside the group. See below for function signature."),
|
|
44
|
+
dragVariant: _reactDesc.PropTypes.oneOf(['handle', 'row']).description('When Drag-and-Drop sorting is enabled, defines if the rows should be dragged only from the default handle or from anywhere in the row. This flag is ignored when a `DragHandle` node is rendered in a `DataCell`.').defaultValue('row')
|
|
43
45
|
};
|
|
44
46
|
var _default = schema;
|
|
45
47
|
exports.default = _default;
|
|
@@ -2,19 +2,30 @@
|
|
|
2
2
|
import { sizes } from '@decisiv/breakpoint-observer';
|
|
3
3
|
import { HeightProperty } from 'csstype';
|
|
4
4
|
import { ModifiersProp } from 'styled-components-modifiers';
|
|
5
|
+
import { DroppableProvided, DroppableStateSnapshot, DraggableProvided, DraggableStateSnapshot, DropResult } from 'react-beautiful-dnd';
|
|
5
6
|
import { KindModifiers, ScrollModifiersConfig, VariantModifiers } from './Container';
|
|
6
7
|
import { SortableState, SortingTypes } from './hooks/useSortableHeaders';
|
|
8
|
+
import { CustomHeaderCellProps } from './HeaderCell/types';
|
|
7
9
|
export { KindModifiers, ScrollModifiers, VariantModifiers } from './Container';
|
|
8
10
|
export interface Column<TData> {
|
|
11
|
+
HeaderCell?: (props: CustomHeaderCellProps) => JSX.Element;
|
|
9
12
|
DataCell: (props: DataCellProps<TData>) => JSX.Element;
|
|
10
13
|
getCellAttrs?: (rowData: TData, columnName: string) => object | undefined;
|
|
14
|
+
getHeaderCellAttrs?: (columnName: string) => object | undefined;
|
|
11
15
|
getCellKey?: (rowData: TData, columnName: string) => string;
|
|
12
16
|
name: string;
|
|
13
17
|
sortBy?: (sortingType: SortingTypes) => void;
|
|
14
18
|
title?: string;
|
|
15
|
-
fixed?:
|
|
19
|
+
fixed?: boolean;
|
|
16
20
|
}
|
|
21
|
+
export declare type DragVariant = 'handle' | 'row';
|
|
17
22
|
export declare type Columns<TData> = Column<TData>[];
|
|
23
|
+
export interface FixedColumns {
|
|
24
|
+
[name: string]: {
|
|
25
|
+
offset: number;
|
|
26
|
+
alignment: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
18
29
|
export interface HeadProps<TData> {
|
|
19
30
|
columns: Columns<TData>;
|
|
20
31
|
kind?: KindModifiers;
|
|
@@ -23,13 +34,14 @@ export interface HeadProps<TData> {
|
|
|
23
34
|
export interface DataRowProps<TData> {
|
|
24
35
|
className?: 'group-data-row';
|
|
25
36
|
columns: Columns<TData>;
|
|
26
|
-
getRowAttrs?:
|
|
37
|
+
getRowAttrs?: TableProps<TData>['getRowAttrs'];
|
|
27
38
|
groupData?: TData;
|
|
28
39
|
groupId?: string | undefined;
|
|
29
40
|
kind?: KindModifiers;
|
|
30
41
|
rowData: TData;
|
|
31
42
|
rowIndex: number;
|
|
32
43
|
variant?: VariantModifiers;
|
|
44
|
+
provided?: DraggableProvided;
|
|
33
45
|
}
|
|
34
46
|
interface DataCellProps<TData> extends Omit<Column<TData>, 'DataCell' | 'sortBy' | 'title'> {
|
|
35
47
|
colIndex: number;
|
|
@@ -38,6 +50,7 @@ interface DataCellProps<TData> extends Omit<Column<TData>, 'DataCell' | 'sortBy'
|
|
|
38
50
|
rowData: TData;
|
|
39
51
|
rowIndex: number;
|
|
40
52
|
variant?: VariantModifiers;
|
|
53
|
+
DragHandle?: React.ReactNode;
|
|
41
54
|
}
|
|
42
55
|
export interface RowData extends Object {
|
|
43
56
|
key?: string;
|
|
@@ -66,11 +79,28 @@ export interface TableProps<TData extends RowData> extends HeadProps<TData>, Too
|
|
|
66
79
|
data: TData[];
|
|
67
80
|
defaultSort?: SortableState;
|
|
68
81
|
getGroupHeaderAttrs?: (groupData: TData) => object | undefined;
|
|
69
|
-
getRowAttrs?: (rowData: TData,
|
|
70
|
-
|
|
82
|
+
getRowAttrs?: (rowData: TData, options: {
|
|
83
|
+
isGroupHeaderRow?: boolean;
|
|
84
|
+
}) => object | undefined;
|
|
85
|
+
getRowKey?: (rowData: TData, options: {
|
|
86
|
+
isGroupHeaderRow?: boolean;
|
|
87
|
+
}) => string;
|
|
71
88
|
height?: HeightProperty<string>;
|
|
72
89
|
rowDataPath?: string;
|
|
73
90
|
scroll?: ModifiersProp<ScrollModifiersConfig, typeof sizes>;
|
|
74
91
|
size?: keyof typeof sizes;
|
|
92
|
+
onDragEnd?: (from: number | number[], to: number | number[]) => void;
|
|
93
|
+
dragVariant?: DragVariant;
|
|
94
|
+
}
|
|
95
|
+
export interface DroppableWrapperProps {
|
|
96
|
+
children(provided?: DroppableProvided, snapshot?: DroppableStateSnapshot): React.ReactElement<HTMLElement>;
|
|
97
|
+
onDragEnd: (result: DropResult) => void;
|
|
98
|
+
onBeforeDragStart: () => void;
|
|
99
|
+
}
|
|
100
|
+
export interface DraggableWrapperProps {
|
|
101
|
+
isDragDisabled?: boolean;
|
|
102
|
+
dndIndex: number;
|
|
103
|
+
id: string;
|
|
104
|
+
children(provided?: DraggableProvided, snapshot?: DraggableStateSnapshot): React.ReactElement<HTMLElement>;
|
|
75
105
|
}
|
|
76
106
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Table/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Table/types.ts"],"names":[],"mappings":";AAAA,OA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AO,CAAA;KAAE,KACpC,MAAM,CAAC;IAKZ,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAOhC,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,MAAM,CAAC,EAAE,aAAa,CAAC,qBAAqB,EAAE,OAAO,KAAK,CAAC,CAAC;IAK5D,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC;IAK1B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IAMrE,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CACN,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,QAAQ,CAAC,EAAE,sBAAsB,GAChC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACnC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CACN,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,QAAQ,CAAC,EAAE,sBAAsB,GAChC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;CACpC"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { RowData, TableProps, WrapperProps, Columns } from './types';
|
|
1
|
+
import { RowData, TableProps, WrapperProps, Columns, FixedColumns } from './types';
|
|
2
2
|
export declare function defaultGetRowKey({ key, id }: RowData): string | undefined;
|
|
3
3
|
export declare function isGroupData<TData>(dataObj: TData, { rowDataPath, GroupHeader }: TableProps<TData>): boolean;
|
|
4
4
|
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, WrapperProps, never>;
|
|
5
|
-
export interface ColumnsOffset {
|
|
6
|
-
[name: string]: number;
|
|
7
|
-
}
|
|
8
5
|
export declare function calculateOffsets<T>(columns: Columns<T>, columnsWidth: {
|
|
9
6
|
[name: string]: number;
|
|
10
|
-
}):
|
|
11
|
-
leftColumnsOffset: ColumnsOffset;
|
|
12
|
-
rightColumnsOffset: ColumnsOffset;
|
|
13
|
-
};
|
|
7
|
+
}): FixedColumns;
|
|
14
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Table/utils.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Table/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,EACP,UAAU,EACV,YAAY,EACZ,OAAO,EACP,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAC/B,OAAO,EAAE,KAAK,EACd,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,GAC9C,OAAO,CAMT;AAaD,eAAO,MAAM,OAAO,8EAQnB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,YAAY,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACvC,YAAY,CA4Bd"}
|