@k-int/stripes-kint-components 1.7.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 (136) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/index.js +43 -8
  3. package/es/lib/ActionList/ActionList.js +48 -28
  4. package/es/lib/ActionList/ActionListFieldArray.js +52 -16
  5. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
  6. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +321 -0
  7. package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
  8. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +357 -0
  9. package/es/lib/CustomProperties/Config/index.js +41 -0
  10. package/es/lib/FormModal/FormModal.js +126 -0
  11. package/es/lib/{TypeDown → FormModal}/index.js +2 -2
  12. package/es/lib/NoResultsMessage/NoResultsMessage.js +1 -1
  13. package/es/lib/Typedown/Typedown.js +44 -13
  14. package/es/lib/constants/customProperties.js +60 -0
  15. package/es/lib/hooks/index.js +16 -0
  16. package/es/lib/hooks/useCustomProperties.js +112 -0
  17. package/es/lib/hooks/useMutateCustomProperties.js +143 -0
  18. package/package.json +4 -2
  19. package/src/index.js +11 -4
  20. package/src/lib/ActionList/ActionList.js +30 -23
  21. package/src/lib/ActionList/ActionListFieldArray.js +36 -2
  22. package/src/lib/ActionList/README.md +4 -1
  23. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
  24. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +237 -0
  25. package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
  26. package/src/lib/CustomProperties/Config/CustomPropertyForm.js +295 -0
  27. package/src/lib/CustomProperties/Config/index.js +4 -0
  28. package/src/lib/FormModal/FormModal.js +71 -0
  29. package/src/lib/FormModal/index.js +1 -0
  30. package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
  31. package/src/lib/Typedown/Typedown.js +50 -8
  32. package/src/lib/constants/customProperties.js +9 -0
  33. package/src/lib/hooks/index.js +2 -0
  34. package/src/lib/hooks/useCustomProperties.js +73 -0
  35. package/src/lib/hooks/useMutateCustomProperties.js +62 -0
  36. package/translations/stripes-kint-components/en.json +47 -1
  37. package/yarn-error.log +14118 -0
  38. package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -109
  39. package/es/artifacts/coverage-jest/lcov-report/prettify.js +0 -998
  40. package/es/artifacts/coverage-jest/lcov-report/sorter.js +0 -238
  41. package/es/lib/TypeDown/TypeDown.js +0 -251
  42. package/junit.xml +0 -79
  43. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +0 -256
  44. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +0 -799
  45. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +0 -146
  46. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +0 -88
  47. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +0 -376
  48. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +0 -131
  49. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +0 -88
  50. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +0 -223
  51. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -211
  52. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -376
  53. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -262
  54. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +0 -436
  55. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +0 -161
  56. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +0 -94
  57. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +0 -146
  58. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +0 -94
  59. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +0 -319
  60. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +0 -131
  61. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +0 -88
  62. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +0 -184
  63. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +0 -131
  64. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +0 -88
  65. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +0 -370
  66. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +0 -131
  67. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +0 -88
  68. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +0 -949
  69. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +0 -131
  70. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +0 -88
  71. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +0 -274
  72. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +0 -131
  73. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +0 -88
  74. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +0 -250
  75. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +0 -131
  76. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +0 -88
  77. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +0 -214
  78. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +0 -131
  79. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +0 -88
  80. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +0 -211
  81. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +0 -178
  82. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +0 -146
  83. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +0 -91
  84. package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -769
  85. package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +0 -131
  86. package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +0 -88
  87. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +0 -790
  88. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +0 -131
  89. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +0 -88
  90. package/src/artifacts/coverage-jest/lcov-report/base.css +0 -224
  91. package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
  92. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +0 -94
  93. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +0 -116
  94. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +0 -97
  95. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +0 -131
  96. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +0 -91
  97. package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  98. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +0 -251
  99. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +0 -115
  100. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +0 -146
  101. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +0 -91
  102. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +0 -163
  103. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +0 -403
  104. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +0 -161
  105. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +0 -94
  106. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +0 -520
  107. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +0 -163
  108. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +0 -163
  109. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +0 -157
  110. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +0 -283
  111. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +0 -274
  112. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +0 -178
  113. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +0 -136
  114. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +0 -301
  115. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +0 -208
  116. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +0 -268
  117. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +0 -166
  118. package/src/artifacts/coverage-jest/lcov-report/index.html +0 -401
  119. package/src/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
  120. package/src/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
  121. package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  122. package/src/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
  123. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +0 -193
  124. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +0 -109
  125. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +0 -286
  126. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +0 -236
  127. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +0 -121
  128. package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +0 -106
  129. package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +0 -166
  130. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +0 -103
  131. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +0 -130
  132. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +0 -127
  133. package/src/artifacts/coverage-jest/lcov.info +0 -1999
  134. package/src/lib/TypeDown/README.md +0 -1
  135. package/src/lib/TypeDown/TypeDown.js +0 -228
  136. package/src/lib/TypeDown/index.js +0 -1
@@ -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
+ })();