versacall-core-library-react 2.0.65 → 2.0.67
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/dist/components/CoreAlert/CoreAlert.js +43 -107
- package/dist/components/CoreAlert/index.js +2 -4
- package/dist/components/CoreAppBar/CoreAppBar.js +275 -418
- package/dist/components/CoreAppBar/CoreAppBarDrawer.js +88 -171
- package/dist/components/CoreAppBar/index.js +2 -4
- package/dist/components/CoreAppSelector/AppLink.js +36 -60
- package/dist/components/CoreAppSelector/CoreAppSelector.js +109 -200
- package/dist/components/CoreAppSelector/index.js +2 -4
- package/dist/components/CoreDialogueToolBar/CoreDialogueToolBar.js +43 -69
- package/dist/components/CoreDialogueToolBar/index.js +2 -4
- package/dist/components/CoreDrawer/CoreDrawer.js +168 -286
- package/dist/components/CoreDrawer/index.js +2 -4
- package/dist/components/CoreDropDownTextfield/CoreDropDownTextfield.js +57 -121
- package/dist/components/CoreDropDownTextfield/index.js +2 -4
- package/dist/components/CoreElapsedTime/CoreElapsedTime.js +38 -97
- package/dist/components/CoreElapsedTime/index.js +2 -4
- package/dist/components/CoreFrame/CoreFrame.js +17 -28
- package/dist/components/CoreFrame/index.js +2 -4
- package/dist/components/CoreImportDialog/CoreImportDialog.js +87 -189
- package/dist/components/CoreImportDialog/index.js +2 -4
- package/dist/components/CoreImportResultsDialog/CoreImportResultsDialog.js +19 -45
- package/dist/components/CoreImportResultsDialog/index.js +2 -4
- package/dist/components/CoreImporting/CoreImporting.js +23 -39
- package/dist/components/CoreImporting/index.js +2 -4
- package/dist/components/CorePlugin/CorePlugin.js +83 -160
- package/dist/components/CorePlugin/OldCorePlugin.js +73 -149
- package/dist/components/CorePlugin/index.js +2 -4
- package/dist/components/CoreSaveChangesDialog/CoreSaveChangesDialog.js +10 -32
- package/dist/components/CoreSaveChangesDialog/index.js +2 -4
- package/dist/components/CoreShiftTagFilter/CoreShiftTagFilter.js +288 -408
- package/dist/components/CoreShiftTagFilter/OldCoreShiftTagFilter.js +161 -257
- package/dist/components/CoreShiftTagFilter/index.js +2 -4
- package/dist/components/CoreSideBar/CoreSideBar.js +578 -737
- package/dist/components/CoreSideBar/CoreSideBarDrawer.js +122 -212
- package/dist/components/CoreSideBar/index.js +2 -4
- package/dist/components/CoreSnackBar/CoreSnackBar.js +76 -143
- package/dist/components/CoreSnackBar/index.js +2 -4
- package/dist/components/CoreTable/CoreTable.js +219 -337
- package/dist/components/CoreTable/CoreTableChips.js +11 -19
- package/dist/components/CoreTable/CoreTableHead.js +125 -205
- package/dist/components/CoreTable/CoreTableToolbar.js +34 -56
- package/dist/components/CoreTable/index.js +2 -4
- package/dist/components/CoreTagFilter/CoreTagFilter.js +212 -319
- package/dist/components/CoreTagFilter/OldCoreTagFilter.js +270 -402
- package/dist/components/CoreTagFilter/OldTagChip.js +10 -20
- package/dist/components/CoreTagFilter/OldTagFilterSelector.js +77 -148
- package/dist/components/CoreTagFilter/OldTagOption.js +21 -47
- package/dist/components/CoreTagFilter/TagFilterBuilder.js +114 -274
- package/dist/components/CoreTagFilter/index.js +2 -4
- package/dist/components/CoreTextField/CoreTextField.js +69 -132
- package/dist/components/CoreTextField/index.js +2 -4
- package/dist/components/CoreTheme/CoreTheme.js +13 -27
- package/dist/components/CoreTheme/index.js +2 -4
- package/dist/components/CoreTile/CoreTile.js +21 -34
- package/dist/components/CoreTile/CoreTileToolbar.js +21 -36
- package/dist/components/CoreTile/index.js +2 -4
- package/dist/components/CoreTimerInput/CoreTimerInput.js +36 -60
- package/dist/components/CoreTimerInput/CoreTimerInputOld.js +29 -47
- package/dist/components/CoreTimerInput/index.js +2 -4
- package/dist/components/CoreToolbar/CoreToolbar.js +65 -95
- package/dist/components/CoreToolbar/index.js +2 -4
- package/dist/components/CoreTracker/CoreTracker.js +32 -91
- package/dist/components/CoreTracker/index.js +2 -4
- package/dist/components/CoreTranslate/CoreTranslate.js +17 -48
- package/dist/components/CoreTranslate/index.js +2 -4
- package/dist/components/CoreTranslateWrapper/CoreTranslateWrapper.js +7 -15
- package/dist/components/CoreTranslateWrapper/index.js +2 -4
- package/dist/components/CoreWidget/CoreWidget.js +81 -149
- package/dist/components/CoreWidget/index.js +2 -4
- package/dist/components/CoreWrapper/CoreWrapper.js +8 -16
- package/dist/components/CoreWrapper/index.js +2 -4
- package/dist/components/index.js +29 -58
- package/dist/constants/index.js +3 -6
- package/dist/constants/testOrganization.js +2 -3
- package/dist/constants/testToken.js +2 -3
- package/dist/context/Authentication/AuthenticationContext.js +3 -8
- package/dist/context/Authentication/AuthenticationProvider.js +156 -257
- package/dist/context/Authentication/index.js +4 -8
- package/dist/context/Authentication/withAuthentication.js +5 -14
- package/dist/context/Channels/ChannelsConsumer.js +14 -70
- package/dist/context/Channels/ChannelsContext.js +3 -8
- package/dist/context/Channels/ChannelsProvider.js +132 -278
- package/dist/context/Channels/DataChannel.js +39 -103
- package/dist/context/Channels/EntityChannel.js +40 -104
- package/dist/context/Channels/EveryoneChannel.js +32 -92
- package/dist/context/Channels/OrganizationChannel.js +40 -104
- package/dist/context/Channels/UserChannel.js +37 -99
- package/dist/context/Channels/index.js +10 -20
- package/dist/context/Channels/withChannels.js +5 -14
- package/dist/context/Core/CoreContext.js +3 -8
- package/dist/context/Core/CoreProvider.js +68 -132
- package/dist/context/Core/index.js +4 -8
- package/dist/context/Core/withCore.js +5 -14
- package/dist/context/Organization/OrganizationContext.js +3 -8
- package/dist/context/Organization/OrganizationProvider.js +48 -120
- package/dist/context/Organization/index.js +4 -8
- package/dist/context/Organization/withOrganization.js +5 -14
- package/dist/context/Plugin/PluginContext.js +3 -8
- package/dist/context/Plugin/PluginProvider.js +55 -112
- package/dist/context/Plugin/index.js +4 -8
- package/dist/context/Plugin/withPlugin.js +5 -14
- package/dist/context/index.js +5 -15
- package/dist/css/index.js +3 -6
- package/dist/functions/TagEvaluator.js +107 -156
- package/dist/functions/compareObjects.js +0 -7
- package/dist/functions/formatElapsedTime.js +5 -6
- package/dist/functions/formatNameFileSafe.js +3 -4
- package/dist/functions/getIconUrl.js +0 -3
- package/dist/functions/getParameterByName.js +9 -12
- package/dist/functions/getProperty.js +4 -8
- package/dist/functions/getUrl.js +0 -3
- package/dist/functions/index.js +9 -18
- package/dist/icons/CopyIcon.js +11 -22
- package/dist/icons/DeleteIcon.js +11 -22
- package/dist/icons/DuplicateIcon.js +11 -22
- package/dist/icons/EditIcon.js +11 -22
- package/dist/icons/FabAddIcon.js +19 -35
- package/dist/icons/PasteIcon.js +11 -22
- package/dist/icons/index.js +7 -14
- package/dist/index.js +6 -18
- package/package.json +89 -79
|
@@ -1,408 +1,291 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
8
|
var _TableCell = _interopRequireDefault(require("@material-ui/core/TableCell"));
|
|
13
|
-
|
|
14
9
|
var _TableBody = _interopRequireDefault(require("@material-ui/core/TableBody"));
|
|
15
|
-
|
|
16
10
|
var _TableRow = _interopRequireDefault(require("@material-ui/core/TableRow"));
|
|
17
|
-
|
|
18
11
|
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
19
|
-
|
|
20
12
|
var _CircularProgress = _interopRequireDefault(require("@material-ui/core/CircularProgress"));
|
|
21
|
-
|
|
22
13
|
var _Table = _interopRequireDefault(require("@material-ui/core/Table"));
|
|
23
|
-
|
|
24
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
15
|
var _reactIntl = require("react-intl");
|
|
27
|
-
|
|
28
16
|
var _CoreTableToolbar = _interopRequireDefault(require("./CoreTableToolbar"));
|
|
29
|
-
|
|
30
17
|
var _CoreTableHead = _interopRequireDefault(require("./CoreTableHead"));
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
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); } }
|
|
41
|
-
|
|
42
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
|
-
|
|
44
|
-
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
|
-
|
|
46
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
-
|
|
48
|
-
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); }; }
|
|
49
|
-
|
|
50
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
51
|
-
|
|
52
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
53
|
-
|
|
54
|
-
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; } }
|
|
55
|
-
|
|
56
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
59
|
-
|
|
60
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
61
|
-
|
|
62
|
-
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; }
|
|
63
|
-
|
|
64
|
-
var desc = function desc(a, b, orderBy) {
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
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); }
|
|
26
|
+
const desc = (a, b, orderBy) => {
|
|
65
27
|
if (b[orderBy] < a[orderBy]) {
|
|
66
28
|
return -1;
|
|
67
29
|
}
|
|
68
|
-
|
|
69
30
|
if (b[orderBy] > a[orderBy]) {
|
|
70
31
|
return 1;
|
|
71
32
|
}
|
|
72
|
-
|
|
73
33
|
return 0;
|
|
74
34
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return desc(a, b, orderBy);
|
|
79
|
-
};
|
|
80
|
-
return function (a, b) {
|
|
81
|
-
return -desc(a, b, orderBy);
|
|
82
|
-
};
|
|
35
|
+
const getSorting = (order, orderBy) => {
|
|
36
|
+
if (order === 'desc') return (a, b) => desc(a, b, orderBy);
|
|
37
|
+
return (a, b) => -desc(a, b, orderBy);
|
|
83
38
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
stabilizedThis.sort(function (a, b) {
|
|
90
|
-
var order = cmp(a[0], b[0]);
|
|
39
|
+
const stableSort = (array, cmp) => {
|
|
40
|
+
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
41
|
+
stabilizedThis.sort((a, b) => {
|
|
42
|
+
const order = cmp(a[0], b[0]);
|
|
91
43
|
return order !== 0 ? order : a[1] - b[1];
|
|
92
44
|
});
|
|
93
|
-
return stabilizedThis.map(
|
|
94
|
-
return el[0];
|
|
95
|
-
});
|
|
45
|
+
return stabilizedThis.map(el => el[0]);
|
|
96
46
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var style = {};
|
|
100
|
-
|
|
47
|
+
const getStyles = (row, column) => {
|
|
48
|
+
let style = {};
|
|
101
49
|
if (column.style !== undefined) {
|
|
102
50
|
style = column.style;
|
|
103
51
|
}
|
|
104
|
-
|
|
105
52
|
if (row.style !== undefined) {
|
|
106
53
|
if (row.style.all !== undefined) {
|
|
107
54
|
style = _objectSpread(_objectSpread({}, style), row.style.all);
|
|
108
55
|
}
|
|
109
|
-
|
|
110
56
|
if (row.style[column.id] !== undefined) {
|
|
111
57
|
style = _objectSpread(_objectSpread({}, style), row.style[column.id]);
|
|
112
58
|
}
|
|
113
59
|
}
|
|
114
|
-
|
|
115
60
|
return style;
|
|
116
61
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var style = {};
|
|
120
|
-
|
|
62
|
+
const getRowStyles = (id, activeRow, flaggedRows) => {
|
|
63
|
+
let style = {};
|
|
121
64
|
if (id === activeRow) {
|
|
122
65
|
style = {
|
|
123
66
|
backgroundColor: 'LightSteelBlue'
|
|
124
67
|
};
|
|
125
68
|
}
|
|
126
|
-
|
|
127
69
|
if (flaggedRows.includes(id)) {
|
|
128
70
|
style = {
|
|
129
71
|
backgroundColor: 'Red'
|
|
130
72
|
};
|
|
131
73
|
}
|
|
132
|
-
|
|
133
74
|
return style;
|
|
134
75
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var _super = _createSuper(CoreTable);
|
|
140
|
-
|
|
141
|
-
function CoreTable(props) {
|
|
142
|
-
var _this;
|
|
143
|
-
|
|
144
|
-
_classCallCheck(this, CoreTable);
|
|
145
|
-
|
|
146
|
-
_this = _super.call(this, props);
|
|
147
|
-
_this.state = {
|
|
76
|
+
class CoreTable extends _react.Component {
|
|
77
|
+
constructor(props) {
|
|
78
|
+
super(props);
|
|
79
|
+
this.state = {
|
|
148
80
|
selected: [],
|
|
149
81
|
order: 'asc',
|
|
150
82
|
orderBy: '',
|
|
151
83
|
activeFilters: {}
|
|
152
84
|
};
|
|
153
|
-
return _this;
|
|
154
85
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.props.columns.forEach(function (column) {
|
|
161
|
-
if (column.filter === 'text' || column.filter === true) {
|
|
162
|
-
filters[column.id] = '';
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
this.setState({
|
|
166
|
-
activeFilters: filters
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}, {
|
|
170
|
-
key: "componentDidUpdate",
|
|
171
|
-
value: function componentDidUpdate(prevProps) {
|
|
172
|
-
if (JSON.stringify(this.props.data) !== JSON.stringify(prevProps.data)) {
|
|
173
|
-
this.handleClearSelected();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}, {
|
|
177
|
-
key: "onRowClick",
|
|
178
|
-
value: function onRowClick(row) {
|
|
179
|
-
if (this.props.onRowClick) {
|
|
180
|
-
this.props.onRowClick(row);
|
|
86
|
+
componentDidMount() {
|
|
87
|
+
const filters = {};
|
|
88
|
+
this.props.columns.forEach(column => {
|
|
89
|
+
if (column.filter === 'text' || column.filter === true) {
|
|
90
|
+
filters[column.id] = '';
|
|
181
91
|
}
|
|
92
|
+
});
|
|
93
|
+
this.setState({
|
|
94
|
+
activeFilters: filters
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
componentDidUpdate(prevProps) {
|
|
98
|
+
if (JSON.stringify(this.props.data) !== JSON.stringify(prevProps.data)) {
|
|
99
|
+
this.handleClearSelected();
|
|
182
100
|
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.
|
|
187
|
-
selected: []
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
key: "handleChipDelete",
|
|
192
|
-
value: function handleChipDelete(id) {
|
|
193
|
-
this.setState(function (prevState) {
|
|
194
|
-
return {
|
|
195
|
-
activeFilters: _objectSpread(_objectSpread({}, prevState.activeFilters), {}, _defineProperty({}, id, ''))
|
|
196
|
-
};
|
|
197
|
-
});
|
|
101
|
+
}
|
|
102
|
+
onRowClick(row) {
|
|
103
|
+
if (this.props.onRowClick) {
|
|
104
|
+
this.props.onRowClick(row);
|
|
198
105
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
106
|
+
}
|
|
107
|
+
handleClearSelected() {
|
|
108
|
+
this.setState({
|
|
109
|
+
selected: []
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
handleChipDelete(id) {
|
|
113
|
+
this.setState(prevState => ({
|
|
114
|
+
activeFilters: _objectSpread(_objectSpread({}, prevState.activeFilters), {}, {
|
|
115
|
+
[id]: ''
|
|
116
|
+
})
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
filterInputHandler(_ref) {
|
|
120
|
+
let {
|
|
121
|
+
target
|
|
122
|
+
} = _ref;
|
|
123
|
+
const {
|
|
124
|
+
name,
|
|
125
|
+
value
|
|
126
|
+
} = target;
|
|
127
|
+
this.setState(prevState => ({
|
|
128
|
+
activeFilters: _objectSpread(_objectSpread({}, prevState.activeFilters), {}, {
|
|
129
|
+
[name]: value
|
|
130
|
+
})
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
passesFilter(row) {
|
|
134
|
+
let passed = true;
|
|
135
|
+
const filterKeys = Object.keys(this.state.activeFilters);
|
|
136
|
+
if (filterKeys.length > 0) {
|
|
137
|
+
filterKeys.forEach(filter => {
|
|
138
|
+
if (!row[filter].toLowerCase().includes(this.state.activeFilters[filter].toLowerCase())) {
|
|
139
|
+
passed = false;
|
|
140
|
+
}
|
|
209
141
|
});
|
|
210
142
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
143
|
+
return passed;
|
|
144
|
+
}
|
|
145
|
+
isSelected(id) {
|
|
146
|
+
return this.state.selected.indexOf(id) !== -1;
|
|
147
|
+
}
|
|
148
|
+
handleSelectAll(event) {
|
|
149
|
+
this.setState({
|
|
150
|
+
selected: event.target.checked ? this.props.data.map(row => row[this.props.id]) : []
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
handleOnSort(orderBy) {
|
|
154
|
+
// console.log('orderBy', orderBy);
|
|
155
|
+
this.setState(prevState => {
|
|
156
|
+
const order = prevState.orderBy === orderBy && prevState.order === 'desc' ? 'asc' : 'desc';
|
|
157
|
+
return {
|
|
158
|
+
order: order,
|
|
159
|
+
orderBy: orderBy
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
handleClick(key, row) {
|
|
164
|
+
if (this.props.multiSelect) {
|
|
165
|
+
const {
|
|
166
|
+
selected
|
|
167
|
+
} = this.state;
|
|
168
|
+
const selectedIndex = selected.indexOf(key);
|
|
169
|
+
let newSelected = [];
|
|
170
|
+
if (selectedIndex === -1) {
|
|
171
|
+
// Not in selected, add
|
|
172
|
+
newSelected = newSelected.concat(selected, key);
|
|
173
|
+
} else if (selectedIndex === 0) {
|
|
174
|
+
// First item in selected, remove
|
|
175
|
+
newSelected = newSelected.concat(selected.slice(1));
|
|
176
|
+
} else if (selectedIndex === selected.length - 1) {
|
|
177
|
+
// Last item in selected, remove
|
|
178
|
+
newSelected = newSelected.concat(selected.slice(0, -1));
|
|
179
|
+
} else if (selectedIndex > 0) {
|
|
180
|
+
// Somewhere in the middle of selected, remove
|
|
181
|
+
newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
|
|
225
182
|
}
|
|
226
|
-
|
|
227
|
-
return passed;
|
|
228
|
-
}
|
|
229
|
-
}, {
|
|
230
|
-
key: "isSelected",
|
|
231
|
-
value: function isSelected(id) {
|
|
232
|
-
return this.state.selected.indexOf(id) !== -1;
|
|
233
|
-
}
|
|
234
|
-
}, {
|
|
235
|
-
key: "handleSelectAll",
|
|
236
|
-
value: function handleSelectAll(event) {
|
|
237
|
-
var _this3 = this;
|
|
238
|
-
|
|
239
183
|
this.setState({
|
|
240
|
-
selected:
|
|
241
|
-
return row[_this3.props.id];
|
|
242
|
-
}) : []
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}, {
|
|
246
|
-
key: "handleOnSort",
|
|
247
|
-
value: function handleOnSort(orderBy) {
|
|
248
|
-
// console.log('orderBy', orderBy);
|
|
249
|
-
this.setState(function (prevState) {
|
|
250
|
-
var order = prevState.orderBy === orderBy && prevState.order === 'desc' ? 'asc' : 'desc';
|
|
251
|
-
return {
|
|
252
|
-
order: order,
|
|
253
|
-
orderBy: orderBy
|
|
254
|
-
};
|
|
184
|
+
selected: newSelected
|
|
255
185
|
});
|
|
256
186
|
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
187
|
+
}
|
|
188
|
+
render() {
|
|
189
|
+
const {
|
|
190
|
+
sort,
|
|
191
|
+
id,
|
|
192
|
+
title,
|
|
193
|
+
columns,
|
|
194
|
+
data,
|
|
195
|
+
customToolbar,
|
|
196
|
+
multiSelect,
|
|
197
|
+
hover,
|
|
198
|
+
toolBarIcons,
|
|
199
|
+
activeRow,
|
|
200
|
+
flaggedRows,
|
|
201
|
+
loading
|
|
202
|
+
} = this.props;
|
|
203
|
+
const {
|
|
204
|
+
selected,
|
|
205
|
+
order,
|
|
206
|
+
orderBy,
|
|
207
|
+
activeFilters
|
|
208
|
+
} = this.state;
|
|
209
|
+
return /*#__PURE__*/_react.default.createElement("div", null, (title || multiSelect) && /*#__PURE__*/_react.default.createElement(_CoreTableToolbar.default, {
|
|
210
|
+
title: title,
|
|
211
|
+
selected: selected,
|
|
212
|
+
icons: toolBarIcons,
|
|
213
|
+
customToolbar: customToolbar,
|
|
214
|
+
activeFilters: activeFilters,
|
|
215
|
+
handleChipDelete: _id => this.handleChipDelete(_id)
|
|
216
|
+
}), /*#__PURE__*/_react.default.createElement(_Table.default, null, /*#__PURE__*/_react.default.createElement(_CoreTableHead.default, {
|
|
217
|
+
sort: sort,
|
|
218
|
+
order: order,
|
|
219
|
+
columns: columns,
|
|
220
|
+
orderBy: orderBy,
|
|
221
|
+
rowCount: data.length,
|
|
222
|
+
multiSelect: multiSelect,
|
|
223
|
+
selected: selected.length,
|
|
224
|
+
activeFilters: activeFilters,
|
|
225
|
+
onSort: _orderBy => this.handleOnSort(_orderBy),
|
|
226
|
+
onSelectAll: event => this.handleSelectAll(event),
|
|
227
|
+
updateFilter: target => this.filterInputHandler(target)
|
|
228
|
+
}), /*#__PURE__*/_react.default.createElement(_TableBody.default, null, stableSort(data, getSorting(order, orderBy)).map(row => {
|
|
229
|
+
const isSelected = this.isSelected(row[id]);
|
|
230
|
+
if (this.passesFilter(row)) {
|
|
231
|
+
return /*#__PURE__*/_react.default.createElement(_TableRow.default, {
|
|
232
|
+
role: "checkbox",
|
|
233
|
+
key: row[id],
|
|
234
|
+
hover: hover,
|
|
235
|
+
tabIndex: -1,
|
|
236
|
+
selected: isSelected,
|
|
237
|
+
"aria-checked": isSelected,
|
|
238
|
+
onClick: () => this.onRowClick(row),
|
|
239
|
+
style: getRowStyles(row[id], activeRow, flaggedRows)
|
|
240
|
+
}, multiSelect && /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
241
|
+
padding: "checkbox",
|
|
242
|
+
onClick: event => {
|
|
243
|
+
event.stopPropagation();
|
|
244
|
+
this.handleClick(row[id], row);
|
|
245
|
+
}
|
|
246
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
247
|
+
checked: isSelected,
|
|
248
|
+
color: "primary"
|
|
249
|
+
})), columns.map((column, columnIndex) => /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
250
|
+
key: String(columnIndex),
|
|
251
|
+
style: _objectSpread(_objectSpread({
|
|
252
|
+
cursor: this.props.onRowClick ? 'pointer' : 'default'
|
|
253
|
+
}, getStyles(row, column)), column.style)
|
|
254
|
+
}, column.customCell ? column.customCell({
|
|
255
|
+
id: id,
|
|
256
|
+
row: row
|
|
257
|
+
}) : row[column.id])));
|
|
282
258
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
handleChipDelete: function handleChipDelete(_id) {
|
|
314
|
-
return _this4.handleChipDelete(_id);
|
|
315
|
-
}
|
|
316
|
-
}), /*#__PURE__*/_react.default.createElement(_Table.default, null, /*#__PURE__*/_react.default.createElement(_CoreTableHead.default, {
|
|
317
|
-
sort: sort,
|
|
318
|
-
order: order,
|
|
319
|
-
columns: columns,
|
|
320
|
-
orderBy: orderBy,
|
|
321
|
-
rowCount: data.length,
|
|
322
|
-
multiSelect: multiSelect,
|
|
323
|
-
selected: selected.length,
|
|
324
|
-
activeFilters: activeFilters,
|
|
325
|
-
onSort: function onSort(_orderBy) {
|
|
326
|
-
return _this4.handleOnSort(_orderBy);
|
|
327
|
-
},
|
|
328
|
-
onSelectAll: function onSelectAll(event) {
|
|
329
|
-
return _this4.handleSelectAll(event);
|
|
330
|
-
},
|
|
331
|
-
updateFilter: function updateFilter(target) {
|
|
332
|
-
return _this4.filterInputHandler(target);
|
|
333
|
-
}
|
|
334
|
-
}), /*#__PURE__*/_react.default.createElement(_TableBody.default, null, stableSort(data, getSorting(order, orderBy)).map(function (row) {
|
|
335
|
-
var isSelected = _this4.isSelected(row[id]);
|
|
336
|
-
|
|
337
|
-
if (_this4.passesFilter(row)) {
|
|
338
|
-
return /*#__PURE__*/_react.default.createElement(_TableRow.default, {
|
|
339
|
-
role: "checkbox",
|
|
340
|
-
key: row[id],
|
|
341
|
-
hover: hover,
|
|
342
|
-
tabIndex: -1,
|
|
343
|
-
selected: isSelected,
|
|
344
|
-
"aria-checked": isSelected,
|
|
345
|
-
onClick: function onClick() {
|
|
346
|
-
return _this4.onRowClick(row);
|
|
347
|
-
},
|
|
348
|
-
style: getRowStyles(row[id], activeRow, flaggedRows)
|
|
349
|
-
}, multiSelect && /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
350
|
-
padding: "checkbox",
|
|
351
|
-
onClick: function onClick(event) {
|
|
352
|
-
event.stopPropagation();
|
|
353
|
-
|
|
354
|
-
_this4.handleClick(row[id], row);
|
|
355
|
-
}
|
|
356
|
-
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
357
|
-
checked: isSelected,
|
|
358
|
-
color: "primary"
|
|
359
|
-
})), columns.map(function (column, columnIndex) {
|
|
360
|
-
return /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
361
|
-
key: String(columnIndex),
|
|
362
|
-
style: _objectSpread(_objectSpread({
|
|
363
|
-
cursor: _this4.props.onRowClick ? 'pointer' : 'default'
|
|
364
|
-
}, getStyles(row, column)), column.style)
|
|
365
|
-
}, column.customCell ? column.customCell({
|
|
366
|
-
id: id,
|
|
367
|
-
row: row
|
|
368
|
-
}) : row[column.id]);
|
|
369
|
-
}));
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
373
|
-
}))), loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
374
|
-
style: {
|
|
375
|
-
display: 'flex',
|
|
376
|
-
alignItems: 'center',
|
|
377
|
-
justifyContent: 'center',
|
|
378
|
-
paddingTop: 20,
|
|
379
|
-
paddingBottom: 20
|
|
380
|
-
}
|
|
381
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
382
|
-
style: {
|
|
383
|
-
display: 'flex',
|
|
384
|
-
alignItems: 'center'
|
|
385
|
-
}
|
|
386
|
-
}, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
387
|
-
color: "secondary",
|
|
388
|
-
style: {
|
|
389
|
-
marginRight: 20
|
|
390
|
-
}
|
|
391
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
392
|
-
style: {
|
|
393
|
-
fontSize: '26px',
|
|
394
|
-
fontStyle: 'italic',
|
|
395
|
-
color: 'rgba(0,0,0,0.6)'
|
|
396
|
-
}
|
|
397
|
-
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
398
|
-
id: "__loading"
|
|
399
|
-
}), "\u2026"))));
|
|
400
|
-
}
|
|
401
|
-
}]);
|
|
402
|
-
|
|
403
|
-
return CoreTable;
|
|
404
|
-
}(_react.Component);
|
|
405
|
-
|
|
259
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
260
|
+
}))), loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
261
|
+
style: {
|
|
262
|
+
display: 'flex',
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
justifyContent: 'center',
|
|
265
|
+
paddingTop: 20,
|
|
266
|
+
paddingBottom: 20
|
|
267
|
+
}
|
|
268
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
269
|
+
style: {
|
|
270
|
+
display: 'flex',
|
|
271
|
+
alignItems: 'center'
|
|
272
|
+
}
|
|
273
|
+
}, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
274
|
+
color: "secondary",
|
|
275
|
+
style: {
|
|
276
|
+
marginRight: 20
|
|
277
|
+
}
|
|
278
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
279
|
+
style: {
|
|
280
|
+
fontSize: '26px',
|
|
281
|
+
fontStyle: 'italic',
|
|
282
|
+
color: 'rgba(0,0,0,0.6)'
|
|
283
|
+
}
|
|
284
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
285
|
+
id: "__loading"
|
|
286
|
+
}), "\u2026"))));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
406
289
|
CoreTable.propTypes = {
|
|
407
290
|
sort: _propTypes.default.bool,
|
|
408
291
|
hover: _propTypes.default.bool,
|
|
@@ -430,5 +313,4 @@ CoreTable.defaultProps = {
|
|
|
430
313
|
toolBarIcons: /*#__PURE__*/_react.default.createElement("span", null),
|
|
431
314
|
loading: false
|
|
432
315
|
};
|
|
433
|
-
var _default = CoreTable;
|
|
434
|
-
exports.default = _default;
|
|
316
|
+
var _default = exports.default = CoreTable;
|