@k-int/stripes-kint-components 5.25.1 → 5.25.3
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 +14 -0
- package/es/__mocks__/@folio/stripes/components.js +7 -3
- package/es/__mocks__/@folio/stripes/core.js +6 -4
- package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
- package/es/__mocks__/react-query.js +6 -4
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +33 -26
- package/es/lib/ActionList/ActionListFieldArray.js +119 -103
- package/es/lib/ComboButton/ComboButton.js +47 -42
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +35 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +17 -14
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +17 -9
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
- package/es/lib/EditableRefdataList/EditableRefdataList.js +43 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +9 -5
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +6 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +12 -8
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/FormModal/FormModal.js +32 -24
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
- package/es/lib/IconSelect/IconSelect.js +32 -22
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
- package/es/lib/NumberField/NumberField.js +25 -17
- package/es/lib/NumberField/NumberField.test.js +7 -6
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +36 -31
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +51 -41
- package/es/lib/SASQRoute/SASQRoute.js +29 -25
- package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
- package/es/lib/SearchField/SearchField.js +13 -7
- package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +35 -30
- package/es/lib/Tags/Tags.js +8 -5
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +1 -1
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +28 -21
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +10 -6
- package/es/lib/hooks/useHelperApp.js +16 -13
- package/es/lib/hooks/useKiwtFieldArray.js +8 -7
- package/es/lib/hooks/useKiwtSASQuery.js +19 -15
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
- package/es/lib/hooks/usePrevNextPagination.js +19 -17
- package/es/lib/hooks/useQIndex.js +14 -11
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings/useAppSettings.js +11 -7
- package/es/lib/settingsHooks/useSettingSection/useSettingSection.js +18 -12
- package/es/lib/settingsHooks/useSettings/useSettings.js +60 -60
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +82 -70
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString.js +7 -5
- package/es/lib/utils/parseErrorResponse.js +4 -3
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +9 -6
- package/package.json +1 -1
- package/src/lib/SASQViewComponent/SASQViewComponent.js +2 -3
- package/styles/TypeDown.css +3 -1
|
@@ -10,31 +10,38 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _components = require("@folio/stripes/components");
|
|
11
11
|
var _ResponsiveButtonGroup = _interopRequireDefault(require("../../../styles/ResponsiveButtonGroup.css"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
|
-
// FIXME we should probably store the shared styles in a more aptly named file
|
|
15
|
-
|
|
13
|
+
const _excluded = ["children", "dropdownButtons", "dropdownProps", "dropdownRender", "marginBottom0", "popoverProps", "triggerProps"]; // FIXME we should probably store the shared styles in a more aptly named file
|
|
16
14
|
/*
|
|
17
15
|
* ComboButton component, can either act as Primary/Bonus buttons in a dropdown
|
|
18
16
|
* OR it can act as a popover rendered besides a button.
|
|
19
17
|
* If neither are provided it will act as an ordinary button
|
|
20
|
-
*/
|
|
18
|
+
*/
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
26
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
27
|
+
const ComboButton = _ref => {
|
|
21
28
|
let {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
children,
|
|
30
|
+
dropdownButtons = [],
|
|
31
|
+
// These MUST be buttons
|
|
32
|
+
dropdownProps = {},
|
|
33
|
+
dropdownRender,
|
|
34
|
+
marginBottom0,
|
|
35
|
+
// Will ONLY control the margin of the dropdown/main button
|
|
36
|
+
popoverProps = {},
|
|
37
|
+
triggerProps
|
|
38
|
+
} = _ref,
|
|
39
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
40
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
34
41
|
const onToggle = (0, _react.useCallback)(() => setOpen(!open), [open, setOpen]);
|
|
35
42
|
|
|
36
43
|
// FIXME a lot of this is shared with ResponsiveButtonGroup
|
|
37
|
-
const styledDropdownButtons = (0, _react.useMemo)(() => dropdownButtons
|
|
44
|
+
const styledDropdownButtons = (0, _react.useMemo)(() => dropdownButtons === null || dropdownButtons === void 0 ? void 0 : dropdownButtons.map(button => {
|
|
38
45
|
return /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
39
46
|
buttonStyle: 'dropdownItem'
|
|
40
47
|
});
|
|
@@ -45,6 +52,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
45
52
|
children: [...styledDropdownButtons]
|
|
46
53
|
}), [styledDropdownButtons]);
|
|
47
54
|
const renderTrigger = (0, _react.useCallback)(_ref2 => {
|
|
55
|
+
var _buttonProps$buttonSt;
|
|
48
56
|
let {
|
|
49
57
|
onToggle: toggleFunc,
|
|
50
58
|
triggerRef,
|
|
@@ -53,39 +61,36 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
53
61
|
ariaProps,
|
|
54
62
|
getTriggerProps
|
|
55
63
|
} = _ref2;
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
57
65
|
ref: triggerRef,
|
|
58
66
|
"aria-label": "menu",
|
|
59
67
|
buttonClass: (0, _classnames.default)(_ResponsiveButtonGroup.default.width100, _ResponsiveButtonGroup.default.dropdownButtonClass, {
|
|
60
|
-
[
|
|
68
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom)]: !marginBottom0
|
|
61
69
|
}, {
|
|
62
|
-
[
|
|
70
|
+
["".concat(_ResponsiveButtonGroup.default.marginBottom0)]: marginBottom0
|
|
63
71
|
}),
|
|
64
|
-
buttonStyle: buttonProps
|
|
72
|
+
buttonStyle: (_buttonProps$buttonSt = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonStyle) !== null && _buttonProps$buttonSt !== void 0 ? _buttonProps$buttonSt : 'default',
|
|
65
73
|
onClick: toggleFunc,
|
|
66
74
|
onKeyDown: keyHandler,
|
|
67
|
-
type: "button"
|
|
68
|
-
|
|
69
|
-
...ariaProps,
|
|
70
|
-
...triggerProps,
|
|
75
|
+
type: "button"
|
|
76
|
+
}, getTriggerProps()), ariaProps), triggerProps), {}, {
|
|
71
77
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
72
78
|
icon: openState ? 'triangle-up' : 'triangle-down',
|
|
73
79
|
iconPosition: "end"
|
|
74
80
|
})
|
|
75
|
-
});
|
|
76
|
-
}, [buttonProps
|
|
81
|
+
}));
|
|
82
|
+
}, [buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.buttonStyle, triggerProps, marginBottom0]);
|
|
77
83
|
let comboTrigger;
|
|
78
84
|
if (dropdownButtons.length > 0) {
|
|
79
|
-
comboTrigger = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
|
|
85
|
+
comboTrigger = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, _objectSpread({
|
|
80
86
|
className: _ResponsiveButtonGroup.default.dropdownClass,
|
|
81
87
|
onToggle: onToggle,
|
|
82
88
|
open: open,
|
|
83
89
|
renderMenu: renderActionMenuContent,
|
|
84
|
-
renderTrigger: renderTriggerProps => renderTrigger(renderTriggerProps)
|
|
85
|
-
|
|
86
|
-
}, "combobutton-dropdown-toggle");
|
|
90
|
+
renderTrigger: renderTriggerProps => renderTrigger(renderTriggerProps)
|
|
91
|
+
}, dropdownProps), "combobutton-dropdown-toggle");
|
|
87
92
|
} else if (dropdownRender) {
|
|
88
|
-
comboTrigger = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover, {
|
|
93
|
+
comboTrigger = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover, _objectSpread(_objectSpread({
|
|
89
94
|
onToggle: onToggle,
|
|
90
95
|
open: open,
|
|
91
96
|
renderTrigger: _ref3 => {
|
|
@@ -100,28 +105,28 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
100
105
|
open: openState,
|
|
101
106
|
triggerRef: ref
|
|
102
107
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
108
|
+
}
|
|
109
|
+
}, popoverProps), {}, {
|
|
105
110
|
children: dropdownRender
|
|
106
|
-
});
|
|
111
|
+
}));
|
|
107
112
|
}
|
|
108
113
|
if (comboTrigger) {
|
|
109
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
110
115
|
className: (0, _classnames.default)(_ResponsiveButtonGroup.default.buttonGroup),
|
|
111
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
112
|
-
marginBottom0: marginBottom0
|
|
113
|
-
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, _objectSpread(_objectSpread({
|
|
117
|
+
marginBottom0: marginBottom0
|
|
118
|
+
}, buttonProps), {}, {
|
|
114
119
|
children: children
|
|
115
|
-
}), comboTrigger]
|
|
120
|
+
})), comboTrigger]
|
|
116
121
|
});
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
// Fallback, acts as a normal button
|
|
120
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
121
|
-
marginBottom0: marginBottom0
|
|
122
|
-
|
|
125
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, _objectSpread(_objectSpread({
|
|
126
|
+
marginBottom0: marginBottom0
|
|
127
|
+
}, buttonProps), {}, {
|
|
123
128
|
children: children
|
|
124
|
-
});
|
|
129
|
+
}));
|
|
125
130
|
};
|
|
126
131
|
ComboButton.propTypes = {
|
|
127
132
|
children: _propTypes.default.node,
|
|
@@ -13,6 +13,11 @@ var _hooks = require("../../hooks");
|
|
|
13
13
|
var _CustomProperties = _interopRequireDefault(require("../../../../styles/CustomProperties.css"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
21
|
const CustomPropertiesLookup = _ref => {
|
|
17
22
|
let {
|
|
18
23
|
contextFilterOptions,
|
|
@@ -47,10 +52,9 @@ const CustomPropertiesLookup = _ref => {
|
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
54
|
const handleSearch = query => {
|
|
50
|
-
setNsValues({
|
|
51
|
-
...nsValues,
|
|
55
|
+
setNsValues(_objectSpread(_objectSpread({}, nsValues), {}, {
|
|
52
56
|
query
|
|
53
|
-
});
|
|
57
|
+
}));
|
|
54
58
|
};
|
|
55
59
|
const [searchTerm, setSearchTerm] = (0, _react.useState)('');
|
|
56
60
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
@@ -103,7 +107,7 @@ const CustomPropertiesLookup = _ref => {
|
|
|
103
107
|
value: selectedContext
|
|
104
108
|
})
|
|
105
109
|
})
|
|
106
|
-
}), isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
110
|
+
}), isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
107
111
|
columnMapping: {
|
|
108
112
|
'label': kintIntl.formatKintMessage({
|
|
109
113
|
id: 'customProperties.label',
|
|
@@ -133,7 +137,7 @@ const CustomPropertiesLookup = _ref => {
|
|
|
133
137
|
contentData: custprops,
|
|
134
138
|
formatter: {
|
|
135
139
|
primary: data => {
|
|
136
|
-
if (data
|
|
140
|
+
if (data !== null && data !== void 0 && data.primary) {
|
|
137
141
|
return kintIntl.formatKintMessage({
|
|
138
142
|
id: 'yes',
|
|
139
143
|
overrideValue: labelOverrides.yes
|
|
@@ -146,15 +150,17 @@ const CustomPropertiesLookup = _ref => {
|
|
|
146
150
|
}
|
|
147
151
|
},
|
|
148
152
|
type: data => kintIntl.formatKintMessage({
|
|
149
|
-
id:
|
|
150
|
-
overrideValue: labelOverrides
|
|
153
|
+
id: "customProperties.type.".concat(data === null || data === void 0 ? void 0 : data.type),
|
|
154
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides[data === null || data === void 0 ? void 0 : data.type]
|
|
151
155
|
}),
|
|
152
|
-
category: data =>
|
|
156
|
+
category: data => {
|
|
157
|
+
var _data$category;
|
|
158
|
+
return data === null || data === void 0 || (_data$category = data.category) === null || _data$category === void 0 ? void 0 : _data$category.desc;
|
|
159
|
+
}
|
|
153
160
|
},
|
|
154
161
|
onRowClick: onSelectCustomProperty,
|
|
155
|
-
visibleColumns: ['label', 'primary', 'ctx', 'weight', 'type', 'category']
|
|
156
|
-
|
|
157
|
-
})]
|
|
162
|
+
visibleColumns: ['label', 'primary', 'ctx', 'weight', 'type', 'category']
|
|
163
|
+
}, mclProps))]
|
|
158
164
|
});
|
|
159
165
|
};
|
|
160
166
|
CustomPropertiesLookup.propTypes = {
|
|
@@ -18,12 +18,18 @@ var _hooks = require("../../hooks");
|
|
|
18
18
|
var _utils = require("../../utils");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
26
|
const EDITING = 'edit';
|
|
22
27
|
const CREATING = 'create';
|
|
23
28
|
const VIEWING = 'view';
|
|
24
29
|
|
|
25
30
|
// A default option for setting up panes manually
|
|
26
31
|
const CustomPropertiesSettings = _ref => {
|
|
32
|
+
var _customProperty$label, _customProperty$label2, _customProperty$categ, _customProperty$label3, _customProperty$label4;
|
|
27
33
|
let {
|
|
28
34
|
afterQueryCalls,
|
|
29
35
|
catchQueryCalls,
|
|
@@ -68,7 +74,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
68
74
|
// empty string is all custoprop contexts
|
|
69
75
|
label: kintIntl.formatKintMessage({
|
|
70
76
|
id: 'customProperties.config.all',
|
|
71
|
-
overrideValue: labelOverrides
|
|
77
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.all
|
|
72
78
|
})
|
|
73
79
|
}];
|
|
74
80
|
}
|
|
@@ -85,7 +91,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
85
91
|
setMode(VIEWING);
|
|
86
92
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
87
93
|
setCustomProperty(res);
|
|
88
|
-
if (afterQueryCalls
|
|
94
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.put) {
|
|
89
95
|
afterQueryCalls.put(res);
|
|
90
96
|
}
|
|
91
97
|
},
|
|
@@ -93,7 +99,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
93
99
|
setMode(VIEWING);
|
|
94
100
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
95
101
|
setCustomProperty(res);
|
|
96
|
-
if (afterQueryCalls
|
|
102
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.post) {
|
|
97
103
|
afterQueryCalls.post(res);
|
|
98
104
|
}
|
|
99
105
|
},
|
|
@@ -101,12 +107,12 @@ const CustomPropertiesSettings = _ref => {
|
|
|
101
107
|
setMode(VIEWING);
|
|
102
108
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
103
109
|
setCustomProperty();
|
|
104
|
-
if (afterQueryCalls
|
|
110
|
+
if (afterQueryCalls !== null && afterQueryCalls !== void 0 && afterQueryCalls.delete) {
|
|
105
111
|
afterQueryCalls.delete(res);
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
114
|
},
|
|
109
|
-
catchQueryCalls: {
|
|
115
|
+
catchQueryCalls: _objectSpread({
|
|
110
116
|
// Default delete behaviour is to fire a callout, either with kint-components default message
|
|
111
117
|
// or one provided in labelOverrides, which is passed the error message and customProperty in question
|
|
112
118
|
delete: async err => {
|
|
@@ -114,35 +120,34 @@ const CustomPropertiesSettings = _ref => {
|
|
|
114
120
|
callout.sendCallout({
|
|
115
121
|
message: kintIntl.formatKintMessage({
|
|
116
122
|
id: 'customProperties.config.delete.errorMessage',
|
|
117
|
-
overrideValue: labelOverrides
|
|
123
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.deleteError
|
|
118
124
|
}, {
|
|
119
|
-
error: errorResp
|
|
120
|
-
label: customProperty
|
|
125
|
+
error: errorResp === null || errorResp === void 0 ? void 0 : errorResp.message,
|
|
126
|
+
label: customProperty === null || customProperty === void 0 ? void 0 : customProperty.label
|
|
121
127
|
}),
|
|
122
128
|
type: 'error'
|
|
123
129
|
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
},
|
|
130
|
+
}
|
|
131
|
+
}, catchQueryCalls),
|
|
127
132
|
endpoint: customPropertiesEndpoint,
|
|
128
|
-
id: customProperty
|
|
133
|
+
id: customProperty === null || customProperty === void 0 ? void 0 : customProperty.id
|
|
129
134
|
});
|
|
130
135
|
const handeContextSubmit = submitData => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
ctx: submitData
|
|
134
|
-
};
|
|
136
|
+
var _submitData$ctx$0$val, _submitData$ctx;
|
|
137
|
+
return _objectSpread(_objectSpread({}, submitData), {}, {
|
|
138
|
+
ctx: (_submitData$ctx$0$val = submitData === null || submitData === void 0 || (_submitData$ctx = submitData.ctx) === null || _submitData$ctx === void 0 || (_submitData$ctx = _submitData$ctx[0]) === null || _submitData$ctx === void 0 ? void 0 : _submitData$ctx.value) !== null && _submitData$ctx$0$val !== void 0 ? _submitData$ctx$0$val : ''
|
|
139
|
+
});
|
|
135
140
|
};
|
|
136
141
|
|
|
137
142
|
// When POSTing a custom property, the backend expects a shorthand "Integer" or "LocalDate"
|
|
138
143
|
// When PUTing a custom property, the backend needs the full class name
|
|
139
144
|
const handleType = submitData => {
|
|
145
|
+
var _typeRegex$exec;
|
|
140
146
|
const typeRegex = /(com\.k_int\.web\.toolkit\.custprops\.types\.CustomProperty)(.*)/g;
|
|
141
|
-
const typeMatch = typeRegex.exec(submitData
|
|
142
|
-
return {
|
|
143
|
-
...submitData,
|
|
147
|
+
const typeMatch = (_typeRegex$exec = typeRegex.exec(submitData === null || submitData === void 0 ? void 0 : submitData.type)) !== null && _typeRegex$exec !== void 0 ? _typeRegex$exec : [];
|
|
148
|
+
return _objectSpread(_objectSpread({}, submitData), {}, {
|
|
144
149
|
type: typeMatch[2]
|
|
145
|
-
};
|
|
150
|
+
});
|
|
146
151
|
};
|
|
147
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
148
153
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
@@ -155,7 +160,7 @@ const CustomPropertiesSettings = _ref => {
|
|
|
155
160
|
,
|
|
156
161
|
children: kintIntl.formatKintMessage({
|
|
157
162
|
id: 'new',
|
|
158
|
-
overrideValue: labelOverrides
|
|
163
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.new
|
|
159
164
|
})
|
|
160
165
|
}),
|
|
161
166
|
paneTitle: kintIntl.formatKintMessage({
|
|
@@ -185,10 +190,10 @@ const CustomPropertiesSettings = _ref => {
|
|
|
185
190
|
icon: "edit",
|
|
186
191
|
children: kintIntl.formatKintMessage({
|
|
187
192
|
id: 'edit',
|
|
188
|
-
overrideValue: labelOverrides
|
|
193
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.edit
|
|
189
194
|
})
|
|
190
195
|
})
|
|
191
|
-
},
|
|
196
|
+
}, "".concat(customProperty.name, "-action-edit")));
|
|
192
197
|
}
|
|
193
198
|
if (deleteCondition) {
|
|
194
199
|
actionsArray.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
@@ -202,12 +207,12 @@ const CustomPropertiesSettings = _ref => {
|
|
|
202
207
|
icon: "trash",
|
|
203
208
|
children: kintIntl.formatKintMessage({
|
|
204
209
|
id: 'delete',
|
|
205
|
-
overrideValue: labelOverrides
|
|
210
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
206
211
|
})
|
|
207
212
|
})
|
|
208
|
-
},
|
|
213
|
+
}, "".concat(customProperty.name, "-action-delete")));
|
|
209
214
|
}
|
|
210
|
-
return actionsArray
|
|
215
|
+
return actionsArray !== null && actionsArray !== void 0 && actionsArray.length ? actionsArray : null;
|
|
211
216
|
},
|
|
212
217
|
defaultWidth: "fill",
|
|
213
218
|
dismissible: true,
|
|
@@ -215,10 +220,10 @@ const CustomPropertiesSettings = _ref => {
|
|
|
215
220
|
onClose: () => setCustomProperty(),
|
|
216
221
|
paneTitle: kintIntl.formatKintMessage({
|
|
217
222
|
id: 'customProperties.config.viewPaneTitle',
|
|
218
|
-
overrideValue: labelOverrides
|
|
219
|
-
fallbackMessage: customProperty
|
|
223
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.viewPaneTitle,
|
|
224
|
+
fallbackMessage: (_customProperty$label = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label !== void 0 ? _customProperty$label : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
220
225
|
}, {
|
|
221
|
-
name: customProperty
|
|
226
|
+
name: (_customProperty$label2 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label2 !== void 0 ? _customProperty$label2 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
222
227
|
}),
|
|
223
228
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyView.default, {
|
|
224
229
|
customProperty: customProperty,
|
|
@@ -233,24 +238,23 @@ const CustomPropertiesSettings = _ref => {
|
|
|
233
238
|
primary: true,
|
|
234
239
|
retired: false,
|
|
235
240
|
defaultInternal: true
|
|
236
|
-
} : {
|
|
237
|
-
|
|
238
|
-
ctx: customProperty?.ctx ? [{
|
|
241
|
+
} : _objectSpread(_objectSpread({}, customProperty), {}, {
|
|
242
|
+
ctx: customProperty !== null && customProperty !== void 0 && customProperty.ctx ? [{
|
|
239
243
|
value: customProperty.ctx,
|
|
240
244
|
label: customProperty.ctx
|
|
241
245
|
}] : null,
|
|
242
|
-
category: customProperty
|
|
243
|
-
},
|
|
246
|
+
category: customProperty !== null && customProperty !== void 0 && customProperty.category ? customProperty === null || customProperty === void 0 || (_customProperty$categ = customProperty.category) === null || _customProperty$categ === void 0 ? void 0 : _customProperty$categ.id : null
|
|
247
|
+
}),
|
|
244
248
|
modalProps: {
|
|
245
249
|
dismissible: true,
|
|
246
250
|
label: mode === CREATING ? kintIntl.formatKintMessage({
|
|
247
251
|
id: 'customProperties.config.newModal',
|
|
248
|
-
overrideValue: labelOverrides
|
|
252
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.newModalTitle
|
|
249
253
|
}) : kintIntl.formatKintMessage({
|
|
250
254
|
id: 'customProperties.config.editModal',
|
|
251
|
-
overrideValue: labelOverrides
|
|
255
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.editModalTitle
|
|
252
256
|
}, {
|
|
253
|
-
name: customProperty
|
|
257
|
+
name: (_customProperty$label3 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label3 !== void 0 ? _customProperty$label3 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
254
258
|
}),
|
|
255
259
|
onClose: () => setMode(VIEWING),
|
|
256
260
|
open: mode === CREATING || mode === EDITING
|
|
@@ -271,22 +275,22 @@ const CustomPropertiesSettings = _ref => {
|
|
|
271
275
|
buttonStyle: "danger",
|
|
272
276
|
confirmLabel: kintIntl.formatKintMessage({
|
|
273
277
|
id: 'delete',
|
|
274
|
-
overrideValue: labelOverrides
|
|
278
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.delete
|
|
275
279
|
}),
|
|
276
280
|
heading: kintIntl.formatKintMessage({
|
|
277
281
|
id: 'customProperties.config.delete.confirmHeading',
|
|
278
|
-
overrideValue: labelOverrides
|
|
282
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmHeading
|
|
279
283
|
}),
|
|
280
284
|
id: "delete-custprop-confirmation",
|
|
281
285
|
message: kintIntl.formatKintMessage({
|
|
282
286
|
id: 'customProperties.config.delete.confirmMessage',
|
|
283
|
-
overrideValue: labelOverrides
|
|
287
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.confirmMessage
|
|
284
288
|
}, {
|
|
285
|
-
name: customProperty
|
|
289
|
+
name: (_customProperty$label4 = customProperty === null || customProperty === void 0 ? void 0 : customProperty.label) !== null && _customProperty$label4 !== void 0 ? _customProperty$label4 : customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
286
290
|
}),
|
|
287
291
|
onCancel: () => setDeleteModal(false),
|
|
288
292
|
onConfirm: () => {
|
|
289
|
-
deleteCustProp(customProperty
|
|
293
|
+
deleteCustProp(customProperty === null || customProperty === void 0 ? void 0 : customProperty.id);
|
|
290
294
|
setCustomProperty();
|
|
291
295
|
setDeleteModal(false);
|
|
292
296
|
},
|