@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.
Files changed (168) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/es/index.js +80 -25
  3. package/es/lib/ActionList/ActionList.js +92 -33
  4. package/es/lib/ActionList/ActionListFieldArray.js +202 -104
  5. package/es/lib/ActionList/index.js +7 -3
  6. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
  7. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +321 -0
  8. package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
  9. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +357 -0
  10. package/es/lib/CustomProperties/Config/index.js +41 -0
  11. package/es/lib/EditableRefdataList/EditableRefdataList.js +69 -24
  12. package/es/lib/EditableRefdataList/index.js +7 -3
  13. package/es/lib/EditableSettingsList/EditableSettingsList.js +90 -0
  14. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +90 -0
  15. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +181 -0
  16. package/es/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +72 -9
  17. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +447 -0
  18. package/es/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +45 -7
  19. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +495 -0
  20. package/es/lib/EditableSettingsList/SettingField/SettingField.js +187 -0
  21. package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +180 -0
  22. package/es/lib/EditableSettingsList/SettingField/index.js +35 -0
  23. package/es/lib/EditableSettingsList/index.js +35 -0
  24. package/es/lib/FormModal/FormModal.js +126 -0
  25. package/es/lib/FormModal/index.js +19 -0
  26. package/es/lib/NoResultsMessage/NoResultsMessage.js +65 -32
  27. package/es/lib/NoResultsMessage/index.js +7 -3
  28. package/es/lib/QueryTypedown/QueryTypedown.js +48 -9
  29. package/es/lib/QueryTypedown/index.js +6 -2
  30. package/es/lib/RefdataButtons/RefdataButtons.js +143 -0
  31. package/es/lib/RefdataButtons/index.js +19 -0
  32. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +194 -140
  33. package/es/lib/SASQLookupComponent/index.js +6 -2
  34. package/es/lib/SASQRoute/SASQRoute.js +55 -18
  35. package/es/lib/SASQRoute/index.js +6 -2
  36. package/es/lib/SASQViewComponent/SASQViewComponent.js +50 -11
  37. package/es/lib/SASQViewComponent/index.js +6 -2
  38. package/es/lib/SearchField/SearchField.js +48 -13
  39. package/es/lib/SearchField/index.js +6 -2
  40. package/es/lib/SettingPage/SettingPage.js +99 -0
  41. package/es/lib/SettingPage/SettingPagePane.js +83 -0
  42. package/es/lib/SettingPage/index.js +27 -0
  43. package/es/lib/Typedown/Typedown.js +174 -99
  44. package/es/lib/Typedown/index.js +6 -2
  45. package/es/lib/constants/customProperties.js +60 -0
  46. package/es/lib/constants/eventCodes.js +31 -1
  47. package/es/lib/contexts/SettingsContext.js +41 -0
  48. package/es/lib/contexts/index.js +19 -0
  49. package/es/lib/hooks/index.js +44 -10
  50. package/es/lib/hooks/settingsHooks/index.js +27 -0
  51. package/es/lib/hooks/settingsHooks/useSettingSection.js +74 -0
  52. package/es/lib/hooks/settingsHooks/useSettings.js +175 -0
  53. package/es/lib/hooks/typedownHooks/index.js +8 -28
  54. package/es/lib/hooks/typedownHooks/useTypedown.js +129 -12
  55. package/es/lib/hooks/typedownHooks/useTypedownData.js +35 -2
  56. package/es/lib/hooks/typedownHooks/useTypedownToggle.js +39 -6
  57. package/es/lib/hooks/useActiveElement.js +33 -2
  58. package/es/lib/hooks/useCustomProperties.js +112 -0
  59. package/es/lib/hooks/useHelperApp.js +44 -11
  60. package/es/lib/hooks/useKiwtFieldArray.js +37 -4
  61. package/es/lib/hooks/useKiwtSASQuery.js +43 -9
  62. package/es/lib/hooks/useLocalStorageState.js +37 -4
  63. package/es/lib/hooks/useMutateCustomProperties.js +143 -0
  64. package/es/lib/hooks/useMutateRefdataValue.js +42 -9
  65. package/es/lib/hooks/useQIndex.js +42 -9
  66. package/es/lib/hooks/useRefdata.js +43 -16
  67. package/es/lib/hooks/useTemplates.js +36 -3
  68. package/es/lib/utils/buildUrl.js +43 -10
  69. package/es/lib/utils/generateKiwtQuery.js +33 -4
  70. package/es/lib/utils/generateKiwtQueryParams.js +31 -2
  71. package/es/lib/utils/index.js +41 -5
  72. package/es/lib/utils/refdataOptions.js +43 -0
  73. package/es/lib/utils/renderHelpText.js +109 -0
  74. package/es/lib/utils/selectorSafe.js +31 -2
  75. package/es/lib/utils/sortByLabel.js +55 -0
  76. package/es/lib/utils/toCamelCase.js +48 -0
  77. package/jest.config.js +15 -1
  78. package/package.json +19 -10
  79. package/src/index.js +25 -10
  80. package/src/lib/ActionList/ActionList.js +32 -22
  81. package/src/lib/ActionList/ActionListFieldArray.js +56 -10
  82. package/src/lib/ActionList/README.md +5 -1
  83. package/src/lib/ActionList/index.js +1 -1
  84. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
  85. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +237 -0
  86. package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
  87. package/src/lib/CustomProperties/Config/CustomPropertyForm.js +295 -0
  88. package/src/lib/CustomProperties/Config/index.js +4 -0
  89. package/src/lib/EditableRefdataList/EditableRefdataList.js +10 -5
  90. package/src/lib/EditableRefdataList/index.js +1 -1
  91. package/src/lib/{Settings → EditableSettingsList}/EditableSettingsList.js +0 -0
  92. package/src/lib/{Settings → EditableSettingsList}/EditableSettingsListFieldArray.js +2 -2
  93. package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +111 -0
  94. package/src/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +24 -1
  95. package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +379 -0
  96. package/src/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +2 -1
  97. package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +368 -0
  98. package/src/lib/{Settings → EditableSettingsList/SettingField}/SettingField.js +7 -7
  99. package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +80 -0
  100. package/src/lib/EditableSettingsList/SettingField/index.js +3 -0
  101. package/src/lib/EditableSettingsList/index.js +3 -0
  102. package/src/lib/FormModal/FormModal.js +71 -0
  103. package/src/lib/FormModal/index.js +1 -0
  104. package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
  105. package/src/lib/NoResultsMessage/index.js +1 -1
  106. package/src/lib/{Settings → RefdataButtons}/RefdataButtons.js +1 -1
  107. package/src/lib/RefdataButtons/index.js +1 -0
  108. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +7 -1
  109. package/src/lib/{Settings → SettingPage}/SettingPage.js +5 -5
  110. package/src/lib/{Settings → SettingPage}/SettingPagePane.js +12 -2
  111. package/src/lib/SettingPage/index.js +2 -0
  112. package/src/lib/Typedown/Typedown.js +52 -9
  113. package/src/lib/constants/customProperties.js +9 -0
  114. package/src/lib/{Settings → contexts}/SettingsContext.js +1 -1
  115. package/src/lib/contexts/index.js +2 -0
  116. package/src/lib/hooks/index.js +3 -0
  117. package/src/lib/hooks/settingsHooks/index.js +2 -0
  118. package/src/lib/{Settings → hooks/settingsHooks}/useSettingSection.js +0 -0
  119. package/src/lib/{Settings → hooks/settingsHooks}/useSettings.js +14 -6
  120. package/src/lib/hooks/typedownHooks/index.js +0 -3
  121. package/src/lib/hooks/typedownHooks/useTypedown.js +93 -11
  122. package/src/lib/hooks/useCustomProperties.js +73 -0
  123. package/src/lib/hooks/useMutateCustomProperties.js +62 -0
  124. package/src/lib/hooks/useRefdata.js +2 -8
  125. package/src/lib/utils/index.js +7 -0
  126. package/src/lib/utils/refdataOptions.js +7 -0
  127. package/src/lib/{Settings/utils → utils}/renderHelpText.js +1 -1
  128. package/src/lib/{Settings/utils → utils}/sortByLabel.js +1 -1
  129. package/src/lib/{Settings/utils → utils}/toCamelCase.js +0 -0
  130. package/test/helpers/index.js +1 -0
  131. package/test/helpers/translationsProperties.js +40 -0
  132. package/test/jest/helpers/KintHarness.js +36 -0
  133. package/test/jest/helpers/index.js +2 -0
  134. package/test/jest/helpers/renderWithKintHarness.js +15 -0
  135. package/test/jest/jest-transformer.js +4 -0
  136. package/test/jest/setupTests.js +1 -0
  137. package/translations/stripes-kint-components/en.json +48 -1
  138. package/yarn-error.log +14118 -0
  139. package/babelOptions.js +0 -30
  140. package/es/lib/Settings/EditableSettingsList.js +0 -57
  141. package/es/lib/Settings/EditableSettingsListFieldArray.js +0 -59
  142. package/es/lib/Settings/RefdataButtons.js +0 -100
  143. package/es/lib/Settings/SettingField.js +0 -144
  144. package/es/lib/Settings/SettingPage.js +0 -64
  145. package/es/lib/Settings/SettingPagePane.js +0 -43
  146. package/es/lib/Settings/SettingsContext.js +0 -18
  147. package/es/lib/Settings/index.js +0 -71
  148. package/es/lib/Settings/useSettingSection.js +0 -41
  149. package/es/lib/Settings/useSettings.js +0 -126
  150. package/es/lib/Settings/utils/index.js +0 -31
  151. package/es/lib/Settings/utils/renderHelpText.js +0 -57
  152. package/es/lib/Settings/utils/sortByLabel.js +0 -26
  153. package/es/lib/Settings/utils/toCamelCase.js +0 -19
  154. package/es/lib/TypeDown/TypeDown.js +0 -209
  155. package/es/lib/TypeDown/index.js +0 -15
  156. package/es/lib/hooks/typedownHooks/useTypedownFooter.js +0 -47
  157. package/es/lib/hooks/typedownHooks/useTypedownList.js +0 -45
  158. package/es/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -47
  159. package/es/lib/utils/getFocusableElements.js +0 -132
  160. package/src/lib/Settings/index.js +0 -8
  161. package/src/lib/Settings/utils/index.js +0 -3
  162. package/src/lib/TypeDown/README.md +0 -1
  163. package/src/lib/TypeDown/TypeDown.js +0 -226
  164. package/src/lib/TypeDown/index.js +0 -1
  165. package/src/lib/hooks/typedownHooks/useTypedownFooter.js +0 -43
  166. package/src/lib/hooks/typedownHooks/useTypedownList.js +0 -36
  167. package/src/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -39
  168. package/src/lib/utils/getFocusableElements.js +0 -99
@@ -0,0 +1,321 @@
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 _composeFunction = _interopRequireDefault(require("compose-function"));
13
+
14
+ var _reactIntl = require("react-intl");
15
+
16
+ var _reactQuery = require("react-query");
17
+
18
+ var _reactIntlSafeHtml = _interopRequireDefault(require("@folio/react-intl-safe-html"));
19
+
20
+ var _components = require("@folio/stripes/components");
21
+
22
+ var _FormModal = _interopRequireDefault(require("../../FormModal/FormModal"));
23
+
24
+ var _CustomPropertiesLookup = _interopRequireDefault(require("./CustomPropertiesLookup"));
25
+
26
+ var _CustomPropertiesView = _interopRequireDefault(require("./CustomPropertiesView"));
27
+
28
+ var _CustomPropertyForm = _interopRequireDefault(require("./CustomPropertyForm"));
29
+
30
+ var _hooks = require("../../hooks");
31
+
32
+ var _jsxRuntime = require("react/jsx-runtime");
33
+
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
+
36
+ (function () {
37
+ var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
38
+ enterModule && enterModule(module);
39
+ })();
40
+
41
+ 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; }
42
+
43
+ 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; }
44
+
45
+ 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; }
46
+
47
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
+
49
+ 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."); }
50
+
51
+ 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); }
52
+
53
+ 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; }
54
+
55
+ 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; }
56
+
57
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
58
+
59
+ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
60
+ return a;
61
+ };
62
+
63
+ var EDITING = 'edit';
64
+ var CREATING = 'create';
65
+ var VIEWING = 'view'; // A default option for setting up panes manually
66
+
67
+ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
68
+ var _labelOverrides$paneT, _ref3, _renderViewPaneTitle, _labelOverrides$confi, _labelOverrides$confi2, _labelOverrides$confi3;
69
+
70
+ var afterQueryCalls = _ref.afterQueryCalls,
71
+ contextFilterOptions = _ref.contextFilterOptions,
72
+ customPropertiesEndpoint = _ref.customPropertiesEndpoint,
73
+ helpPopovers = _ref.helpPopovers,
74
+ labelOverrides = _ref.labelOverrides,
75
+ refdataEndpoint = _ref.refdataEndpoint;
76
+ var queryClient = (0, _reactQuery.useQueryClient)();
77
+ var intl = (0, _reactIntl.useIntl)();
78
+
79
+ var _useState = (0, _react.useState)(),
80
+ _useState2 = _slicedToArray(_useState, 2),
81
+ customProperty = _useState2[0],
82
+ setCustomProperty = _useState2[1];
83
+
84
+ var _useState3 = (0, _react.useState)(false),
85
+ _useState4 = _slicedToArray(_useState3, 2),
86
+ deleteModal = _useState4[0],
87
+ setDeleteModal = _useState4[1];
88
+
89
+ var refdata = (0, _hooks.useRefdata)({
90
+ endpoint: refdataEndpoint
91
+ });
92
+
93
+ var _useState5 = (0, _react.useState)(VIEWING),
94
+ _useState6 = _slicedToArray(_useState5, 2),
95
+ mode = _useState6[0],
96
+ setMode = _useState6[1]; // Default props that need hooks are hard
97
+
98
+
99
+ var renderContextFilterOptions = contextFilterOptions;
100
+
101
+ if (!contextFilterOptions) {
102
+ /*
103
+ Default is {value: '', label: 'All'}, empty string will map to ALL contexts
104
+ If null context is needed, use
105
+ {value: 'isNull', label: ...}
106
+ */
107
+ renderContextFilterOptions = [{
108
+ value: '',
109
+ // empty string is all custoprop contexts
110
+ label: intl.formatMessage({
111
+ id: 'stripes-kint-components.customProperties.all'
112
+ })
113
+ }];
114
+ }
115
+
116
+ var renderViewPaneTitle = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.viewPaneTitle;
117
+
118
+ if (renderViewPaneTitle instanceof Function) {
119
+ renderViewPaneTitle = renderViewPaneTitle(customProperty);
120
+ } // Defaulting is hard
121
+
122
+
123
+ var afterQueryCallsSafe = _objectSpread({
124
+ put: function put() {
125
+ return null;
126
+ },
127
+ post: function post() {
128
+ return null;
129
+ },
130
+ delete: function _delete() {
131
+ return null;
132
+ }
133
+ }, afterQueryCalls);
134
+
135
+ var _useMutateCustomPrope = (0, _hooks.useMutateCustomProperties)({
136
+ afterQueryCalls: {
137
+ put: function put() {
138
+ setMode(VIEWING);
139
+ queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
140
+ afterQueryCallsSafe.put();
141
+ },
142
+ post: function post() {
143
+ setMode(VIEWING);
144
+ queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
145
+ afterQueryCallsSafe.post();
146
+ },
147
+ delete: function _delete() {
148
+ setMode(VIEWING);
149
+ queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
150
+ afterQueryCallsSafe.delete();
151
+ }
152
+ },
153
+ endpoint: customPropertiesEndpoint,
154
+ id: customProperty === null || customProperty === void 0 ? void 0 : customProperty.id
155
+ }),
156
+ createCustprop = _useMutateCustomPrope.post,
157
+ editCustProp = _useMutateCustomPrope.put,
158
+ deleteCustProp = _useMutateCustomPrope.delete;
159
+
160
+ var handeContextSubmit = function handeContextSubmit(submitData) {
161
+ var _submitData$ctx, _submitData$ctx$;
162
+
163
+ return _objectSpread(_objectSpread({}, submitData), {}, {
164
+ ctx: submitData === null || submitData === void 0 ? void 0 : (_submitData$ctx = submitData.ctx) === null || _submitData$ctx === void 0 ? void 0 : (_submitData$ctx$ = _submitData$ctx[0]) === null || _submitData$ctx$ === void 0 ? void 0 : _submitData$ctx$.value
165
+ });
166
+ };
167
+
168
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
169
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
170
+ defaultWidth: "fill",
171
+ id: "settings-customProperties.lookupPane",
172
+ lastMenu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
173
+ marginBottom0: true,
174
+ onClick: function onClick() {
175
+ return setMode(CREATING);
176
+ } // TODO do we need to clear form here too?
177
+ ,
178
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
179
+ id: "stripes-kint-components.create"
180
+ })
181
+ }),
182
+ paneTitle: (_labelOverrides$paneT = labelOverrides.paneTitle) !== null && _labelOverrides$paneT !== void 0 ? _labelOverrides$paneT : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
183
+ id: "stripes-kint-components.customProperties"
184
+ }) // This should be configurable?
185
+ ,
186
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesLookup.default, {
187
+ contextFilterOptions: renderContextFilterOptions,
188
+ customPropertiesEndpoint: customPropertiesEndpoint,
189
+ labelOverrides: labelOverrides,
190
+ onSelectCustomProperty: function onSelectCustomProperty(_e, cp) {
191
+ return setCustomProperty(cp);
192
+ }
193
+ })
194
+ }), customProperty && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
195
+ actionMenu: function actionMenu(_ref2) {
196
+ var onToggle = _ref2.onToggle;
197
+ return [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
198
+ buttonStyle: "dropdownItem",
199
+ marginBottom0: true,
200
+ onClick: function onClick() {
201
+ return setMode(EDITING);
202
+ },
203
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
204
+ id: "stripes-kint-components.edit"
205
+ })
206
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
207
+ buttonStyle: "dropdownItem",
208
+ marginBottom0: true,
209
+ onClick: function onClick() {
210
+ setDeleteModal(true);
211
+ onToggle();
212
+ },
213
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
214
+ id: "stripes-kint-components.delete"
215
+ })
216
+ })];
217
+ },
218
+ defaultWidth: "fill",
219
+ dismissible: true,
220
+ id: "settings-customProperties-viewPane",
221
+ onClose: function onClose() {
222
+ return setCustomProperty();
223
+ },
224
+ paneTitle: (_ref3 = (_renderViewPaneTitle = renderViewPaneTitle) !== null && _renderViewPaneTitle !== void 0 ? _renderViewPaneTitle : customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _ref3 !== void 0 ? _ref3 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name,
225
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesView.default, {
226
+ customProperty: customProperty,
227
+ labelOverrides: labelOverrides
228
+ })
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormModal.default, {
230
+ initialValues: mode === CREATING ? {
231
+ weight: 0,
232
+ primary: true,
233
+ defaultInternal: true
234
+ } : customProperty,
235
+ modalProps: {
236
+ dismissible: true,
237
+ onClose: function onClose() {
238
+ return setMode(VIEWING);
239
+ },
240
+ open: mode === CREATING || mode === EDITING
241
+ },
242
+ onSubmit: mode === CREATING ? (0, _composeFunction.default)(createCustprop, handeContextSubmit) : (0, _composeFunction.default)(editCustProp, handeContextSubmit),
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyForm.default, {
244
+ contextFilterOptions: renderContextFilterOptions,
245
+ helpPopovers: helpPopovers,
246
+ labelOverrides: labelOverrides,
247
+ refdata: refdata.map(function (rdc) {
248
+ return {
249
+ label: rdc.desc,
250
+ value: rdc.id
251
+ };
252
+ })
253
+ })
254
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
255
+ buttonStyle: "danger",
256
+ confirmLabel: (_labelOverrides$confi = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmLabel) !== null && _labelOverrides$confi !== void 0 ? _labelOverrides$confi : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
257
+ id: "stripes-kint-components.customProperties.delete.confirmLabel"
258
+ }),
259
+ heading: (_labelOverrides$confi2 = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmHeading) !== null && _labelOverrides$confi2 !== void 0 ? _labelOverrides$confi2 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
260
+ id: "stripes-kint-components.customProperties.delete.confirmHeading"
261
+ }),
262
+ id: "delete-job-confirmation",
263
+ message: (_labelOverrides$confi3 = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmMessage) !== null && _labelOverrides$confi3 !== void 0 ? _labelOverrides$confi3 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntlSafeHtml.default, {
264
+ id: "stripes-kint-components.customProperties.delete.confirmMessage",
265
+ values: {
266
+ name: customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
267
+ }
268
+ }),
269
+ onCancel: function onCancel() {
270
+ return setDeleteModal(false);
271
+ },
272
+ onConfirm: function onConfirm() {
273
+ deleteCustProp();
274
+ setCustomProperty();
275
+ setDeleteModal(false);
276
+ },
277
+ open: deleteModal
278
+ })]
279
+ });
280
+ };
281
+
282
+ __signature__(CustomPropertiesSettings, "useQueryClient{queryClient}\nuseIntl{intl}\nuseState{[customProperty, setCustomProperty]}\nuseState{[deleteModal, setDeleteModal](false)}\nuseRefdata{refdata}\nuseState{[mode, setMode](VIEWING)}\nuseMutateCustomProperties{{\n post: createCustprop,\n put: editCustProp,\n delete: deleteCustProp\n }}", function () {
283
+ return [_reactQuery.useQueryClient, _reactIntl.useIntl, _hooks.useRefdata, _hooks.useMutateCustomProperties];
284
+ });
285
+
286
+ CustomPropertiesSettings.propTypes = {
287
+ afterQueryCalls: _propTypes.default.object,
288
+ contextFilterOptions: _propTypes.default.arrayOf(_propTypes.default.shape({
289
+ value: _propTypes.default.string,
290
+ label: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.string])
291
+ })),
292
+ customPropertiesEndpoint: _propTypes.default.string,
293
+ helpPopovers: _propTypes.default.object,
294
+ labelOverrides: _propTypes.default.object,
295
+ refdataEndpoint: _propTypes.default.string
296
+ };
297
+ var _default = CustomPropertiesSettings;
298
+ var _default2 = _default;
299
+ exports.default = _default2;
300
+ ;
301
+
302
+ (function () {
303
+ var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
304
+
305
+ if (!reactHotLoader) {
306
+ return;
307
+ }
308
+
309
+ reactHotLoader.register(EDITING, "EDITING", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesSettings.js");
310
+ reactHotLoader.register(CREATING, "CREATING", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesSettings.js");
311
+ reactHotLoader.register(VIEWING, "VIEWING", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesSettings.js");
312
+ reactHotLoader.register(CustomPropertiesSettings, "CustomPropertiesSettings", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesSettings.js");
313
+ reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesSettings.js");
314
+ })();
315
+
316
+ ;
317
+
318
+ (function () {
319
+ var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
320
+ leaveModule && leaveModule(module);
321
+ })();
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+
10
+ var _reactIntl = require("react-intl");
11
+
12
+ var _components = require("@folio/stripes/components");
13
+
14
+ var _customProperties = require("../../constants/customProperties");
15
+
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ (function () {
21
+ var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
22
+ enterModule && enterModule(module);
23
+ })();
24
+
25
+ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
26
+ return a;
27
+ };
28
+
29
+ // A default option for CustProp view pane, with the ability to override labels for fields
30
+ var CustomPropertiesView = function CustomPropertiesView(_ref) {
31
+ var _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$weigh, _labelOverrides$prima, _labelOverrides$defau, _labelOverrides$ctx, _customProperty$ctx, _labelOverrides$type, _labelOverrides$categ, _customProperty$categ, _customProperty$categ2;
32
+
33
+ var customProperty = _ref.customProperty,
34
+ labelOverrides = _ref.labelOverrides;
35
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
36
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
37
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
38
+ xs: 6,
39
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
40
+ 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, {
41
+ id: "stripes-kint-components.customProperties.label"
42
+ }),
43
+ value: customProperty === null || customProperty === void 0 ? void 0 : customProperty.label
44
+ })
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
46
+ xs: 6,
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
48
+ label: (_labelOverrides$name = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.name) !== null && _labelOverrides$name !== void 0 ? _labelOverrides$name : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
49
+ id: "stripes-kint-components.customProperties.name"
50
+ }),
51
+ value: customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
52
+ })
53
+ })]
54
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Row, {
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
56
+ xs: 12,
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
58
+ label: (_labelOverrides$descr = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.description) !== null && _labelOverrides$descr !== void 0 ? _labelOverrides$descr : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
59
+ id: "stripes-kint-components.customProperties.description"
60
+ }),
61
+ value: customProperty === null || customProperty === void 0 ? void 0 : customProperty.description
62
+ })
63
+ })
64
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
65
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
66
+ xs: 6,
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
68
+ label: (_labelOverrides$weigh = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.weight) !== null && _labelOverrides$weigh !== void 0 ? _labelOverrides$weigh : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
69
+ id: "stripes-kint-components.customProperties.weight"
70
+ }),
71
+ value: customProperty === null || customProperty === void 0 ? void 0 : customProperty.weight
72
+ })
73
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
74
+ xs: 6,
75
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
76
+ label: (_labelOverrides$prima = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.primary) !== null && _labelOverrides$prima !== void 0 ? _labelOverrides$prima : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
77
+ id: "stripes-kint-components.customProperties.primary"
78
+ }),
79
+ value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
80
+ id: customProperty !== null && customProperty !== void 0 && customProperty.primary ? 'stripes-kint-components.yes' : 'stripes-kint-components.no'
81
+ })
82
+ })
83
+ })]
84
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
85
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
86
+ xs: 6,
87
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
88
+ label: (_labelOverrides$defau = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.defaultVisibility) !== null && _labelOverrides$defau !== void 0 ? _labelOverrides$defau : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
89
+ id: "stripes-kint-components.customProperties.defaultVisibility"
90
+ }),
91
+ value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
92
+ id: customProperty !== null && customProperty !== void 0 && customProperty.defaultInternal ? 'stripes-kint-components.customProperties.internalTrue' : 'stripes-kint-components.customProperties.internalFalse'
93
+ })
94
+ })
95
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
96
+ xs: 6,
97
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
98
+ label: (_labelOverrides$ctx = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.ctx) !== null && _labelOverrides$ctx !== void 0 ? _labelOverrides$ctx : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
99
+ id: "stripes-kint-components.customProperties.ctx"
100
+ }),
101
+ value: (_customProperty$ctx = customProperty === null || customProperty === void 0 ? void 0 : customProperty.ctx) !== null && _customProperty$ctx !== void 0 ? _customProperty$ctx : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoValue, {})
102
+ })
103
+ })]
104
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
105
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
106
+ xs: 6,
107
+ children: (customProperty === null || customProperty === void 0 ? void 0 : customProperty.type) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
108
+ label: (_labelOverrides$type = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.type) !== null && _labelOverrides$type !== void 0 ? _labelOverrides$type : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
109
+ id: "stripes-kint-components.customProperties.type"
110
+ }),
111
+ value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
112
+ id: "stripes-kint-components.customProperties.type.".concat(customProperty === null || customProperty === void 0 ? void 0 : customProperty.type)
113
+ })
114
+ })
115
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
116
+ xs: 6,
117
+ children: (customProperty === null || customProperty === void 0 ? void 0 : customProperty.type) === _customProperties.REFDATA_CLASS_NAME && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
118
+ label: (_labelOverrides$categ = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.category) !== null && _labelOverrides$categ !== void 0 ? _labelOverrides$categ : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
119
+ id: "stripes-kint-components.customProperties.category"
120
+ }),
121
+ value: (_customProperty$categ = customProperty === null || customProperty === void 0 ? void 0 : (_customProperty$categ2 = customProperty.category) === null || _customProperty$categ2 === void 0 ? void 0 : _customProperty$categ2.desc) !== null && _customProperty$categ !== void 0 ? _customProperty$categ : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoValue, {})
122
+ })
123
+ })]
124
+ })]
125
+ });
126
+ };
127
+
128
+ CustomPropertiesView.propTypes = {
129
+ customProperty: _propTypes.default.shape({
130
+ id: _propTypes.default.string,
131
+ label: _propTypes.default.string,
132
+ name: _propTypes.default.string,
133
+ description: _propTypes.default.string,
134
+ weight: _propTypes.default.number,
135
+ primary: _propTypes.default.bool,
136
+ defaultInternal: _propTypes.default.bool,
137
+ ctx: _propTypes.default.string,
138
+ type: _propTypes.default.string,
139
+ category: _propTypes.default.shape({
140
+ desc: _propTypes.default.string
141
+ })
142
+ }),
143
+ labelOverrides: _propTypes.default.object
144
+ };
145
+ var _default = CustomPropertiesView;
146
+ var _default2 = _default;
147
+ exports.default = _default2;
148
+ ;
149
+
150
+ (function () {
151
+ var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
152
+
153
+ if (!reactHotLoader) {
154
+ return;
155
+ }
156
+
157
+ reactHotLoader.register(CustomPropertiesView, "CustomPropertiesView", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesView.js");
158
+ reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesView.js");
159
+ })();
160
+
161
+ ;
162
+
163
+ (function () {
164
+ var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
165
+ leaveModule && leaveModule(module);
166
+ })();