@k-int/stripes-kint-components 2.6.4 → 2.6.5
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 +3 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +3 -1
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +5 -5
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +7 -7
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +2 -2
- package/package.json +1 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +1 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +2 -3
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +6 -6
- package/src/lib/CustomProperties/Config/CustomPropertyView.js +1 -1
- package/src/lib/CustomProperties/Config/README.md +35 -0
- package/translations/stripes-kint-components/en.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -175,7 +175,9 @@ var CustomPropertiesLookup = function CustomPropertiesLookup(_ref) {
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
type: function type(data) {
|
|
178
|
-
|
|
178
|
+
var _labelOverrides$data$;
|
|
179
|
+
|
|
180
|
+
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
181
|
id: "stripes-kint-components.customProperties.type.".concat(data === null || data === void 0 ? void 0 : data.type)
|
|
180
182
|
});
|
|
181
183
|
},
|
|
@@ -64,7 +64,7 @@ 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,
|
|
@@ -326,14 +326,14 @@ var CustomPropertiesSettings = function CustomPropertiesSettings(_ref) {
|
|
|
326
326
|
})
|
|
327
327
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ConfirmationModal, {
|
|
328
328
|
buttonStyle: "danger",
|
|
329
|
-
confirmLabel:
|
|
330
|
-
id: "stripes-kint-components.
|
|
329
|
+
confirmLabel: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
330
|
+
id: "stripes-kint-components.delete"
|
|
331
331
|
}),
|
|
332
|
-
heading: (_labelOverrides$
|
|
332
|
+
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
333
|
id: "stripes-kint-components.customProperties.delete.confirmHeading"
|
|
334
334
|
}),
|
|
335
335
|
id: "delete-job-confirmation",
|
|
336
|
-
message:
|
|
336
|
+
message: labelOverrides !== null && labelOverrides !== void 0 && labelOverrides.confirmMessage ? labelOverrides.confirmMessage(customProperty) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
337
337
|
id: "stripes-kint-components.customProperties.delete.confirmMessage",
|
|
338
338
|
values: {
|
|
339
339
|
name: customProperty === null || customProperty === void 0 ? void 0 : customProperty.name
|
|
@@ -44,7 +44,7 @@ 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,
|
|
@@ -124,32 +124,32 @@ var CustomPropertyForm = function CustomPropertyForm(_ref) {
|
|
|
124
124
|
label: '',
|
|
125
125
|
value: ''
|
|
126
126
|
}, {
|
|
127
|
-
label: intl.formatMessage({
|
|
127
|
+
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
128
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.DECIMAL_CLASS_NAME)
|
|
129
129
|
}),
|
|
130
130
|
value: _customProperties.DECIMAL_CLASS_NAME
|
|
131
131
|
}, {
|
|
132
|
-
label: intl.formatMessage({
|
|
132
|
+
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
133
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.INTEGER_CLASS_NAME)
|
|
134
134
|
}),
|
|
135
135
|
value: _customProperties.INTEGER_CLASS_NAME
|
|
136
136
|
}, {
|
|
137
|
-
label: intl.formatMessage({
|
|
137
|
+
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
138
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.TEXT_CLASS_NAME)
|
|
139
139
|
}),
|
|
140
140
|
value: _customProperties.TEXT_CLASS_NAME
|
|
141
141
|
}, {
|
|
142
|
-
label: intl.formatMessage({
|
|
142
|
+
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
143
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.REFDATA_CLASS_NAME)
|
|
144
144
|
}),
|
|
145
145
|
value: _customProperties.REFDATA_CLASS_NAME
|
|
146
146
|
}, {
|
|
147
|
-
label: intl.formatMessage({
|
|
147
|
+
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
148
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.MULTI_REFDATA_CLASS_NAME)
|
|
149
149
|
}),
|
|
150
150
|
value: _customProperties.MULTI_REFDATA_CLASS_NAME
|
|
151
151
|
}, {
|
|
152
|
-
label: intl.formatMessage({
|
|
152
|
+
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
153
|
id: "stripes-kint-components.customProperties.type.".concat(_customProperties.DATE_CLASS_NAME)
|
|
154
154
|
}),
|
|
155
155
|
value: _customProperties.DATE_CLASS_NAME
|
|
@@ -19,7 +19,7 @@ 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,
|
|
@@ -124,7 +124,7 @@ var CustomPropertyView = function CustomPropertyView(_ref) {
|
|
|
124
124
|
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
125
|
id: "stripes-kint-components.customProperties.type"
|
|
126
126
|
}),
|
|
127
|
-
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
127
|
+
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
128
|
id: "stripes-kint-components.customProperties.type.".concat(customProperty === null || customProperty === void 0 ? void 0 : customProperty.type)
|
|
129
129
|
})
|
|
130
130
|
})
|
package/package.json
CHANGED
|
@@ -242,8 +242,7 @@ const CustomPropertiesSettings = ({
|
|
|
242
242
|
<ConfirmationModal
|
|
243
243
|
buttonStyle="danger"
|
|
244
244
|
confirmLabel={
|
|
245
|
-
|
|
246
|
-
<FormattedMessage id="stripes-kint-components.customProperties.delete.confirmLabel" />
|
|
245
|
+
<FormattedMessage id="stripes-kint-components.delete" />
|
|
247
246
|
}
|
|
248
247
|
heading={
|
|
249
248
|
labelOverrides?.confirmHeading ??
|
|
@@ -251,7 +250,7 @@ const CustomPropertiesSettings = ({
|
|
|
251
250
|
}
|
|
252
251
|
id="delete-job-confirmation"
|
|
253
252
|
message={
|
|
254
|
-
labelOverrides?.confirmMessage
|
|
253
|
+
labelOverrides?.confirmMessage ? labelOverrides.confirmMessage(customProperty) :
|
|
255
254
|
<FormattedMessage id="stripes-kint-components.customProperties.delete.confirmMessage" values={{ name: customProperty?.name }} />
|
|
256
255
|
}
|
|
257
256
|
onCancel={() => setDeleteModal(false)}
|
|
@@ -70,37 +70,37 @@ const CustomPropertyForm = ({
|
|
|
70
70
|
dataOptions={[
|
|
71
71
|
{ label: '', value: '' },
|
|
72
72
|
{
|
|
73
|
-
label: intl.formatMessage({
|
|
73
|
+
label: labelOverrides?.[DECIMAL_CLASS_NAME] ?? intl.formatMessage({
|
|
74
74
|
id: `stripes-kint-components.customProperties.type.${DECIMAL_CLASS_NAME}`,
|
|
75
75
|
}),
|
|
76
76
|
value: DECIMAL_CLASS_NAME,
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
label: intl.formatMessage({
|
|
79
|
+
label: labelOverrides?.[INTEGER_CLASS_NAME] ?? intl.formatMessage({
|
|
80
80
|
id: `stripes-kint-components.customProperties.type.${INTEGER_CLASS_NAME}`,
|
|
81
81
|
}),
|
|
82
82
|
value: INTEGER_CLASS_NAME,
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
label: intl.formatMessage({
|
|
85
|
+
label: labelOverrides?.[TEXT_CLASS_NAME] ?? intl.formatMessage({
|
|
86
86
|
id: `stripes-kint-components.customProperties.type.${TEXT_CLASS_NAME}`,
|
|
87
87
|
}),
|
|
88
88
|
value: TEXT_CLASS_NAME,
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
label: intl.formatMessage({
|
|
91
|
+
label: labelOverrides?.[REFDATA_CLASS_NAME] ?? intl.formatMessage({
|
|
92
92
|
id: `stripes-kint-components.customProperties.type.${REFDATA_CLASS_NAME}`,
|
|
93
93
|
}),
|
|
94
94
|
value: REFDATA_CLASS_NAME,
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
|
-
label: intl.formatMessage({
|
|
97
|
+
label: labelOverrides?.[MULTI_REFDATA_CLASS_NAME] ?? intl.formatMessage({
|
|
98
98
|
id: `stripes-kint-components.customProperties.type.${MULTI_REFDATA_CLASS_NAME}`,
|
|
99
99
|
}),
|
|
100
100
|
value: MULTI_REFDATA_CLASS_NAME,
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
|
-
label: intl.formatMessage({
|
|
103
|
+
label: labelOverrides?.[DATE_CLASS_NAME] ?? intl.formatMessage({
|
|
104
104
|
id: `stripes-kint-components.customProperties.type.${DATE_CLASS_NAME}`,
|
|
105
105
|
}),
|
|
106
106
|
value: DATE_CLASS_NAME,
|
|
@@ -148,7 +148,7 @@ const CustomPropertyView = ({
|
|
|
148
148
|
labelOverrides?.type ??
|
|
149
149
|
<FormattedMessage id="stripes-kint-components.customProperties.type" />
|
|
150
150
|
}
|
|
151
|
-
value={<FormattedMessage id={`stripes-kint-components.customProperties.type.${customProperty?.type}`} />}
|
|
151
|
+
value={labelOverrides?.[customProperty?.type] ?? <FormattedMessage id={`stripes-kint-components.customProperties.type.${customProperty?.type}`} />}
|
|
152
152
|
/>
|
|
153
153
|
)}
|
|
154
154
|
</Col>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# CustomProperties Config components
|
|
2
|
+
|
|
3
|
+
## Motivation
|
|
4
|
+
These components, namely CustomPropertiesSettings, and its constituent components CustomPropertiesLookup, CustomPropertiesForm and CustomPropertyView are designed for use in a FOLIO settings context, as a way to search through, view, create and edit custom properties.
|
|
5
|
+
|
|
6
|
+
## LabelOverrides
|
|
7
|
+
These components can all be provided with a prop `labelOverrides` which allows the overriding of certain translation defaults provided by kint-components. These values must take a certain shape, which differs by translation key. A table is provided below.
|
|
8
|
+
|
|
9
|
+
Key | Type | Description | default
|
|
10
|
+
--- | --- | --- | ---
|
|
11
|
+
category | node/string | Override for the display of field "category" | "Category" |
|
|
12
|
+
confirmHeading | node/string | Override for the title of the confirmation modal which pops up on attempting to delete a custom property | "Delete custom property" |
|
|
13
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyDate (See customPropertyConstants) | string | Override for the "Date" type custom property display. Must be string in order to support display within the Select. | "Date" |
|
|
14
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyDecimal (See customPropertyConstants) | string | Override for the "Decimal" type custom property display. Must be string in order to support display within the Select. | "Decimal" |
|
|
15
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyInteger (See customPropertyConstants) | string | Override for the "Integer" type custom property display. Must be string in order to support display within the Select. | "Integer" |
|
|
16
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyMultiRefdata (See customPropertyConstants) | string | Override for the "MultiRefdata" type custom property display. Must be string in order to support display within the Select. | "Refdata (multi-select)" |
|
|
17
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata (See customPropertyConstants) | string | Override for the "Refdata" type custom property display. Must be string in order to support display within the Select. | "Refdata" |
|
|
18
|
+
com.k_int.web.toolkit.custprops.types.CustomPropertyText (See customPropertyConstants) | string | Override for the "Text" type custom property display. Must be string in order to support display within the Select. | "Text" |
|
|
19
|
+
confirmMessage | function | Override for the message displayed in the confirmation modal on trying to delete a custom property. Accepts a function which will be provided the custom property object in question. | "Custom property <strong>{name}</strong> will be <strong>deleted</strong>." |
|
|
20
|
+
ctx | node/string | Override for the display of field "ctx" | "Context" |
|
|
21
|
+
deleteError | function | Override for the default callout message shown when a custom property fails to delete. Accepts a function to which it will provide the error message and the customProperty in question. | "<strong>Error: {label}</strong> was not deleted. {error}" |
|
|
22
|
+
defaultVisibility | node/string | Override for the display of field "defaultVisibility" | "Default visibility" |
|
|
23
|
+
description | node/string | Override for the display of field "description" | "Description" |
|
|
24
|
+
label | node/string | Override for the display of field "label" | "Label" |
|
|
25
|
+
modalTitleEdit | node/string | Override for the modal header on editing a custom property | "New custom property" |
|
|
26
|
+
modalTitleNew | node/string | Override for the modal header on attempting to create a custom property | "Edit custom property" |
|
|
27
|
+
name | node/string | Override for the display of field "name" | "Name" |
|
|
28
|
+
paneTitle | node/string | Override for the pane title displayed in the main lookup section. | "Custom properties" |
|
|
29
|
+
primary | node/string | Override for the display of field "primary" | "Primary" |
|
|
30
|
+
primaryRetired | node/string | Override for the warning message on validation, preventing a custom property being set both as primary AND as retired | "A custom property cannot be both primary and retired" |
|
|
31
|
+
retired | node/string | Override for the display of field "retired" | "Retired" |
|
|
32
|
+
searchAriaLabel | string | Override for the aria label provided by the search field in the main custom property lookup section | 'custom-property-search-field' |
|
|
33
|
+
type | node/string | Override for the display of field "type" | "Type" |
|
|
34
|
+
viewPaneTitle | node/string/function | Label override for the title of the custom property view pane once one has been selected. This override accepts any shape, if a function is provided it will provide the customProperty and expect a string/node in return: `(customProperty) => ("${customProperty.name}-example")` | customProperty label if exists, falls back to customProperty name |
|
|
35
|
+
weight | node/string | Override for the display of field "weight" | ""Order weight" |
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyLocalDate": "Date",
|
|
73
73
|
"customProperties.type.com.k_int.web.toolkit.custprops.types.CustomPropertyMultiRefdata": "Refdata (multi-select)",
|
|
74
74
|
|
|
75
|
-
"customProperties.delete.confirmLabel": "Delete",
|
|
76
75
|
"customProperties.delete.confirmHeading": "Delete custom property",
|
|
77
76
|
"customProperties.delete.confirmMessage": "Custom property <strong>{name}</strong> will be <strong>deleted</strong>.",
|
|
78
77
|
"customPropertiesSettings.deleteCustomProperty.errorMessage": "<strong>Error: {label}</strong> was not deleted. {error}",
|