carbon-react 93.0.4 → 94.0.3
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/__internal__/checkable-input/checkable-input.component.js +7 -1
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +11 -1
- package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +5 -1
- package/lib/__internal__/form-field/form-field.component.js +9 -8
- package/lib/__internal__/form-field/form-field.d.ts +2 -0
- package/lib/components/action-popover/action-popover.component.js +28 -20
- package/lib/components/action-popover/action-popover.style.js +22 -12
- package/lib/components/i18n-provider/i18n-provider.component.js +0 -3
- package/lib/locales/en-gb.js +1 -8
- package/lib/locales/locale.d.ts +0 -7
- package/lib/locales/pl-pl.js +1 -8
- package/package.json +1 -6
- package/lib/components/action-toolbar/action-toolbar.component.js +0 -213
- package/lib/components/action-toolbar/action-toolbar.d.ts +0 -20
- package/lib/components/action-toolbar/action-toolbar.style.js +0 -40
- package/lib/components/action-toolbar/index.d.ts +0 -1
- package/lib/components/action-toolbar/index.js +0 -15
- package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +0 -174
- package/lib/components/configurable-items/configurable-item-row/configurable-item-row.d.ts +0 -25
- package/lib/components/configurable-items/configurable-item-row/configurable-item-row.style.js +0 -73
- package/lib/components/configurable-items/configurable-item-row/index.d.ts +0 -1
- package/lib/components/configurable-items/configurable-item-row/index.js +0 -15
- package/lib/components/configurable-items/configurable-items.component.js +0 -155
- package/lib/components/configurable-items/configurable-items.d.ts +0 -20
- package/lib/components/configurable-items/configurable-items.style.js +0 -70
- package/lib/components/configurable-items/index.d.ts +0 -2
- package/lib/components/configurable-items/index.js +0 -23
- package/lib/components/drag-and-drop/__internal__/item-target/index.js +0 -15
- package/lib/components/drag-and-drop/__internal__/item-target/item-target.js +0 -44
- package/lib/components/drag-and-drop/__internal__/item-types/index.js +0 -15
- package/lib/components/drag-and-drop/__internal__/item-types/item-types.js +0 -20
- package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +0 -171
- package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.style.js +0 -28
- package/lib/components/drag-and-drop/custom-drag-layer/index.js +0 -15
- package/lib/components/drag-and-drop/drag-and-drop-test.stories.js +0 -95
- package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +0 -15
- package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/scrollable-parent.js +0 -36
- package/lib/components/drag-and-drop/draggable-context/draggable-context.js +0 -264
- package/lib/components/drag-and-drop/draggable-context/index.js +0 -15
- package/lib/components/drag-and-drop/index.js +0 -39
- package/lib/components/drag-and-drop/with-drag/index.js +0 -15
- package/lib/components/drag-and-drop/with-drag/with-drag.js +0 -176
- package/lib/components/drag-and-drop/with-drop/index.js +0 -15
- package/lib/components/drag-and-drop/with-drop/with-drop.js +0 -201
- package/lib/components/table/draggable-table-cell/draggable-table-cell.component.js +0 -59
- package/lib/components/table/draggable-table-cell/draggable-table-cell.style.js +0 -36
- package/lib/components/table/draggable-table-cell/index.js +0 -15
- package/lib/components/table/index.js +0 -43
- package/lib/components/table/table-cell/index.js +0 -15
- package/lib/components/table/table-cell/table-cell.component.js +0 -164
- package/lib/components/table/table-cell/table-cell.style.js +0 -164
- package/lib/components/table/table-header/index.js +0 -15
- package/lib/components/table/table-header/table-header.component.js +0 -282
- package/lib/components/table/table-header/table-header.style.js +0 -116
- package/lib/components/table/table-modern.style.js +0 -110
- package/lib/components/table/table-row/index.js +0 -15
- package/lib/components/table/table-row/table-row-modern.style.js +0 -70
- package/lib/components/table/table-row/table-row.component.js +0 -486
- package/lib/components/table/table-row/table-row.style.js +0 -165
- package/lib/components/table/table-sizes.style.js +0 -33
- package/lib/components/table/table-story-helpers/table-story-wrapper.component.js +0 -189
- package/lib/components/table/table-subheader/index.js +0 -15
- package/lib/components/table/table-subheader/table-subheader.component.js +0 -35
- package/lib/components/table/table-subheader/table-subheader.style.js +0 -33
- package/lib/components/table/table.component.js +0 -792
- package/lib/components/table/table.config.js +0 -14
- package/lib/components/table/table.style.js +0 -139
- package/lib/components/table-ajax/__internal__/serialize/package.json +0 -3
- package/lib/components/table-ajax/__internal__/serialize/serialize.js +0 -26
- package/lib/components/table-ajax/index.js +0 -37
- package/lib/components/table-ajax/table-ajax.component.js +0 -602
- package/lib/patterns/configurable-items/actions/actions.js +0 -41
- package/lib/patterns/configurable-items/actions/package.json +0 -3
- package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +0 -140
- package/lib/patterns/configurable-items/configurable-items-content/package.json +0 -3
- package/lib/patterns/configurable-items/configurable-items.js +0 -216
- package/lib/patterns/configurable-items/constants/constants.js +0 -13
- package/lib/patterns/configurable-items/constants/package.json +0 -3
- package/lib/patterns/configurable-items/package.json +0 -3
- package/lib/patterns/configurable-items/store/package.json +0 -3
- package/lib/patterns/configurable-items/store/store.js +0 -92
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "TableRow", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _table.TableRow;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "TableCell", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _table.TableCell;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "TableHeader", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _table.TableHeader;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "TableSubheader", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _table.TableSubheader;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
exports.TableAjax = void 0;
|
|
31
|
-
|
|
32
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
|
-
|
|
34
|
-
var _superagent = _interopRequireDefault(require("superagent"));
|
|
35
|
-
|
|
36
|
-
var _serialize = _interopRequireDefault(require("./__internal__/serialize/serialize"));
|
|
37
|
-
|
|
38
|
-
var _table = require("../table");
|
|
39
|
-
|
|
40
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
41
|
-
|
|
42
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
-
|
|
44
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
|
-
|
|
46
|
-
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); } }
|
|
47
|
-
|
|
48
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
49
|
-
|
|
50
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
51
|
-
|
|
52
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
53
|
-
|
|
54
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
55
|
-
|
|
56
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
|
-
|
|
58
|
-
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); }; }
|
|
59
|
-
|
|
60
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
61
|
-
|
|
62
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
63
|
-
|
|
64
|
-
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; } }
|
|
65
|
-
|
|
66
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
67
|
-
|
|
68
|
-
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; }
|
|
69
|
-
|
|
70
|
-
let deprecatedWarnTriggered = false;
|
|
71
|
-
|
|
72
|
-
let TableAjax = /*#__PURE__*/function (_Table) {
|
|
73
|
-
_inherits(TableAjax, _Table);
|
|
74
|
-
|
|
75
|
-
var _super = _createSuper(TableAjax);
|
|
76
|
-
|
|
77
|
-
function TableAjax(_props) {
|
|
78
|
-
var _this;
|
|
79
|
-
|
|
80
|
-
_classCallCheck(this, TableAjax);
|
|
81
|
-
|
|
82
|
-
_this = _super.call(this, _props);
|
|
83
|
-
|
|
84
|
-
_defineProperty(_assertThisInitialized(_this), "timeout", null);
|
|
85
|
-
|
|
86
|
-
_defineProperty(_assertThisInitialized(_this), "_request", null);
|
|
87
|
-
|
|
88
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
89
|
-
/**
|
|
90
|
-
* Pagination
|
|
91
|
-
* Current Visible Page
|
|
92
|
-
*
|
|
93
|
-
* @property currentPage
|
|
94
|
-
* @type {String}
|
|
95
|
-
*/
|
|
96
|
-
currentPage: _this.props.currentPage || "1",
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The current value of the data-state property
|
|
100
|
-
*
|
|
101
|
-
* @property dataState
|
|
102
|
-
* @type {String}
|
|
103
|
-
*/
|
|
104
|
-
dataState: "idle",
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Pagination
|
|
108
|
-
* Page Size of grid (number of visible records)
|
|
109
|
-
*
|
|
110
|
-
* @property pageSize
|
|
111
|
-
* @type {String}
|
|
112
|
-
*/
|
|
113
|
-
pageSize: _this.defaultPageSize,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Pagination
|
|
117
|
-
* Total number of records in the grid
|
|
118
|
-
*
|
|
119
|
-
* @property totalRecords
|
|
120
|
-
* @type {Number}
|
|
121
|
-
*/
|
|
122
|
-
totalRecords: _this.props.totalRecords || 0,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Sorting
|
|
126
|
-
* either 'asc' or 'desc' order
|
|
127
|
-
*
|
|
128
|
-
* @property sortOrder
|
|
129
|
-
* @type {String}
|
|
130
|
-
*/
|
|
131
|
-
sortOrder: _this.props.sortOrder || "",
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Sorting
|
|
135
|
-
* column name to sort
|
|
136
|
-
*
|
|
137
|
-
* @property sortedColumn
|
|
138
|
-
* @type {String}
|
|
139
|
-
*/
|
|
140
|
-
sortedColumn: _this.props.sortedColumn || ""
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
_defineProperty(_assertThisInitialized(_this), "getChildContext", () => {
|
|
144
|
-
return {
|
|
145
|
-
attachActionToolbar: _this.attachActionToolbar,
|
|
146
|
-
detachActionToolbar: _this.detachActionToolbar,
|
|
147
|
-
attachToTable: _this.attachToTable,
|
|
148
|
-
detachFromTable: _this.detachFromTable,
|
|
149
|
-
checkSelection: _this.checkSelection,
|
|
150
|
-
onSort: _this.onSort,
|
|
151
|
-
selectable: _this.props.selectable,
|
|
152
|
-
highlightable: _this.props.highlightable,
|
|
153
|
-
selectAll: _this.selectAll,
|
|
154
|
-
selectRow: _this.selectRow,
|
|
155
|
-
highlightRow: _this.highlightRow,
|
|
156
|
-
sortedColumn: _this.sortedColumn,
|
|
157
|
-
sortOrder: _this.sortOrder
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
_defineProperty(_assertThisInitialized(_this), "emitOnChangeCallback", (element, options, timeout = 250) => {
|
|
162
|
-
if (_this.selectAllComponent) {
|
|
163
|
-
// reset the select all component
|
|
164
|
-
_this.selectAllComponent.setState({
|
|
165
|
-
selected: false
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
_this.selectAllComponent = null;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const resetHeight = Number(options.pageSize) < Number(_this.pageSize),
|
|
172
|
-
currentPage = element === "filter" ? "1" : options.currentPage;
|
|
173
|
-
|
|
174
|
-
_this.setState({
|
|
175
|
-
currentPage,
|
|
176
|
-
pageSize: options.pageSize,
|
|
177
|
-
sortOrder: options.sortOrder,
|
|
178
|
-
sortedColumn: options.sortedColumn
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
_this.stopTimeout();
|
|
182
|
-
|
|
183
|
-
_this.timeout = setTimeout(() => {
|
|
184
|
-
// track the request incase we need to abort it
|
|
185
|
-
_this.setState({
|
|
186
|
-
dataState: "requested",
|
|
187
|
-
ariaBusy: true
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
if (_this.props.postAction) {
|
|
191
|
-
_this._request = _superagent.default.post(_this.props.path).set(_this.getHeaders()).send(_this.queryParams(element, options));
|
|
192
|
-
} else {
|
|
193
|
-
_this._request = _superagent.default.get(_this.props.path).set(_this.getHeaders()).query(_this.queryParams(element, options));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (_this.props.withCredentials) _this._request.withCredentials();
|
|
197
|
-
|
|
198
|
-
_this._request.end((err, response) => {
|
|
199
|
-
_this._hasRetreivedData = true;
|
|
200
|
-
|
|
201
|
-
_this.handleResponse(err, response);
|
|
202
|
-
|
|
203
|
-
if (resetHeight) {
|
|
204
|
-
_this.resetTableHeight();
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}, timeout);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
_defineProperty(_assertThisInitialized(_this), "stopTimeout", () => {
|
|
211
|
-
if (_this.timeout) {
|
|
212
|
-
clearTimeout(_this.timeout);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (_this._request) {
|
|
216
|
-
_this._request.abort();
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
_defineProperty(_assertThisInitialized(_this), "handleResponse", (err, response) => {
|
|
221
|
-
if (!err) {
|
|
222
|
-
const data = _this.props.formatResponse ? _this.props.formatResponse(response.body) : response.body;
|
|
223
|
-
|
|
224
|
-
_this.props.onChange(data);
|
|
225
|
-
|
|
226
|
-
_this.setState({
|
|
227
|
-
totalRecords: Number(data.records),
|
|
228
|
-
dataState: "loaded",
|
|
229
|
-
ariaBusy: false
|
|
230
|
-
});
|
|
231
|
-
} else if (_this.props.onAjaxError) {
|
|
232
|
-
_this.setComponentTagsErrored();
|
|
233
|
-
|
|
234
|
-
_this.props.onAjaxError(err, response);
|
|
235
|
-
} else {
|
|
236
|
-
_this.setComponentTagsErrored();
|
|
237
|
-
|
|
238
|
-
_logger.default.warn(`${err.status} - ${response}`);
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
_defineProperty(_assertThisInitialized(_this), "queryParams", (element, options) => {
|
|
243
|
-
const query = options.filter || {};
|
|
244
|
-
query.page = element === "filter" ? "1" : options.currentPage;
|
|
245
|
-
query.rows = options.pageSize;
|
|
246
|
-
|
|
247
|
-
if (options.sortOrder) {
|
|
248
|
-
query.sord = options.sortOrder;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (options.sortedColumn) {
|
|
252
|
-
query.sidx = options.sortedColumn;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (_this.props.postAction) {
|
|
256
|
-
return query;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (_this.props.formatRequest) {
|
|
260
|
-
return (0, _serialize.default)(_this.props.formatRequest(query));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return (0, _serialize.default)(query);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
_defineProperty(_assertThisInitialized(_this), "getHeaders", () => {
|
|
267
|
-
return _this.props.getCustomHeaders ? _this.props.getCustomHeaders() : {
|
|
268
|
-
Accept: "application/json"
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
_defineProperty(_assertThisInitialized(_this), "emitOptions", (props = _this.props) => {
|
|
273
|
-
return {
|
|
274
|
-
currentPage: _this.state.currentPage,
|
|
275
|
-
filter: props.filter ? props.filter.toJS() : {},
|
|
276
|
-
pageSize: _this.state.pageSize,
|
|
277
|
-
sortedColumn: _this.state.sortedColumn,
|
|
278
|
-
sortOrder: _this.state.sortOrder
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
_defineProperty(_assertThisInitialized(_this), "dataState", () => {
|
|
283
|
-
return _this.state.dataState;
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
if (!deprecatedWarnTriggered) {
|
|
287
|
-
deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
|
|
288
|
-
|
|
289
|
-
_logger.default.deprecate("`TableAjax` component is deprecated and will soon be removed.");
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return _this;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Timeout for firing ajax request
|
|
296
|
-
*
|
|
297
|
-
* @property timeout
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
_createClass(TableAjax, [{
|
|
302
|
-
key: "componentDidMount",
|
|
303
|
-
value:
|
|
304
|
-
/**
|
|
305
|
-
* Request initial data on mount
|
|
306
|
-
* @override
|
|
307
|
-
*
|
|
308
|
-
* @method componentDidMount
|
|
309
|
-
* @return {Void}
|
|
310
|
-
*/
|
|
311
|
-
function componentDidMount() {
|
|
312
|
-
_get(_getPrototypeOf(TableAjax.prototype), "componentDidMount", this).call(this);
|
|
313
|
-
|
|
314
|
-
this.emitOnChangeCallback("data", this.emitOptions(), 0);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Lifecycle for after a update has happened
|
|
318
|
-
* Retrieve the data when page size chagnes
|
|
319
|
-
* Resize the grid to fit new content
|
|
320
|
-
*
|
|
321
|
-
* @method componentDidUpdate
|
|
322
|
-
* @param {Object} preProps The previos props passed down to the component
|
|
323
|
-
* @param {Object} prevState The previous of the component
|
|
324
|
-
* @return {Void}
|
|
325
|
-
*/
|
|
326
|
-
|
|
327
|
-
}, {
|
|
328
|
-
key: "componentDidUpdate",
|
|
329
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
330
|
-
if (this.state.pageSize !== prevState.pageSize) {
|
|
331
|
-
this.emitOnChangeCallback("data", this.emitOptions());
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
this.resizeTable();
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Lifecycle before a mounted component receives new props
|
|
338
|
-
* Set pageSize state if component pass a new pageSize props
|
|
339
|
-
*
|
|
340
|
-
* @method componentWillReceiveProps
|
|
341
|
-
* @param {Object} nextProps The new props passed down to the component
|
|
342
|
-
* @return {Void}
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
}, {
|
|
346
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
347
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
348
|
-
_get(_getPrototypeOf(TableAjax.prototype), "UNSAFE_componentWillReceiveProps", this).call(this, nextProps);
|
|
349
|
-
|
|
350
|
-
if (this.props.pageSize !== nextProps.pageSize) {
|
|
351
|
-
this.setState({
|
|
352
|
-
pageSize: nextProps.pageSize
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Lifecycle for when a component unmounts
|
|
358
|
-
* Clears any deferred tasks
|
|
359
|
-
*
|
|
360
|
-
* @method componentWillUnmount
|
|
361
|
-
* @return {Void}
|
|
362
|
-
*/
|
|
363
|
-
|
|
364
|
-
}, {
|
|
365
|
-
key: "componentWillUnmount",
|
|
366
|
-
value: function componentWillUnmount() {
|
|
367
|
-
this.stopTimeout();
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
key: "pageSize",
|
|
371
|
-
get:
|
|
372
|
-
/**
|
|
373
|
-
* Get pageSize for table
|
|
374
|
-
* @override
|
|
375
|
-
*
|
|
376
|
-
* @method pageSize
|
|
377
|
-
* @return {String} table page size
|
|
378
|
-
*/
|
|
379
|
-
function () {
|
|
380
|
-
return this.state.pageSize;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Returns the currently sorted column.
|
|
384
|
-
*
|
|
385
|
-
* @method sortedColumn
|
|
386
|
-
* @return {String}
|
|
387
|
-
*/
|
|
388
|
-
|
|
389
|
-
}, {
|
|
390
|
-
key: "sortedColumn",
|
|
391
|
-
get: function () {
|
|
392
|
-
return this.state.sortedColumn;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Returns the current sort order.
|
|
396
|
-
*
|
|
397
|
-
* @method sortOrder
|
|
398
|
-
* @return {String}
|
|
399
|
-
*/
|
|
400
|
-
|
|
401
|
-
}, {
|
|
402
|
-
key: "sortOrder",
|
|
403
|
-
get: function () {
|
|
404
|
-
return this.state.sortOrder;
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Emit onChange event row data
|
|
408
|
-
* @override
|
|
409
|
-
*
|
|
410
|
-
* @method emitOnChangeCallback
|
|
411
|
-
* @param {String} element changed element
|
|
412
|
-
* @param {Object} options base and updated options
|
|
413
|
-
* @return {Void}
|
|
414
|
-
*/
|
|
415
|
-
|
|
416
|
-
}, {
|
|
417
|
-
key: "setComponentTagsErrored",
|
|
418
|
-
value: function setComponentTagsErrored() {
|
|
419
|
-
this.setState({
|
|
420
|
-
dataState: "errored",
|
|
421
|
-
ariaBusy: false
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Formatted params for server request
|
|
426
|
-
*
|
|
427
|
-
* @method queryParams
|
|
428
|
-
* @param {String} element changed element
|
|
429
|
-
* @param {Object} options base and updated options
|
|
430
|
-
* @return {Object} params for query
|
|
431
|
-
*/
|
|
432
|
-
|
|
433
|
-
}, {
|
|
434
|
-
key: "pagerProps",
|
|
435
|
-
get:
|
|
436
|
-
/**
|
|
437
|
-
* Props to pass to pager component
|
|
438
|
-
* @override
|
|
439
|
-
*
|
|
440
|
-
* @method pagerProps
|
|
441
|
-
* @return {Object} props
|
|
442
|
-
*/
|
|
443
|
-
function () {
|
|
444
|
-
return {
|
|
445
|
-
currentPage: this.state.currentPage,
|
|
446
|
-
pageSize: this.state.pageSize,
|
|
447
|
-
totalRecords: this.state.totalRecords,
|
|
448
|
-
onPagination: this.onPagination,
|
|
449
|
-
pageSizeSelectionOptions: this.props.pageSizeSelectionOptions,
|
|
450
|
-
showPageSizeSelection: this.props.showPageSizeSelection
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Returns the data-state string used in componentTags
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
}, {
|
|
458
|
-
key: "dataComponent",
|
|
459
|
-
get:
|
|
460
|
-
/**
|
|
461
|
-
* The name used for the data-component attribute
|
|
462
|
-
*/
|
|
463
|
-
function () {
|
|
464
|
-
return "table-ajax";
|
|
465
|
-
}
|
|
466
|
-
}]);
|
|
467
|
-
|
|
468
|
-
return TableAjax;
|
|
469
|
-
}(_table.Table);
|
|
470
|
-
|
|
471
|
-
exports.TableAjax = TableAjax;
|
|
472
|
-
|
|
473
|
-
_defineProperty(TableAjax, "childContextTypes", {
|
|
474
|
-
/**
|
|
475
|
-
* Defines a context object for child components of the table-ajax component.
|
|
476
|
-
* https://facebook.github.io/react/docs/context.html
|
|
477
|
-
*
|
|
478
|
-
* @property childContextTypes
|
|
479
|
-
* @type {Object}
|
|
480
|
-
*/
|
|
481
|
-
attachActionToolbar: _propTypes.default.func,
|
|
482
|
-
// tracks the action toolbar component
|
|
483
|
-
detachActionToolbar: _propTypes.default.func,
|
|
484
|
-
// tracks the action toolbar component
|
|
485
|
-
attachToTable: _propTypes.default.func,
|
|
486
|
-
// attach the row to the table
|
|
487
|
-
checkSelection: _propTypes.default.func,
|
|
488
|
-
// a function to check if the row is currently selected
|
|
489
|
-
detachFromTable: _propTypes.default.func,
|
|
490
|
-
// detach the row from the table
|
|
491
|
-
highlightable: _propTypes.default.bool,
|
|
492
|
-
// table can enable all rows to be highlightable
|
|
493
|
-
onSort: _propTypes.default.func,
|
|
494
|
-
// a callback function for when a sort order is updated
|
|
495
|
-
selectAll: _propTypes.default.func,
|
|
496
|
-
// a callback function for when all visible rows are selected
|
|
497
|
-
selectRow: _propTypes.default.func,
|
|
498
|
-
// a callback function for when a row is selected
|
|
499
|
-
highlightRow: _propTypes.default.func,
|
|
500
|
-
// a callback function for when a row is highlighted
|
|
501
|
-
selectable: _propTypes.default.bool,
|
|
502
|
-
// table can enable all rows to be selectable
|
|
503
|
-
sortOrder: _propTypes.default.string,
|
|
504
|
-
// the current sort order applied
|
|
505
|
-
sortedColumn: _propTypes.default.string // the currently sorted column
|
|
506
|
-
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
TableAjax.propTypes = {
|
|
510
|
-
/**
|
|
511
|
-
* Data used to filter the data
|
|
512
|
-
*
|
|
513
|
-
* @property filter
|
|
514
|
-
* @type {Object}
|
|
515
|
-
*/
|
|
516
|
-
filter: _propTypes.default.object,
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* A callback function used to format the Ajax
|
|
520
|
-
* request into the format required endpoint
|
|
521
|
-
*
|
|
522
|
-
* @property formatRequest
|
|
523
|
-
* @type {Function}
|
|
524
|
-
*/
|
|
525
|
-
formatRequest: _propTypes.default.func,
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* A callback function used to set the Ajax
|
|
529
|
-
* headers using custom ones provided by the consumer
|
|
530
|
-
*
|
|
531
|
-
* Expected return object format
|
|
532
|
-
* {
|
|
533
|
-
'Accept': 'application/json',
|
|
534
|
-
'jwt': 'secret',
|
|
535
|
-
...
|
|
536
|
-
}
|
|
537
|
-
*
|
|
538
|
-
* @property getCustomHeaders
|
|
539
|
-
* @type {Function}
|
|
540
|
-
*/
|
|
541
|
-
getCustomHeaders: _propTypes.default.func,
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* A callback function used to format the Ajax
|
|
545
|
-
* response into the format required by the table
|
|
546
|
-
*
|
|
547
|
-
* @property formatResponse
|
|
548
|
-
* @type {Function}
|
|
549
|
-
*/
|
|
550
|
-
formatResponse: _propTypes.default.func,
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Setting to true turns on pagination for the table
|
|
554
|
-
*
|
|
555
|
-
* @property paginate
|
|
556
|
-
* @type {Boolean}
|
|
557
|
-
*/
|
|
558
|
-
paginate: _propTypes.default.bool,
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Pagination
|
|
562
|
-
* Page Size of grid (number of visible records)
|
|
563
|
-
*
|
|
564
|
-
* @property pageSize
|
|
565
|
-
* @type {String}
|
|
566
|
-
*/
|
|
567
|
-
pageSize: _propTypes.default.string,
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Endpoint to fetch the data for table
|
|
571
|
-
*
|
|
572
|
-
* @property path
|
|
573
|
-
* @type {String}
|
|
574
|
-
*/
|
|
575
|
-
path: _propTypes.default.string.isRequired,
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Callback function for XHR request errors
|
|
579
|
-
*
|
|
580
|
-
* @property onAjaxError
|
|
581
|
-
* @type {Function}
|
|
582
|
-
*/
|
|
583
|
-
onAjaxError: _propTypes.default.func,
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* A prop to allow the override of the default get request and perform a post.
|
|
587
|
-
* @property postAction
|
|
588
|
-
* @type {Boolean}
|
|
589
|
-
*/
|
|
590
|
-
postAction: _propTypes.default.bool,
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Enable the ability to send cookies from the origin.
|
|
594
|
-
*
|
|
595
|
-
* @property withCredentials
|
|
596
|
-
* @type: {Boolean}
|
|
597
|
-
*/
|
|
598
|
-
withCredentials: _propTypes.default.bool
|
|
599
|
-
};
|
|
600
|
-
TableAjax.defaultProps = {
|
|
601
|
-
paginate: true
|
|
602
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _flux = require("carbon-state-management/lib/flux");
|
|
9
|
-
|
|
10
|
-
var _constants = _interopRequireDefault(require("../constants"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const ConfigurableItemsActions = {
|
|
15
|
-
toggleDialogOpen: () => {
|
|
16
|
-
_flux.Dispatcher.dispatch({
|
|
17
|
-
actionType: _constants.default.TOGGLE_CONFIGURABLE_ITEMS_DIALOG
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
reorderItems: (dragIndex, hoverIndex) => {
|
|
21
|
-
_flux.Dispatcher.dispatch({
|
|
22
|
-
actionType: _constants.default.REORDER_CONFIGURABLE_ITEMS,
|
|
23
|
-
dragIndex,
|
|
24
|
-
hoverIndex
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
updateData: data => {
|
|
28
|
-
_flux.Dispatcher.dispatch({
|
|
29
|
-
actionType: _constants.default.UPDATE_CONFIGURABLE_ITEMS_DATA,
|
|
30
|
-
data
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
updateItem: rowIndex => {
|
|
34
|
-
_flux.Dispatcher.dispatch({
|
|
35
|
-
actionType: _constants.default.UPDATE_CONFIGURABLE_ITEM,
|
|
36
|
-
rowIndex
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var _default = ConfigurableItemsActions;
|
|
41
|
-
exports.default = _default;
|