@unbxd-ui/unbxd-react-components 0.2.145 → 0.2.146
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/README.md +17 -1
- package/components/Accordian/Accordian.js +1 -2
- package/components/Accordian/Accordian.stories.js +140 -117
- package/components/Button/Button.stories.js +167 -61
- package/components/Button/DropdownButton.js +1 -2
- package/components/Button/index.js +1 -2
- package/components/DataLoader/DataLoader.js +1 -2
- package/components/DataLoader/DataLoader.stories.js +239 -53
- package/components/Form/Checkbox.js +5 -4
- package/components/Form/DragDropFileUploader.js +1 -2
- package/components/Form/Dropdown.js +1 -2
- package/components/Form/FileUploader.js +1 -2
- package/components/Form/Form.js +1 -2
- package/components/Form/Input.js +1 -2
- package/components/Form/RadioList.js +1 -2
- package/components/Form/RangeSlider.js +1 -2
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +17 -11
- package/components/Form/Textarea.js +1 -2
- package/components/Form/Toggle.js +1 -2
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +7 -0
- package/components/Form/stories/Checkbox.stories.js +138 -39
- package/components/Form/stories/Dropdown.stories.js +322 -91
- package/components/Form/stories/FileUploader.stories.js +177 -18
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +161 -63
- package/components/Form/stories/SearchableDropdown.stories.js +189 -0
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +365 -0
- package/components/Form/stories/Textarea.stories.js +112 -33
- package/components/Form/stories/Toggle.stories.js +192 -13
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +1 -2
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/List/List.stories.js +238 -0
- package/components/Modal/Modal.js +1 -2
- package/components/Modal/Modal.stories.js +256 -37
- package/components/Modal/modalCore.css +1 -1
- package/components/NotificationComponent/NotificationComponent.js +1 -2
- package/components/NotificationComponent/NotificationComponent.stories.js +170 -18
- package/components/PageLoader/PageLoader.js +84 -0
- package/components/PageLoader/PageLoader.stories.js +276 -0
- package/components/PageLoader/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.css +1 -0
- package/components/ProgressBar/ProgressBar.css +0 -0
- package/components/ProgressBar/ProgressBar.stories.js +202 -9
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +84 -354
- package/components/Table/Table.js +6 -359
- package/components/Table/Table.stories.js +2109 -150
- package/components/Table/TableChild.js +383 -0
- package/components/Table/TableConstants.js +15 -0
- package/components/Table/hooks/usePrevious.js +14 -0
- package/components/Table/index.js +13 -0
- package/components/Table/tableCore.css +1 -1
- package/components/TableOld/BaseTable.js +373 -0
- package/components/TableOld/PaginationComponent.js +86 -0
- package/components/TableOld/TableOld.js +367 -0
- package/components/TableOld/index.js +15 -0
- package/components/TabsComponent/TabsComponent.js +1 -2
- package/components/TabsComponent/TabsComponent.stories.js +290 -52
- package/components/ToastNotification/ToastNotificationWrapper.js +212 -0
- package/components/ToastNotification/ToastNotificationWrapper.stories.js +554 -0
- package/components/ToastNotification/index.js +40 -0
- package/components/ToastNotification/toastNotificationCore.css +1 -0
- package/components/Tooltip/Tooltip.js +221 -83
- package/components/Tooltip/Tooltip.stories.js +379 -14
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/core.css +2 -3
- package/components/core.scss +17 -0
- package/components/index.js +58 -2
- package/components/theme.css +2 -3
- package/core/dataLoader.js +5 -2
- package/index.js +54 -0
- package/package.json +31 -20
- package/components/Button/DropdownButton.stories.js +0 -49
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -25
- package/components/Form/stories/FormDefault.stories.js +0 -115
- package/components/Form/stories/RadioList.stories.js +0 -53
- package/components/Form/stories/TextInput.stories.js +0 -76
- package/components/Form/stories/form.stories.js +0 -233
- package/components/List/list.stories.js +0 -35
- package/core/dataLoader.stories.js +0 -119
|
@@ -1,374 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDataTableComponent = _interopRequireDefault(require("react-data-table-component"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var
|
|
11
|
-
var _Checkbox = _interopRequireDefault(require("../Form/Checkbox"));
|
|
10
|
+
var _excluded = ["customStyles", "fixedHeader", "pagination", "dense", "data", "onChangePage", "paginationServer"];
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
16
|
-
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."); }
|
|
17
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
18
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
19
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
25
|
-
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."); }
|
|
26
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
27
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
28
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
30
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/* eslint-disable react/prop-types */
|
|
42
|
-
|
|
43
|
-
var getTDValue = function getTDValue(_ref) {
|
|
44
|
-
var columnValue = _ref.columnValue,
|
|
45
|
-
_ref$rowData = _ref.rowData,
|
|
46
|
-
rowData = _ref$rowData === void 0 ? {} : _ref$rowData,
|
|
47
|
-
_ref$columnConfig = _ref.columnConfig,
|
|
48
|
-
columnConfig = _ref$columnConfig === void 0 ? {} : _ref$columnConfig,
|
|
49
|
-
_ref$tdProps = _ref.tdProps,
|
|
50
|
-
tdProps = _ref$tdProps === void 0 ? {} : _ref$tdProps;
|
|
51
|
-
var key = columnConfig.key,
|
|
52
|
-
valueFormatter = columnConfig.valueFormatter,
|
|
53
|
-
ColumnComponent = columnConfig.ColumnComponent,
|
|
54
|
-
_columnConfig$compone = columnConfig.componentProps,
|
|
55
|
-
componentProps = _columnConfig$compone === void 0 ? {} : _columnConfig$compone;
|
|
56
|
-
var tdValue = columnValue;
|
|
57
|
-
if (typeof valueFormatter === "function") {
|
|
58
|
-
tdValue = valueFormatter({
|
|
59
|
-
value: columnValue,
|
|
60
|
-
record: rowData
|
|
61
|
-
});
|
|
62
|
-
} else if (ColumnComponent) {
|
|
63
|
-
tdValue = /*#__PURE__*/_react["default"].createElement(ColumnComponent, _extends({
|
|
64
|
-
record: rowData
|
|
65
|
-
}, componentProps));
|
|
66
|
-
}
|
|
67
|
-
return /*#__PURE__*/_react["default"].createElement("td", _extends({
|
|
68
|
-
key: key
|
|
69
|
-
}, tdProps), tdValue);
|
|
70
|
-
};
|
|
71
|
-
var ExpandableTR = function ExpandableTR(props) {
|
|
72
|
-
var rowIndex = props.rowIndex,
|
|
73
|
-
rowData = props.rowData,
|
|
74
|
-
columnConfigs = props.columnConfigs,
|
|
75
|
-
isEven = props.isEven,
|
|
76
|
-
ExpandedRowComponent = props.ExpandedRowComponent,
|
|
77
|
-
showCheckbox = props.showCheckbox,
|
|
78
|
-
checkboxChangeCounter = props.checkboxChangeCounter,
|
|
79
|
-
checkboxValue = props.checkboxValue,
|
|
80
|
-
onSelectionChange = props.onSelectionChange;
|
|
81
|
-
var _useState = (0, _react.useState)(checkboxValue || false),
|
|
82
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
83
|
-
selected = _useState2[0],
|
|
84
|
-
setSelected = _useState2[1];
|
|
85
|
-
var _useState3 = (0, _react.useState)(false),
|
|
86
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
87
|
-
isExpanded = _useState4[0],
|
|
88
|
-
setIsExpanded = _useState4[1];
|
|
89
|
-
var onChange = function onChange(value) {
|
|
90
|
-
setSelected(value);
|
|
91
|
-
onSelectionChange(rowData, value);
|
|
92
|
-
};
|
|
93
|
-
(0, _react.useEffect)(function () {
|
|
94
|
-
setSelected(checkboxValue);
|
|
95
|
-
}, [checkboxChangeCounter, checkboxValue]);
|
|
96
|
-
var toggleExpanded = function toggleExpanded() {
|
|
97
|
-
setIsExpanded(!isExpanded);
|
|
98
|
-
};
|
|
99
|
-
var className = "RCB-tr RCB-parent-row " + (isEven ? "RCB-even-tr" : "RCB-odd-tr");
|
|
100
|
-
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("tr", {
|
|
101
|
-
className: className
|
|
102
|
-
}, getTDValue({
|
|
103
|
-
columnValue: "",
|
|
104
|
-
columnConfig: {
|
|
105
|
-
key: "expandIcon"
|
|
106
|
-
},
|
|
107
|
-
tdProps: {
|
|
108
|
-
onClick: toggleExpanded,
|
|
109
|
-
className: isExpanded ? "expand-open" : "expand-close"
|
|
13
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
|
+
var customStyles = {
|
|
16
|
+
table: {
|
|
17
|
+
borderRadius: '8px',
|
|
18
|
+
overflow: 'hidden'
|
|
19
|
+
},
|
|
20
|
+
rows: {
|
|
21
|
+
style: {
|
|
22
|
+
border: 'none'
|
|
110
23
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
onChange: onChange,
|
|
118
|
-
value: selected
|
|
119
|
-
})), columnConfigs.map(function (configObj) {
|
|
120
|
-
var key = configObj.key;
|
|
121
|
-
return getTDValue({
|
|
122
|
-
columnValue: rowData[key],
|
|
123
|
-
rowData: rowData,
|
|
124
|
-
columnConfig: configObj,
|
|
125
|
-
tdProps: {
|
|
126
|
-
onClick: toggleExpanded
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
})), isExpanded && /*#__PURE__*/_react["default"].createElement("tr", {
|
|
130
|
-
className: "RCB-expanded-row"
|
|
131
|
-
}, /*#__PURE__*/_react["default"].createElement("td", {
|
|
132
|
-
colSpan: columnConfigs.length + 1
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement(ExpandedRowComponent, {
|
|
134
|
-
parentRecord: rowData
|
|
135
|
-
}))));
|
|
136
|
-
};
|
|
137
|
-
ExpandableTR.propTypes = {
|
|
138
|
-
ExpandedRowComponent: _propTypes["default"].any.isRequired // TODO : check for a React Component
|
|
139
|
-
};
|
|
140
|
-
var TR = function TR(props) {
|
|
141
|
-
var rowIndex = props.rowIndex,
|
|
142
|
-
rowData = props.rowData,
|
|
143
|
-
columnConfigs = props.columnConfigs,
|
|
144
|
-
isEven = props.isEven,
|
|
145
|
-
showCheckbox = props.showCheckbox,
|
|
146
|
-
checkboxChangeCounter = props.checkboxChangeCounter,
|
|
147
|
-
checkboxValue = props.checkboxValue,
|
|
148
|
-
onSelectionChange = props.onSelectionChange;
|
|
149
|
-
var _useState5 = (0, _react.useState)(checkboxValue || false),
|
|
150
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
151
|
-
selected = _useState6[0],
|
|
152
|
-
setSelected = _useState6[1];
|
|
153
|
-
var className = "RCB-tr " + (isEven ? "RCB-even-tr" : "RCB-odd-tr");
|
|
154
|
-
var onChange = function onChange(value) {
|
|
155
|
-
setSelected(value);
|
|
156
|
-
onSelectionChange(rowData, value);
|
|
157
|
-
};
|
|
158
|
-
(0, _react.useEffect)(function () {
|
|
159
|
-
setSelected(checkboxValue);
|
|
160
|
-
}, [checkboxChangeCounter, checkboxValue]);
|
|
161
|
-
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
162
|
-
className: className
|
|
163
|
-
}, showCheckbox && /*#__PURE__*/_react["default"].createElement("td", {
|
|
164
|
-
key: "checkbox-colum-".concat(rowIndex)
|
|
165
|
-
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
166
|
-
name: "checkbox".concat(rowIndex),
|
|
167
|
-
type: "checkbox",
|
|
168
|
-
className: "table-checkbox",
|
|
169
|
-
onChange: onChange,
|
|
170
|
-
value: selected
|
|
171
|
-
})), columnConfigs.map(function (configObj) {
|
|
172
|
-
var key = configObj.key;
|
|
173
|
-
return getTDValue({
|
|
174
|
-
columnValue: rowData[key],
|
|
175
|
-
rowData: rowData,
|
|
176
|
-
columnConfig: configObj
|
|
177
|
-
});
|
|
178
|
-
}));
|
|
179
|
-
};
|
|
180
|
-
var BaseTable = function BaseTable(props, ref) {
|
|
181
|
-
var className = props.className,
|
|
182
|
-
records = props.records,
|
|
183
|
-
columnConfigs = props.columnConfigs,
|
|
184
|
-
idAttribute = props.idAttribute,
|
|
185
|
-
checkboxConfig = props.checkboxConfig,
|
|
186
|
-
isExpandableTable = props.isExpandableTable,
|
|
187
|
-
ExpandedRowComponent = props.ExpandedRowComponent,
|
|
188
|
-
noDataComponent = props.noDataComponent,
|
|
189
|
-
sortByConfig = props.sortByConfig,
|
|
190
|
-
resetPageNo = props.resetPageNo,
|
|
191
|
-
pageNo = props.pageNo,
|
|
192
|
-
tbodyClassName = props.tbodyClassName,
|
|
193
|
-
refreshFeature = props.refreshFeature,
|
|
194
|
-
onRefreshTableData = props.onRefreshTableData,
|
|
195
|
-
isTableRefreshing = props.isTableRefreshing,
|
|
196
|
-
refreshIconClass = props.refreshIconClass,
|
|
197
|
-
spinnerIconClass = props.spinnerIconClass,
|
|
198
|
-
onRefreshCB = props.onRefreshCB;
|
|
199
|
-
var _DEFAULT_CHECKBOX_CON = _objectSpread(_objectSpread({}, DEFAULT_CHECKBOX_CONFIG), checkboxConfig || {}),
|
|
200
|
-
showCheckbox = _DEFAULT_CHECKBOX_CON.enabled,
|
|
201
|
-
showInHeader = _DEFAULT_CHECKBOX_CON.showInHeader;
|
|
202
|
-
var sortBy = sortByConfig.sortBy,
|
|
203
|
-
sortOrder = sortByConfig.sortOrder;
|
|
204
|
-
var _useState7 = (0, _react.useState)(false),
|
|
205
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
206
|
-
checkboxValue = _useState8[0],
|
|
207
|
-
setCheckboxValue = _useState8[1];
|
|
208
|
-
var _useState9 = (0, _react.useState)(0),
|
|
209
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
210
|
-
checkboxChangeCounter = _useState10[0],
|
|
211
|
-
setChangeCounter = _useState10[1];
|
|
212
|
-
var _useState11 = (0, _react.useState)([]),
|
|
213
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
214
|
-
selected = _useState12[0],
|
|
215
|
-
setSelected = _useState12[1];
|
|
216
|
-
var RowComponent = isExpandableTable ? ExpandableTR : TR;
|
|
217
|
-
var onSelectionChange = function onSelectionChange(record, checked) {
|
|
218
|
-
if (checked) {
|
|
219
|
-
/* add to selected array */
|
|
220
|
-
setSelected([].concat(_toConsumableArray(selected), [record]));
|
|
221
|
-
} else {
|
|
222
|
-
/* remove from selected array */
|
|
223
|
-
var newSelected = selected.filter(function (obj) {
|
|
224
|
-
return obj[idAttribute] !== record[idAttribute];
|
|
225
|
-
});
|
|
226
|
-
setSelected(newSelected);
|
|
24
|
+
},
|
|
25
|
+
headCells: {
|
|
26
|
+
style: {
|
|
27
|
+
borderRight: '1px solid rgb(224 224 224)',
|
|
28
|
+
borderTop: '1px solid rgb(224 224 224)',
|
|
29
|
+
padding: '16px'
|
|
227
30
|
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
var updateCheckboxValue = function updateCheckboxValue(newValue) {
|
|
237
|
-
setCheckboxValue(newValue);
|
|
238
|
-
setChangeCounter(checkboxChangeCounter + 1);
|
|
239
|
-
};
|
|
240
|
-
var resetSelected = function resetSelected() {
|
|
241
|
-
updateCheckboxValue(false);
|
|
242
|
-
setSelected([]);
|
|
243
|
-
};
|
|
244
|
-
var toggleSelectAll = function toggleSelectAll() {
|
|
245
|
-
var checked = !checkboxValue;
|
|
246
|
-
updateCheckboxValue(checked);
|
|
247
|
-
if (checked) {
|
|
248
|
-
setSelected(records);
|
|
249
|
-
} else {
|
|
250
|
-
setSelected([]);
|
|
31
|
+
},
|
|
32
|
+
cells: {
|
|
33
|
+
style: {
|
|
34
|
+
borderRight: '1px solid rgb(224 224 224)',
|
|
35
|
+
padding: '8px 16px 8px 16px',
|
|
36
|
+
fontSize: '14px',
|
|
37
|
+
fontWeight: '400',
|
|
38
|
+
color: '#273251'
|
|
251
39
|
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
};
|
|
259
|
-
});
|
|
260
|
-
if (records.length === 0) {
|
|
261
|
-
if (pageNo === 1) {
|
|
262
|
-
return noDataComponent;
|
|
263
|
-
} else {
|
|
264
|
-
var LoaderComponent = _utils["default"].getDefaultConfig("DefaultLoader") || "";
|
|
265
|
-
return /*#__PURE__*/_react["default"].createElement(LoaderComponent, null);
|
|
40
|
+
},
|
|
41
|
+
pagination: {
|
|
42
|
+
style: {
|
|
43
|
+
borderBottom: '1px solid rgb(224 224 224)',
|
|
44
|
+
borderRight: '1px solid rgb(224 224 224)',
|
|
45
|
+
borderLeft: '1px solid rgb(224 224 224)'
|
|
266
46
|
}
|
|
267
|
-
} else {
|
|
268
|
-
return /*#__PURE__*/_react["default"].createElement("table", {
|
|
269
|
-
className: "RCB-table ".concat(className)
|
|
270
|
-
}, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", null, isExpandableTable && /*#__PURE__*/_react["default"].createElement("th", {
|
|
271
|
-
key: "expandIcon",
|
|
272
|
-
className: "RCB-th RCB-expand-column"
|
|
273
|
-
}), showCheckbox && (showInHeader ? /*#__PURE__*/_react["default"].createElement("th", {
|
|
274
|
-
key: "headerCheckbox"
|
|
275
|
-
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
276
|
-
name: "headerCheckbox",
|
|
277
|
-
type: "checkbox",
|
|
278
|
-
className: "table-checkbox",
|
|
279
|
-
value: checkboxValue,
|
|
280
|
-
onChange: toggleSelectAll
|
|
281
|
-
})) : /*#__PURE__*/_react["default"].createElement("th", null)), columnConfigs.map(function (columnObj) {
|
|
282
|
-
var key = columnObj.key,
|
|
283
|
-
label = columnObj.label,
|
|
284
|
-
sortable = columnObj.sortable,
|
|
285
|
-
headerClassName = columnObj.headerClassName;
|
|
286
|
-
var className = "RCB-th";
|
|
287
|
-
var thAttrs = {};
|
|
288
|
-
if (sortable) {
|
|
289
|
-
className += " RCB-th-sortable";
|
|
290
|
-
if (sortBy === key) {
|
|
291
|
-
className += " RCB-th-".concat(sortOrder.toLowerCase());
|
|
292
|
-
} else {
|
|
293
|
-
className += " RCB-th-sort";
|
|
294
|
-
}
|
|
295
|
-
thAttrs = {
|
|
296
|
-
onClick: function onClick() {
|
|
297
|
-
props.onSort(columnObj);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
if (headerClassName) {
|
|
302
|
-
className += " ".concat(headerClassName);
|
|
303
|
-
}
|
|
304
|
-
return /*#__PURE__*/_react["default"].createElement("th", _extends({
|
|
305
|
-
className: className,
|
|
306
|
-
key: key
|
|
307
|
-
}, thAttrs), label);
|
|
308
|
-
}), refreshFeature && /*#__PURE__*/_react["default"].createElement("th", null, !isTableRefreshing && /*#__PURE__*/_react["default"].createElement("span", {
|
|
309
|
-
onClick: refreshTableData,
|
|
310
|
-
className: refreshIconClass
|
|
311
|
-
}), isTableRefreshing && /*#__PURE__*/_react["default"].createElement("span", {
|
|
312
|
-
className: spinnerIconClass
|
|
313
|
-
})))), /*#__PURE__*/_react["default"].createElement("tbody", {
|
|
314
|
-
className: tbodyClassName
|
|
315
|
-
}, records.map(function (rowData, index) {
|
|
316
|
-
return /*#__PURE__*/_react["default"].createElement(RowComponent, {
|
|
317
|
-
key: rowData[idAttribute],
|
|
318
|
-
isEven: _utils["default"].isEven(index),
|
|
319
|
-
rowIndex: index,
|
|
320
|
-
rowData: rowData,
|
|
321
|
-
columnConfigs: columnConfigs,
|
|
322
|
-
ExpandedRowComponent: ExpandedRowComponent,
|
|
323
|
-
showCheckbox: showCheckbox,
|
|
324
|
-
checkboxValue: checkboxValue,
|
|
325
|
-
checkboxChangeCounter: checkboxChangeCounter,
|
|
326
|
-
onSelectionChange: onSelectionChange
|
|
327
|
-
});
|
|
328
|
-
})));
|
|
329
47
|
}
|
|
330
48
|
};
|
|
331
|
-
BaseTable =
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
49
|
+
var BaseTable = function BaseTable(props) {
|
|
50
|
+
var overrideStyles = props.customStyles,
|
|
51
|
+
fixedHeader = props.fixedHeader,
|
|
52
|
+
pagination = props.pagination,
|
|
53
|
+
dense = props.dense,
|
|
54
|
+
data = props.data,
|
|
55
|
+
onChangePage = props.onChangePage,
|
|
56
|
+
paginationServer = props.paginationServer,
|
|
57
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
58
|
+
var rowAnimations = [{
|
|
59
|
+
when: function when() {
|
|
60
|
+
return true;
|
|
61
|
+
},
|
|
62
|
+
style: {
|
|
63
|
+
animation: "fadeInUp 0.4s ease-in-out"
|
|
347
64
|
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
65
|
+
}];
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(_reactDataTableComponent["default"], _extends({
|
|
67
|
+
customStyles: overrideStyles || customStyles,
|
|
68
|
+
fixedHeader: fixedHeader,
|
|
69
|
+
pagination: pagination,
|
|
70
|
+
dense: dense,
|
|
71
|
+
data: data,
|
|
72
|
+
conditionalRowStyles: rowAnimations,
|
|
73
|
+
paginationServer: paginationServer,
|
|
74
|
+
onChangePage: onChangePage
|
|
75
|
+
}, restProps));
|
|
76
|
+
};
|
|
77
|
+
BaseTable.propTypes = {
|
|
78
|
+
/** DataTable column definitions*/
|
|
79
|
+
columns: _propTypes["default"].array,
|
|
80
|
+
/**data which u want to show in table */
|
|
81
|
+
data: _propTypes["default"].array,
|
|
82
|
+
/**unique identifier for table by default its id */
|
|
83
|
+
keyField: _propTypes["default"].string,
|
|
84
|
+
/**The title displayed in the Table Header. If you do not provide the title property the Table Header will not be rendered */
|
|
85
|
+
title: _propTypes["default"].string,
|
|
86
|
+
/**Makes the table horizontally scrollable on smaller screen widths */
|
|
87
|
+
responsive: _propTypes["default"].bool,
|
|
88
|
+
/**Stripe/band color the odd rows */
|
|
89
|
+
striped: _propTypes["default"].bool,
|
|
90
|
+
/** custom css */
|
|
91
|
+
customStyles: _propTypes["default"].object,
|
|
92
|
+
/**direction */
|
|
93
|
+
direction: _propTypes["default"].string
|
|
366
94
|
};
|
|
367
95
|
BaseTable.defaultProps = {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
96
|
+
columns: [],
|
|
97
|
+
data: [],
|
|
98
|
+
keyField: "id",
|
|
99
|
+
responsive: true,
|
|
100
|
+
striped: false,
|
|
101
|
+
customStyles: customStyles,
|
|
102
|
+
direction: "auto"
|
|
373
103
|
};
|
|
374
104
|
var _default = exports["default"] = BaseTable;
|