@k-int/stripes-kint-components 5.25.2 → 5.26.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 +19 -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 +54 -42
- 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/CustomProperties/Edit/CustomPropertiesListField.js +1 -1
- package/src/lib/SASQLookupComponent/README.md +1 -0
- package/src/lib/SASQLookupComponent/TableBody/README.md +15 -14
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +8 -3
- package/styles/TypeDown.css +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [5.26.0](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.25.3...v5.26.0) (2025-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Agreements/Licenses: Term / Suppl. property values disappear when other terms / optional properties of same category are deleted -- ERM-3813 ([37a70ac](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/37a70ac46b98146ca96f15cc39cf927bb32596a6))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add ability to choose view URL identifier in SASQRoute (and children) via `getNavigationIdentifier` -- refs ERM-3804 ([8356b97](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/8356b97488bba5220ed2cb81017149527e444068))
|
|
12
|
+
|
|
13
|
+
## [5.25.3](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.25.2...v5.25.3) (2025-09-16)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **Typedown:** Typedown styling ([bd364e3](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/bd364e3d6adcb5f4877949104290266d063747af))
|
|
19
|
+
|
|
1
20
|
## [5.25.2](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.25.1...v5.25.2) (2025-09-12)
|
|
2
21
|
|
|
3
22
|
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _mocks = require("@folio/stripes-erm-testing/jest/mocks");
|
|
4
4
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
|
+
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); }
|
|
5
10
|
jest.mock('@folio/stripes-components/lib/Icon', () => _mocks.mockStripesIcon);
|
|
6
|
-
module.exports = {
|
|
7
|
-
...jest.requireActual('@folio/stripes/components'),
|
|
11
|
+
module.exports = _objectSpread(_objectSpread({}, jest.requireActual('@folio/stripes/components')), {}, {
|
|
8
12
|
Icon: _mocks.mockStripesIcon,
|
|
9
13
|
LoadingView: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
10
14
|
children: "LoadingView"
|
|
@@ -12,4 +16,4 @@ module.exports = {
|
|
|
12
16
|
LoadingPane: () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
13
17
|
children: "LoadingPane"
|
|
14
18
|
})
|
|
15
|
-
};
|
|
19
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _mocks = require("@folio/stripes-erm-testing/jest/mocks");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
|
+
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); }
|
|
9
|
+
module.exports = _objectSpread(_objectSpread({}, jest.requireActual('@folio/stripes-core')), _mocks.mockStripesCore);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _mocks = require("@folio/stripes-erm-testing/jest/mocks");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
|
+
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); }
|
|
9
|
+
module.exports = _objectSpread(_objectSpread({}, jest.requireActual('@folio/stripes/smart-components')), _mocks.mockStripesSmartComponents);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _mocks = require("@folio/stripes-erm-testing/jest/mocks");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
|
+
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); }
|
|
9
|
+
module.exports = _objectSpread(_objectSpread({}, jest.requireActual('react-query')), _mocks.mockReactQuery);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _mocks = require("@folio/stripes-erm-testing/jest/mocks");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
8
|
+
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); } // FIXME currently since erm-testing exports TestForm using stripes-components, we have an issue
|
|
9
|
+
module.exports = _objectSpread(_objectSpread({}, jest.requireActual('react-router-dom')), _mocks.mockReactRouterDom);
|
|
@@ -11,8 +11,16 @@ var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
|
11
11
|
var _finalFormArrays = _interopRequireDefault(require("final-form-arrays"));
|
|
12
12
|
var _ActionListFieldArray = _interopRequireDefault(require("./ActionListFieldArray"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const _excluded = ["actionAssigner", "columnMapping", "contentData", "creatableFields", "createCallback", "defaultNewObject", "editableFields", "fieldComponents", "hideActionsColumn", "hideCreateButton", "intlKey", "intlNS", "label", "labelOverrides", "validateFields", "visibleFields"];
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
16
24
|
const propTypes = {
|
|
17
25
|
actionAssigner: _propTypes.default.func,
|
|
18
26
|
columnMapping: _propTypes.default.object,
|
|
@@ -33,28 +41,28 @@ const propTypes = {
|
|
|
33
41
|
};
|
|
34
42
|
const ActionList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
35
43
|
let {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
44
|
+
actionAssigner,
|
|
45
|
+
columnMapping,
|
|
46
|
+
contentData,
|
|
47
|
+
creatableFields = {},
|
|
48
|
+
createCallback,
|
|
49
|
+
defaultNewObject = {},
|
|
50
|
+
editableFields = {},
|
|
51
|
+
fieldComponents = {},
|
|
52
|
+
hideActionsColumn = false,
|
|
53
|
+
hideCreateButton,
|
|
54
|
+
intlKey: passedIntlKey,
|
|
55
|
+
intlNS: passedIntlNS,
|
|
56
|
+
label,
|
|
57
|
+
labelOverrides = {},
|
|
58
|
+
validateFields,
|
|
59
|
+
visibleFields
|
|
60
|
+
// Assume anything left over is to directly apply to the MCL
|
|
61
|
+
} = _ref,
|
|
62
|
+
mclProps = _objectWithoutProperties(_ref, _excluded);
|
|
63
|
+
const ActionListFieldArrayWithRef = alfaProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionListFieldArray.default, _objectSpread({
|
|
64
|
+
ref: ref
|
|
65
|
+
}, alfaProps));
|
|
58
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
59
67
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Form, {
|
|
60
68
|
enableReinitialize: true,
|
|
@@ -74,7 +82,7 @@ const ActionList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
74
82
|
onSubmit: e => {
|
|
75
83
|
e.preventDefault();
|
|
76
84
|
},
|
|
77
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
85
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, _objectSpread({
|
|
78
86
|
actionAssigner: actionAssigner,
|
|
79
87
|
columnMapping: columnMapping,
|
|
80
88
|
component: ActionListFieldArrayWithRef,
|
|
@@ -92,9 +100,8 @@ const ActionList = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
100
|
name: "contentData",
|
|
93
101
|
triggerFormSubmit: handleSubmit,
|
|
94
102
|
validateFields: validateFields,
|
|
95
|
-
visibleFields: visibleFields
|
|
96
|
-
|
|
97
|
-
})
|
|
103
|
+
visibleFields: visibleFields
|
|
104
|
+
}, mclProps))
|
|
98
105
|
});
|
|
99
106
|
}
|
|
100
107
|
})
|
|
@@ -13,8 +13,22 @@ var _components = require("@folio/stripes/components");
|
|
|
13
13
|
var _hooks = require("../hooks");
|
|
14
14
|
var _ActionListFieldArray = _interopRequireDefault(require("../../../styles/ActionListFieldArray.css"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["action"],
|
|
17
|
+
_excluded2 = ["actionAssigner", "columnMapping", "creatableFields", "createCallback", "defaultNewObject", "editableFields", "fields", "fieldComponents", "hideActionsColumn", "hideCreateButton", "intlKey", "intlNS", "label", "labelOverrides", "onRowClick", "validateFields", "visibleFields", "triggerFormSubmit"],
|
|
18
|
+
_excluded3 = ["actionListActions", "fieldName", "fieldIndex", "_isNewActionListRow"],
|
|
19
|
+
_excluded4 = ["actionListActions", "fieldName", "fieldIndex", "_isNewActionListRow"],
|
|
20
|
+
_excluded5 = ["actionListActions"],
|
|
21
|
+
_excluded6 = ["formatter"],
|
|
22
|
+
_excluded7 = ["actionListActions"];
|
|
16
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
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; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
18
32
|
const EDITING_ACTIONS_WIDTH = 25;
|
|
19
33
|
const NON_EDITING_ACTIONS_WIDTH = 20;
|
|
20
34
|
const TOTAL_WIDTH = 100;
|
|
@@ -42,23 +56,23 @@ const propTypes = {
|
|
|
42
56
|
|
|
43
57
|
// This needs to be outside of the main component for forwardRef to work properly it seems.
|
|
44
58
|
const ActionTrigger = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
59
|
+
var _action$label;
|
|
45
60
|
let {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
action
|
|
62
|
+
} = _ref,
|
|
63
|
+
actionTriggerProps = _objectWithoutProperties(_ref, _excluded);
|
|
49
64
|
if (action.icon) {
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, _objectSpread({
|
|
51
66
|
ref: ref,
|
|
52
|
-
icon: action.icon
|
|
53
|
-
|
|
54
|
-
});
|
|
67
|
+
icon: action.icon
|
|
68
|
+
}, actionTriggerProps));
|
|
55
69
|
}
|
|
56
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, _objectSpread(_objectSpread({
|
|
57
71
|
ref: ref,
|
|
58
|
-
marginBottom0: true
|
|
59
|
-
|
|
60
|
-
children: action.label
|
|
61
|
-
});
|
|
72
|
+
marginBottom0: true
|
|
73
|
+
}, actionTriggerProps), {}, {
|
|
74
|
+
children: (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : action.name
|
|
75
|
+
}));
|
|
62
76
|
});
|
|
63
77
|
ActionTrigger.propTypes = {
|
|
64
78
|
action: _propTypes.default.shape({
|
|
@@ -69,27 +83,29 @@ ActionTrigger.propTypes = {
|
|
|
69
83
|
};
|
|
70
84
|
const NEW_ROW = 'NEW_ROW';
|
|
71
85
|
const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
86
|
+
var _fields$value$filter$, _fields$value;
|
|
72
87
|
let {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
actionAssigner,
|
|
89
|
+
columnMapping,
|
|
90
|
+
creatableFields,
|
|
91
|
+
createCallback,
|
|
92
|
+
defaultNewObject,
|
|
93
|
+
editableFields,
|
|
94
|
+
fields,
|
|
95
|
+
fieldComponents,
|
|
96
|
+
hideActionsColumn = false,
|
|
97
|
+
hideCreateButton = false,
|
|
98
|
+
intlKey: passedIntlKey,
|
|
99
|
+
intlNS: passedIntlNS,
|
|
100
|
+
label,
|
|
101
|
+
labelOverrides = {},
|
|
102
|
+
onRowClick,
|
|
103
|
+
validateFields,
|
|
104
|
+
visibleFields,
|
|
105
|
+
triggerFormSubmit
|
|
106
|
+
// Assume anything left over is to directly apply to the MCL
|
|
107
|
+
} = _ref2,
|
|
108
|
+
mclProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
93
109
|
// Grab finalForm functions/values from form hooks
|
|
94
110
|
const {
|
|
95
111
|
change
|
|
@@ -107,7 +123,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
107
123
|
null for no field, string id if we are editing an existing field and
|
|
108
124
|
'NEW_ROW' for a new row
|
|
109
125
|
*/
|
|
110
|
-
const [editing, setEditing] = (0, _react.useState)((fields
|
|
126
|
+
const [editing, setEditing] = (0, _react.useState)(((_fields$value$filter$ = fields === null || fields === void 0 || (_fields$value = fields.value) === null || _fields$value === void 0 || (_fields$value = _fields$value.filter(f => f._isNewActionListRow)) === null || _fields$value === void 0 ? void 0 : _fields$value.length) !== null && _fields$value$filter$ !== void 0 ? _fields$value$filter$ : 0) > 0 ? NEW_ROW : undefined);
|
|
111
127
|
const toggleEditing = (0, _react.useCallback)(id => {
|
|
112
128
|
if (editing) {
|
|
113
129
|
setEditing();
|
|
@@ -118,43 +134,46 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
118
134
|
|
|
119
135
|
// Ensure editing doesn't get stuck in "NEW_ROW" state;
|
|
120
136
|
(0, _react.useEffect)(() => {
|
|
121
|
-
|
|
137
|
+
var _fields$value$filter$2, _fields$value2;
|
|
138
|
+
if (editing === NEW_ROW && ((_fields$value$filter$2 = fields === null || fields === void 0 || (_fields$value2 = fields.value) === null || _fields$value2 === void 0 || (_fields$value2 = _fields$value2.filter(f => f._isNewActionListRow)) === null || _fields$value2 === void 0 ? void 0 : _fields$value2.length) !== null && _fields$value$filter$2 !== void 0 ? _fields$value$filter$2 : 0) === 0) {
|
|
122
139
|
setEditing();
|
|
123
140
|
}
|
|
124
|
-
}, [editing, fields
|
|
141
|
+
}, [editing, fields === null || fields === void 0 ? void 0 : fields.value]);
|
|
125
142
|
const handleSave = index => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
var _actionAssigner;
|
|
144
|
+
const _fields$value$index = fields.value[index],
|
|
145
|
+
{
|
|
146
|
+
actionListActions: _a,
|
|
147
|
+
fieldName: _fn,
|
|
148
|
+
fieldIndex: _fi,
|
|
149
|
+
_isNewActionListRow: _inalr
|
|
150
|
+
} = _fields$value$index,
|
|
151
|
+
rowData = _objectWithoutProperties(_fields$value$index, _excluded3);
|
|
133
152
|
|
|
134
153
|
// Find "edit" entry in actionAssigner
|
|
135
|
-
const editCallback = actionAssigner(rowData)
|
|
154
|
+
const editCallback = (_actionAssigner = actionAssigner(rowData)) === null || _actionAssigner === void 0 || (_actionAssigner = _actionAssigner.find(act => act.name === 'edit')) === null || _actionAssigner === void 0 ? void 0 : _actionAssigner.callback;
|
|
136
155
|
if (editCallback) {
|
|
137
156
|
editCallback(rowData);
|
|
138
157
|
}
|
|
139
158
|
};
|
|
140
159
|
const handleCreate = index => {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
const _fields$value$index2 = fields.value[index],
|
|
161
|
+
{
|
|
162
|
+
actionListActions: _a,
|
|
163
|
+
fieldName: _fn,
|
|
164
|
+
fieldIndex: _fi,
|
|
165
|
+
_isNewActionListRow: _inalr
|
|
166
|
+
} = _fields$value$index2,
|
|
167
|
+
rowData = _objectWithoutProperties(_fields$value$index2, _excluded4);
|
|
148
168
|
if (createCallback) {
|
|
149
169
|
createCallback(rowData);
|
|
150
170
|
}
|
|
151
171
|
};
|
|
152
172
|
const handleClickCreate = (0, _react.useCallback)(() => {
|
|
153
173
|
toggleEditing(NEW_ROW);
|
|
154
|
-
fields.unshift({
|
|
155
|
-
...defaultNewObject,
|
|
174
|
+
fields.unshift(_objectSpread(_objectSpread({}, defaultNewObject), {}, {
|
|
156
175
|
_isNewActionListRow: true
|
|
157
|
-
});
|
|
176
|
+
}));
|
|
158
177
|
}, [defaultNewObject, fields, toggleEditing]);
|
|
159
178
|
|
|
160
179
|
// Way to go into create mode from external component, and way to tell internal editing state
|
|
@@ -168,22 +187,22 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
168
187
|
const widthsObject = {};
|
|
169
188
|
visibleFields.forEach(f => {
|
|
170
189
|
if (f !== 'actionListActions') {
|
|
171
|
-
widthsObject[f] =
|
|
190
|
+
widthsObject[f] = "".concat(staticWidth, "%");
|
|
172
191
|
}
|
|
173
192
|
});
|
|
174
|
-
widthsObject.actionListActions = editing ?
|
|
193
|
+
widthsObject.actionListActions = editing ? "".concat(EDITING_ACTIONS_WIDTH, "%") : "".concat(NON_EDITING_ACTIONS_WIDTH, "%");
|
|
175
194
|
return widthsObject;
|
|
176
195
|
};
|
|
177
196
|
const renderActionButtons = data => {
|
|
178
|
-
const fieldName =
|
|
197
|
+
const fieldName = "contentData[".concat(data.rowIndex, "]");
|
|
179
198
|
const {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
actionListActions: actions
|
|
200
|
+
} = data,
|
|
201
|
+
rest = _objectWithoutProperties(data, _excluded5);
|
|
183
202
|
if (data.id === editing || !data.id && editing === NEW_ROW) {
|
|
184
203
|
// Render the save/cancel buttons
|
|
185
204
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
186
|
-
id:
|
|
205
|
+
id: "action-button-parent-".concat(data.rowIndex + 1),
|
|
187
206
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
188
207
|
buttonStyle: "primary",
|
|
189
208
|
disabled: hasValidationErrors || submitting || pristine,
|
|
@@ -203,9 +222,9 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
203
222
|
type: "submit",
|
|
204
223
|
children: kintIntl.formatKintMessage({
|
|
205
224
|
id: 'save',
|
|
206
|
-
overrideValue: labelOverrides
|
|
225
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.save
|
|
207
226
|
})
|
|
208
|
-
},
|
|
227
|
+
}, "save[".concat(data.rowIndex, "]")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
209
228
|
"data-type-button": "cancel",
|
|
210
229
|
marginBottom0: true,
|
|
211
230
|
onClick: () => {
|
|
@@ -219,14 +238,14 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
219
238
|
},
|
|
220
239
|
children: kintIntl.formatKintMessage({
|
|
221
240
|
id: 'cancel',
|
|
222
|
-
overrideValue: labelOverrides
|
|
241
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.cancel
|
|
223
242
|
})
|
|
224
|
-
},
|
|
243
|
+
}, "cancel[".concat(data.rowIndex, "]"))]
|
|
225
244
|
});
|
|
226
245
|
}
|
|
227
246
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
228
|
-
id:
|
|
229
|
-
children: actions
|
|
247
|
+
id: "action-button-parent-".concat(data.rowIndex + 1),
|
|
248
|
+
children: actions === null || actions === void 0 ? void 0 : actions.map(action => {
|
|
230
249
|
let actionFunction;
|
|
231
250
|
if (action.callback) {
|
|
232
251
|
actionFunction = () => action.callback(rest);
|
|
@@ -236,25 +255,25 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
236
255
|
if (action.name === 'edit') {
|
|
237
256
|
actionFunction = () => toggleEditing(data.id);
|
|
238
257
|
}
|
|
239
|
-
let ariaLabel =
|
|
240
|
-
if (action
|
|
258
|
+
let ariaLabel = "action-".concat(action.name, "[").concat(data.rowIndex, "]");
|
|
259
|
+
if (action !== null && action !== void 0 && action.ariaLabel) {
|
|
241
260
|
if (typeof action.ariaLabel === 'function') {
|
|
242
261
|
ariaLabel = action.ariaLabel(data);
|
|
243
262
|
} else if (typeof action.ariaLabel === 'string') {
|
|
244
263
|
ariaLabel = action.ariaLabel;
|
|
245
264
|
} else {
|
|
246
|
-
throw new Error(
|
|
265
|
+
throw new Error("Provided ariaLabel for action \"".concat(action.name, "\" must be a function or a string."));
|
|
247
266
|
}
|
|
248
267
|
}
|
|
249
268
|
let tooltip;
|
|
250
269
|
let tooltipSub;
|
|
251
|
-
if (action
|
|
270
|
+
if (action !== null && action !== void 0 && action.tooltip) {
|
|
252
271
|
if (typeof action.tooltip === 'function') {
|
|
253
272
|
tooltip = action.tooltip(data);
|
|
254
273
|
} else {
|
|
255
274
|
tooltip = action.tooltip;
|
|
256
275
|
}
|
|
257
|
-
if (action
|
|
276
|
+
if (action !== null && action !== void 0 && action.tooltipSub) {
|
|
258
277
|
if (typeof action.tooltipSub === 'function') {
|
|
259
278
|
tooltipSub = action.tooltipSub(data);
|
|
260
279
|
} else {
|
|
@@ -266,7 +285,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
266
285
|
// If a tooltip is declared, render that around the actionButton
|
|
267
286
|
if (tooltip) {
|
|
268
287
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
269
|
-
id:
|
|
288
|
+
id: "action-".concat(action.name, "[").concat(data.rowIndex, "]-tooltip"),
|
|
270
289
|
sub: tooltipSub,
|
|
271
290
|
text: tooltip,
|
|
272
291
|
children: _ref3 => {
|
|
@@ -288,7 +307,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
288
307
|
return null;
|
|
289
308
|
},
|
|
290
309
|
to: action.to
|
|
291
|
-
},
|
|
310
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
292
311
|
}
|
|
293
312
|
});
|
|
294
313
|
}
|
|
@@ -306,7 +325,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
306
325
|
return null;
|
|
307
326
|
},
|
|
308
327
|
to: action.to
|
|
309
|
-
},
|
|
328
|
+
}, "action-".concat(action.name, "[").concat(data.rowIndex, "]"));
|
|
310
329
|
})
|
|
311
330
|
});
|
|
312
331
|
};
|
|
@@ -315,17 +334,16 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
315
334
|
// Fetch the content from the field Values
|
|
316
335
|
const cd = (0, _cloneDeep.default)((0, _get.default)(values, fieldName));
|
|
317
336
|
cd.actionListActions = actionAssigner(cd);
|
|
318
|
-
return {
|
|
319
|
-
...cd,
|
|
337
|
+
return _objectSpread(_objectSpread({}, cd), {}, {
|
|
320
338
|
fieldName,
|
|
321
339
|
fieldIndex
|
|
322
|
-
};
|
|
340
|
+
});
|
|
323
341
|
});
|
|
324
342
|
};
|
|
325
343
|
const {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
344
|
+
formatter
|
|
345
|
+
} = mclProps,
|
|
346
|
+
restOfMclProps = _objectWithoutProperties(mclProps, _excluded6); // Destructure formatter part of mclProps
|
|
329
347
|
|
|
330
348
|
const fieldAwareFormatter = () => {
|
|
331
349
|
const returnObj = {};
|
|
@@ -339,16 +357,17 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
339
357
|
const editingRow = cd.id === editing || !cd.id;
|
|
340
358
|
|
|
341
359
|
// Default to the passed formatter values
|
|
342
|
-
let returnValue = formatter
|
|
360
|
+
let returnValue = formatter !== null && formatter !== void 0 && formatter[key] ? formatter[key](cd) : cd[key];
|
|
343
361
|
|
|
344
362
|
// If editing, replace values with fields
|
|
345
363
|
if (editingRow) {
|
|
364
|
+
var _editableFields$key, _creatableFields$key;
|
|
346
365
|
/*
|
|
347
366
|
Check if the property is a visible field.
|
|
348
367
|
If it is not then we don't allow editing in this component.
|
|
349
368
|
*/
|
|
350
|
-
const editFunction = editableFields[key]
|
|
351
|
-
const createFunction = creatableFields[key]
|
|
369
|
+
const editFunction = (_editableFields$key = editableFields[key]) !== null && _editableFields$key !== void 0 ? _editableFields$key : () => true;
|
|
370
|
+
const createFunction = (_creatableFields$key = creatableFields[key]) !== null && _creatableFields$key !== void 0 ? _creatableFields$key : () => true;
|
|
352
371
|
/*
|
|
353
372
|
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
354
373
|
If it is not a new row, then we run the editableField function with the data,
|
|
@@ -359,12 +378,12 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
359
378
|
if (!cd.id && createFunction(cd) || !!cd.id && editFunction(cd)) {
|
|
360
379
|
const passedObject = {
|
|
361
380
|
allValues: values,
|
|
362
|
-
index: cd
|
|
381
|
+
index: cd === null || cd === void 0 ? void 0 : cd.fieldIndex,
|
|
363
382
|
key,
|
|
364
|
-
name:
|
|
383
|
+
name: "".concat(cd.fieldName, ".").concat(key),
|
|
365
384
|
rowFieldName: cd.fieldName
|
|
366
385
|
};
|
|
367
|
-
const validateFunction = validateFields
|
|
386
|
+
const validateFunction = validateFields !== null && validateFields !== void 0 && validateFields[key] ? validateFields === null || validateFields === void 0 ? void 0 : validateFields[key](passedObject) : null;
|
|
368
387
|
returnValue = fieldComponents[key] ? fieldComponents[key](passedObject) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
369
388
|
ariaLabel: key // TODO at the moment the only way to override this is passing in an entire fieldComponent.
|
|
370
389
|
,
|
|
@@ -372,7 +391,7 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
372
391
|
,
|
|
373
392
|
component: _components.TextField,
|
|
374
393
|
marginBottom0: true,
|
|
375
|
-
name:
|
|
394
|
+
name: "".concat(cd.fieldName, ".").concat(key),
|
|
376
395
|
parse: v => v,
|
|
377
396
|
validate: validateFunction
|
|
378
397
|
});
|
|
@@ -396,38 +415,35 @@ const ActionListFieldArray = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
396
415
|
onClick: handleClickCreate,
|
|
397
416
|
children: kintIntl.formatKintMessage({
|
|
398
417
|
id: 'new',
|
|
399
|
-
overrideValue: labelOverrides
|
|
418
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.new
|
|
400
419
|
})
|
|
401
420
|
})]
|
|
402
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
403
|
-
columnMapping: {
|
|
404
|
-
...columnMapping,
|
|
421
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
422
|
+
columnMapping: _objectSpread(_objectSpread({}, columnMapping), {}, {
|
|
405
423
|
actionListActions: kintIntl.formatKintMessage({
|
|
406
424
|
id: 'actions',
|
|
407
|
-
overrideValue: labelOverrides
|
|
425
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.actions
|
|
408
426
|
})
|
|
409
|
-
},
|
|
427
|
+
}),
|
|
410
428
|
columnWidths: getColumnWidths(),
|
|
411
429
|
contentData: assignActions(),
|
|
412
|
-
formatter: {
|
|
413
|
-
actionListActions: renderActionButtons
|
|
414
|
-
|
|
415
|
-
},
|
|
430
|
+
formatter: _objectSpread({
|
|
431
|
+
actionListActions: renderActionButtons
|
|
432
|
+
}, fieldAwareFormatter()),
|
|
416
433
|
interactive: !!onRowClick,
|
|
417
434
|
onRowClick: onRowClick ? (e, row) => {
|
|
418
435
|
// Make sure we ONLY fire row click from row, and not from action buttons.
|
|
419
436
|
const targetIsAction = e.target.closest('[id^=action-button-parent]') !== null;
|
|
420
437
|
if (!targetIsAction) {
|
|
421
438
|
const {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
439
|
+
actionListActions: _ala
|
|
440
|
+
} = row,
|
|
441
|
+
rowWithoutActions = _objectWithoutProperties(row, _excluded7);
|
|
425
442
|
onRowClick(e, rowWithoutActions);
|
|
426
443
|
}
|
|
427
444
|
} : null,
|
|
428
|
-
visibleColumns: !hideActionsColumn || !!editing ? [...visibleFields, 'actionListActions'] : visibleFields
|
|
429
|
-
|
|
430
|
-
})]
|
|
445
|
+
visibleColumns: !hideActionsColumn || !!editing ? [...visibleFields, 'actionListActions'] : visibleFields
|
|
446
|
+
}, restOfMclProps))]
|
|
431
447
|
});
|
|
432
448
|
});
|
|
433
449
|
ActionListFieldArray.propTypes = propTypes;
|