@splunk/react-ui 4.4.0 → 4.4.1
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/Accordion.js +2 -2
- package/Anchor.js +2 -2
- package/Animation.js +2 -2
- package/AnimationToggle.js +2 -2
- package/Box.js +2 -2
- package/Button.js +2 -2
- package/ButtonGroup.js +2 -2
- package/ButtonSimple.js +2 -2
- package/CHANGELOG.md +5 -0
- package/Calendar.js +2 -2
- package/Card.js +2 -2
- package/CardLayout.js +2 -2
- package/Chip.js +2 -2
- package/Clickable.js +2 -2
- package/CloseButton.js +2 -2
- package/Code.js +2 -2
- package/CollapsiblePanel.js +2 -2
- package/Color.js +2 -2
- package/ColumnLayout.js +2 -2
- package/ComboBox.js +2 -2
- package/Concertina.js +2 -2
- package/ControlGroup.js +2 -2
- package/Date.js +2 -2
- package/DefinitionList.js +2 -2
- package/Dropdown.js +2 -2
- package/FetchOptions.js +2 -2
- package/File.js +46 -46
- package/FormRows.js +211 -323
- package/Image.js +2 -2
- package/JSONTree.js +2 -2
- package/Layer.js +2 -2
- package/Link.js +2 -2
- package/List.js +2 -2
- package/Markdown.js +2 -2
- package/Modal.js +2 -2
- package/ModalLayer.js +2 -2
- package/Monogram.js +2 -2
- package/Paragraph.js +2 -2
- package/Popover.js +2 -2
- package/Progress.js +2 -2
- package/RadioBar.js +2 -2
- package/RadioList.js +2 -2
- package/Resize.js +2 -2
- package/ResultsMenu.js +2 -2
- package/Scroll.js +2 -2
- package/ScrollContainerContext.js +2 -2
- package/Select.js +22 -10
- package/SidePanel.js +2 -2
- package/Slider.js +2 -2
- package/SlidingPanels.js +2 -2
- package/StaticContent.js +2 -2
- package/StepBar.js +2 -2
- package/Switch.js +2 -2
- package/TabBar.js +2 -2
- package/TabLayout.js +2 -2
- package/Text.js +2 -2
- package/Tooltip.js +2 -2
- package/WaitSpinner.js +2 -2
- package/package.json +1 -1
- package/types/src/File/FileContext.d.ts +3 -0
- package/types/src/File/Item.d.ts +5 -8
- package/types/src/FormRows/FormRows.d.ts +11 -69
- package/types/src/FormRows/FormRowsContext.d.ts +9 -0
- package/types/src/FormRows/Row.d.ts +7 -20
package/FormRows.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 112);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -101,7 +101,7 @@ module.exports = require("prop-types");
|
|
|
101
101
|
|
|
102
102
|
/***/ }),
|
|
103
103
|
|
|
104
|
-
/***/
|
|
104
|
+
/***/ 112:
|
|
105
105
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
106
106
|
|
|
107
107
|
"use strict";
|
|
@@ -109,7 +109,7 @@ module.exports = require("prop-types");
|
|
|
109
109
|
__webpack_require__.r(__webpack_exports__);
|
|
110
110
|
|
|
111
111
|
// EXPORTS
|
|
112
|
-
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */
|
|
112
|
+
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ FormRows_FormRows; });
|
|
113
113
|
__webpack_require__.d(__webpack_exports__, "Row", function() { return /* reexport */ FormRows_Row; });
|
|
114
114
|
|
|
115
115
|
// EXTERNAL MODULE: external "react"
|
|
@@ -286,36 +286,21 @@ var StyledDrag = external_styled_components_default.a.div.withConfig({
|
|
|
286
286
|
prisma: Object(external_styled_components_["css"])(["height:20px;"])
|
|
287
287
|
}));
|
|
288
288
|
|
|
289
|
-
// CONCATENATED MODULE: ./src/FormRows/
|
|
290
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
289
|
+
// CONCATENATED MODULE: ./src/FormRows/FormRowsContext.tsx
|
|
291
290
|
|
|
291
|
+
var FormRowsContext = /*#__PURE__*/Object(external_react_["createContext"])({
|
|
292
|
+
disabledDeleteButton: false,
|
|
293
|
+
sortable: true
|
|
294
|
+
});
|
|
295
|
+
FormRowsContext.displayName = 'FormRows';
|
|
296
|
+
/* harmony default export */ var FormRows_FormRowsContext = (FormRowsContext);
|
|
297
|
+
// CONCATENATED MODULE: ./src/FormRows/Row.tsx
|
|
292
298
|
function Row_extends() { Row_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Row_extends.apply(this, arguments); }
|
|
293
299
|
|
|
294
300
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
295
301
|
|
|
296
302
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
297
303
|
|
|
298
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
299
|
-
|
|
300
|
-
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); } }
|
|
301
|
-
|
|
302
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
303
|
-
|
|
304
|
-
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); }
|
|
305
|
-
|
|
306
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
307
|
-
|
|
308
|
-
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); }; }
|
|
309
|
-
|
|
310
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
311
|
-
|
|
312
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
313
|
-
|
|
314
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
315
|
-
|
|
316
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
317
|
-
|
|
318
|
-
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; }
|
|
319
304
|
|
|
320
305
|
|
|
321
306
|
|
|
@@ -327,103 +312,63 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
327
312
|
|
|
328
313
|
var propTypes = {
|
|
329
314
|
children: external_prop_types_default.a.node,
|
|
330
|
-
|
|
331
|
-
/** @private */
|
|
332
|
-
disabledDeleteButton: external_prop_types_default.a.bool,
|
|
333
315
|
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
334
316
|
index: external_prop_types_default.a.number,
|
|
335
|
-
|
|
336
|
-
/** @private */
|
|
337
|
-
onKeyDown: external_prop_types_default.a.func,
|
|
338
317
|
onRequestRemove: external_prop_types_default.a.func,
|
|
339
318
|
|
|
340
319
|
/** @private */
|
|
341
320
|
rowIndex: external_prop_types_default.a.number,
|
|
342
|
-
|
|
343
|
-
/** @private */
|
|
344
|
-
sortable: external_prop_types_default.a.bool,
|
|
345
321
|
value: external_prop_types_default.a.node
|
|
346
322
|
};
|
|
347
|
-
var defaultProps = {
|
|
348
|
-
disabledDeleteButton: false,
|
|
349
|
-
sortable: true
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
var Row_Row = /*#__PURE__*/function (_Component) {
|
|
353
|
-
_inherits(Row, _Component);
|
|
354
|
-
|
|
355
|
-
var _super = _createSuper(Row);
|
|
356
|
-
|
|
357
|
-
function Row() {
|
|
358
|
-
var _this;
|
|
359
323
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
324
|
+
function Row(_ref) {
|
|
325
|
+
var children = _ref.children,
|
|
326
|
+
elementRef = _ref.elementRef,
|
|
327
|
+
onRequestRemove = _ref.onRequestRemove,
|
|
328
|
+
rowIndex = _ref.rowIndex,
|
|
329
|
+
otherProps = _objectWithoutProperties(_ref, ["children", "elementRef", "onRequestRemove", "rowIndex"]);
|
|
330
|
+
|
|
331
|
+
// @docs-props-type RowPropsBase
|
|
332
|
+
var _useContext = Object(external_react_["useContext"])(FormRowsContext),
|
|
333
|
+
onKeyDownContext = _useContext.onKeyDown,
|
|
334
|
+
disabledDeleteButtonContext = _useContext.disabledDeleteButton,
|
|
335
|
+
sortableContext = _useContext.sortable;
|
|
336
|
+
|
|
337
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
338
|
+
onKeyDownContext === null || onKeyDownContext === void 0 ? void 0 : onKeyDownContext(e, {
|
|
339
|
+
index: rowIndex !== null && rowIndex !== void 0 ? rowIndex : 0
|
|
374
340
|
});
|
|
341
|
+
};
|
|
375
342
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
(_this$props$onRequest = (_this$props2 = _this.props).onRequestRemove) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props2, e, {
|
|
380
|
-
index: (_this$props$rowIndex2 = _this.props.rowIndex) !== null && _this$props$rowIndex2 !== void 0 ? _this$props$rowIndex2 : 0
|
|
381
|
-
});
|
|
343
|
+
var handleRequestRemove = function handleRequestRemove(e) {
|
|
344
|
+
onRequestRemove === null || onRequestRemove === void 0 ? void 0 : onRequestRemove(e, {
|
|
345
|
+
index: rowIndex !== null && rowIndex !== void 0 ? rowIndex : 0
|
|
382
346
|
});
|
|
347
|
+
};
|
|
383
348
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
$sortable: sortable,
|
|
405
|
-
"data-test": "row",
|
|
406
|
-
ref: elementRef,
|
|
407
|
-
onKeyDown: this.handleKeyDown // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
408
|
-
,
|
|
409
|
-
tabIndex: sortable ? 0 : undefined
|
|
410
|
-
}, Object(external_lodash_["omit"])(otherProps, ['onKeyDown', 'onRequestRemove', 'rowIndex'])), sortable && /*#__PURE__*/external_react_default.a.createElement(DragHandle, null), children, /*#__PURE__*/external_react_default.a.createElement(StyledButton, null, /*#__PURE__*/external_react_default.a.createElement(CloseButton_default.a, {
|
|
411
|
-
disabled: disabledDeleteButton,
|
|
412
|
-
"data-test": "remove",
|
|
413
|
-
onClick: this.handleRequestRemove,
|
|
414
|
-
screenReaderText: Object(i18n_["_"])('Remove Row')
|
|
415
|
-
})));
|
|
416
|
-
}
|
|
417
|
-
}]);
|
|
418
|
-
|
|
419
|
-
return Row;
|
|
420
|
-
}(external_react_["Component"]);
|
|
421
|
-
|
|
422
|
-
_defineProperty(Row_Row, "propTypes", propTypes);
|
|
423
|
-
|
|
424
|
-
_defineProperty(Row_Row, "defaultProps", defaultProps);
|
|
349
|
+
var DragHandle = Object(external_react_sortable_hoc_["SortableHandle"])(function () {
|
|
350
|
+
return /*#__PURE__*/external_react_default.a.createElement(StyledDrag, {
|
|
351
|
+
"data-test": "drag-handle"
|
|
352
|
+
}, /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, Object(i18n_["_"])('Press arrow up or arrow down to re-order items')));
|
|
353
|
+
});
|
|
354
|
+
return /*#__PURE__*/external_react_default.a.createElement(Styled // eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
355
|
+
, Row_extends({
|
|
356
|
+
$sortable: sortableContext,
|
|
357
|
+
"data-test": "row",
|
|
358
|
+
ref: elementRef,
|
|
359
|
+
onKeyDown: handleKeyDown // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
360
|
+
,
|
|
361
|
+
tabIndex: sortableContext ? 0 : undefined
|
|
362
|
+
}, Object(external_lodash_["omit"])(otherProps, ['onKeyDown', 'onRequestRemove', 'rowIndex'])), sortableContext && /*#__PURE__*/external_react_default.a.createElement(DragHandle, null), children, /*#__PURE__*/external_react_default.a.createElement(StyledButton, null, /*#__PURE__*/external_react_default.a.createElement(CloseButton_default.a, {
|
|
363
|
+
disabled: disabledDeleteButtonContext,
|
|
364
|
+
"data-test": "remove",
|
|
365
|
+
onClick: handleRequestRemove,
|
|
366
|
+
screenReaderText: Object(i18n_["_"])('Remove Row')
|
|
367
|
+
})));
|
|
368
|
+
}
|
|
425
369
|
|
|
426
|
-
|
|
370
|
+
Row.propTypes = propTypes;
|
|
371
|
+
var SortableRow = Object(external_react_sortable_hoc_["SortableElement"])(Row);
|
|
427
372
|
SortableRow.propTypes = propTypes;
|
|
428
373
|
/* harmony default export */ var FormRows_Row = (SortableRow);
|
|
429
374
|
// CONCATENATED MODULE: ./src/FormRows/SortableList.tsx
|
|
@@ -436,35 +381,13 @@ var SortableList = Object(external_react_sortable_hoc_["SortableContainer"])(fun
|
|
|
436
381
|
});
|
|
437
382
|
/* harmony default export */ var FormRows_SortableList = (SortableList);
|
|
438
383
|
// CONCATENATED MODULE: ./src/FormRows/FormRows.tsx
|
|
439
|
-
function FormRows_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { FormRows_typeof = function _typeof(obj) { return typeof obj; }; } else { FormRows_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return FormRows_typeof(obj); }
|
|
440
|
-
|
|
441
384
|
function FormRows_extends() { FormRows_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FormRows_extends.apply(this, arguments); }
|
|
442
385
|
|
|
443
386
|
function FormRows_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = FormRows_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
444
387
|
|
|
445
388
|
function FormRows_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
446
389
|
|
|
447
|
-
function FormRows_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
448
|
-
|
|
449
|
-
function FormRows_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); } }
|
|
450
|
-
|
|
451
|
-
function FormRows_createClass(Constructor, protoProps, staticProps) { if (protoProps) FormRows_defineProperties(Constructor.prototype, protoProps); if (staticProps) FormRows_defineProperties(Constructor, staticProps); return Constructor; }
|
|
452
390
|
|
|
453
|
-
function FormRows_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) FormRows_setPrototypeOf(subClass, superClass); }
|
|
454
|
-
|
|
455
|
-
function FormRows_setPrototypeOf(o, p) { FormRows_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FormRows_setPrototypeOf(o, p); }
|
|
456
|
-
|
|
457
|
-
function FormRows_createSuper(Derived) { var hasNativeReflectConstruct = FormRows_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FormRows_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FormRows_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FormRows_possibleConstructorReturn(this, result); }; }
|
|
458
|
-
|
|
459
|
-
function FormRows_possibleConstructorReturn(self, call) { if (call && (FormRows_typeof(call) === "object" || typeof call === "function")) { return call; } return FormRows_assertThisInitialized(self); }
|
|
460
|
-
|
|
461
|
-
function FormRows_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
462
|
-
|
|
463
|
-
function FormRows_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
464
|
-
|
|
465
|
-
function FormRows_getPrototypeOf(o) { FormRows_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FormRows_getPrototypeOf(o); }
|
|
466
|
-
|
|
467
|
-
function FormRows_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; }
|
|
468
391
|
|
|
469
392
|
|
|
470
393
|
|
|
@@ -473,6 +396,7 @@ function FormRows_defineProperty(obj, key, value) { if (key in obj) { Object.def
|
|
|
473
396
|
|
|
474
397
|
|
|
475
398
|
|
|
399
|
+
/** @public */
|
|
476
400
|
|
|
477
401
|
var FormRows_propTypes = {
|
|
478
402
|
addLabel: external_prop_types_default.a.string,
|
|
@@ -484,214 +408,178 @@ var FormRows_propTypes = {
|
|
|
484
408
|
onRequestAdd: external_prop_types_default.a.func,
|
|
485
409
|
onRequestMove: external_prop_types_default.a.func
|
|
486
410
|
};
|
|
487
|
-
var
|
|
411
|
+
var defaultProps = {
|
|
488
412
|
addLabel: Object(i18n_["_"])('Add Row'),
|
|
489
413
|
disabled: false,
|
|
490
414
|
header: null
|
|
491
415
|
};
|
|
492
416
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
417
|
+
function FormRows(props) {
|
|
418
|
+
// @docs-props-type FormRowsPropsBase
|
|
419
|
+
var addLabel = props.addLabel,
|
|
420
|
+
children = props.children,
|
|
421
|
+
disabled = props.disabled,
|
|
422
|
+
header = props.header,
|
|
423
|
+
menu = props.menu,
|
|
424
|
+
onRequestAdd = props.onRequestAdd,
|
|
425
|
+
onRequestMove = props.onRequestMove,
|
|
426
|
+
otherProps = FormRows_objectWithoutProperties(props, ["addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove"]);
|
|
427
|
+
|
|
428
|
+
var handleKeyDown = function handleKeyDown(e, _ref) {
|
|
429
|
+
var index = _ref.index;
|
|
430
|
+
|
|
431
|
+
if (e.currentTarget !== e.target) {
|
|
432
|
+
return;
|
|
505
433
|
}
|
|
506
434
|
|
|
507
|
-
|
|
435
|
+
if (Object(keyboard_["keycode"])(e.nativeEvent) === 'up') {
|
|
436
|
+
e.preventDefault();
|
|
508
437
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
438
|
+
if (index > 0) {
|
|
439
|
+
onRequestMove === null || onRequestMove === void 0 ? void 0 : onRequestMove({
|
|
440
|
+
fromIndex: index,
|
|
441
|
+
toIndex: index - 1
|
|
442
|
+
});
|
|
514
443
|
}
|
|
444
|
+
} else if (Object(keyboard_["keycode"])(e.nativeEvent) === 'down') {
|
|
445
|
+
e.preventDefault();
|
|
515
446
|
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
(_this$props$onRequest = (_this$props = _this.props).onRequestMove) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, {
|
|
523
|
-
fromIndex: index,
|
|
524
|
-
toIndex: index - 1
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
} else if (Object(keyboard_["keycode"])(e.nativeEvent) === 'down') {
|
|
528
|
-
e.preventDefault();
|
|
529
|
-
|
|
530
|
-
if (index < external_react_default.a.Children.toArray(_this.props.children).length - 1) {
|
|
531
|
-
var _this$props$onRequest2, _this$props2;
|
|
532
|
-
|
|
533
|
-
(_this$props$onRequest2 = (_this$props2 = _this.props).onRequestMove) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, {
|
|
534
|
-
fromIndex: index,
|
|
535
|
-
toIndex: index + 1
|
|
536
|
-
});
|
|
537
|
-
}
|
|
447
|
+
if (index < external_react_default.a.Children.toArray(children).length - 1) {
|
|
448
|
+
onRequestMove === null || onRequestMove === void 0 ? void 0 : onRequestMove({
|
|
449
|
+
fromIndex: index,
|
|
450
|
+
toIndex: index + 1
|
|
451
|
+
});
|
|
538
452
|
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
var handleSortEnd = function handleSortEnd(_ref2) {
|
|
457
|
+
var oldIndex = _ref2.oldIndex,
|
|
458
|
+
newIndex = _ref2.newIndex;
|
|
459
|
+
onRequestMove === null || onRequestMove === void 0 ? void 0 : onRequestMove({
|
|
460
|
+
fromIndex: oldIndex,
|
|
461
|
+
toIndex: newIndex
|
|
539
462
|
});
|
|
463
|
+
};
|
|
540
464
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
(_this$props$onRequest3 = (_this$props3 = _this.props).onRequestMove) === null || _this$props$onRequest3 === void 0 ? void 0 : _this$props$onRequest3.call(_this$props3, {
|
|
547
|
-
fromIndex: oldIndex,
|
|
548
|
-
toIndex: newIndex
|
|
549
|
-
});
|
|
465
|
+
var sortable = onRequestMove !== undefined && !disabled;
|
|
466
|
+
var StyledHeaderComp = sortable ? StyledHeader : 'div';
|
|
467
|
+
var clonedChildren = external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]).map(function (item) {
|
|
468
|
+
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
469
|
+
rowIndex: item.props.index
|
|
550
470
|
});
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
disabled = _this$props4.disabled,
|
|
564
|
-
header = _this$props4.header,
|
|
565
|
-
menu = _this$props4.menu,
|
|
566
|
-
onRequestAdd = _this$props4.onRequestAdd,
|
|
567
|
-
onRequestMove = _this$props4.onRequestMove,
|
|
568
|
-
otherProps = FormRows_objectWithoutProperties(_this$props4, ["addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove"]);
|
|
569
|
-
|
|
570
|
-
var sortable = onRequestMove !== undefined && !disabled;
|
|
571
|
-
var StyledHeaderComp = sortable ? StyledHeader : 'div';
|
|
572
|
-
var clonedChildren = external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]).map(function (item) {
|
|
573
|
-
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
574
|
-
onKeyDown: _this2.handleKeyDown,
|
|
575
|
-
rowIndex: item.props.index,
|
|
576
|
-
disabledDeleteButton: disabled,
|
|
577
|
-
sortable: sortable
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledBox, FormRows_extends({
|
|
581
|
-
"data-test": "form-rows"
|
|
582
|
-
}, otherProps), header && /*#__PURE__*/external_react_default.a.createElement(StyledHeaderComp, null, header), /*#__PURE__*/external_react_default.a.createElement(FormRows_SortableList, {
|
|
583
|
-
helperClass: "sorting",
|
|
584
|
-
onSortEnd: this.handleSortEnd,
|
|
585
|
-
useDragHandle: true
|
|
586
|
-
}, clonedChildren), menu || /*#__PURE__*/external_react_default.a.createElement(StyledAddRowButton, {
|
|
587
|
-
disabled: disabled,
|
|
588
|
-
appearance: "pill",
|
|
589
|
-
"data-test": "add-row",
|
|
590
|
-
icon: /*#__PURE__*/external_react_default.a.createElement(Plus, null),
|
|
591
|
-
label: addLabel,
|
|
592
|
-
onClick: onRequestAdd,
|
|
593
|
-
$sortable: sortable
|
|
594
|
-
}));
|
|
595
|
-
}
|
|
596
|
-
}], [{
|
|
597
|
-
key: "addRow",
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Static function for adding a row.
|
|
601
|
-
*
|
|
602
|
-
* Example Use:
|
|
603
|
-
*
|
|
604
|
-
* onRequestAdd() => {
|
|
605
|
-
* this.setState(state => ({
|
|
606
|
-
* items: FormRows.addRow(
|
|
607
|
-
* <FormRows.Row
|
|
608
|
-
* index={state.items.length}
|
|
609
|
-
* key={createDOMID()}
|
|
610
|
-
* onRequestRemove={this.handleRequestRemove}
|
|
611
|
-
* >
|
|
612
|
-
* <Text />
|
|
613
|
-
* </FormRows.Row>,
|
|
614
|
-
* state.items
|
|
615
|
-
* ),
|
|
616
|
-
* }));
|
|
617
|
-
* };
|
|
618
|
-
*
|
|
619
|
-
* @param element Row element to add.
|
|
620
|
-
* @param items Array of current FormRows to add to.
|
|
621
|
-
* @return New array of FormRows with new Row added.
|
|
622
|
-
*/
|
|
623
|
-
value: function addRow(element, items) {
|
|
624
|
-
return items.concat(element);
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Static function for moving a row.
|
|
628
|
-
*
|
|
629
|
-
* Example Use:
|
|
630
|
-
*
|
|
631
|
-
* onRequestMove({ fromIndex, toIndex }) => {
|
|
632
|
-
* this.setState(state => ({
|
|
633
|
-
* items: FormRows.moveRow(fromIndex, toIndex, state.items),
|
|
634
|
-
* }));
|
|
635
|
-
* };
|
|
636
|
-
*
|
|
637
|
-
* @param fromIndex Current index of row to move.
|
|
638
|
-
* @param toIndex New index to move row to.
|
|
639
|
-
* @param items Array of current FormRows.
|
|
640
|
-
* @return New array of FormRows arranged in new order.
|
|
641
|
-
*/
|
|
642
|
-
|
|
643
|
-
}, {
|
|
644
|
-
key: "moveRow",
|
|
645
|
-
value: function moveRow(fromIndex, toIndex, items) {
|
|
646
|
-
var tempArray = items.filter(function (val, idx) {
|
|
647
|
-
return idx !== fromIndex;
|
|
648
|
-
});
|
|
649
|
-
tempArray.splice(toIndex, 0, items[fromIndex]);
|
|
650
|
-
return tempArray.map(function (item, index) {
|
|
651
|
-
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
652
|
-
index: index
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Static function for removing a row.
|
|
658
|
-
*
|
|
659
|
-
* Example Use:
|
|
660
|
-
*
|
|
661
|
-
* onRequestRemove(e, { index }) => {
|
|
662
|
-
* this.setState(state => ({
|
|
663
|
-
* items: FormRows.removeRow(index, state.items),
|
|
664
|
-
* }));
|
|
665
|
-
* };
|
|
666
|
-
*
|
|
667
|
-
* @param index Index of Row to delete.
|
|
668
|
-
* @param items Array of current FormRows.
|
|
669
|
-
* @return New array of FormRows with Row of given index deleted.
|
|
670
|
-
*/
|
|
671
|
-
|
|
672
|
-
}, {
|
|
673
|
-
key: "removeRow",
|
|
674
|
-
value: function removeRow(index, items) {
|
|
675
|
-
return items.filter(function (val, idx) {
|
|
676
|
-
return idx !== index;
|
|
677
|
-
}).map(function (item, idx) {
|
|
678
|
-
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
679
|
-
index: idx
|
|
680
|
-
});
|
|
681
|
-
});
|
|
471
|
+
});
|
|
472
|
+
return /*#__PURE__*/external_react_default.a.createElement(StyledBox, FormRows_extends({
|
|
473
|
+
"data-test": "form-rows"
|
|
474
|
+
}, otherProps), header && /*#__PURE__*/external_react_default.a.createElement(StyledHeaderComp, null, header), /*#__PURE__*/external_react_default.a.createElement(FormRows_SortableList, {
|
|
475
|
+
helperClass: "sorting",
|
|
476
|
+
onSortEnd: handleSortEnd,
|
|
477
|
+
useDragHandle: true
|
|
478
|
+
}, /*#__PURE__*/external_react_default.a.createElement(FormRows_FormRowsContext.Provider, {
|
|
479
|
+
value: {
|
|
480
|
+
disabledDeleteButton: disabled,
|
|
481
|
+
onKeyDown: handleKeyDown,
|
|
482
|
+
sortable: sortable
|
|
682
483
|
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
484
|
+
}, clonedChildren)), menu || /*#__PURE__*/external_react_default.a.createElement(StyledAddRowButton, {
|
|
485
|
+
disabled: disabled,
|
|
486
|
+
appearance: "pill",
|
|
487
|
+
"data-test": "add-row",
|
|
488
|
+
icon: /*#__PURE__*/external_react_default.a.createElement(Plus, null),
|
|
489
|
+
label: addLabel,
|
|
490
|
+
onClick: onRequestAdd,
|
|
491
|
+
$sortable: sortable
|
|
492
|
+
}));
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Static function for adding a row.
|
|
496
|
+
*
|
|
497
|
+
* Example Use:
|
|
498
|
+
*
|
|
499
|
+
* onRequestAdd() => {
|
|
500
|
+
* this.setState(state => ({
|
|
501
|
+
* items: FormRows.addRow(
|
|
502
|
+
* <FormRows.Row
|
|
503
|
+
* index={state.items.length}
|
|
504
|
+
* key={createDOMID()}
|
|
505
|
+
* onRequestRemove={this.handleRequestRemove}
|
|
506
|
+
* >
|
|
507
|
+
* <Text />
|
|
508
|
+
* </FormRows.Row>,
|
|
509
|
+
* state.items
|
|
510
|
+
* ),
|
|
511
|
+
* }));
|
|
512
|
+
* };
|
|
513
|
+
*
|
|
514
|
+
* @param element Row element to add.
|
|
515
|
+
* @param items Array of current FormRows to add to.
|
|
516
|
+
* @return New array of FormRows with new Row added.
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
FormRows.addRow = function (element, items) {
|
|
521
|
+
return items.concat(element);
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Static function for moving a row.
|
|
525
|
+
*
|
|
526
|
+
* Example Use:
|
|
527
|
+
*
|
|
528
|
+
* onRequestMove({ fromIndex, toIndex }) => {
|
|
529
|
+
* this.setState(state => ({
|
|
530
|
+
* items: FormRows.moveRow(fromIndex, toIndex, state.items),
|
|
531
|
+
* }));
|
|
532
|
+
* };
|
|
533
|
+
*
|
|
534
|
+
* @param fromIndex Current index of row to move.
|
|
535
|
+
* @param toIndex New index to move row to.
|
|
536
|
+
* @param items Array of current FormRows.
|
|
537
|
+
* @return New array of FormRows arranged in new order.
|
|
538
|
+
*/
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
FormRows.moveRow = function (fromIndex, toIndex, items) {
|
|
542
|
+
var tempArray = items.filter(function (val, idx) {
|
|
543
|
+
return idx !== fromIndex;
|
|
544
|
+
});
|
|
545
|
+
tempArray.splice(toIndex, 0, items[fromIndex]);
|
|
546
|
+
return tempArray.map(function (item, index) {
|
|
547
|
+
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
548
|
+
index: index
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* Static function for removing a row.
|
|
554
|
+
*
|
|
555
|
+
* Example Use:
|
|
556
|
+
*
|
|
557
|
+
* onRequestRemove(e, { index }) => {
|
|
558
|
+
* this.setState(state => ({
|
|
559
|
+
* items: FormRows.removeRow(index, state.items),
|
|
560
|
+
* }));
|
|
561
|
+
* };
|
|
562
|
+
*
|
|
563
|
+
* @param index Index of Row to delete.
|
|
564
|
+
* @param items Array of current FormRows.
|
|
565
|
+
* @return New array of FormRows with Row of given index deleted.
|
|
566
|
+
*/
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
FormRows.removeRow = function (index, items) {
|
|
570
|
+
return items.filter(function (val, idx) {
|
|
571
|
+
return idx !== index;
|
|
572
|
+
}).map(function (item, idx) {
|
|
573
|
+
return /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
574
|
+
index: idx
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
};
|
|
693
578
|
|
|
694
|
-
|
|
579
|
+
FormRows.propTypes = FormRows_propTypes;
|
|
580
|
+
FormRows.defaultProps = defaultProps;
|
|
581
|
+
FormRows.Row = FormRows_Row;
|
|
582
|
+
/* harmony default export */ var FormRows_FormRows = (FormRows);
|
|
695
583
|
|
|
696
584
|
// CONCATENATED MODULE: ./src/FormRows/index.ts
|
|
697
585
|
|
package/Image.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 161);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -108,7 +108,7 @@ module.exports = require("@splunk/react-ui/Clickable");
|
|
|
108
108
|
|
|
109
109
|
/***/ }),
|
|
110
110
|
|
|
111
|
-
/***/
|
|
111
|
+
/***/ 161:
|
|
112
112
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
113
113
|
|
|
114
114
|
"use strict";
|