@k-int/stripes-kint-components 2.6.4 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -10
- package/es/index.js +24 -0
- package/es/lib/ActionList/ActionList.js +6 -2
- package/es/lib/ActionList/ActionListFieldArray.js +38 -15
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +5 -2
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +7 -6
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +9 -8
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +4 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +2 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +2 -1
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +2 -1
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +2 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +2 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +3 -2
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +2 -1
- package/es/lib/CycleButton/CycleButton.js +81 -0
- package/es/lib/CycleButton/index.js +15 -0
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +281 -0
- package/es/lib/EditableRefdataCategoryList/index.js +15 -0
- package/es/lib/EditableRefdataList/EditableRefdataList.js +2 -1
- package/es/lib/IconSelect/IconSelect.js +183 -0
- package/es/lib/IconSelect/index.js +15 -0
- package/es/lib/hooks/index.js +8 -0
- package/es/lib/hooks/useMutateRefdataCategory.js +108 -0
- package/es/lib/utils/refdataOptions.js +3 -0
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/lib/ActionList/ActionList.js +4 -1
- package/src/lib/ActionList/ActionListFieldArray.js +35 -12
- package/src/lib/ActionList/README.md +9 -8
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +2 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +3 -4
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +7 -7
- package/src/lib/CustomProperties/Config/CustomPropertyView.js +2 -2
- package/src/lib/CustomProperties/Config/README.md +35 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +1 -1
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +1 -1
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +1 -1
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +1 -1
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +2 -3
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +1 -1
- package/src/lib/CycleButton/CycleButton.js +43 -0
- package/src/lib/CycleButton/README.md +28 -0
- package/src/lib/CycleButton/index.js +1 -0
- package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +167 -0
- package/src/lib/EditableRefdataCategoryList/index.js +1 -0
- package/src/lib/EditableRefdataList/EditableRefdataList.js +1 -1
- package/src/lib/IconSelect/IconSelect.js +149 -0
- package/src/lib/IconSelect/README.md +36 -0
- package/src/lib/IconSelect/index.js +1 -0
- package/src/lib/hooks/index.js +1 -0
- package/src/lib/hooks/useMutateRefdataCategory.js +63 -0
- package/src/lib/utils/refdataOptions.js +1 -0
- package/styles/CycleButton.css +5 -0
- package/styles/IconSelect.css +5 -0
- package/translations/stripes-kint-components/ar.json +14 -7
- package/translations/stripes-kint-components/cs_CZ.json +14 -7
- package/translations/stripes-kint-components/de.json +14 -7
- package/translations/stripes-kint-components/en.json +13 -2
- package/translations/stripes-kint-components/es.json +14 -7
- package/translations/stripes-kint-components/hi_IN.json +121 -1
- package/translations/stripes-kint-components/hu.json +14 -7
- package/translations/stripes-kint-components/it_IT.json +14 -7
- package/translations/stripes-kint-components/ja.json +14 -7
- package/translations/stripes-kint-components/ko.json +14 -7
- package/translations/stripes-kint-components/pl.json +1 -114
- package/translations/stripes-kint-components/pt_PT.json +14 -7
- package/translations/stripes-kint-components/ru.json +14 -7
- package/translations/stripes-kint-components/sv.json +14 -7
- package/translations/stripes-kint-components/zh_CN.json +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
## 2.
|
|
2
|
-
* Custom property weight sorting not working as expected
|
|
3
|
-
|
|
4
|
-
## 2.6.3 2022-06-21
|
|
5
|
-
* Null safety issue
|
|
6
|
-
|
|
7
|
-
## 2.6.2 2022-06-21
|
|
8
|
-
* Fixed more missing translations issues
|
|
9
|
-
|
|
10
|
-
## 2.6.1 2022-06-21
|
|
1
|
+
## 2.7.0 2022-07-05
|
|
11
2
|
* Fixed missing translation issue
|
|
3
|
+
* EditableRefdataCategoryList component set up for ease of refdata category creation/deletion
|
|
4
|
+
* Also exposed useMutateRefdataCategory that it uses under the hood
|
|
5
|
+
* Custom property weight sorting not working as expected
|
|
6
|
+
* Fix aria label null safety in ActionList
|
|
7
|
+
* refdataOptions now sorts by desc by default
|
|
8
|
+
* ActionList
|
|
9
|
+
* autoFocus only applied to first field in editing row.
|
|
10
|
+
* formatter accidentally applied over editing fields
|
|
11
|
+
* validateFields prop to allow validation of fields. Takes an object with keys from `visibleFields` and values which are functions accepting the rowData, and returning a function to be used for validation in final-form.
|
|
12
|
+
* CustomProperties added default `labelOverrides={}` to all components to allow proper modular use without unnecessary props.
|
|
13
|
+
* CycleButton component
|
|
14
|
+
* IconSelect component
|
|
12
15
|
|
|
13
16
|
## 2.6.0 2022-06-20
|
|
14
17
|
* UIOA-118 App does not function when code-splitting is enabled - no longer set history when url has not changed
|
package/es/index.js
CHANGED
|
@@ -107,6 +107,18 @@ Object.defineProperty(exports, "CustomPropertyView", {
|
|
|
107
107
|
return _CustomProperties.CustomPropertyView;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
+
Object.defineProperty(exports, "CycleButton", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function get() {
|
|
113
|
+
return _CycleButton.default;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "EditableRefdataCategoryList", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _EditableRefdataCategoryList.default;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
110
122
|
Object.defineProperty(exports, "EditableRefdataList", {
|
|
111
123
|
enumerable: true,
|
|
112
124
|
get: function get() {
|
|
@@ -119,6 +131,12 @@ Object.defineProperty(exports, "FormModal", {
|
|
|
119
131
|
return _FormModal.default;
|
|
120
132
|
}
|
|
121
133
|
});
|
|
134
|
+
Object.defineProperty(exports, "IconSelect", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function get() {
|
|
137
|
+
return _IconSelect.default;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
122
140
|
Object.defineProperty(exports, "NoResultsMessage", {
|
|
123
141
|
enumerable: true,
|
|
124
142
|
get: function get() {
|
|
@@ -393,6 +411,8 @@ var _ActionList = _interopRequireDefault(require("./lib/ActionList"));
|
|
|
393
411
|
|
|
394
412
|
var _EditableRefdataList = _interopRequireDefault(require("./lib/EditableRefdataList"));
|
|
395
413
|
|
|
414
|
+
var _EditableRefdataCategoryList = _interopRequireDefault(require("./lib/EditableRefdataCategoryList"));
|
|
415
|
+
|
|
396
416
|
var _Typedown = _interopRequireDefault(require("./lib/Typedown"));
|
|
397
417
|
|
|
398
418
|
var _QueryTypedown = _interopRequireDefault(require("./lib/QueryTypedown"));
|
|
@@ -417,6 +437,10 @@ var _customPropertyContants = _interopRequireWildcard(require("./lib/constants/c
|
|
|
417
437
|
|
|
418
438
|
exports.customPropertyContants = _customPropertyContants;
|
|
419
439
|
|
|
440
|
+
var _CycleButton = _interopRequireDefault(require("./lib/CycleButton"));
|
|
441
|
+
|
|
442
|
+
var _IconSelect = _interopRequireDefault(require("./lib/IconSelect"));
|
|
443
|
+
|
|
420
444
|
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); }
|
|
421
445
|
|
|
422
446
|
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; }
|
|
@@ -21,7 +21,7 @@ var _ActionListFieldArray = _interopRequireDefault(require("./ActionListFieldArr
|
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["actionAssigner", "actionCalls", "columnMapping", "contentData", "creatableFields", "createCallback", "editableFields", "fieldComponents", "hideCreateButton", "label", "visibleFields"];
|
|
24
|
+
var _excluded = ["actionAssigner", "actionCalls", "columnMapping", "contentData", "creatableFields", "createCallback", "editableFields", "fieldComponents", "hideCreateButton", "label", "validateFields", "visibleFields"];
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
@@ -67,6 +67,7 @@ var ActionList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
67
67
|
fieldComponents = _ref$fieldComponents === void 0 ? {} : _ref$fieldComponents,
|
|
68
68
|
hideCreateButton = _ref.hideCreateButton,
|
|
69
69
|
label = _ref.label,
|
|
70
|
+
validateFields = _ref.validateFields,
|
|
70
71
|
visibleFields = _ref.visibleFields,
|
|
71
72
|
mclProps = _objectWithoutProperties(_ref, _excluded);
|
|
72
73
|
|
|
@@ -89,7 +90,8 @@ var ActionList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
89
90
|
subscription: {
|
|
90
91
|
contentData: true
|
|
91
92
|
},
|
|
92
|
-
children: function children() {
|
|
93
|
+
children: function children(_ref2) {
|
|
94
|
+
var handleSubmit = _ref2.handleSubmit;
|
|
93
95
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
94
96
|
onSubmit: function onSubmit(e) {
|
|
95
97
|
e.preventDefault();
|
|
@@ -106,6 +108,8 @@ var ActionList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
106
108
|
hideCreateButton: hideCreateButton,
|
|
107
109
|
label: label,
|
|
108
110
|
name: "contentData",
|
|
111
|
+
triggerFormSubmit: handleSubmit,
|
|
112
|
+
validateFields: validateFields,
|
|
109
113
|
visibleFields: visibleFields
|
|
110
114
|
}, mclProps))
|
|
111
115
|
});
|
|
@@ -23,7 +23,7 @@ var _ActionListFieldArray = _interopRequireDefault(require("../../../styles/Acti
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["actionAssigner", "actionCalls", "columnMapping", "creatableFields", "createCallback", "editableFields", "fields", "fieldComponents", "hideCreateButton", "label", "visibleFields"],
|
|
26
|
+
var _excluded = ["actionAssigner", "actionCalls", "columnMapping", "creatableFields", "createCallback", "editableFields", "fields", "fieldComponents", "hideCreateButton", "label", "validateFields", "visibleFields", "triggerFormSubmit"],
|
|
27
27
|
_excluded2 = ["actionListActions", "fieldName", "fieldIndex"],
|
|
28
28
|
_excluded3 = ["actionListActions", "fieldName", "fieldIndex"],
|
|
29
29
|
_excluded4 = ["actionListActions"],
|
|
@@ -94,7 +94,9 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
94
94
|
_ref$hideCreateButton = _ref.hideCreateButton,
|
|
95
95
|
hideCreateButton = _ref$hideCreateButton === void 0 ? false : _ref$hideCreateButton,
|
|
96
96
|
label = _ref.label,
|
|
97
|
+
validateFields = _ref.validateFields,
|
|
97
98
|
visibleFields = _ref.visibleFields,
|
|
99
|
+
triggerFormSubmit = _ref.triggerFormSubmit,
|
|
98
100
|
mclProps = _objectWithoutProperties(_ref, _excluded);
|
|
99
101
|
|
|
100
102
|
// Grab finalForm functions/values from form hooks
|
|
@@ -102,6 +104,7 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
102
104
|
change = _useForm.change;
|
|
103
105
|
|
|
104
106
|
var _useFormState = (0, _reactFinalForm.useFormState)(),
|
|
107
|
+
hasValidationErrors = _useFormState.hasValidationErrors,
|
|
105
108
|
initialValues = _useFormState.initialValues,
|
|
106
109
|
pristine = _useFormState.pristine,
|
|
107
110
|
submitting = _useFormState.submitting,
|
|
@@ -201,14 +204,19 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
201
204
|
disabled: submitting || pristine,
|
|
202
205
|
marginBottom0: true,
|
|
203
206
|
onClick: function onClick() {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
triggerFormSubmit(); // This is set up as () => null in ActionList, so essentially only acts here to force validation
|
|
208
|
+
|
|
209
|
+
if (!hasValidationErrors) {
|
|
210
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
211
|
+
handleCreate(data.rowIndex);
|
|
212
|
+
} else {
|
|
213
|
+
handleSave(data.rowIndex);
|
|
214
|
+
}
|
|
209
215
|
|
|
210
|
-
|
|
216
|
+
toggleEditing(data.id);
|
|
217
|
+
}
|
|
211
218
|
},
|
|
219
|
+
type: "submit",
|
|
212
220
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
213
221
|
id: "stripes-kint-components.actionList.save"
|
|
214
222
|
})
|
|
@@ -255,12 +263,24 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
255
263
|
actionFunction = function actionFunction() {
|
|
256
264
|
return toggleEditing(data.id);
|
|
257
265
|
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
var ariaLabel = "action-".concat(action.name, "[").concat(data.rowIndex, "]");
|
|
269
|
+
|
|
270
|
+
if (action !== null && action !== void 0 && action.ariaLabel) {
|
|
271
|
+
if (typeof action.ariaLabel === 'function') {
|
|
272
|
+
ariaLabel = action.ariaLabel(data);
|
|
273
|
+
} else if (typeof action.ariaLabel === 'string') {
|
|
274
|
+
ariaLabel = action.ariaLabel;
|
|
275
|
+
} else {
|
|
276
|
+
throw new Error("Provided ariaLabel for action \"".concat(action.name, "\" must be a function or a string."));
|
|
277
|
+
}
|
|
258
278
|
} // If we're handed an icon, use that for the action button
|
|
259
279
|
|
|
260
280
|
|
|
261
281
|
if (action.icon) {
|
|
262
282
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
263
|
-
ariaLabel:
|
|
283
|
+
ariaLabel: ariaLabel,
|
|
264
284
|
disabled: editing,
|
|
265
285
|
icon: action.icon,
|
|
266
286
|
onClick: function onClick() {
|
|
@@ -274,6 +294,7 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
274
294
|
|
|
275
295
|
|
|
276
296
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
297
|
+
ariaLabel: ariaLabel,
|
|
277
298
|
disabled: editing,
|
|
278
299
|
marginBottom0: true,
|
|
279
300
|
onClick: function onClick() {
|
|
@@ -306,7 +327,9 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
306
327
|
|
|
307
328
|
var fieldAwareFormatter = function fieldAwareFormatter() {
|
|
308
329
|
var returnObj = {}; // For each visible field, if it's being edited then ignore passed formatters, else use them
|
|
330
|
+
// Track whether we've autoFocused on a field yet
|
|
309
331
|
|
|
332
|
+
var autoFocus = true;
|
|
310
333
|
visibleFields.forEach(function (key) {
|
|
311
334
|
returnObj[key] = function (cd) {
|
|
312
335
|
// Row is being edited if it has no id, or its id is in the editing string
|
|
@@ -336,22 +359,22 @@ var ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
336
359
|
*/
|
|
337
360
|
|
|
338
361
|
if (!cd.id && createFunction(cd) || editFunction(cd)) {
|
|
362
|
+
var validateFunction = validateFields !== null && validateFields !== void 0 && validateFields[key] ? validateFields === null || validateFields === void 0 ? void 0 : validateFields[key](cd) : null;
|
|
339
363
|
returnValue = fieldComponents[key] ? fieldComponents[key]({
|
|
340
364
|
name: "".concat(cd.fieldName, ".").concat(key)
|
|
341
365
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
342
|
-
autoFocus:
|
|
366
|
+
autoFocus: autoFocus,
|
|
343
367
|
component: _components.TextField,
|
|
344
368
|
marginBottom0: true,
|
|
345
369
|
name: "".concat(cd.fieldName, ".").concat(key),
|
|
346
370
|
parse: function parse(v) {
|
|
347
371
|
return v;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
372
|
+
},
|
|
373
|
+
validate: validateFunction
|
|
374
|
+
}); // After first field, every other field should not autofocus
|
|
352
375
|
|
|
353
|
-
|
|
354
|
-
|
|
376
|
+
autoFocus = false;
|
|
377
|
+
}
|
|
355
378
|
}
|
|
356
379
|
|
|
357
380
|
return returnValue;
|
|
@@ -48,7 +48,8 @@ var CustomPropertiesLookup = function CustomPropertiesLookup(_ref) {
|
|
|
48
48
|
|
|
49
49
|
var contextFilterOptions = _ref.contextFilterOptions,
|
|
50
50
|
endpoint = _ref.customPropertiesEndpoint,
|
|
51
|
-
labelOverrides = _ref.labelOverrides,
|
|
51
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
52
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
52
53
|
mclProps = _ref.mclProps,
|
|
53
54
|
onSelectCustomProperty = _ref.onSelectCustomProperty,
|
|
54
55
|
queryParams = _ref.queryParams;
|
|
@@ -175,7 +176,9 @@ var CustomPropertiesLookup = function CustomPropertiesLookup(_ref) {
|
|
|
175
176
|
}
|
|
176
177
|
},
|
|
177
178
|
type: function type(data) {
|
|
178
|
-
|
|
179
|
+
var _labelOverrides$data$;
|
|
180
|
+
|
|
181
|
+
return (_labelOverrides$data$ = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[data === null || data === void 0 ? void 0 : data.type]) !== null && _labelOverrides$data$ !== void 0 ? _labelOverrides$data$ : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
179
182
|
id: "stripes-kint-components.customProperties.type.".concat(data === null || data === void 0 ? void 0 : data.type)
|
|
180
183
|
});
|
|
181
184
|
},
|
|
@@ -64,14 +64,15 @@ var CREATING = 'create';
|
|
|
64
64
|
var VIEWING = 'view'; // A default option for setting up panes manually
|
|
65
65
|
|
|
66
66
|
var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
67
|
-
var _labelOverrides$paneT, _ref3, _renderViewPaneTitle, _customProperty$categ, _labelOverrides$modal, _labelOverrides$modal2, _labelOverrides$confi
|
|
67
|
+
var _labelOverrides$paneT, _ref3, _renderViewPaneTitle, _customProperty$categ, _labelOverrides$modal, _labelOverrides$modal2, _labelOverrides$confi;
|
|
68
68
|
|
|
69
69
|
var afterQueryCalls = _ref.afterQueryCalls,
|
|
70
70
|
catchQueryCalls = _ref.catchQueryCalls,
|
|
71
71
|
contextFilterOptions = _ref.contextFilterOptions,
|
|
72
72
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
73
73
|
helpPopovers = _ref.helpPopovers,
|
|
74
|
-
labelOverrides = _ref.labelOverrides,
|
|
74
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
75
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
75
76
|
refdataEndpoint = _ref.refdataEndpoint;
|
|
76
77
|
var callout = (0, _react.useContext)(_core.CalloutContext);
|
|
77
78
|
var queryClient = (0, _reactQuery.useQueryClient)();
|
|
@@ -326,14 +327,14 @@ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
|
326
327
|
})
|
|
327
328
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
328
329
|
buttonStyle: "danger",
|
|
329
|
-
confirmLabel:
|
|
330
|
-
id: "stripes-kint-components.
|
|
330
|
+
confirmLabel: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
331
|
+
id: "stripes-kint-components.delete"
|
|
331
332
|
}),
|
|
332
|
-
heading: (_labelOverrides$
|
|
333
|
+
heading: (_labelOverrides$confi = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmHeading) !== null && _labelOverrides$confi !== void 0 ? _labelOverrides$confi : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
333
334
|
id: "stripes-kint-components.customProperties.delete.confirmHeading"
|
|
334
335
|
}),
|
|
335
336
|
id: "delete-job-confirmation",
|
|
336
|
-
message:
|
|
337
|
+
message: labelOverrides !== null && labelOverrides !== void 0 && labelOverrides.confirmMessage ? labelOverrides.confirmMessage(customProperty) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
337
338
|
id: "stripes-kint-components.customProperties.delete.confirmMessage",
|
|
338
339
|
values: {
|
|
339
340
|
name: customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
@@ -44,11 +44,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
44
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
45
|
|
|
46
46
|
var CustomPropertyForm = function CustomPropertyForm(_ref) {
|
|
47
|
-
var _labelOverrides$type, _labelOverrides$categ, _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$ctx, _labelOverrides$weigh, _labelOverrides$prima2, _labelOverrides$retir, _labelOverrides$defau;
|
|
47
|
+
var _labelOverrides$DECIM, _labelOverrides$INTEG, _labelOverrides$TEXT_, _labelOverrides$REFDA, _labelOverrides$MULTI, _labelOverrides$DATE_, _labelOverrides$type, _labelOverrides$categ, _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$ctx, _labelOverrides$weigh, _labelOverrides$prima2, _labelOverrides$retir, _labelOverrides$defau;
|
|
48
48
|
|
|
49
49
|
var contextFilterOptions = _ref.contextFilterOptions,
|
|
50
50
|
helpPopovers = _ref.helpPopovers,
|
|
51
|
-
labelOverrides = _ref.labelOverrides,
|
|
51
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
52
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
52
53
|
refdata = _ref.refdata;
|
|
53
54
|
|
|
54
55
|
var _useFormState = (0, _reactFinalForm.useFormState)(),
|
|
@@ -124,32 +125,32 @@ var CustomPropertyForm = function CustomPropertyForm(_ref) {
|
|
|
124
125
|
label: '',
|
|
125
126
|
value: ''
|
|
126
127
|
}, {
|
|
127
|
-
label: intl.formatMessage({
|
|
128
|
+
label: (_labelOverrides$DECIM = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.DECIMAL_CLASS_NAME]) !== null && _labelOverrides$DECIM !== void 0 ? _labelOverrides$DECIM : intl.formatMessage({
|
|
128
129
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.DECIMAL_CLASS_NAME)
|
|
129
130
|
}),
|
|
130
131
|
value: _customProperties.DECIMAL_CLASS_NAME
|
|
131
132
|
}, {
|
|
132
|
-
label: intl.formatMessage({
|
|
133
|
+
label: (_labelOverrides$INTEG = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.INTEGER_CLASS_NAME]) !== null && _labelOverrides$INTEG !== void 0 ? _labelOverrides$INTEG : intl.formatMessage({
|
|
133
134
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.INTEGER_CLASS_NAME)
|
|
134
135
|
}),
|
|
135
136
|
value: _customProperties.INTEGER_CLASS_NAME
|
|
136
137
|
}, {
|
|
137
|
-
label: intl.formatMessage({
|
|
138
|
+
label: (_labelOverrides$TEXT_ = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.TEXT_CLASS_NAME]) !== null && _labelOverrides$TEXT_ !== void 0 ? _labelOverrides$TEXT_ : intl.formatMessage({
|
|
138
139
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.TEXT_CLASS_NAME)
|
|
139
140
|
}),
|
|
140
141
|
value: _customProperties.TEXT_CLASS_NAME
|
|
141
142
|
}, {
|
|
142
|
-
label: intl.formatMessage({
|
|
143
|
+
label: (_labelOverrides$REFDA = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.REFDATA_CLASS_NAME]) !== null && _labelOverrides$REFDA !== void 0 ? _labelOverrides$REFDA : intl.formatMessage({
|
|
143
144
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.REFDATA_CLASS_NAME)
|
|
144
145
|
}),
|
|
145
146
|
value: _customProperties.REFDATA_CLASS_NAME
|
|
146
147
|
}, {
|
|
147
|
-
label: intl.formatMessage({
|
|
148
|
+
label: (_labelOverrides$MULTI = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.MULTI_REFDATA_CLASS_NAME]) !== null && _labelOverrides$MULTI !== void 0 ? _labelOverrides$MULTI : intl.formatMessage({
|
|
148
149
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.MULTI_REFDATA_CLASS_NAME)
|
|
149
150
|
}),
|
|
150
151
|
value: _customProperties.MULTI_REFDATA_CLASS_NAME
|
|
151
152
|
}, {
|
|
152
|
-
label: intl.formatMessage({
|
|
153
|
+
label: (_labelOverrides$DATE_ = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[_customProperties.DATE_CLASS_NAME]) !== null && _labelOverrides$DATE_ !== void 0 ? _labelOverrides$DATE_ : intl.formatMessage({
|
|
153
154
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.DATE_CLASS_NAME)
|
|
154
155
|
}),
|
|
155
156
|
value: _customProperties.DATE_CLASS_NAME
|
|
@@ -19,11 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
|
|
20
20
|
// A default option for CustProp view pane, with the ability to override labels for fields
|
|
21
21
|
var CustomPropertyView = function CustomPropertyView(_ref) {
|
|
22
|
-
var _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$prima, _labelOverrides$retir, _labelOverrides$weigh, _labelOverrides$defau, _labelOverrides$ctx, _customProperty$ctx, _labelOverrides$type, _labelOverrides$categ, _customProperty$categ, _customProperty$categ2;
|
|
22
|
+
var _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$prima, _labelOverrides$retir, _labelOverrides$weigh, _labelOverrides$defau, _labelOverrides$ctx, _customProperty$ctx, _labelOverrides$type, _labelOverrides$custo, _labelOverrides$categ, _customProperty$categ, _customProperty$categ2;
|
|
23
23
|
|
|
24
24
|
var customProperty = _ref.customProperty,
|
|
25
25
|
helpPopovers = _ref.helpPopovers,
|
|
26
|
-
labelOverrides = _ref.labelOverrides
|
|
26
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
27
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
27
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
28
29
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
29
30
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
@@ -124,7 +125,7 @@ var CustomPropertyView = function CustomPropertyView(_ref) {
|
|
|
124
125
|
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, {
|
|
125
126
|
id: "stripes-kint-components.customProperties.type"
|
|
126
127
|
}),
|
|
127
|
-
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
128
|
+
value: (_labelOverrides$custo = labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[customProperty === null || customProperty === void 0 ? void 0 : customProperty.type]) !== null && _labelOverrides$custo !== void 0 ? _labelOverrides$custo : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
128
129
|
id: "stripes-kint-components.customProperties.type.".concat(customProperty === null || customProperty === void 0 ? void 0 : customProperty.type)
|
|
129
130
|
})
|
|
130
131
|
})
|
|
@@ -23,7 +23,8 @@ var CustomPropertiesEditCtx = function CustomPropertiesEditCtx(_ref) {
|
|
|
23
23
|
var ctx = _ref.ctx,
|
|
24
24
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
25
25
|
id = _ref.id,
|
|
26
|
-
labelOverrides = _ref.labelOverrides,
|
|
26
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
27
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
27
28
|
nameOverride = _ref.nameOverride;
|
|
28
29
|
|
|
29
30
|
// Deal with all the possible label override options
|
|
@@ -64,7 +64,8 @@ var CustomPropertiesList = function CustomPropertiesList(_ref) {
|
|
|
64
64
|
name = _ref$input.name,
|
|
65
65
|
onChange = _ref$input.onChange,
|
|
66
66
|
value = _ref$input.value,
|
|
67
|
-
labelOverrides = _ref.labelOverrides,
|
|
67
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
68
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
68
69
|
pristine = _ref.meta.pristine;
|
|
69
70
|
|
|
70
71
|
var _useState = (0, _react.useState)([]),
|
|
@@ -51,7 +51,8 @@ var CustomPropertyField = function CustomPropertyField(_ref) {
|
|
|
51
51
|
customPropertyType = _ref.customPropertyType,
|
|
52
52
|
customProperties = _ref.customProperties,
|
|
53
53
|
index = _ref.index,
|
|
54
|
-
labelOverrides = _ref.labelOverrides,
|
|
54
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
55
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
55
56
|
name = _ref.name,
|
|
56
57
|
_onChange = _ref.onChange,
|
|
57
58
|
value = _ref.value,
|
|
@@ -25,7 +25,8 @@ var CustomPropertyFormCard = function CustomPropertyFormCard(_ref) {
|
|
|
25
25
|
handleDeleteCustomProperty = _ref.handleDeleteCustomProperty,
|
|
26
26
|
index = _ref.index,
|
|
27
27
|
internalPropertyCounter = _ref.internalPropertyCounter,
|
|
28
|
-
labelOverrides = _ref.labelOverrides,
|
|
28
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
29
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
29
30
|
name = _ref.name,
|
|
30
31
|
onChange = _ref.onChange,
|
|
31
32
|
setCustomProperties = _ref.setCustomProperties,
|
|
@@ -57,7 +57,8 @@ var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
|
57
57
|
restOfFilters = _objectWithoutProperties(_ref$activeFilters, _excluded),
|
|
58
58
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
59
59
|
filterHandlers = _ref.filterHandlers,
|
|
60
|
-
labelOverrides = _ref.labelOverrides
|
|
60
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
61
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
61
62
|
|
|
62
63
|
var _useState = (0, _react.useState)(false),
|
|
63
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,8 @@ var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray
|
|
|
25
25
|
var _labelOverrides$addFi;
|
|
26
26
|
|
|
27
27
|
var customProperties = _ref.customProperties,
|
|
28
|
-
labelOverrides = _ref.labelOverrides
|
|
28
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
29
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
29
30
|
|
|
30
31
|
var _useForm = (0, _reactFinalForm.useForm)(),
|
|
31
32
|
push = _useForm.mutators.push;
|
|
@@ -36,7 +36,8 @@ var CustomPropertyFiltersForm = function CustomPropertyFiltersForm(_ref) {
|
|
|
36
36
|
_ref$handlers = _ref.handlers,
|
|
37
37
|
closeEditModal = _ref$handlers.closeEditModal,
|
|
38
38
|
openEditModal = _ref$handlers.openEditModal,
|
|
39
|
-
labelOverrides = _ref.labelOverrides,
|
|
39
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
40
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
40
41
|
onSubmit = _ref.onSubmit;
|
|
41
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
42
43
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -39,7 +39,8 @@ var CustomPropertiesViewCtx = function CustomPropertiesViewCtx(_ref) {
|
|
|
39
39
|
customProperties = _ref$customProperties === void 0 ? [] : _ref$customProperties,
|
|
40
40
|
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
41
41
|
id = _ref.id,
|
|
42
|
-
labelOverrides = _ref.labelOverrides
|
|
42
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
43
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
43
44
|
|
|
44
45
|
// Deal with all the possible label override options
|
|
45
46
|
var getAccordionLabel = function getAccordionLabel() {
|
|
@@ -90,7 +91,7 @@ var CustomPropertiesViewCtx = function CustomPropertiesViewCtx(_ref) {
|
|
|
90
91
|
}, // Within those groups, sort by weight
|
|
91
92
|
{
|
|
92
93
|
path: 'label'
|
|
93
|
-
} //
|
|
94
|
+
} //For those with the same weight, sort by label
|
|
94
95
|
]
|
|
95
96
|
}
|
|
96
97
|
}),
|
|
@@ -31,7 +31,8 @@ var CustomPropertyCard = function CustomPropertyCard(_ref) {
|
|
|
31
31
|
_ref$customPropertyDe = _ref.customPropertyDefinition,
|
|
32
32
|
customPropertyDefinition = _ref$customPropertyDe === void 0 ? {} : _ref$customPropertyDe,
|
|
33
33
|
index = _ref.index,
|
|
34
|
-
labelOverrides = _ref.labelOverrides
|
|
34
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
35
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
35
36
|
// We only need to display primary and set properties
|
|
36
37
|
var toDisplay = !!(customPropertyDefinition.primary || customProperty);
|
|
37
38
|
|
|
@@ -0,0 +1,81 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _components = require("@folio/stripes/components");
|
|
15
|
+
|
|
16
|
+
var _CycleButton = _interopRequireDefault(require("../../../styles/CycleButton.css"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
var _excluded = ["className", "onClick"];
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
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."); }
|
|
37
|
+
|
|
38
|
+
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); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
var CycleButton = function CycleButton(_ref) {
|
|
47
|
+
var buttons = _ref.buttons,
|
|
48
|
+
_ref$startIndex = _ref.startIndex,
|
|
49
|
+
startIndex = _ref$startIndex === void 0 ? 0 : _ref$startIndex;
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(startIndex),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
index = _useState2[0],
|
|
54
|
+
setIndex = _useState2[1];
|
|
55
|
+
|
|
56
|
+
var _buttons$index = buttons[index],
|
|
57
|
+
className = _buttons$index.className,
|
|
58
|
+
_onClick = _buttons$index.onClick,
|
|
59
|
+
buttonProps = _objectWithoutProperties(_buttons$index, _excluded);
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
62
|
+
className: (0, _classnames.default)(className, _CycleButton.default.buttonStyle),
|
|
63
|
+
onClick: function onClick(e) {
|
|
64
|
+
if (_onClick) {
|
|
65
|
+
_onClick(e);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setIndex(index !== (buttons === null || buttons === void 0 ? void 0 : buttons.length) - 1 ? index + 1 : 0);
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
CycleButton.propTypes = {
|
|
74
|
+
buttons: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
75
|
+
className: _propTypes.default.object,
|
|
76
|
+
icon: _propTypes.default.string.isRequired,
|
|
77
|
+
onClick: _propTypes.default.func.isRequired
|
|
78
|
+
}))
|
|
79
|
+
};
|
|
80
|
+
var _default = CycleButton;
|
|
81
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _CycleButton.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _CycleButton = _interopRequireDefault(require("./CycleButton"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|