@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.
- package/CHANGELOG.md +7 -0
- package/es/index.js +29 -49
- package/es/lib/ActionList/ActionList.js +28 -73
- package/es/lib/ActionList/ActionListFieldArray.js +97 -220
- package/es/lib/ActionList/index.js +2 -8
- package/es/lib/EditableRefdataList/EditableRefdataList.js +46 -134
- package/es/lib/EditableRefdataList/index.js +2 -8
- package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -47
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +16 -61
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +62 -137
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +23 -91
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +103 -127
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +19 -75
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +188 -357
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +39 -120
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +61 -157
- package/es/lib/EditableSettingsList/SettingField/index.js +4 -12
- package/es/lib/EditableSettingsList/index.js +4 -12
- package/es/lib/NoResultsMessage/NoResultsMessage.js +24 -61
- package/es/lib/NoResultsMessage/index.js +2 -8
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -89
- package/es/lib/QueryTypedown/index.js +2 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +32 -85
- package/es/lib/RefdataButtons/index.js +2 -8
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +120 -227
- package/es/lib/SASQLookupComponent/index.js +2 -8
- package/es/lib/SASQRoute/SASQRoute.js +27 -76
- package/es/lib/SASQRoute/index.js +2 -8
- package/es/lib/SASQViewComponent/SASQViewComponent.js +28 -89
- package/es/lib/SASQViewComponent/index.js +2 -8
- package/es/lib/SearchField/SearchField.js +11 -61
- package/es/lib/SearchField/index.js +2 -8
- package/es/lib/SettingPage/SettingPage.js +17 -63
- package/es/lib/SettingPage/SettingPagePane.js +13 -58
- package/es/lib/SettingPage/index.js +3 -10
- package/es/lib/TypeDown/TypeDown.js +61 -132
- package/es/lib/TypeDown/index.js +2 -8
- package/es/lib/Typedown/Typedown.js +74 -153
- package/es/lib/Typedown/index.js +2 -8
- package/es/lib/constants/eventCodes.js +3 -36
- package/es/lib/contexts/SettingsContext.js +2 -34
- package/es/lib/contexts/index.js +2 -8
- package/es/lib/hooks/index.js +12 -27
- package/es/lib/hooks/settingsHooks/index.js +3 -10
- package/es/lib/hooks/settingsHooks/useSettingSection.js +16 -60
- package/es/lib/hooks/settingsHooks/useSettings.js +51 -130
- package/es/lib/hooks/typedownHooks/index.js +4 -12
- package/es/lib/hooks/typedownHooks/useTypedown.js +60 -114
- package/es/lib/hooks/typedownHooks/useTypedownData.js +13 -69
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +15 -71
- package/es/lib/hooks/useActiveElement.js +10 -63
- package/es/lib/hooks/useHelperApp.js +37 -111
- package/es/lib/hooks/useKiwtFieldArray.js +35 -101
- package/es/lib/hooks/useKiwtSASQuery.js +36 -107
- package/es/lib/hooks/useLocalStorageState.js +7 -69
- package/es/lib/hooks/useMutateRefdataValue.js +31 -115
- package/es/lib/hooks/useQIndex.js +17 -87
- package/es/lib/hooks/useRefdata.js +19 -65
- package/es/lib/hooks/useTemplates.js +16 -60
- package/es/lib/utils/buildUrl.js +11 -51
- package/es/lib/utils/generateKiwtQuery.js +4 -40
- package/es/lib/utils/generateKiwtQueryParams.js +38 -125
- package/es/lib/utils/index.js +9 -22
- package/es/lib/utils/refdataOptions.js +2 -32
- package/es/lib/utils/renderHelpText.js +32 -89
- package/es/lib/utils/selectorSafe.js +2 -34
- package/es/lib/utils/sortByLabel.js +4 -41
- package/es/lib/utils/toCamelCase.js +8 -42
- package/package.json +17 -3
- package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -109
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +0 -998
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +0 -238
- package/junit.xml +0 -79
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +0 -256
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +0 -799
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +0 -376
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +0 -223
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -211
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -376
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -262
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +0 -436
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +0 -161
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +0 -319
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +0 -184
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +0 -370
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +0 -949
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +0 -274
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +0 -250
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +0 -214
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +0 -211
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +0 -178
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -769
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +0 -790
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/base.css +0 -224
- package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +0 -116
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +0 -97
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +0 -251
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +0 -115
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +0 -403
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +0 -161
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +0 -520
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +0 -157
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +0 -283
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +0 -274
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +0 -178
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +0 -136
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +0 -301
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +0 -208
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +0 -268
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +0 -166
- package/src/artifacts/coverage-jest/lcov-report/index.html +0 -401
- package/src/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
- package/src/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +0 -193
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +0 -109
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +0 -286
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +0 -236
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +0 -121
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +0 -106
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +0 -166
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +0 -103
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +0 -130
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +0 -127
- 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
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
101
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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] =
|
|
84
|
+
widthsObject[f] = `${staticWidth}%`;
|
|
151
85
|
}
|
|
152
86
|
});
|
|
153
|
-
widthsObject.actionListActions = editing ?
|
|
87
|
+
widthsObject.actionListActions = editing ? `${EDITING_ACTIONS_WIDTH}%` : `${NON_EDITING_ACTIONS_WIDTH}%`;
|
|
154
88
|
return widthsObject;
|
|
155
89
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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:
|
|
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
|
-
},
|
|
113
|
+
}, `save[${data.rowIndex}]`), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
182
114
|
"data-type-button": "cancel",
|
|
183
|
-
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
|
-
},
|
|
127
|
+
}, `cancel[${data.rowIndex}]`)]
|
|
196
128
|
});
|
|
197
129
|
}
|
|
198
|
-
|
|
199
130
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
200
|
-
children: actions
|
|
201
|
-
|
|
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 =
|
|
210
|
-
|
|
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
|
-
},
|
|
221
|
-
}
|
|
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:
|
|
228
|
-
},
|
|
151
|
+
children: action.label ?? action.name
|
|
152
|
+
}, `action-${action.name}[${data.rowIndex}]`);
|
|
229
153
|
})
|
|
230
154
|
});
|
|
231
155
|
};
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
237
|
-
cd.actionListActions = actionAssigner(cd);
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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:
|
|
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:
|
|
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: [
|
|
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
|
|
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 }; }
|