@k-int/stripes-kint-components 1.3.0 → 1.7.0
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 +34 -2
- package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +109 -0
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +998 -0
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +238 -0
- package/es/index.js +69 -17
- package/es/lib/ActionList/ActionList.js +63 -24
- package/es/lib/ActionList/ActionListFieldArray.js +158 -96
- package/es/lib/ActionList/index.js +7 -3
- package/es/lib/EditableRefdataList/EditableRefdataList.js +69 -24
- package/es/lib/EditableRefdataList/index.js +7 -3
- package/es/lib/EditableSettingsList/EditableSettingsList.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +181 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +72 -9
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +447 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +45 -7
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +495 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +187 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +180 -0
- package/es/lib/EditableSettingsList/SettingField/index.js +35 -0
- package/es/lib/EditableSettingsList/index.js +35 -0
- package/es/lib/NoResultsMessage/NoResultsMessage.js +122 -0
- package/es/lib/NoResultsMessage/index.js +19 -0
- package/es/lib/QueryTypedown/QueryTypedown.js +48 -9
- package/es/lib/QueryTypedown/index.js +6 -2
- package/es/lib/RefdataButtons/RefdataButtons.js +143 -0
- package/es/lib/RefdataButtons/index.js +19 -0
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +202 -131
- package/es/lib/SASQLookupComponent/index.js +6 -2
- package/es/lib/SASQRoute/SASQRoute.js +55 -18
- package/es/lib/SASQRoute/index.js +6 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +50 -11
- package/es/lib/SASQViewComponent/index.js +6 -2
- package/es/lib/SearchField/SearchField.js +48 -13
- package/es/lib/SearchField/index.js +6 -2
- package/es/lib/SettingPage/SettingPage.js +99 -0
- package/es/lib/SettingPage/SettingPagePane.js +83 -0
- package/es/lib/SettingPage/index.js +27 -0
- package/es/lib/TypeDown/TypeDown.js +143 -101
- package/es/lib/TypeDown/index.js +6 -2
- package/es/lib/Typedown/Typedown.js +140 -96
- package/es/lib/Typedown/index.js +6 -2
- package/es/lib/constants/eventCodes.js +31 -1
- package/es/lib/contexts/SettingsContext.js +41 -0
- package/es/lib/contexts/index.js +19 -0
- package/es/lib/hooks/index.js +42 -8
- package/es/lib/hooks/settingsHooks/index.js +27 -0
- package/es/lib/hooks/settingsHooks/useSettingSection.js +74 -0
- package/es/lib/hooks/settingsHooks/useSettings.js +175 -0
- package/es/lib/hooks/typedownHooks/index.js +8 -28
- package/es/lib/hooks/typedownHooks/useTypedown.js +129 -12
- package/es/lib/hooks/typedownHooks/useTypedownData.js +35 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +39 -6
- package/es/lib/hooks/useActiveElement.js +33 -2
- package/es/lib/hooks/useHelperApp.js +51 -12
- package/es/lib/hooks/useKiwtFieldArray.js +142 -0
- package/es/lib/hooks/useKiwtSASQuery.js +62 -7
- package/es/lib/hooks/useLocalStorageState.js +37 -4
- package/es/lib/hooks/useMutateRefdataValue.js +42 -9
- package/es/lib/hooks/useQIndex.js +108 -0
- package/es/lib/hooks/useRefdata.js +56 -12
- package/es/lib/hooks/useTemplates.js +36 -3
- package/es/lib/utils/buildUrl.js +43 -10
- package/es/lib/utils/generateKiwtQuery.js +31 -108
- package/es/lib/utils/generateKiwtQueryParams.js +154 -0
- package/es/lib/utils/index.js +55 -3
- package/es/lib/utils/refdataOptions.js +43 -0
- package/es/lib/utils/renderHelpText.js +109 -0
- package/es/lib/utils/selectorSafe.js +31 -2
- package/es/lib/utils/sortByLabel.js +55 -0
- package/es/lib/utils/toCamelCase.js +48 -0
- package/jest.config.js +15 -1
- package/junit.xml +79 -0
- package/package.json +17 -10
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +256 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +799 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +223 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +262 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +436 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +319 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +184 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +370 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +949 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +250 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +214 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +769 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +790 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/base.css +224 -0
- package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +87 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +116 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +97 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +251 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +115 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +403 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +520 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +157 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +283 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +136 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +301 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +208 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +268 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/index.html +401 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.css +1 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.js +2 -0
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/sorter.js +196 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +193 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +109 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +286 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +236 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +121 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +106 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +103 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +130 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov.info +1999 -0
- package/src/index.js +21 -6
- package/src/lib/ActionList/ActionList.js +5 -2
- package/src/lib/ActionList/ActionListFieldArray.js +20 -8
- package/src/lib/ActionList/README.md +1 -0
- package/src/lib/ActionList/index.js +1 -1
- package/src/lib/EditableRefdataList/EditableRefdataList.js +10 -5
- package/src/lib/EditableRefdataList/index.js +1 -1
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsList.js +0 -0
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsListFieldArray.js +2 -2
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +111 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +24 -1
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +379 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +2 -1
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +368 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/SettingField.js +7 -7
- package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +80 -0
- package/src/lib/EditableSettingsList/SettingField/index.js +3 -0
- package/src/lib/EditableSettingsList/index.js +3 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +78 -0
- package/src/lib/NoResultsMessage/index.js +1 -0
- package/src/lib/{Settings → RefdataButtons}/RefdataButtons.js +1 -1
- package/src/lib/RefdataButtons/index.js +1 -0
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +36 -8
- package/src/lib/SASQRoute/README.md +1 -1
- package/src/lib/{Settings → SettingPage}/SettingPage.js +5 -5
- package/src/lib/{Settings → SettingPage}/SettingPagePane.js +12 -2
- package/src/lib/SettingPage/index.js +2 -0
- package/src/lib/TypeDown/README.md +1 -115
- package/src/lib/TypeDown/TypeDown.js +4 -2
- package/src/lib/Typedown/Typedown.js +2 -1
- package/src/lib/{Settings → contexts}/SettingsContext.js +1 -1
- package/src/lib/contexts/index.js +2 -0
- package/src/lib/hooks/README.md +107 -0
- package/src/lib/hooks/index.js +3 -0
- package/src/lib/hooks/settingsHooks/index.js +2 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettingSection.js +0 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettings.js +14 -6
- package/src/lib/hooks/typedownHooks/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedown.js +93 -11
- package/src/lib/hooks/useHelperApp.js +5 -1
- package/src/lib/hooks/useKiwtFieldArray.js +63 -0
- package/src/lib/hooks/useKiwtSASQuery.js +9 -1
- package/src/lib/hooks/useQIndex.js +41 -0
- package/src/lib/hooks/useRefdata.js +17 -6
- package/src/lib/utils/README.md +39 -1
- package/src/lib/utils/generateKiwtQuery.js +3 -62
- package/src/lib/utils/generateKiwtQueryParams.js +67 -0
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/refdataOptions.js +7 -0
- package/src/lib/{Settings/utils → utils}/renderHelpText.js +1 -1
- package/src/lib/{Settings/utils → utils}/sortByLabel.js +1 -1
- package/src/lib/{Settings/utils → utils}/toCamelCase.js +0 -0
- package/styles/NoResultsMessage.css +38 -0
- package/test/helpers/index.js +1 -0
- package/test/helpers/translationsProperties.js +40 -0
- package/test/jest/helpers/KintHarness.js +36 -0
- package/test/jest/helpers/index.js +2 -0
- package/test/jest/helpers/renderWithKintHarness.js +15 -0
- package/test/jest/jest-transformer.js +4 -0
- package/test/jest/setupTests.js +1 -0
- package/translations/stripes-kint-components/en.json +4 -1
- package/babelOptions.js +0 -30
- package/es/lib/Settings/EditableSettingsList.js +0 -57
- package/es/lib/Settings/EditableSettingsListFieldArray.js +0 -59
- package/es/lib/Settings/RefdataButtons.js +0 -100
- package/es/lib/Settings/SettingField.js +0 -144
- package/es/lib/Settings/SettingPage.js +0 -64
- package/es/lib/Settings/SettingPagePane.js +0 -43
- package/es/lib/Settings/SettingsContext.js +0 -18
- package/es/lib/Settings/index.js +0 -71
- package/es/lib/Settings/useSettingSection.js +0 -41
- package/es/lib/Settings/useSettings.js +0 -126
- package/es/lib/Settings/utils/index.js +0 -31
- package/es/lib/Settings/utils/renderHelpText.js +0 -57
- package/es/lib/Settings/utils/sortByLabel.js +0 -26
- package/es/lib/Settings/utils/toCamelCase.js +0 -19
- package/es/lib/hooks/typedownHooks/useTypedownFooter.js +0 -47
- package/es/lib/hooks/typedownHooks/useTypedownList.js +0 -45
- package/es/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -47
- package/es/lib/utils/getFocusableElements.js +0 -132
- package/src/lib/Settings/index.js +0 -8
- package/src/lib/Settings/utils/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedownFooter.js +0 -43
- package/src/lib/hooks/typedownHooks/useTypedownList.js +0 -36
- package/src/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -39
- package/src/lib/utils/getFocusableElements.js +0 -99
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -21,14 +21,22 @@ var _components = require("@folio/stripes/components");
|
|
|
21
21
|
|
|
22
22
|
var _ActionListFieldArray = _interopRequireDefault(require("../../../styles/ActionListFieldArray.css"));
|
|
23
23
|
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
24
26
|
var _excluded = ["actionListActions"],
|
|
25
|
-
_excluded2 = ["actionListActions"]
|
|
27
|
+
_excluded2 = ["actionListActions"],
|
|
28
|
+
_excluded3 = ["actionListActions"];
|
|
26
29
|
|
|
27
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
31
|
|
|
29
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); }
|
|
30
33
|
|
|
31
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return {
|
|
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
|
+
})();
|
|
32
40
|
|
|
33
41
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
34
42
|
|
|
@@ -38,11 +46,11 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
38
46
|
|
|
39
47
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
40
48
|
|
|
41
|
-
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
|
|
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; } } }; }
|
|
42
50
|
|
|
43
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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; }
|
|
44
52
|
|
|
45
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
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; }
|
|
46
54
|
|
|
47
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; }
|
|
48
56
|
|
|
@@ -62,22 +70,28 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
62
70
|
|
|
63
71
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
64
72
|
|
|
73
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
74
|
+
return a;
|
|
75
|
+
};
|
|
76
|
+
|
|
65
77
|
var EDITING_ACTIONS_WIDTH = 25;
|
|
66
78
|
var NON_EDITING_ACTIONS_WIDTH = 20;
|
|
67
79
|
var TOTAL_WIDTH = 100;
|
|
68
80
|
var propTypes = {
|
|
69
|
-
actionAssigner: _propTypes
|
|
70
|
-
actionCalls: _propTypes
|
|
71
|
-
columnMapping: _propTypes
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
actionAssigner: _propTypes.default.func,
|
|
82
|
+
actionCalls: _propTypes.default.object,
|
|
83
|
+
columnMapping: _propTypes.default.object,
|
|
84
|
+
creatableFields: _propTypes.default.object,
|
|
85
|
+
editableFields: _propTypes.default.object,
|
|
86
|
+
fields: _propTypes.default.object,
|
|
87
|
+
visibleFields: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
75
88
|
};
|
|
76
89
|
|
|
77
90
|
var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
78
91
|
var actionAssigner = _ref.actionAssigner,
|
|
79
92
|
actionCalls = _ref.actionCalls,
|
|
80
93
|
columnMapping = _ref.columnMapping,
|
|
94
|
+
creatableFields = _ref.creatableFields,
|
|
81
95
|
editableFields = _ref.editableFields,
|
|
82
96
|
fields = _ref.fields,
|
|
83
97
|
visibleFields = _ref.visibleFields;
|
|
@@ -120,7 +134,10 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
120
134
|
};
|
|
121
135
|
|
|
122
136
|
var handleCreate = function handleCreate(index) {
|
|
123
|
-
var
|
|
137
|
+
var _fields$value$index2 = fields.value[index],
|
|
138
|
+
_a = _fields$value$index2.actionListActions,
|
|
139
|
+
rowData = _objectWithoutProperties(_fields$value$index2, _excluded2);
|
|
140
|
+
|
|
124
141
|
actionCalls.create(rowData);
|
|
125
142
|
};
|
|
126
143
|
|
|
@@ -141,74 +158,82 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
141
158
|
var fieldName = "contentData[".concat(data.rowIndex, "]");
|
|
142
159
|
|
|
143
160
|
var actions = data.actionListActions,
|
|
144
|
-
rest = _objectWithoutProperties(data,
|
|
161
|
+
rest = _objectWithoutProperties(data, _excluded3);
|
|
145
162
|
|
|
146
163
|
if (data.id === editing || !data.id && editing === 'NEW_ROW') {
|
|
147
164
|
// Render the save/cancel buttons
|
|
148
|
-
return /*#__PURE__*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
166
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
167
|
+
buttonStyle: "primary",
|
|
168
|
+
disabled: submitting || pristine,
|
|
169
|
+
onClick: function onClick() {
|
|
170
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
171
|
+
handleCreate(data.rowIndex);
|
|
172
|
+
} else {
|
|
173
|
+
handleSave(data.rowIndex);
|
|
174
|
+
}
|
|
158
175
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
toggleEditing(data.id);
|
|
177
|
+
},
|
|
178
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
179
|
+
id: "stripes-kint-components.actionList.save"
|
|
180
|
+
})
|
|
181
|
+
}, "save[".concat(data.rowIndex, "]")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
182
|
+
"data-type-button": "cancel",
|
|
183
|
+
onClick: function onClick() {
|
|
184
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
185
|
+
fields.remove(data.rowIndex);
|
|
186
|
+
toggleEditing('NEW_ROW');
|
|
187
|
+
} else {
|
|
188
|
+
change(fieldName, (0, _get.default)(initialValues, fieldName));
|
|
189
|
+
toggleEditing(data.id);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
193
|
+
id: "stripes-kint-components.actionList.cancel"
|
|
194
|
+
})
|
|
195
|
+
}, "cancel[".concat(data.rowIndex, "]"))]
|
|
196
|
+
});
|
|
173
197
|
}
|
|
174
198
|
|
|
175
|
-
return /*#__PURE__*/
|
|
176
|
-
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
200
|
+
children: actions === null || actions === void 0 ? void 0 : actions.map(function (action) {
|
|
201
|
+
var _action$label;
|
|
177
202
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
203
|
+
var actionFunction = function actionFunction() {
|
|
204
|
+
return actionCalls[action.name](rest);
|
|
205
|
+
}; // Edit has special action functionality, revealing fields etc.
|
|
181
206
|
|
|
182
207
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
208
|
+
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
|
|
188
213
|
|
|
189
214
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
215
|
+
if (action.icon) {
|
|
216
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
217
|
+
disabled: editing,
|
|
218
|
+
icon: action.icon,
|
|
219
|
+
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
|
+
|
|
223
|
+
|
|
224
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
193
225
|
disabled: editing,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return /*#__PURE__*/_react["default"].createElement(_components.Button, {
|
|
201
|
-
key: "action-".concat(action.name, "[").concat(data.rowIndex, "]"),
|
|
202
|
-
disabled: editing,
|
|
203
|
-
onClick: actionFunction
|
|
204
|
-
}, (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : action.name);
|
|
205
|
-
}));
|
|
226
|
+
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, "]"));
|
|
229
|
+
})
|
|
230
|
+
});
|
|
206
231
|
};
|
|
207
232
|
|
|
208
233
|
var formatContent = function formatContent() {
|
|
209
|
-
return fields.map(function (fieldName) {
|
|
234
|
+
return fields.map(function (fieldName, fieldIndex) {
|
|
210
235
|
// Fetch the content from the field Values
|
|
211
|
-
var cd = (0, _get
|
|
236
|
+
var cd = (0, _get.default)(values, fieldName);
|
|
212
237
|
cd.actionListActions = actionAssigner(cd); // Row is being edited if it has no id, or its id is in the editing string
|
|
213
238
|
|
|
214
239
|
var editingRow = cd.id === editing || !cd.id;
|
|
@@ -226,20 +251,26 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
226
251
|
|
|
227
252
|
try {
|
|
228
253
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
229
|
-
var _editableFields$key;
|
|
254
|
+
var _editableFields$key, _creatableFields$key;
|
|
230
255
|
|
|
231
256
|
var key = _step.value;
|
|
232
257
|
var editFunction = (_editableFields$key = editableFields[key]) !== null && _editableFields$key !== void 0 ? _editableFields$key : function () {
|
|
233
258
|
return true;
|
|
234
259
|
};
|
|
260
|
+
var createFunction = (_creatableFields$key = creatableFields[key]) !== null && _creatableFields$key !== void 0 ? _creatableFields$key : function () {
|
|
261
|
+
return true;
|
|
262
|
+
};
|
|
235
263
|
/*
|
|
236
|
-
Next check if this is a new row, if so we should
|
|
237
|
-
If it
|
|
238
|
-
|
|
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
|
|
239
269
|
*/
|
|
240
270
|
|
|
241
|
-
if (!cd.id || editFunction(cd)) {
|
|
242
|
-
returnObj[key] = /*#__PURE__*/
|
|
271
|
+
if (!cd.id && createFunction(cd) || editFunction(cd)) {
|
|
272
|
+
returnObj[key] = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
273
|
+
autofocus: fieldIndex === 0,
|
|
243
274
|
component: _components.TextField,
|
|
244
275
|
name: "".concat(fieldName, ".").concat(key)
|
|
245
276
|
});
|
|
@@ -256,31 +287,62 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
256
287
|
});
|
|
257
288
|
};
|
|
258
289
|
|
|
259
|
-
return /*#__PURE__*/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
columnMapping: _objectSpread(_objectSpread({}, columnMapping), {}, {
|
|
270
|
-
actionListActions: /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
|
|
271
|
-
id: "stripes-kint-components.actionList.actions"
|
|
290
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
291
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
292
|
+
buttonClass: _ActionListFieldArray.default.buttonRight,
|
|
293
|
+
disabled: !actionCalls.create,
|
|
294
|
+
onClick: function onClick() {
|
|
295
|
+
toggleEditing('NEW_ROW');
|
|
296
|
+
fields.push({});
|
|
297
|
+
},
|
|
298
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
299
|
+
id: "stripes-kint-components.actionList.create"
|
|
272
300
|
})
|
|
273
|
-
}),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
301
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
302
|
+
columnMapping: _objectSpread(_objectSpread({}, columnMapping), {}, {
|
|
303
|
+
actionListActions: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
304
|
+
id: "stripes-kint-components.actionList.actions"
|
|
305
|
+
})
|
|
306
|
+
}),
|
|
307
|
+
columnWidths: getColumnWidths(),
|
|
308
|
+
contentData: formatContent(),
|
|
309
|
+
formatter: {
|
|
310
|
+
actionListActions: renderActionButtons
|
|
311
|
+
},
|
|
312
|
+
interactive: false,
|
|
313
|
+
visibleColumns: [].concat(_toConsumableArray(visibleFields), ['actionListActions'])
|
|
314
|
+
})]
|
|
315
|
+
});
|
|
282
316
|
};
|
|
283
317
|
|
|
318
|
+
__signature__(ActionListFieldArray, "useForm{{ change }}\nuseFormState{{ initialValues, pristine, submitting, values }}\nuseState{[editing, setEditing](null)}", function () {
|
|
319
|
+
return [_reactFinalForm.useForm, _reactFinalForm.useFormState];
|
|
320
|
+
});
|
|
321
|
+
|
|
284
322
|
ActionListFieldArray.propTypes = propTypes;
|
|
285
323
|
var _default = ActionListFieldArray;
|
|
286
|
-
|
|
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
|
+
})();
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return _ActionList
|
|
9
|
+
return _ActionList.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
var _ActionList = _interopRequireDefault(require("./ActionList"));
|
|
14
14
|
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
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
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -15,13 +15,20 @@ var _reactIntl = require("react-intl");
|
|
|
15
15
|
|
|
16
16
|
var _hooks = require("../hooks");
|
|
17
17
|
|
|
18
|
-
var _ActionList = require("../ActionList");
|
|
18
|
+
var _ActionList = _interopRequireDefault(require("../ActionList"));
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
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); }
|
|
23
25
|
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return {
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
(function () {
|
|
29
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
30
|
+
enterModule && enterModule(module);
|
|
31
|
+
})();
|
|
25
32
|
|
|
26
33
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
34
|
|
|
@@ -35,9 +42,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
35
42
|
|
|
36
43
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
44
|
|
|
45
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
46
|
+
return a;
|
|
47
|
+
};
|
|
48
|
+
|
|
38
49
|
var propTypes = {
|
|
39
|
-
desc: _propTypes
|
|
40
|
-
refdataEndpoint: _propTypes
|
|
50
|
+
desc: _propTypes.default.string,
|
|
51
|
+
refdataEndpoint: _propTypes.default.string
|
|
41
52
|
};
|
|
42
53
|
|
|
43
54
|
var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
@@ -62,31 +73,35 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
62
73
|
contentData = _useState2[0],
|
|
63
74
|
setContentData = _useState2[1];
|
|
64
75
|
|
|
76
|
+
var sortByLabel = function sortByLabel(a, b) {
|
|
77
|
+
return a.label.localeCompare(b.label);
|
|
78
|
+
};
|
|
79
|
+
|
|
65
80
|
(0, _react.useEffect)(function () {
|
|
66
81
|
if (!isRefdataLoading) {
|
|
67
|
-
var _refdata$values;
|
|
82
|
+
var _refdata$values$sort, _refdata$values;
|
|
68
83
|
|
|
69
|
-
setContentData((_refdata$values = refdata === null || refdata === void 0 ? void 0 : refdata.values) !== null && _refdata$values !== void 0 ? _refdata$values : []);
|
|
84
|
+
setContentData((_refdata$values$sort = refdata === null || refdata === void 0 ? void 0 : (_refdata$values = refdata.values) === null || _refdata$values === void 0 ? void 0 : _refdata$values.sort(sortByLabel)) !== null && _refdata$values$sort !== void 0 ? _refdata$values$sort : []);
|
|
70
85
|
}
|
|
71
86
|
}, [isRefdataLoading, refdata]); // Edit and Create will use the same PUT mutation
|
|
72
87
|
|
|
73
88
|
var _useMutateRefdataValu = (0, _hooks.useMutateRefdataValue)({
|
|
74
89
|
afterQueryCalls: {
|
|
75
|
-
|
|
76
|
-
var _json$values;
|
|
90
|
+
delete: function _delete(json) {
|
|
91
|
+
var _json$values$sort, _json$values;
|
|
77
92
|
|
|
78
|
-
return setContentData((_json$values = json === null || json === void 0 ? void 0 : json.values) !== null && _json$values !== void 0 ? _json$values : []);
|
|
93
|
+
return setContentData((_json$values$sort = json === null || json === void 0 ? void 0 : (_json$values = json.values) === null || _json$values === void 0 ? void 0 : _json$values.sort(sortByLabel)) !== null && _json$values$sort !== void 0 ? _json$values$sort : []);
|
|
79
94
|
},
|
|
80
95
|
put: function put(json) {
|
|
81
|
-
var _json$values2;
|
|
96
|
+
var _json$values$sort2, _json$values2;
|
|
82
97
|
|
|
83
|
-
return setContentData((_json$
|
|
98
|
+
return setContentData((_json$values$sort2 = json === null || json === void 0 ? void 0 : (_json$values2 = json.values) === null || _json$values2 === void 0 ? void 0 : _json$values2.sort(sortByLabel)) !== null && _json$values$sort2 !== void 0 ? _json$values$sort2 : []);
|
|
84
99
|
}
|
|
85
100
|
},
|
|
86
101
|
endpoint: refdataEndpoint,
|
|
87
102
|
id: refdata === null || refdata === void 0 ? void 0 : refdata.id,
|
|
88
103
|
queryParams: {
|
|
89
|
-
|
|
104
|
+
delete: {
|
|
90
105
|
enabled: !!refdata
|
|
91
106
|
},
|
|
92
107
|
put: {
|
|
@@ -94,7 +109,7 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
94
109
|
}
|
|
95
110
|
}
|
|
96
111
|
}),
|
|
97
|
-
deleteRefdataValue = _useMutateRefdataValu
|
|
112
|
+
deleteRefdataValue = _useMutateRefdataValu.delete,
|
|
98
113
|
editRefdataValue = _useMutateRefdataValu.put;
|
|
99
114
|
|
|
100
115
|
if (isRefdataLoading) {
|
|
@@ -106,7 +121,7 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
106
121
|
var actionAssigner = function actionAssigner() {
|
|
107
122
|
var actionArray = [{
|
|
108
123
|
name: 'edit',
|
|
109
|
-
label: /*#__PURE__*/
|
|
124
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
110
125
|
id: "stripes-kint-components.editableRefdataList.edit"
|
|
111
126
|
}),
|
|
112
127
|
icon: 'edit'
|
|
@@ -115,7 +130,7 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
115
130
|
if (!(refdata !== null && refdata !== void 0 && refdata.internal)) {
|
|
116
131
|
actionArray.push({
|
|
117
132
|
name: 'delete',
|
|
118
|
-
label: /*#__PURE__*/
|
|
133
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
119
134
|
id: "stripes-kint-components.editableRefdataList.delete"
|
|
120
135
|
}),
|
|
121
136
|
icon: 'trash'
|
|
@@ -132,25 +147,30 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
132
147
|
edit: function edit(data) {
|
|
133
148
|
return editRefdataValue(data);
|
|
134
149
|
},
|
|
135
|
-
|
|
150
|
+
delete: function _delete(data) {
|
|
136
151
|
return deleteRefdataValue(data.id);
|
|
137
152
|
}
|
|
138
153
|
};
|
|
139
|
-
return /*#__PURE__*/
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionList.default, {
|
|
140
155
|
actionAssigner: actionAssigner,
|
|
141
156
|
actionCalls: actionCalls,
|
|
142
157
|
columnMapping: {
|
|
143
|
-
label: /*#__PURE__*/
|
|
158
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
144
159
|
id: "stripes-kint-components.editableRefdataList.label"
|
|
145
160
|
}),
|
|
146
|
-
value: /*#__PURE__*/
|
|
161
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
147
162
|
id: "stripes-kint-components.editableRefdataList.value"
|
|
148
163
|
})
|
|
149
164
|
},
|
|
150
165
|
contentData: contentData,
|
|
166
|
+
creatableFields: {
|
|
167
|
+
value: function value() {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
151
171
|
editableFields: {
|
|
152
172
|
value: function value() {
|
|
153
|
-
return
|
|
173
|
+
return false;
|
|
154
174
|
}
|
|
155
175
|
},
|
|
156
176
|
visibleFields: ['label', 'value'] // TODO add a field validator/fieldType as options?
|
|
@@ -158,6 +178,31 @@ var EditableRefdataList = function EditableRefdataList(_ref) {
|
|
|
158
178
|
});
|
|
159
179
|
};
|
|
160
180
|
|
|
181
|
+
__signature__(EditableRefdataList, "useRefdata{{ data: { 0: refdata } = {}, isLoading: isRefdataLoading }}\nuseState{[contentData, setContentData]([])}\nuseEffect{}\nuseMutateRefdataValue{{ delete: deleteRefdataValue, put: editRefdataValue }}", function () {
|
|
182
|
+
return [_hooks.useRefdata, _hooks.useMutateRefdataValue];
|
|
183
|
+
});
|
|
184
|
+
|
|
161
185
|
EditableRefdataList.propTypes = propTypes;
|
|
162
186
|
var _default = EditableRefdataList;
|
|
163
|
-
|
|
187
|
+
var _default2 = _default;
|
|
188
|
+
exports.default = _default2;
|
|
189
|
+
;
|
|
190
|
+
|
|
191
|
+
(function () {
|
|
192
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
193
|
+
|
|
194
|
+
if (!reactHotLoader) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
reactHotLoader.register(propTypes, "propTypes", "/home/ethan/FolioModules/stripes-kint-components/src/lib/EditableRefdataList/EditableRefdataList.js");
|
|
199
|
+
reactHotLoader.register(EditableRefdataList, "EditableRefdataList", "/home/ethan/FolioModules/stripes-kint-components/src/lib/EditableRefdataList/EditableRefdataList.js");
|
|
200
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/EditableRefdataList/EditableRefdataList.js");
|
|
201
|
+
})();
|
|
202
|
+
|
|
203
|
+
;
|
|
204
|
+
|
|
205
|
+
(function () {
|
|
206
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
207
|
+
leaveModule && leaveModule(module);
|
|
208
|
+
})();
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return _EditableRefdataList
|
|
9
|
+
return _EditableRefdataList.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
var _EditableRefdataList = _interopRequireDefault(require("./EditableRefdataList"));
|
|
14
14
|
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
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
|
+
};
|