@k-int/stripes-kint-components 1.5.0 → 2.0.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 +40 -1
- package/es/index.js +80 -25
- package/es/lib/ActionList/ActionList.js +92 -33
- package/es/lib/ActionList/ActionListFieldArray.js +202 -104
- package/es/lib/ActionList/index.js +7 -3
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +321 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +357 -0
- package/es/lib/CustomProperties/Config/index.js +41 -0
- 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/FormModal/FormModal.js +126 -0
- package/es/lib/FormModal/index.js +19 -0
- package/es/lib/NoResultsMessage/NoResultsMessage.js +65 -32
- package/es/lib/NoResultsMessage/index.js +7 -3
- 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 +194 -140
- 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 +174 -99
- package/es/lib/Typedown/index.js +6 -2
- package/es/lib/constants/customProperties.js +60 -0
- 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 +44 -10
- 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/useCustomProperties.js +112 -0
- package/es/lib/hooks/useHelperApp.js +44 -11
- package/es/lib/hooks/useKiwtFieldArray.js +37 -4
- package/es/lib/hooks/useKiwtSASQuery.js +43 -9
- package/es/lib/hooks/useLocalStorageState.js +37 -4
- package/es/lib/hooks/useMutateCustomProperties.js +143 -0
- package/es/lib/hooks/useMutateRefdataValue.js +42 -9
- package/es/lib/hooks/useQIndex.js +42 -9
- package/es/lib/hooks/useRefdata.js +43 -16
- package/es/lib/hooks/useTemplates.js +36 -3
- package/es/lib/utils/buildUrl.js +43 -10
- package/es/lib/utils/generateKiwtQuery.js +33 -4
- package/es/lib/utils/generateKiwtQueryParams.js +31 -2
- package/es/lib/utils/index.js +41 -5
- 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/package.json +19 -10
- package/src/index.js +25 -10
- package/src/lib/ActionList/ActionList.js +32 -22
- package/src/lib/ActionList/ActionListFieldArray.js +56 -10
- package/src/lib/ActionList/README.md +5 -1
- package/src/lib/ActionList/index.js +1 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +237 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +295 -0
- package/src/lib/CustomProperties/Config/index.js +4 -0
- 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/FormModal/FormModal.js +71 -0
- package/src/lib/FormModal/index.js +1 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
- package/src/lib/NoResultsMessage/index.js +1 -1
- package/src/lib/{Settings → RefdataButtons}/RefdataButtons.js +1 -1
- package/src/lib/RefdataButtons/index.js +1 -0
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +7 -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/Typedown.js +52 -9
- package/src/lib/constants/customProperties.js +9 -0
- package/src/lib/{Settings → contexts}/SettingsContext.js +1 -1
- package/src/lib/contexts/index.js +2 -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/useCustomProperties.js +73 -0
- package/src/lib/hooks/useMutateCustomProperties.js +62 -0
- package/src/lib/hooks/useRefdata.js +2 -8
- package/src/lib/utils/index.js +7 -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/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 +48 -1
- package/yarn-error.log +14118 -0
- 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/TypeDown/TypeDown.js +0 -209
- package/es/lib/TypeDown/index.js +0 -15
- 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/TypeDown/README.md +0 -1
- package/src/lib/TypeDown/TypeDown.js +0 -226
- package/src/lib/TypeDown/index.js +0 -1
- 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,24 @@ var _components = require("@folio/stripes/components");
|
|
|
21
21
|
|
|
22
22
|
var _ActionListFieldArray = _interopRequireDefault(require("../../../styles/ActionListFieldArray.css"));
|
|
23
23
|
|
|
24
|
-
var
|
|
25
|
-
_excluded2 = ["actionListActions"];
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
var _excluded = ["actionAssigner", "actionCalls", "columnMapping", "creatableFields", "editableFields", "fields", "fieldComponents", "visibleFields"],
|
|
27
|
+
_excluded2 = ["actionListActions"],
|
|
28
|
+
_excluded3 = ["actionListActions"],
|
|
29
|
+
_excluded4 = ["actionListActions"],
|
|
30
|
+
_excluded5 = ["formatter"];
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
33
|
|
|
29
34
|
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
35
|
|
|
31
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return {
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
(function () {
|
|
39
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
40
|
+
enterModule && enterModule(module);
|
|
41
|
+
})();
|
|
32
42
|
|
|
33
43
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
34
44
|
|
|
@@ -38,18 +48,14 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
38
48
|
|
|
39
49
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
40
50
|
|
|
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
|
|
51
|
+
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
52
|
|
|
43
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
53
|
+
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
54
|
|
|
45
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
55
|
+
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
56
|
|
|
47
57
|
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
58
|
|
|
49
|
-
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; }
|
|
50
|
-
|
|
51
|
-
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; }
|
|
52
|
-
|
|
53
59
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
54
60
|
|
|
55
61
|
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."); }
|
|
@@ -62,25 +68,39 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
62
68
|
|
|
63
69
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
64
70
|
|
|
71
|
+
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; }
|
|
72
|
+
|
|
73
|
+
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; }
|
|
74
|
+
|
|
75
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
76
|
+
return a;
|
|
77
|
+
};
|
|
78
|
+
|
|
65
79
|
var EDITING_ACTIONS_WIDTH = 25;
|
|
66
80
|
var NON_EDITING_ACTIONS_WIDTH = 20;
|
|
67
81
|
var TOTAL_WIDTH = 100;
|
|
68
82
|
var propTypes = {
|
|
69
|
-
actionAssigner: _propTypes
|
|
70
|
-
actionCalls: _propTypes
|
|
71
|
-
columnMapping: _propTypes
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
actionAssigner: _propTypes.default.func,
|
|
84
|
+
actionCalls: _propTypes.default.object,
|
|
85
|
+
columnMapping: _propTypes.default.object,
|
|
86
|
+
creatableFields: _propTypes.default.object,
|
|
87
|
+
editableFields: _propTypes.default.object,
|
|
88
|
+
fields: _propTypes.default.object,
|
|
89
|
+
fieldComponents: _propTypes.default.object,
|
|
90
|
+
formatter: _propTypes.default.object,
|
|
91
|
+
visibleFields: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
75
92
|
};
|
|
76
93
|
|
|
77
94
|
var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
78
95
|
var actionAssigner = _ref.actionAssigner,
|
|
79
96
|
actionCalls = _ref.actionCalls,
|
|
80
97
|
columnMapping = _ref.columnMapping,
|
|
98
|
+
creatableFields = _ref.creatableFields,
|
|
81
99
|
editableFields = _ref.editableFields,
|
|
82
100
|
fields = _ref.fields,
|
|
83
|
-
|
|
101
|
+
fieldComponents = _ref.fieldComponents,
|
|
102
|
+
visibleFields = _ref.visibleFields,
|
|
103
|
+
mclProps = _objectWithoutProperties(_ref, _excluded);
|
|
84
104
|
|
|
85
105
|
// Grab finalForm functions/values from form hooks
|
|
86
106
|
var _useForm = (0, _reactFinalForm.useForm)(),
|
|
@@ -114,13 +134,16 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
114
134
|
var handleSave = function handleSave(index) {
|
|
115
135
|
var _fields$value$index = fields.value[index],
|
|
116
136
|
_a = _fields$value$index.actionListActions,
|
|
117
|
-
rowData = _objectWithoutProperties(_fields$value$index,
|
|
137
|
+
rowData = _objectWithoutProperties(_fields$value$index, _excluded2);
|
|
118
138
|
|
|
119
139
|
actionCalls.edit(rowData);
|
|
120
140
|
};
|
|
121
141
|
|
|
122
142
|
var handleCreate = function handleCreate(index) {
|
|
123
|
-
var
|
|
143
|
+
var _fields$value$index2 = fields.value[index],
|
|
144
|
+
_a = _fields$value$index2.actionListActions,
|
|
145
|
+
rowData = _objectWithoutProperties(_fields$value$index2, _excluded3);
|
|
146
|
+
|
|
124
147
|
actionCalls.create(rowData);
|
|
125
148
|
};
|
|
126
149
|
|
|
@@ -141,74 +164,82 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
141
164
|
var fieldName = "contentData[".concat(data.rowIndex, "]");
|
|
142
165
|
|
|
143
166
|
var actions = data.actionListActions,
|
|
144
|
-
rest = _objectWithoutProperties(data,
|
|
167
|
+
rest = _objectWithoutProperties(data, _excluded4);
|
|
145
168
|
|
|
146
169
|
if (data.id === editing || !data.id && editing === 'NEW_ROW') {
|
|
147
170
|
// Render the save/cancel buttons
|
|
148
|
-
return /*#__PURE__*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
172
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
173
|
+
buttonStyle: "primary",
|
|
174
|
+
disabled: submitting || pristine,
|
|
175
|
+
onClick: function onClick() {
|
|
176
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
177
|
+
handleCreate(data.rowIndex);
|
|
178
|
+
} else {
|
|
179
|
+
handleSave(data.rowIndex);
|
|
180
|
+
}
|
|
158
181
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
182
|
+
toggleEditing(data.id);
|
|
183
|
+
},
|
|
184
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
185
|
+
id: "stripes-kint-components.actionList.save"
|
|
186
|
+
})
|
|
187
|
+
}, "save[".concat(data.rowIndex, "]")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
188
|
+
"data-type-button": "cancel",
|
|
189
|
+
onClick: function onClick() {
|
|
190
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
191
|
+
fields.remove(data.rowIndex);
|
|
192
|
+
toggleEditing('NEW_ROW');
|
|
193
|
+
} else {
|
|
194
|
+
change(fieldName, (0, _get.default)(initialValues, fieldName));
|
|
195
|
+
toggleEditing(data.id);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
199
|
+
id: "stripes-kint-components.actionList.cancel"
|
|
200
|
+
})
|
|
201
|
+
}, "cancel[".concat(data.rowIndex, "]"))]
|
|
202
|
+
});
|
|
173
203
|
}
|
|
174
204
|
|
|
175
|
-
return /*#__PURE__*/
|
|
176
|
-
|
|
205
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
206
|
+
children: actions === null || actions === void 0 ? void 0 : actions.map(function (action) {
|
|
207
|
+
var _action$label;
|
|
208
|
+
|
|
209
|
+
var actionFunction = function actionFunction() {
|
|
210
|
+
return actionCalls[action.name](rest);
|
|
211
|
+
}; // Edit has special action functionality, revealing fields etc.
|
|
212
|
+
|
|
177
213
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
214
|
+
if (action.name === 'edit') {
|
|
215
|
+
actionFunction = function actionFunction() {
|
|
216
|
+
return toggleEditing(data.id);
|
|
217
|
+
};
|
|
218
|
+
} // If we're handed an icon, use that for the action button
|
|
181
219
|
|
|
182
220
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
221
|
+
if (action.icon) {
|
|
222
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
223
|
+
disabled: editing,
|
|
224
|
+
icon: action.icon,
|
|
225
|
+
onClick: actionFunction
|
|
226
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
227
|
+
} // Else return a button with the label, or failing that the name of the action
|
|
188
228
|
|
|
189
229
|
|
|
190
|
-
|
|
191
|
-
return /*#__PURE__*/_react["default"].createElement(_components.IconButton, {
|
|
192
|
-
key: "action-".concat(action.name, "[").concat(data.rowIndex, "]"),
|
|
230
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
193
231
|
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
|
-
}));
|
|
232
|
+
onClick: actionFunction,
|
|
233
|
+
children: (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : action.name
|
|
234
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
235
|
+
})
|
|
236
|
+
});
|
|
206
237
|
};
|
|
207
238
|
|
|
208
239
|
var formatContent = function formatContent() {
|
|
209
|
-
return fields.map(function (fieldName) {
|
|
240
|
+
return fields.map(function (fieldName, fieldIndex) {
|
|
210
241
|
// Fetch the content from the field Values
|
|
211
|
-
var cd = (0, _get
|
|
242
|
+
var cd = (0, _get.default)(values, fieldName);
|
|
212
243
|
cd.actionListActions = actionAssigner(cd); // Row is being edited if it has no id, or its id is in the editing string
|
|
213
244
|
|
|
214
245
|
var editingRow = cd.id === editing || !cd.id;
|
|
@@ -226,22 +257,34 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
226
257
|
|
|
227
258
|
try {
|
|
228
259
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
229
|
-
var _editableFields$key;
|
|
260
|
+
var _editableFields$key, _creatableFields$key;
|
|
230
261
|
|
|
231
262
|
var key = _step.value;
|
|
232
263
|
var editFunction = (_editableFields$key = editableFields[key]) !== null && _editableFields$key !== void 0 ? _editableFields$key : function () {
|
|
233
264
|
return true;
|
|
234
265
|
};
|
|
266
|
+
var createFunction = (_creatableFields$key = creatableFields[key]) !== null && _creatableFields$key !== void 0 ? _creatableFields$key : function () {
|
|
267
|
+
return true;
|
|
268
|
+
};
|
|
235
269
|
/*
|
|
236
|
-
Next check if this is a new row, if so we should
|
|
237
|
-
If it
|
|
238
|
-
|
|
270
|
+
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
271
|
+
If it is not a new row, then we run the editableField function with the data,
|
|
272
|
+
and it should return true/false
|
|
273
|
+
For both checks
|
|
274
|
+
true => Field, false => display value
|
|
239
275
|
*/
|
|
240
276
|
|
|
241
|
-
if (!cd.id || editFunction(cd)) {
|
|
242
|
-
returnObj[key] =
|
|
243
|
-
component: _components.TextField,
|
|
277
|
+
if (!cd.id && createFunction(cd) || editFunction(cd)) {
|
|
278
|
+
returnObj[key] = fieldComponents[key] ? fieldComponents[key]({
|
|
244
279
|
name: "".concat(fieldName, ".").concat(key)
|
|
280
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
281
|
+
autofocus: fieldIndex === 0,
|
|
282
|
+
component: _components.TextField,
|
|
283
|
+
marginBottom0: true,
|
|
284
|
+
name: "".concat(fieldName, ".").concat(key),
|
|
285
|
+
parse: function parse(v) {
|
|
286
|
+
return v;
|
|
287
|
+
}
|
|
245
288
|
});
|
|
246
289
|
}
|
|
247
290
|
}
|
|
@@ -256,31 +299,86 @@ var ActionListFieldArray = function ActionListFieldArray(_ref) {
|
|
|
256
299
|
});
|
|
257
300
|
};
|
|
258
301
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
302
|
+
var formatter = mclProps.formatter,
|
|
303
|
+
restOfMclProps = _objectWithoutProperties(mclProps, _excluded5); // Destructure formatter part of mclProps
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
var fieldAwareFormatter = function fieldAwareFormatter() {
|
|
307
|
+
var returnObj = {}; // For each visible field, if it's being edited then ignore passed formatters, else use them
|
|
308
|
+
|
|
309
|
+
visibleFields.forEach(function (key) {
|
|
310
|
+
returnObj[key] = function (cd) {
|
|
311
|
+
// Row is being edited if it has no id, or its id is in the editing string
|
|
312
|
+
var editingRow = cd.id === editing || !cd.id; // If not editing, use the passed formatter values
|
|
313
|
+
|
|
314
|
+
var returnValue = cd[key];
|
|
315
|
+
|
|
316
|
+
if (!editingRow && formatter[key]) {
|
|
317
|
+
returnValue = formatter[key](cd);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return returnValue;
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
return returnObj;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
327
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
328
|
+
buttonClass: _ActionListFieldArray.default.buttonRight,
|
|
329
|
+
disabled: !actionCalls.create,
|
|
330
|
+
onClick: function onClick() {
|
|
331
|
+
toggleEditing('NEW_ROW');
|
|
332
|
+
fields.push({});
|
|
333
|
+
},
|
|
334
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
335
|
+
id: "stripes-kint-components.actionList.create"
|
|
272
336
|
})
|
|
273
|
-
}),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
337
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
338
|
+
columnMapping: _objectSpread(_objectSpread({}, columnMapping), {}, {
|
|
339
|
+
actionListActions: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
340
|
+
id: "stripes-kint-components.actionList.actions"
|
|
341
|
+
})
|
|
342
|
+
}),
|
|
343
|
+
columnWidths: getColumnWidths(),
|
|
344
|
+
contentData: formatContent(),
|
|
345
|
+
formatter: _objectSpread({
|
|
346
|
+
actionListActions: renderActionButtons
|
|
347
|
+
}, fieldAwareFormatter()),
|
|
348
|
+
interactive: false,
|
|
349
|
+
visibleColumns: [].concat(_toConsumableArray(visibleFields), ['actionListActions'])
|
|
350
|
+
}, restOfMclProps))]
|
|
351
|
+
});
|
|
282
352
|
};
|
|
283
353
|
|
|
354
|
+
__signature__(ActionListFieldArray, "useForm{{ change }}\nuseFormState{{ initialValues, pristine, submitting, values }}\nuseState{[editing, setEditing](null)}", function () {
|
|
355
|
+
return [_reactFinalForm.useForm, _reactFinalForm.useFormState];
|
|
356
|
+
});
|
|
357
|
+
|
|
284
358
|
ActionListFieldArray.propTypes = propTypes;
|
|
285
359
|
var _default = ActionListFieldArray;
|
|
286
|
-
|
|
360
|
+
var _default2 = _default;
|
|
361
|
+
exports.default = _default2;
|
|
362
|
+
;
|
|
363
|
+
|
|
364
|
+
(function () {
|
|
365
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
366
|
+
|
|
367
|
+
if (!reactHotLoader) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
reactHotLoader.register(EDITING_ACTIONS_WIDTH, "EDITING_ACTIONS_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
372
|
+
reactHotLoader.register(NON_EDITING_ACTIONS_WIDTH, "NON_EDITING_ACTIONS_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
373
|
+
reactHotLoader.register(TOTAL_WIDTH, "TOTAL_WIDTH", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
374
|
+
reactHotLoader.register(propTypes, "propTypes", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
375
|
+
reactHotLoader.register(ActionListFieldArray, "ActionListFieldArray", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
376
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/ActionList/ActionListFieldArray.js");
|
|
377
|
+
})();
|
|
378
|
+
|
|
379
|
+
;
|
|
380
|
+
|
|
381
|
+
(function () {
|
|
382
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
383
|
+
leaveModule && leaveModule(module);
|
|
384
|
+
})();
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactIntl = require("react-intl");
|
|
13
|
+
|
|
14
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
15
|
+
|
|
16
|
+
var _components = require("@folio/stripes/components");
|
|
17
|
+
|
|
18
|
+
var _SearchField = _interopRequireDefault(require("../../SearchField"));
|
|
19
|
+
|
|
20
|
+
var _hooks = require("../../hooks");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
(function () {
|
|
27
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
28
|
+
enterModule && enterModule(module);
|
|
29
|
+
})();
|
|
30
|
+
|
|
31
|
+
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; }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
37
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
38
|
+
|
|
39
|
+
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."); }
|
|
40
|
+
|
|
41
|
+
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); }
|
|
42
|
+
|
|
43
|
+
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; }
|
|
44
|
+
|
|
45
|
+
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; }
|
|
46
|
+
|
|
47
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
48
|
+
|
|
49
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
50
|
+
return a;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var DEBOUNCE_TIME = 500;
|
|
54
|
+
|
|
55
|
+
var CustomPropertiesLookup = function CustomPropertiesLookup(_ref) {
|
|
56
|
+
var _labelOverrides$label, _labelOverrides$prima, _labelOverrides$ctx, _labelOverrides$weigh, _labelOverrides$type, _labelOverrides$categ;
|
|
57
|
+
|
|
58
|
+
var contextFilterOptions = _ref.contextFilterOptions,
|
|
59
|
+
endpoint = _ref.customPropertiesEndpoint,
|
|
60
|
+
labelOverrides = _ref.labelOverrides,
|
|
61
|
+
mclProps = _ref.mclProps,
|
|
62
|
+
onSelectCustomProperty = _ref.onSelectCustomProperty,
|
|
63
|
+
queryParams = _ref.queryParams;
|
|
64
|
+
|
|
65
|
+
var _useState = (0, _react.useState)({
|
|
66
|
+
sort: 'id'
|
|
67
|
+
}),
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
nsValues = _useState2[0],
|
|
70
|
+
setNsValues = _useState2[1];
|
|
71
|
+
|
|
72
|
+
var _useState3 = (0, _react.useState)(),
|
|
73
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
74
|
+
selectedContext = _useState4[0],
|
|
75
|
+
setSelectedContext = _useState4[1];
|
|
76
|
+
|
|
77
|
+
var _useCustomProperties = (0, _hooks.useCustomProperties)({
|
|
78
|
+
endpoint: endpoint,
|
|
79
|
+
nsValues: nsValues,
|
|
80
|
+
queryParams: queryParams,
|
|
81
|
+
returnQueryObject: true,
|
|
82
|
+
ctx: selectedContext
|
|
83
|
+
}),
|
|
84
|
+
custprops = _useCustomProperties.data,
|
|
85
|
+
isLoading = _useCustomProperties.isLoading;
|
|
86
|
+
|
|
87
|
+
var handleSearch = (0, _debounce.default)(function (query) {
|
|
88
|
+
setNsValues(_objectSpread(_objectSpread({}, nsValues), {}, {
|
|
89
|
+
query: query
|
|
90
|
+
}));
|
|
91
|
+
}, DEBOUNCE_TIME);
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
93
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchField.default, {
|
|
94
|
+
fullWidth: true,
|
|
95
|
+
onChange: function onChange(e) {
|
|
96
|
+
return handleSearch(e.target.value);
|
|
97
|
+
}
|
|
98
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
|
|
99
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
100
|
+
xs: 6,
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Select, {
|
|
102
|
+
dataOptions: contextFilterOptions,
|
|
103
|
+
onChange: function onChange(e) {
|
|
104
|
+
setSelectedContext(e.target.value);
|
|
105
|
+
},
|
|
106
|
+
value: selectedContext
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
}), isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
110
|
+
columnMapping: {
|
|
111
|
+
'label': (_labelOverrides$label = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.label) !== null && _labelOverrides$label !== void 0 ? _labelOverrides$label : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
112
|
+
id: "stripes-kint-components.customProperties.label"
|
|
113
|
+
}),
|
|
114
|
+
'primary': (_labelOverrides$prima = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.primary) !== null && _labelOverrides$prima !== void 0 ? _labelOverrides$prima : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
115
|
+
id: "stripes-kint-components.customProperties.primary"
|
|
116
|
+
}),
|
|
117
|
+
'ctx': (_labelOverrides$ctx = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.ctx) !== null && _labelOverrides$ctx !== void 0 ? _labelOverrides$ctx : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
118
|
+
id: "stripes-kint-components.customProperties.ctx"
|
|
119
|
+
}),
|
|
120
|
+
'weight': (_labelOverrides$weigh = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.weight) !== null && _labelOverrides$weigh !== void 0 ? _labelOverrides$weigh : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
121
|
+
id: "stripes-kint-components.customProperties.weight"
|
|
122
|
+
}),
|
|
123
|
+
'type': (_labelOverrides$type = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.type) !== null && _labelOverrides$type !== void 0 ? _labelOverrides$type : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
124
|
+
id: "stripes-kint-components.customProperties.type"
|
|
125
|
+
}),
|
|
126
|
+
'category': (_labelOverrides$categ = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.category) !== null && _labelOverrides$categ !== void 0 ? _labelOverrides$categ : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
127
|
+
id: "stripes-kint-components.customProperties.category"
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
contentData: custprops,
|
|
131
|
+
formatter: {
|
|
132
|
+
primary: function primary(data) {
|
|
133
|
+
if (data !== null && data !== void 0 && data.primary) {
|
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
135
|
+
id: "stripes-kint-components.yes"
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
139
|
+
id: "stripes-kint-components.no"
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
type: function type(data) {
|
|
144
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
145
|
+
id: "stripes-kint-components.customProperties.type.".concat(data === null || data === void 0 ? void 0 : data.type)
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
category: function category(data) {
|
|
149
|
+
var _data$category;
|
|
150
|
+
|
|
151
|
+
return data === null || data === void 0 ? void 0 : (_data$category = data.category) === null || _data$category === void 0 ? void 0 : _data$category.desc;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
onRowClick: onSelectCustomProperty,
|
|
155
|
+
visibleColumns: ['label', 'primary', 'ctx', 'weight', 'type', 'category']
|
|
156
|
+
}, mclProps))]
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
__signature__(CustomPropertiesLookup, "useState{[nsValues, setNsValues]({\n sort: 'id'\n })}\nuseState{[selectedContext, setSelectedContext]}\nuseCustomProperties{{ data: custprops, isLoading }}", function () {
|
|
161
|
+
return [_hooks.useCustomProperties];
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
CustomPropertiesLookup.propTypes = {
|
|
165
|
+
contextFilterOptions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
166
|
+
value: _propTypes.default.string,
|
|
167
|
+
label: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.string])
|
|
168
|
+
})),
|
|
169
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
170
|
+
labelOverrides: _propTypes.default.object,
|
|
171
|
+
mclProps: _propTypes.default.object,
|
|
172
|
+
onSelectCustomProperty: _propTypes.default.func,
|
|
173
|
+
queryParams: _propTypes.default.object,
|
|
174
|
+
refdataEndpoint: _propTypes.default.string
|
|
175
|
+
};
|
|
176
|
+
var _default = CustomPropertiesLookup;
|
|
177
|
+
var _default2 = _default;
|
|
178
|
+
exports.default = _default2;
|
|
179
|
+
;
|
|
180
|
+
|
|
181
|
+
(function () {
|
|
182
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
183
|
+
|
|
184
|
+
if (!reactHotLoader) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
reactHotLoader.register(DEBOUNCE_TIME, "DEBOUNCE_TIME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesLookup.js");
|
|
189
|
+
reactHotLoader.register(CustomPropertiesLookup, "CustomPropertiesLookup", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesLookup.js");
|
|
190
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesLookup.js");
|
|
191
|
+
})();
|
|
192
|
+
|
|
193
|
+
;
|
|
194
|
+
|
|
195
|
+
(function () {
|
|
196
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
197
|
+
leaveModule && leaveModule(module);
|
|
198
|
+
})();
|