@k-int/stripes-kint-components 1.7.0 → 1.7.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.
Files changed (164) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es/index.js +29 -49
  3. package/es/lib/ActionList/ActionList.js +28 -73
  4. package/es/lib/ActionList/ActionListFieldArray.js +97 -220
  5. package/es/lib/ActionList/index.js +2 -8
  6. package/es/lib/EditableRefdataList/EditableRefdataList.js +46 -134
  7. package/es/lib/EditableRefdataList/index.js +2 -8
  8. package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -47
  9. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +16 -61
  10. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +62 -137
  11. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +23 -91
  12. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +103 -127
  13. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +19 -75
  14. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +188 -357
  15. package/es/lib/EditableSettingsList/SettingField/SettingField.js +39 -120
  16. package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +61 -157
  17. package/es/lib/EditableSettingsList/SettingField/index.js +4 -12
  18. package/es/lib/EditableSettingsList/index.js +4 -12
  19. package/es/lib/NoResultsMessage/NoResultsMessage.js +24 -61
  20. package/es/lib/NoResultsMessage/index.js +2 -8
  21. package/es/lib/QueryTypedown/QueryTypedown.js +15 -89
  22. package/es/lib/QueryTypedown/index.js +2 -8
  23. package/es/lib/RefdataButtons/RefdataButtons.js +32 -85
  24. package/es/lib/RefdataButtons/index.js +2 -8
  25. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +120 -227
  26. package/es/lib/SASQLookupComponent/index.js +2 -8
  27. package/es/lib/SASQRoute/SASQRoute.js +27 -76
  28. package/es/lib/SASQRoute/index.js +2 -8
  29. package/es/lib/SASQViewComponent/SASQViewComponent.js +28 -89
  30. package/es/lib/SASQViewComponent/index.js +2 -8
  31. package/es/lib/SearchField/SearchField.js +11 -61
  32. package/es/lib/SearchField/index.js +2 -8
  33. package/es/lib/SettingPage/SettingPage.js +17 -63
  34. package/es/lib/SettingPage/SettingPagePane.js +13 -58
  35. package/es/lib/SettingPage/index.js +3 -10
  36. package/es/lib/TypeDown/TypeDown.js +61 -132
  37. package/es/lib/TypeDown/index.js +2 -8
  38. package/es/lib/Typedown/Typedown.js +74 -153
  39. package/es/lib/Typedown/index.js +2 -8
  40. package/es/lib/constants/eventCodes.js +3 -36
  41. package/es/lib/contexts/SettingsContext.js +2 -34
  42. package/es/lib/contexts/index.js +2 -8
  43. package/es/lib/hooks/index.js +12 -27
  44. package/es/lib/hooks/settingsHooks/index.js +3 -10
  45. package/es/lib/hooks/settingsHooks/useSettingSection.js +16 -60
  46. package/es/lib/hooks/settingsHooks/useSettings.js +51 -130
  47. package/es/lib/hooks/typedownHooks/index.js +4 -12
  48. package/es/lib/hooks/typedownHooks/useTypedown.js +60 -114
  49. package/es/lib/hooks/typedownHooks/useTypedownData.js +13 -69
  50. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +15 -71
  51. package/es/lib/hooks/useActiveElement.js +10 -63
  52. package/es/lib/hooks/useHelperApp.js +37 -111
  53. package/es/lib/hooks/useKiwtFieldArray.js +35 -101
  54. package/es/lib/hooks/useKiwtSASQuery.js +36 -107
  55. package/es/lib/hooks/useLocalStorageState.js +7 -69
  56. package/es/lib/hooks/useMutateRefdataValue.js +31 -115
  57. package/es/lib/hooks/useQIndex.js +17 -87
  58. package/es/lib/hooks/useRefdata.js +19 -65
  59. package/es/lib/hooks/useTemplates.js +16 -60
  60. package/es/lib/utils/buildUrl.js +11 -51
  61. package/es/lib/utils/generateKiwtQuery.js +4 -40
  62. package/es/lib/utils/generateKiwtQueryParams.js +38 -125
  63. package/es/lib/utils/index.js +9 -22
  64. package/es/lib/utils/refdataOptions.js +2 -32
  65. package/es/lib/utils/renderHelpText.js +32 -89
  66. package/es/lib/utils/selectorSafe.js +2 -34
  67. package/es/lib/utils/sortByLabel.js +4 -41
  68. package/es/lib/utils/toCamelCase.js +8 -42
  69. package/package.json +17 -3
  70. package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -109
  71. package/es/artifacts/coverage-jest/lcov-report/prettify.js +0 -998
  72. package/es/artifacts/coverage-jest/lcov-report/sorter.js +0 -238
  73. package/junit.xml +0 -79
  74. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +0 -256
  75. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +0 -799
  76. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +0 -146
  77. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +0 -88
  78. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +0 -376
  79. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +0 -131
  80. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +0 -88
  81. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +0 -223
  82. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -211
  83. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -376
  84. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -262
  85. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +0 -436
  86. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +0 -161
  87. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +0 -94
  88. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +0 -146
  89. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +0 -94
  90. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +0 -319
  91. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +0 -131
  92. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +0 -88
  93. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +0 -184
  94. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +0 -131
  95. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +0 -88
  96. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +0 -370
  97. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +0 -131
  98. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +0 -88
  99. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +0 -949
  100. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +0 -131
  101. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +0 -88
  102. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +0 -274
  103. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +0 -131
  104. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +0 -88
  105. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +0 -250
  106. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +0 -131
  107. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +0 -88
  108. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +0 -214
  109. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +0 -131
  110. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +0 -88
  111. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +0 -211
  112. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +0 -178
  113. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +0 -146
  114. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +0 -91
  115. package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -769
  116. package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +0 -131
  117. package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +0 -88
  118. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +0 -790
  119. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +0 -131
  120. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +0 -88
  121. package/src/artifacts/coverage-jest/lcov-report/base.css +0 -224
  122. package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
  123. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +0 -94
  124. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +0 -116
  125. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +0 -97
  126. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +0 -131
  127. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +0 -91
  128. package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  129. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +0 -251
  130. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +0 -115
  131. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +0 -146
  132. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +0 -91
  133. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +0 -163
  134. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +0 -403
  135. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +0 -161
  136. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +0 -94
  137. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +0 -520
  138. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +0 -163
  139. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +0 -163
  140. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +0 -157
  141. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +0 -283
  142. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +0 -274
  143. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +0 -178
  144. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +0 -136
  145. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +0 -301
  146. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +0 -208
  147. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +0 -268
  148. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +0 -166
  149. package/src/artifacts/coverage-jest/lcov-report/index.html +0 -401
  150. package/src/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
  151. package/src/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
  152. package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  153. package/src/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
  154. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +0 -193
  155. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +0 -109
  156. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +0 -286
  157. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +0 -236
  158. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +0 -121
  159. package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +0 -106
  160. package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +0 -166
  161. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +0 -103
  162. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +0 -130
  163. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +0 -127
  164. package/src/artifacts/coverage-jest/lcov.info +0 -1999
@@ -1,83 +1,24 @@
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 _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _reactIntl = require("react-intl");
15
-
16
10
  var _get = _interopRequireDefault(require("lodash/get"));
17
-
18
11
  var _reactFinalForm = require("react-final-form");
19
-
20
12
  var _components = require("@folio/stripes/components");
21
-
22
13
  var _ActionListFieldArray = _interopRequireDefault(require("../../../styles/ActionListFieldArray.css"));
23
-
24
14
  var _jsxRuntime = require("react/jsx-runtime");
25
-
26
- var _excluded = ["actionListActions"],
27
- _excluded2 = ["actionListActions"],
28
- _excluded3 = ["actionListActions"];
29
-
30
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
-
34
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
36
- (function () {
37
- var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
38
- enterModule && enterModule(module);
39
- })();
40
-
41
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
42
-
43
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
44
-
45
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
46
-
47
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
48
-
49
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
50
-
51
- 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; }
52
-
53
- 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; }
54
-
55
- 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; }
56
-
57
- 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; }
58
-
59
- 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; }
60
-
61
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
62
-
63
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
64
-
65
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
66
-
67
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
68
-
69
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
70
-
71
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
72
-
73
- var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
74
- return a;
75
- };
76
-
77
- var EDITING_ACTIONS_WIDTH = 25;
78
- var NON_EDITING_ACTIONS_WIDTH = 20;
79
- var TOTAL_WIDTH = 100;
80
- var propTypes = {
16
+ 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); }
17
+ 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 && Object.prototype.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; }
18
+ const EDITING_ACTIONS_WIDTH = 25;
19
+ const NON_EDITING_ACTIONS_WIDTH = 20;
20
+ const TOTAL_WIDTH = 100;
21
+ const propTypes = {
81
22
  actionAssigner: _propTypes.default.func,
82
23
  actionCalls: _propTypes.default.object,
83
24
  columnMapping: _propTypes.default.object,
@@ -86,101 +27,92 @@ var propTypes = {
86
27
  fields: _propTypes.default.object,
87
28
  visibleFields: _propTypes.default.arrayOf(_propTypes.default.string)
88
29
  };
89
-
90
- var ActionListFieldArray = function ActionListFieldArray(_ref) {
91
- var actionAssigner = _ref.actionAssigner,
92
- actionCalls = _ref.actionCalls,
93
- columnMapping = _ref.columnMapping,
94
- creatableFields = _ref.creatableFields,
95
- editableFields = _ref.editableFields,
96
- fields = _ref.fields,
97
- visibleFields = _ref.visibleFields;
98
-
30
+ const ActionListFieldArray = _ref => {
31
+ let {
32
+ actionAssigner,
33
+ actionCalls,
34
+ columnMapping,
35
+ creatableFields,
36
+ editableFields,
37
+ fields,
38
+ visibleFields
39
+ } = _ref;
99
40
  // Grab finalForm functions/values from form hooks
100
- var _useForm = (0, _reactFinalForm.useForm)(),
101
- change = _useForm.change;
41
+ const {
42
+ change
43
+ } = (0, _reactFinalForm.useForm)();
44
+ const {
45
+ initialValues,
46
+ pristine,
47
+ submitting,
48
+ values
49
+ } = (0, _reactFinalForm.useFormState)();
102
50
 
103
- var _useFormState = (0, _reactFinalForm.useFormState)(),
104
- initialValues = _useFormState.initialValues,
105
- pristine = _useFormState.pristine,
106
- submitting = _useFormState.submitting,
107
- values = _useFormState.values;
108
51
  /*
109
52
  Keep track of which field we are editing.
110
53
  null for no field, string id if we are editing an existing field and
111
54
  'NEW_ROW' for a new row
112
55
  */
113
-
114
-
115
- var _useState = (0, _react.useState)(null),
116
- _useState2 = _slicedToArray(_useState, 2),
117
- editing = _useState2[0],
118
- setEditing = _useState2[1];
119
-
120
- var toggleEditing = function toggleEditing(id) {
56
+ const [editing, setEditing] = (0, _react.useState)(null);
57
+ const toggleEditing = id => {
121
58
  if (editing) {
122
59
  setEditing(null);
123
60
  } else {
124
61
  setEditing(id);
125
62
  }
126
63
  };
127
-
128
- var handleSave = function handleSave(index) {
129
- var _fields$value$index = fields.value[index],
130
- _a = _fields$value$index.actionListActions,
131
- rowData = _objectWithoutProperties(_fields$value$index, _excluded);
132
-
64
+ const handleSave = index => {
65
+ const {
66
+ actionListActions: _a,
67
+ ...rowData
68
+ } = fields.value[index];
133
69
  actionCalls.edit(rowData);
134
70
  };
135
-
136
- var handleCreate = function handleCreate(index) {
137
- var _fields$value$index2 = fields.value[index],
138
- _a = _fields$value$index2.actionListActions,
139
- rowData = _objectWithoutProperties(_fields$value$index2, _excluded2);
140
-
71
+ const handleCreate = index => {
72
+ const {
73
+ actionListActions: _a,
74
+ ...rowData
75
+ } = fields.value[index];
141
76
  actionCalls.create(rowData);
142
77
  };
143
-
144
- var getColumnWidths = function getColumnWidths() {
145
- var widthNotInUseByActions = editing ? TOTAL_WIDTH - EDITING_ACTIONS_WIDTH : TOTAL_WIDTH - NON_EDITING_ACTIONS_WIDTH;
146
- var staticWidth = widthNotInUseByActions / visibleFields.length;
147
- var widthsObject = {};
148
- visibleFields.forEach(function (f) {
78
+ const getColumnWidths = () => {
79
+ const widthNotInUseByActions = editing ? TOTAL_WIDTH - EDITING_ACTIONS_WIDTH : TOTAL_WIDTH - NON_EDITING_ACTIONS_WIDTH;
80
+ const staticWidth = widthNotInUseByActions / visibleFields.length;
81
+ const widthsObject = {};
82
+ visibleFields.forEach(f => {
149
83
  if (f !== 'actionListActions') {
150
- widthsObject[f] = "".concat(staticWidth, "%");
84
+ widthsObject[f] = `${staticWidth}%`;
151
85
  }
152
86
  });
153
- widthsObject.actionListActions = editing ? "".concat(EDITING_ACTIONS_WIDTH, "%") : "".concat(NON_EDITING_ACTIONS_WIDTH, "%");
87
+ widthsObject.actionListActions = editing ? `${EDITING_ACTIONS_WIDTH}%` : `${NON_EDITING_ACTIONS_WIDTH}%`;
154
88
  return widthsObject;
155
89
  };
156
-
157
- var renderActionButtons = function renderActionButtons(data) {
158
- var fieldName = "contentData[".concat(data.rowIndex, "]");
159
-
160
- var actions = data.actionListActions,
161
- rest = _objectWithoutProperties(data, _excluded3);
162
-
90
+ const renderActionButtons = data => {
91
+ const fieldName = `contentData[${data.rowIndex}]`;
92
+ const {
93
+ actionListActions: actions,
94
+ ...rest
95
+ } = data;
163
96
  if (data.id === editing || !data.id && editing === 'NEW_ROW') {
164
97
  // Render the save/cancel buttons
165
98
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
166
99
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
167
100
  buttonStyle: "primary",
168
101
  disabled: submitting || pristine,
169
- onClick: function onClick() {
102
+ onClick: () => {
170
103
  if (!data.id && editing === 'NEW_ROW') {
171
104
  handleCreate(data.rowIndex);
172
105
  } else {
173
106
  handleSave(data.rowIndex);
174
107
  }
175
-
176
108
  toggleEditing(data.id);
177
109
  },
178
110
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
179
111
  id: "stripes-kint-components.actionList.save"
180
112
  })
181
- }, "save[".concat(data.rowIndex, "]")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
113
+ }, `save[${data.rowIndex}]`), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
182
114
  "data-type-button": "cancel",
183
- onClick: function onClick() {
115
+ onClick: () => {
184
116
  if (!data.id && editing === 'NEW_ROW') {
185
117
  fields.remove(data.rowIndex);
186
118
  toggleEditing('NEW_ROW');
@@ -192,106 +124,80 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
192
124
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
193
125
  id: "stripes-kint-components.actionList.cancel"
194
126
  })
195
- }, "cancel[".concat(data.rowIndex, "]"))]
127
+ }, `cancel[${data.rowIndex}]`)]
196
128
  });
197
129
  }
198
-
199
130
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
200
- children: actions === null || actions === void 0 ? void 0 : actions.map(function (action) {
201
- var _action$label;
202
-
203
- var actionFunction = function actionFunction() {
204
- return actionCalls[action.name](rest);
205
- }; // Edit has special action functionality, revealing fields etc.
206
-
207
-
131
+ children: actions?.map(action => {
132
+ let actionFunction = () => actionCalls[action.name](rest);
133
+ // Edit has special action functionality, revealing fields etc.
208
134
  if (action.name === 'edit') {
209
- actionFunction = function actionFunction() {
210
- return toggleEditing(data.id);
211
- };
212
- } // If we're handed an icon, use that for the action button
213
-
135
+ actionFunction = () => toggleEditing(data.id);
136
+ }
214
137
 
138
+ // If we're handed an icon, use that for the action button
215
139
  if (action.icon) {
216
140
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
217
141
  disabled: editing,
218
142
  icon: action.icon,
219
143
  onClick: actionFunction
220
- }, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
221
- } // Else return a button with the label, or failing that the name of the action
222
-
144
+ }, `action-${action.name}[${data.rowIndex}]`);
145
+ }
223
146
 
147
+ // Else return a button with the label, or failing that the name of the action
224
148
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
225
149
  disabled: editing,
226
150
  onClick: actionFunction,
227
- children: (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : action.name
228
- }, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
151
+ children: action.label ?? action.name
152
+ }, `action-${action.name}[${data.rowIndex}]`);
229
153
  })
230
154
  });
231
155
  };
232
-
233
- var formatContent = function formatContent() {
234
- return fields.map(function (fieldName, fieldIndex) {
156
+ const formatContent = () => {
157
+ return fields.map((fieldName, fieldIndex) => {
235
158
  // Fetch the content from the field Values
236
- var cd = (0, _get.default)(values, fieldName);
237
- cd.actionListActions = actionAssigner(cd); // Row is being edited if it has no id, or its id is in the editing string
238
-
239
- var editingRow = cd.id === editing || !cd.id;
240
-
241
- var returnObj = _objectSpread({}, cd); // If editing, replace values with fields
159
+ const cd = (0, _get.default)(values, fieldName);
160
+ cd.actionListActions = actionAssigner(cd);
242
161
 
162
+ // Row is being edited if it has no id, or its id is in the editing string
163
+ const editingRow = cd.id === editing || !cd.id;
164
+ const returnObj = {
165
+ ...cd
166
+ };
243
167
 
168
+ // If editing, replace values with fields
244
169
  if (editingRow) {
245
170
  /*
246
171
  Check if the property is a visible field.
247
172
  If it is not then we don't allow editing in this component.
248
173
  */
249
- var _iterator = _createForOfIteratorHelper(visibleFields),
250
- _step;
251
-
252
- try {
253
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
254
- var _editableFields$key, _creatableFields$key;
255
-
256
- var key = _step.value;
257
- var editFunction = (_editableFields$key = editableFields[key]) !== null && _editableFields$key !== void 0 ? _editableFields$key : function () {
258
- return true;
259
- };
260
- var createFunction = (_creatableFields$key = creatableFields[key]) !== null && _creatableFields$key !== void 0 ? _creatableFields$key : function () {
261
- return true;
262
- };
263
- /*
264
- Next check if this is a new row, if so we should run the createableField function with the data.
265
- If it is not a new row, then we run the editableField function with the data,
266
- and it should return true/false
267
- For both checks
268
- true => Field, false => display value
269
- */
270
-
271
- if (!cd.id && createFunction(cd) || editFunction(cd)) {
272
- returnObj[key] = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
273
- autofocus: fieldIndex === 0,
274
- component: _components.TextField,
275
- name: "".concat(fieldName, ".").concat(key)
276
- });
277
- }
174
+ for (const key of visibleFields) {
175
+ const editFunction = editableFields[key] ?? (() => true);
176
+ const createFunction = creatableFields[key] ?? (() => true);
177
+ /*
178
+ Next check if this is a new row, if so we should run the createableField function with the data.
179
+ If it is not a new row, then we run the editableField function with the data,
180
+ and it should return true/false
181
+ For both checks
182
+ true => Field, false => display value
183
+ */
184
+ if (!cd.id && createFunction(cd) || editFunction(cd)) {
185
+ returnObj[key] = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
186
+ autofocus: fieldIndex === 0,
187
+ component: _components.TextField,
188
+ name: `${fieldName}.${key}`
189
+ });
278
190
  }
279
- } catch (err) {
280
- _iterator.e(err);
281
- } finally {
282
- _iterator.f();
283
191
  }
284
192
  }
285
-
286
193
  return returnObj;
287
194
  });
288
195
  };
289
-
290
196
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
291
197
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
292
198
  buttonClass: _ActionListFieldArray.default.buttonRight,
293
199
  disabled: !actionCalls.create,
294
- onClick: function onClick() {
200
+ onClick: () => {
295
201
  toggleEditing('NEW_ROW');
296
202
  fields.push({});
297
203
  },
@@ -299,50 +205,21 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
299
205
  id: "stripes-kint-components.actionList.create"
300
206
  })
301
207
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
302
- columnMapping: _objectSpread(_objectSpread({}, columnMapping), {}, {
208
+ columnMapping: {
209
+ ...columnMapping,
303
210
  actionListActions: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
304
211
  id: "stripes-kint-components.actionList.actions"
305
212
  })
306
- }),
213
+ },
307
214
  columnWidths: getColumnWidths(),
308
215
  contentData: formatContent(),
309
216
  formatter: {
310
217
  actionListActions: renderActionButtons
311
218
  },
312
219
  interactive: false,
313
- visibleColumns: [].concat(_toConsumableArray(visibleFields), ['actionListActions'])
220
+ visibleColumns: [...visibleFields, 'actionListActions']
314
221
  })]
315
222
  });
316
223
  };
317
-
318
- __signature__(ActionListFieldArray, "useForm{{ change }}\nuseFormState{{ initialValues, pristine, submitting, values }}\nuseState{[editing, setEditing](null)}", function () {
319
- return [_reactFinalForm.useForm, _reactFinalForm.useFormState];
320
- });
321
-
322
224
  ActionListFieldArray.propTypes = propTypes;
323
- var _default = ActionListFieldArray;
324
- var _default2 = _default;
325
- exports.default = _default2;
326
- ;
327
-
328
- (function () {
329
- var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
330
-
331
- if (!reactHotLoader) {
332
- return;
333
- }
334
-
335
- reactHotLoader.register(EDITING_ACTIONS_WIDTH, "EDITING_ACTIONS_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
336
- reactHotLoader.register(NON_EDITING_ACTIONS_WIDTH, "NON_EDITING_ACTIONS_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
337
- reactHotLoader.register(TOTAL_WIDTH, "TOTAL_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
338
- reactHotLoader.register(propTypes, "propTypes", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
339
- reactHotLoader.register(ActionListFieldArray, "ActionListFieldArray", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
340
- reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
341
- })();
342
-
343
- ;
344
-
345
- (function () {
346
- var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
347
- leaveModule && leaveModule(module);
348
- })();
225
+ var _default = exports.default = ActionListFieldArray;
@@ -5,15 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _ActionList.default;
10
10
  }
11
11
  });
12
-
13
12
  var _ActionList = _interopRequireDefault(require("./ActionList"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
- var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
18
- return a;
19
- };
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }