@beinformed/ui 1.12.2 → 1.13.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 +31 -0
- package/esm/builder/mergeLayoutHintConfigurations.js +3 -3
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/LayoutHintConfig.js +9 -0
- package/esm/constants/LayoutHintConfig.js.map +1 -1
- package/esm/constants/LayoutHints.js +5 -0
- package/esm/constants/LayoutHints.js.map +1 -1
- package/esm/constants/Settings.js +2 -1
- package/esm/constants/Settings.js.map +1 -1
- package/esm/exceptions/ConfigurationException.js +2 -1
- package/esm/exceptions/ConfigurationException.js.map +1 -1
- package/esm/exceptions/FetchException.js +4 -3
- package/esm/exceptions/FetchException.js.map +1 -1
- package/esm/exceptions/IllegalArgumentException.js +2 -1
- package/esm/exceptions/IllegalArgumentException.js.map +1 -1
- package/esm/exceptions/IllegalReturnException.js +2 -1
- package/esm/exceptions/IllegalReturnException.js.map +1 -1
- package/esm/exceptions/IllegalStateException.js +2 -1
- package/esm/exceptions/IllegalStateException.js.map +1 -1
- package/esm/exceptions/JsonParseException.js +2 -1
- package/esm/exceptions/JsonParseException.js.map +1 -1
- package/esm/exceptions/MissingPropertyException.js +2 -1
- package/esm/exceptions/MissingPropertyException.js.map +1 -1
- package/esm/exceptions/NetworkException.js +2 -1
- package/esm/exceptions/NetworkException.js.map +1 -1
- package/esm/exceptions/NotAllowedUriException.js +2 -1
- package/esm/exceptions/NotAllowedUriException.js.map +1 -1
- package/esm/exceptions/NotFoundException.js +2 -1
- package/esm/exceptions/NotFoundException.js.map +1 -1
- package/esm/exceptions/ServerRequestException.js +2 -1
- package/esm/exceptions/ServerRequestException.js.map +1 -1
- package/esm/exceptions/ThemePropertyException.js +2 -1
- package/esm/exceptions/ThemePropertyException.js.map +1 -1
- package/esm/exceptions/TimeoutException.js +2 -1
- package/esm/exceptions/TimeoutException.js.map +1 -1
- package/esm/exceptions/UnauthorizedException.js +2 -1
- package/esm/exceptions/UnauthorizedException.js.map +1 -1
- package/esm/exceptions/UnsupportedOperationException.js +2 -1
- package/esm/exceptions/UnsupportedOperationException.js.map +1 -1
- package/esm/hooks/useContent.js +2 -2
- package/esm/hooks/useContent.js.map +1 -1
- package/esm/hooks/useDeepCompareEffect.js +2 -1
- package/esm/hooks/useDeepCompareEffect.js.map +1 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/hooks/useModal.js +2 -2
- package/esm/hooks/useModal.js.map +1 -1
- package/esm/hooks/useModularUI.js +0 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useProgressIndicator.js +2 -2
- package/esm/i18n/Locale.js +11 -4
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/i18n/Locales.js +2 -2
- package/esm/i18n/Message.js +2 -2
- package/esm/i18n/languages.js +2 -1
- package/esm/i18n/languages.js.map +1 -1
- package/esm/models/attributes/AttributeCollection.js +2 -2
- package/esm/models/attributes/AttributeContent.js +2 -2
- package/esm/models/attributes/AttributeDataHelper.js +2 -2
- package/esm/models/attributes/BooleanAttributeModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js +2 -2
- package/esm/models/attributes/CompositeAttributeChildCollection.js +2 -2
- package/esm/models/attributes/DatetimeAttributeModel.js +7 -3
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/attributes/_createAttribute.js +2 -2
- package/esm/models/base/ResourceModel.js +2 -2
- package/esm/models/caseview/CaseViewModel.js +2 -1
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -2
- package/esm/models/concepts/SourceReferenceModel.js +2 -2
- package/esm/models/content/ContentTOCModel.js +2 -2
- package/esm/models/filters/AssignmentFilterModel.js +2 -2
- package/esm/models/filters/BaseFilterModel.js +2 -2
- package/esm/models/filters/ConceptIndexFilterModel.js +2 -1
- package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/esm/models/filters/FilterCollection.js +2 -2
- package/esm/models/filters/FilterModel.js +2 -1
- package/esm/models/filters/FilterModel.js.map +1 -1
- package/esm/models/form/FormModel.js +28 -4
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +2 -2
- package/esm/models/grouping/GroupingModel.js +2 -2
- package/esm/models/links/normalizeLinkJSON.js +2 -2
- package/esm/models/list/ListDetailModel.js +2 -2
- package/esm/models/list/ListItemCollection.js +38 -0
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/models/list/ListItemModel.js +14 -2
- package/esm/models/list/ListItemModel.js.map +1 -1
- package/esm/models/list/ListModel.js +17 -70
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionCollection.js +2 -2
- package/esm/modularui/ModularUIError.js +2 -1
- package/esm/modularui/ModularUIError.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +71 -49
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/react-server/serverUtil.js +2 -2
- package/esm/react-theme/createTheme.js +2 -2
- package/esm/redux/_i18n/reducer.js +2 -2
- package/esm/redux/_modularui/actions.js +2 -2
- package/esm/redux/_modularui/connector.js +2 -2
- package/esm/redux/_modularui/reducer.js +2 -2
- package/esm/redux/_modularui/selectors.js +2 -2
- package/esm/redux/reducers/AuthReducer.js +2 -2
- package/esm/redux/reducers/ModalsReducer.js +2 -2
- package/esm/redux/reducers/NotificationReducer.js +2 -2
- package/esm/redux/reducers/PreferencesReducer.js +2 -2
- package/esm/redux/reducers/ProgressIndicatorReducer.js +2 -2
- package/esm/redux/store/configureStore.js +2 -2
- package/esm/utils/browser/Cookies.js +18 -32
- package/esm/utils/browser/Cookies.js.map +1 -1
- package/esm/utils/fetch/xhr.js +6 -4
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js +3 -3
- package/lib/builder/mergeLayoutHintConfigurations.js.flow +3 -3
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +9 -0
- package/lib/constants/LayoutHintConfig.js.flow +9 -0
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +8 -2
- package/lib/constants/LayoutHints.js.flow +4 -0
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +2 -1
- package/lib/constants/Settings.js.flow +2 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/ConfigurationException.js +3 -1
- package/lib/exceptions/ConfigurationException.js.map +1 -1
- package/lib/exceptions/FetchException.js +5 -3
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/exceptions/IllegalArgumentException.js +3 -1
- package/lib/exceptions/IllegalArgumentException.js.map +1 -1
- package/lib/exceptions/IllegalReturnException.js +3 -1
- package/lib/exceptions/IllegalReturnException.js.map +1 -1
- package/lib/exceptions/IllegalStateException.js +3 -1
- package/lib/exceptions/IllegalStateException.js.map +1 -1
- package/lib/exceptions/JsonParseException.js +3 -1
- package/lib/exceptions/JsonParseException.js.map +1 -1
- package/lib/exceptions/MissingPropertyException.js +3 -1
- package/lib/exceptions/MissingPropertyException.js.map +1 -1
- package/lib/exceptions/NetworkException.js +3 -1
- package/lib/exceptions/NetworkException.js.map +1 -1
- package/lib/exceptions/NotAllowedUriException.js +3 -1
- package/lib/exceptions/NotAllowedUriException.js.map +1 -1
- package/lib/exceptions/NotFoundException.js +3 -1
- package/lib/exceptions/NotFoundException.js.map +1 -1
- package/lib/exceptions/ServerRequestException.js +3 -1
- package/lib/exceptions/ServerRequestException.js.map +1 -1
- package/lib/exceptions/ThemePropertyException.js +3 -1
- package/lib/exceptions/ThemePropertyException.js.map +1 -1
- package/lib/exceptions/TimeoutException.js +3 -1
- package/lib/exceptions/TimeoutException.js.map +1 -1
- package/lib/exceptions/UnauthorizedException.js +3 -1
- package/lib/exceptions/UnauthorizedException.js.map +1 -1
- package/lib/exceptions/UnsupportedOperationException.js +3 -1
- package/lib/exceptions/UnsupportedOperationException.js.map +1 -1
- package/lib/hooks/useContent.js +2 -2
- package/lib/hooks/useContent.js.flow +2 -2
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js +2 -1
- package/lib/hooks/useDeepCompareEffect.js.flow +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.flow +1 -2
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useModal.js +2 -2
- package/lib/hooks/useModal.js.flow +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModularUI.js +0 -1
- package/lib/hooks/useModularUI.js.flow +0 -2
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js +2 -2
- package/lib/i18n/Locale.js +11 -5
- package/lib/i18n/Locale.js.flow +7 -0
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js +2 -2
- package/lib/i18n/Message.js +2 -2
- package/lib/i18n/__tests__/Locale.spec.js.flow +14 -0
- package/lib/i18n/languages.js +2 -1
- package/lib/i18n/languages.js.flow +1 -0
- package/lib/i18n/languages.js.map +1 -1
- package/lib/i18n/types.js.flow +1 -0
- package/lib/models/attributes/AttributeCollection.js +2 -2
- package/lib/models/attributes/AttributeContent.js +2 -2
- package/lib/models/attributes/AttributeDataHelper.js +2 -2
- package/lib/models/attributes/BooleanAttributeModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +2 -2
- package/lib/models/attributes/CompositeAttributeChildCollection.js +2 -2
- package/lib/models/attributes/DatetimeAttributeModel.js +7 -3
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +9 -4
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/__tests__/StringAttributeModel.spec.js.flow +1 -1
- package/lib/models/attributes/_createAttribute.js +2 -2
- package/lib/models/base/ResourceModel.js +2 -2
- package/lib/models/base/__tests__/BaseModel.spec.js.flow +5 -5
- package/lib/models/caseview/CaseViewModel.js +3 -1
- package/lib/models/caseview/CaseViewModel.js.flow +3 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +38 -1
- package/lib/models/concepts/ConceptDetailModel.js +2 -2
- package/lib/models/concepts/SourceReferenceModel.js +2 -2
- package/lib/models/content/ContentTOCModel.js +2 -2
- package/lib/models/filters/AssignmentFilterModel.js +2 -2
- package/lib/models/filters/BaseFilterModel.js +2 -2
- package/lib/models/filters/ConceptIndexFilterModel.js +3 -1
- package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
- package/lib/models/filters/FilterCollection.js +2 -2
- package/lib/models/filters/FilterModel.js +3 -1
- package/lib/models/filters/FilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +28 -4
- package/lib/models/form/FormModel.js.flow +18 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +2 -2
- package/lib/models/form/__tests__/FormModel.getters.spec.js.flow +15 -0
- package/lib/models/grouping/GroupingModel.js +2 -2
- package/lib/models/links/normalizeLinkJSON.js +2 -2
- package/lib/models/list/ListDetailModel.js +2 -2
- package/lib/models/list/ListItemCollection.js +40 -0
- package/lib/models/list/ListItemCollection.js.flow +38 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListItemModel.js +14 -2
- package/lib/models/list/ListItemModel.js.flow +15 -0
- package/lib/models/list/ListItemModel.js.map +1 -1
- package/lib/models/list/ListModel.js +16 -71
- package/lib/models/list/ListModel.js.flow +1 -45
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/list/__tests__/ListItemCollection.spec.js.flow +22 -0
- package/lib/models/list/__tests__/ListModel.spec.js.flow +0 -2
- package/lib/models/lookup/LookupOptionCollection.js +2 -2
- package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +38 -21
- package/lib/models/process/__tests__/ProcessStatusSettingsModel.spec.js.flow +11 -0
- package/lib/modularui/ModularUIError.js +3 -1
- package/lib/modularui/ModularUIError.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +69 -49
- package/lib/modularui/ModularUIRequest.js.flow +38 -22
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/react-server/serverUtil.js +2 -2
- package/lib/react-theme/createTheme.js +2 -2
- package/lib/redux/_i18n/reducer.js +2 -2
- package/lib/redux/_modularui/actions.js +2 -2
- package/lib/redux/_modularui/connector.js +2 -2
- package/lib/redux/_modularui/reducer.js +2 -2
- package/lib/redux/_modularui/selectors.js +2 -2
- package/lib/redux/reducers/AuthReducer.js +2 -2
- package/lib/redux/reducers/ModalsReducer.js +2 -2
- package/lib/redux/reducers/NotificationReducer.js +2 -2
- package/lib/redux/reducers/PreferencesReducer.js +2 -2
- package/lib/redux/reducers/ProgressIndicatorReducer.js +2 -2
- package/lib/redux/store/configureStore.js +2 -2
- package/lib/utils/browser/Cookies.js +18 -31
- package/lib/utils/browser/Cookies.js.flow +22 -28
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/browser/__tests__/Cookies.spec.js.flow +51 -0
- package/lib/utils/fetch/xhr.js +7 -4
- package/lib/utils/fetch/xhr.js.flow +6 -2
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/package.json +37 -35
- package/src/builder/mergeLayoutHintConfigurations.js +3 -3
- package/src/constants/LayoutHintConfig.js +9 -0
- package/src/constants/LayoutHints.js +4 -0
- package/src/constants/Settings.js +2 -0
- package/src/hooks/useContent.js +2 -2
- package/src/hooks/useDeepCompareEffect.js +1 -1
- package/src/hooks/useForm.js +1 -2
- package/src/hooks/useModal.js +1 -1
- package/src/hooks/useModularUI.js +0 -2
- package/src/i18n/Locale.js +7 -0
- package/src/i18n/__tests__/Locale.spec.js +14 -0
- package/src/i18n/languages.js +1 -0
- package/src/i18n/types.js +1 -0
- package/src/models/attributes/DatetimeAttributeModel.js +9 -4
- package/src/models/attributes/__tests__/StringAttributeModel.spec.js +1 -1
- package/src/models/base/__tests__/BaseModel.spec.js +5 -5
- package/src/models/caseview/CaseViewModel.js +3 -1
- package/src/models/caseview/__tests__/CaseViewModel.spec.js +38 -1
- package/src/models/caseview/__tests__/caseview.json +14 -3
- package/src/models/caseview/__tests__/caseviewContributions.json +48 -77
- package/src/models/caseview/__tests__/caseview_local_taskgroup.json +57 -0
- package/src/models/form/FormModel.js +18 -1
- package/src/models/form/__tests__/FormModel.getters.spec.js +15 -0
- package/src/models/list/ListItemCollection.js +38 -1
- package/src/models/list/ListItemModel.js +15 -0
- package/src/models/list/ListModel.js +1 -45
- package/src/models/list/__tests__/ListItemCollection.spec.js +22 -0
- package/src/models/list/__tests__/ListModel.spec.js +0 -2
- package/src/models/panels/__tests__/GroupingPanelModel.spec.js +38 -21
- package/src/models/panels/__tests__/groupingPanel.json +20 -1
- package/src/models/panels/__tests__/groupingPanelContributions.json +14 -1
- package/src/models/process/__tests__/ProcessStatusSettingsModel.spec.js +11 -0
- package/src/modularui/ModularUIRequest.js +38 -22
- package/src/utils/browser/Cookies.js +22 -28
- package/src/utils/browser/__tests__/Cookies.spec.js +51 -0
- package/src/utils/fetch/xhr.js +6 -2
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
@@ -40,7 +42,7 @@ var NotAllowedUriException = /*#__PURE__*/function (_Error) {
|
|
|
40
42
|
return _this;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
return NotAllowedUriException;
|
|
45
|
+
return (0, _createClass2.default)(NotAllowedUriException);
|
|
44
46
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
45
47
|
|
|
46
48
|
var _default = NotAllowedUriException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/NotAllowedUriException.js"],"names":["NotAllowedUriException","message","name","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/NotAllowedUriException.js"],"names":["NotAllowedUriException","message","name","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,sB;;;;;AACJ,kCAAYC,OAAZ,EAA6B;AAAA;;AAAA;AAC3B,8BAAMA,OAAN;AACA,UAAKC,IAAL,GAAY,wBAAZ;AAF2B;AAG5B;;;+CAJkCC,K;;eAOtBH,sB","sourcesContent":["// @flow\n/**\n * NotAllowedUriException\n */\nclass NotAllowedUriException extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"NotAllowedUriException\";\n }\n}\n\nexport default NotAllowedUriException;\n"],"file":"NotAllowedUriException.js"}
|
|
@@ -11,6 +11,8 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
13
13
|
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
15
|
+
|
|
14
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
15
17
|
|
|
16
18
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
@@ -55,7 +57,7 @@ var NotFoundException = /*#__PURE__*/function (_Error) {
|
|
|
55
57
|
return _this;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
return NotFoundException;
|
|
60
|
+
return (0, _createClass2.default)(NotFoundException);
|
|
59
61
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
60
62
|
|
|
61
63
|
var _default = NotFoundException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/NotFoundException.js"],"names":["NotFoundException","url","method","isReload","name","id","status","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/NotFoundException.js"],"names":["NotFoundException","url","method","isReload","name","id","status","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,iB;;;;;AAKJ,6BAAYC,GAAZ,EAAyBC,MAAzB,EAAoE;AAAA;;AAAA;;AAAA,QAA3BC,QAA2B,uEAAP,KAAO;AAAA;AAClE,iFAAkBF,GAAlB,mCAAqCC,MAArC;AADkE;AAAA;AAAA;AAGlE,UAAKE,IAAL,GAAY,mBAAZ;AACA,UAAKC,EAAL,GAAU,mBAAV;AACA,UAAKC,MAAL,GAAc,GAAd;AACA,UAAKH,QAAL,GAAgBA,QAAhB;AANkE;AAOnE;;;+CAZ6BI,K;;eAejBP,iB","sourcesContent":["// @flow\n/**\n * NotFoundException\n */\nclass NotFoundException extends Error {\n status: number;\n isReload: boolean;\n id: string;\n\n constructor(url: string, method: string, isReload: boolean = false) {\n super(`Resource ${url} with method ${method} not found`);\n\n this.name = \"NotFoundException\";\n this.id = \"NotFoundException\";\n this.status = 404;\n this.isReload = isReload;\n }\n}\n\nexport default NotFoundException;\n"],"file":"NotFoundException.js"}
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
@@ -40,7 +42,7 @@ var ServerRequestException = /*#__PURE__*/function (_Error) {
|
|
|
40
42
|
return _this;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
return ServerRequestException;
|
|
45
|
+
return (0, _createClass2.default)(ServerRequestException);
|
|
44
46
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
45
47
|
|
|
46
48
|
var _default = ServerRequestException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/ServerRequestException.js"],"names":["ServerRequestException","message","name","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/ServerRequestException.js"],"names":["ServerRequestException","message","name","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,sB;;;;;AACJ,kCAAYC,OAAZ,EAA6B;AAAA;;AAAA;AAC3B,8BAAMA,OAAN;AACA,UAAKC,IAAL,GAAY,wBAAZ;AAF2B;AAG5B;;;+CAJkCC,K;;eAOtBH,sB","sourcesContent":["// @flow\n/**\n * ServerRequestException\n */\nclass ServerRequestException extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ServerRequestException\";\n }\n}\n\nexport default ServerRequestException;\n"],"file":"ServerRequestException.js"}
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
@@ -40,7 +42,7 @@ var ThemePropertyException = /*#__PURE__*/function (_Error) {
|
|
|
40
42
|
return _this;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
return ThemePropertyException;
|
|
45
|
+
return (0, _createClass2.default)(ThemePropertyException);
|
|
44
46
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
45
47
|
|
|
46
48
|
var _default = ThemePropertyException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/ThemePropertyException.js"],"names":["ThemePropertyException","message","name","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/ThemePropertyException.js"],"names":["ThemePropertyException","message","name","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,sB;;;;;AACJ,kCAAYC,OAAZ,EAA6B;AAAA;;AAAA;AAC3B,8BAAMA,OAAN;AACA,UAAKC,IAAL,GAAY,wBAAZ;AAF2B;AAG5B;;;+CAJkCC,K;;eAOtBH,sB","sourcesContent":["// @flow\n/**\n * ThemePropertyException\n */\nclass ThemePropertyException extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ThemePropertyException\";\n }\n}\n\nexport default ThemePropertyException;\n"],"file":"ThemePropertyException.js"}
|
|
@@ -11,6 +11,8 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
13
13
|
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
15
|
+
|
|
14
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
15
17
|
|
|
16
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
@@ -44,7 +46,7 @@ var TimeoutException = /*#__PURE__*/function (_Error) {
|
|
|
44
46
|
return _this;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
return TimeoutException;
|
|
49
|
+
return (0, _createClass2.default)(TimeoutException);
|
|
48
50
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
49
51
|
|
|
50
52
|
var _default = TimeoutException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/TimeoutException.js"],"names":["TimeoutException","url","method","name","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/TimeoutException.js"],"names":["TimeoutException","url","method","name","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,gB;;;;;AACJ,4BAAYC,GAAZ,EAAyBC,MAAzB,EAAyC;AAAA;;AAAA;;AAAA;AACvC,0GAA2CD,GAA3C,mCAA8DC,MAA9D;AAEA,UAAKC,IAAL,GAAY,kBAAZ;AAHuC;AAIxC;;;+CAL4BC,K;;eAQhBJ,gB","sourcesContent":["// @flow\n/**\n * TimeoutException\n */\nclass TimeoutException extends Error {\n constructor(url: string, method: string) {\n super(`Timeout occurred in connection to ${url} with method ${method}.`);\n\n this.name = \"TimeoutException\";\n }\n}\n\nexport default TimeoutException;\n"],"file":"TimeoutException.js"}
|
|
@@ -11,6 +11,8 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
13
13
|
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
15
|
+
|
|
14
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
15
17
|
|
|
16
18
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
@@ -54,7 +56,7 @@ var UnauthorizedException = /*#__PURE__*/function (_Error) {
|
|
|
54
56
|
return _this;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
return UnauthorizedException;
|
|
59
|
+
return (0, _createClass2.default)(UnauthorizedException);
|
|
58
60
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
59
61
|
|
|
60
62
|
var _default = UnauthorizedException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/UnauthorizedException.js"],"names":["UnauthorizedException","url","method","errorResponse","name","id","status","response","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/UnauthorizedException.js"],"names":["UnauthorizedException","url","method","errorResponse","name","id","status","response","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AACA;AACA;IACMA,qB;;;;;AAKJ,iCACEC,GADF,EAEEC,MAFF,EAGEC,aAHF,EAIE;AAAA;;AAAA;;AAAA;AACA,gGAAiCF,GAAjC,mCAAoDC,MAApD;AADA;AAAA;AAAA;AAGA,UAAKE,IAAL,GAAY,uBAAZ;AACA,UAAKC,EAAL,GAAU,uBAAV;AACA,UAAKC,MAAL,GAAc,GAAd;AACA,UAAKC,QAAL,GAAgBJ,aAAhB;AANA;AAOD;;;+CAhBiCK,K;;eAmBrBR,qB","sourcesContent":["// @flow\nimport type { ModularUIErrorResponse } from \"./FetchException\";\n\n/**\n * UnauthorizedException\n */\nclass UnauthorizedException extends Error {\n status: number;\n id: string;\n response: ?ModularUIErrorResponse;\n\n constructor(\n url: string,\n method: string,\n errorResponse: ?ModularUIErrorResponse\n ) {\n super(`Cannot request resource ${url} with method ${method}`);\n\n this.name = \"UnauthorizedException\";\n this.id = \"UnauthorizedException\";\n this.status = 401;\n this.response = errorResponse;\n }\n}\n\nexport default UnauthorizedException;\n"],"file":"UnauthorizedException.js"}
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
@@ -40,7 +42,7 @@ var UnsupportedOperationException = /*#__PURE__*/function (_Error) {
|
|
|
40
42
|
return _this;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
return UnsupportedOperationException;
|
|
45
|
+
return (0, _createClass2.default)(UnsupportedOperationException);
|
|
44
46
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
45
47
|
|
|
46
48
|
var _default = UnsupportedOperationException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exceptions/UnsupportedOperationException.js"],"names":["UnsupportedOperationException","message","name","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/exceptions/UnsupportedOperationException.js"],"names":["UnsupportedOperationException","message","name","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;IACMA,6B;;;;;AACJ,yCAAYC,OAAZ,EAA6B;AAAA;;AAAA;AAC3B,8BAAMA,OAAN;AACA,UAAKC,IAAL,GAAY,+BAAZ;AAF2B;AAG5B;;;+CAJyCC,K;;eAO7BH,6B","sourcesContent":["// @flow\n/**\n * UnsupportedOperationException\n */\nclass UnsupportedOperationException extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UnsupportedOperationException\";\n }\n}\n\nexport default UnsupportedOperationException;\n"],"file":"UnsupportedOperationException.js"}
|
package/lib/hooks/useContent.js
CHANGED
|
@@ -66,8 +66,8 @@ var useContentFromSourceReferences = function useContentFromSourceReferences(sou
|
|
|
66
66
|
});
|
|
67
67
|
start();
|
|
68
68
|
|
|
69
|
-
_promise.default.all(requests).then(function (
|
|
70
|
-
setContent(
|
|
69
|
+
_promise.default.all(requests).then(function (responseContent) {
|
|
70
|
+
setContent(responseContent);
|
|
71
71
|
finish();
|
|
72
72
|
}); // start and finish don't change
|
|
73
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useContent.js"],"names":["useContentFromSourceReferences","sourceReferences","renderChildSections","content","setContent","localeCode","state","i18n","locale","start","finish","hrefs","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","requests","JSON","parse","modularuiRequest","ModularUIRequest","fetchContent","all","then"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;AACA;AACA;AACO,IAAMA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAC5CC,gBAD4C,EAE5CC,mBAF4C,EAGpB;AAAA;;AACxB,kBAA8B,qBAAS,EAAT,CAA9B;AAAA;AAAA,MAAOC,OAAP;AAAA,MAAgBC,UAAhB;;AACA,MAAMC,UAAU,GAAG,6BAAY,UAACC,KAAD;AAAA;;AAAA,iCAAWA,KAAK,CAACC,IAAN,CAAWC,MAAtB,mEAAgC,IAAhC;AAAA,GAAZ,CAAnB;;AAEA,8BAA0B,kDAA1B;AAAA,MAAQC,KAAR,yBAAQA,KAAR;AAAA,MAAeC,MAAf,yBAAeA,MAAf;;AAEA,MAAMC,KAAK,GAAG,gFAAAV,gBAAgB,MAAhB,CAAAA,gBAAgB,EACvB,UAACW,eAAD;AAAA,WAAqBA,eAAe,CAACC,IAAhB,CAAqBC,QAArB,CAA8BC,IAAnD;AAAA,GADuB,CAAhB,kBAEJ,UAACA,IAAD,EAAOC,KAAP,EAAcC,IAAd;AAAA,WAAuBA,IAAI,CAACC,OAAL,CAAaH,IAAb,MAAuBC,KAA9C;AAAA,GAFI,kBAGP,UAACD,IAAD;AAAA,WAAUA,IAAI,CAACI,QAAL,EAAV;AAAA,GAHO,CAAd;AAKA,MAAMC,QAAQ,GAAG,wBAAeT,KAAf,CAAjB;AACA,wBAAU,YAAM;AAAA;;AACd,QAAMU,QAAQ,GAAG,8BAAAC,IAAI,CAACC,KAAL,CAAWH,QAAX,mBAAyB,UAACL,IAAD,EAAU;AAClD,UAAMS,gBAAgB,GAAG,IAAIC,yBAAJ,CAAqBV,IAArB,CAAzB;AACAS,MAAAA,gBAAgB,CAAChB,MAAjB,GAA0BH,UAA1B;AACA,aAAOmB,gBAAgB,CAACE,YAAjB,CAA8BxB,mBAA9B,CAAP;AACD,KAJgB,CAAjB;AAMAO,IAAAA,KAAK;;AACL,qBAAQkB,GAAR,CAAYN,QAAZ,EAAsBO,IAAtB,CAA2B,
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useContent.js"],"names":["useContentFromSourceReferences","sourceReferences","renderChildSections","content","setContent","localeCode","state","i18n","locale","start","finish","hrefs","sourceReference","link","selfhref","href","index","self","indexOf","toString","allHrefs","requests","JSON","parse","modularuiRequest","ModularUIRequest","fetchContent","all","then","responseContent"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;AACA;AACA;AACO,IAAMA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAC5CC,gBAD4C,EAE5CC,mBAF4C,EAGpB;AAAA;;AACxB,kBAA8B,qBAAS,EAAT,CAA9B;AAAA;AAAA,MAAOC,OAAP;AAAA,MAAgBC,UAAhB;;AACA,MAAMC,UAAU,GAAG,6BAAY,UAACC,KAAD;AAAA;;AAAA,iCAAWA,KAAK,CAACC,IAAN,CAAWC,MAAtB,mEAAgC,IAAhC;AAAA,GAAZ,CAAnB;;AAEA,8BAA0B,kDAA1B;AAAA,MAAQC,KAAR,yBAAQA,KAAR;AAAA,MAAeC,MAAf,yBAAeA,MAAf;;AAEA,MAAMC,KAAK,GAAG,gFAAAV,gBAAgB,MAAhB,CAAAA,gBAAgB,EACvB,UAACW,eAAD;AAAA,WAAqBA,eAAe,CAACC,IAAhB,CAAqBC,QAArB,CAA8BC,IAAnD;AAAA,GADuB,CAAhB,kBAEJ,UAACA,IAAD,EAAOC,KAAP,EAAcC,IAAd;AAAA,WAAuBA,IAAI,CAACC,OAAL,CAAaH,IAAb,MAAuBC,KAA9C;AAAA,GAFI,kBAGP,UAACD,IAAD;AAAA,WAAUA,IAAI,CAACI,QAAL,EAAV;AAAA,GAHO,CAAd;AAKA,MAAMC,QAAQ,GAAG,wBAAeT,KAAf,CAAjB;AACA,wBAAU,YAAM;AAAA;;AACd,QAAMU,QAAQ,GAAG,8BAAAC,IAAI,CAACC,KAAL,CAAWH,QAAX,mBAAyB,UAACL,IAAD,EAAU;AAClD,UAAMS,gBAAgB,GAAG,IAAIC,yBAAJ,CAAqBV,IAArB,CAAzB;AACAS,MAAAA,gBAAgB,CAAChB,MAAjB,GAA0BH,UAA1B;AACA,aAAOmB,gBAAgB,CAACE,YAAjB,CAA8BxB,mBAA9B,CAAP;AACD,KAJgB,CAAjB;AAMAO,IAAAA,KAAK;;AACL,qBAAQkB,GAAR,CAAYN,QAAZ,EAAsBO,IAAtB,CAA2B,UAACC,eAAD,EAAqB;AAC9CzB,MAAAA,UAAU,CAACyB,eAAD,CAAV;AACAnB,MAAAA,MAAM;AACP,KAHD,EARc,CAad;AACA;;AACD,GAfD,EAeG,CAACU,QAAD,EAAWf,UAAX,EAAuBH,mBAAvB,CAfH;AAiBA,SAAOC,OAAP;AACD,CAjCM","sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\nimport { useSelector } from \"react-redux\";\n\nimport SourceReferenceCollection from \"../models/concepts/SourceReferenceCollection\";\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport { useProgressIndicator } from \"../hooks/useProgressIndicator\";\n\nimport type ContentModel from \"../models/content/ContentModel\";\n\n/**\n * Hook to retrieve multiple source references at once\n */\nexport const useContentFromSourceReferences = (\n sourceReferences: SourceReferenceCollection,\n renderChildSections: boolean\n): Array<ContentModel> => {\n const [content, setContent] = useState([]);\n const localeCode = useSelector((state) => state.i18n.locale ?? \"en\");\n\n const { start, finish } = useProgressIndicator();\n\n const hrefs = sourceReferences\n .map((sourceReference) => sourceReference.link.selfhref.href)\n .filter((href, index, self) => self.indexOf(href) === index)\n .map((href) => href.toString());\n\n const allHrefs = JSON.stringify(hrefs);\n useEffect(() => {\n const requests = JSON.parse(allHrefs).map((href) => {\n const modularuiRequest = new ModularUIRequest(href);\n modularuiRequest.locale = localeCode;\n return modularuiRequest.fetchContent(renderChildSections);\n });\n\n start();\n Promise.all(requests).then((responseContent) => {\n setContent(responseContent);\n finish();\n });\n\n // start and finish don't change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allHrefs, localeCode, renderChildSections]);\n\n return content;\n};\n"],"file":"useContent.js"}
|
|
@@ -25,7 +25,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
25
25
|
* Need to copy this, because the dependency on dequal breaks in ie11
|
|
26
26
|
*/
|
|
27
27
|
var useDeepCompareMemoize = function useDeepCompareMemoize(value) {
|
|
28
|
-
var ref = React.useRef(null);
|
|
28
|
+
var ref = React.useRef(null); // NOSONAR
|
|
29
|
+
|
|
29
30
|
var signalRef = React.useRef(0);
|
|
30
31
|
|
|
31
32
|
if (!(0, _lite.dequal)(value, ref.current)) {
|
|
@@ -10,7 +10,7 @@ type DependencyList = Array<mixed>;
|
|
|
10
10
|
* Need to copy this, because the dependency on dequal breaks in ie11
|
|
11
11
|
*/
|
|
12
12
|
const useDeepCompareMemoize = (value: DependencyList) => {
|
|
13
|
-
const ref = React.useRef<DependencyList | null>(null);
|
|
13
|
+
const ref = React.useRef<DependencyList | null>(null); // NOSONAR
|
|
14
14
|
const signalRef = React.useRef<number>(0);
|
|
15
15
|
|
|
16
16
|
if (!deepEqual(value, ref.current)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useDeepCompareEffect.js"],"names":["useDeepCompareMemoize","value","ref","React","useRef","signalRef","current","useDeepCompareEffect","callback","dependencies","useEffect"],"mappings":";;;;;;;;;;;;;;AACA;;AACA;;;;;;AAKA;AACA;AACA;AACA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,KAAD,EAA2B;AACvD,MAAMC,GAAG,GAAGC,KAAK,CAACC,MAAN,CAAoC,IAApC,CAAZ
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useDeepCompareEffect.js"],"names":["useDeepCompareMemoize","value","ref","React","useRef","signalRef","current","useDeepCompareEffect","callback","dependencies","useEffect"],"mappings":";;;;;;;;;;;;;;AACA;;AACA;;;;;;AAKA;AACA;AACA;AACA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,KAAD,EAA2B;AACvD,MAAMC,GAAG,GAAGC,KAAK,CAACC,MAAN,CAAoC,IAApC,CAAZ,CADuD,CACA;;AACvD,MAAMC,SAAS,GAAGF,KAAK,CAACC,MAAN,CAAqB,CAArB,CAAlB;;AAEA,MAAI,CAAC,kBAAUH,KAAV,EAAiBC,GAAG,CAACI,OAArB,CAAL,EAAoC;AAClCJ,IAAAA,GAAG,CAACI,OAAJ,GAAcL,KAAd;AACAI,IAAAA,SAAS,CAACC,OAAV,IAAqB,CAArB;AACD;;AAED,SAAO,CAACD,SAAS,CAACC,OAAX,CAAP;AACD,CAVD;AAYA;AACA;;;AACO,SAASC,oBAAT,CACLC,QADK,EAELC,YAFK,EAGC;AACN;AACA,SAAON,KAAK,CAACO,SAAN,CAAgBF,QAAhB,EAA0BR,qBAAqB,CAACS,YAAD,CAA/C,CAAP;AACD;;eAEcF,oB","sourcesContent":["// @flow\nimport * as React from \"react\";\nimport { dequal as deepEqual } from \"dequal/lite\";\n\ntype Callback = () => void | (() => void);\ntype DependencyList = Array<mixed>;\n\n/**\n * As copied from https://github.com/kentcdodds/use-deep-compare-effect/\n * Need to copy this, because the dependency on dequal breaks in ie11\n */\nconst useDeepCompareMemoize = (value: DependencyList) => {\n const ref = React.useRef<DependencyList | null>(null); // NOSONAR\n const signalRef = React.useRef<number>(0);\n\n if (!deepEqual(value, ref.current)) {\n ref.current = value;\n signalRef.current += 1;\n }\n\n return [signalRef.current];\n};\n\n/**\n */\nexport function useDeepCompareEffect(\n callback: Callback,\n dependencies: DependencyList\n): void {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useEffect(callback, useDeepCompareMemoize(dependencies));\n}\n\nexport default useDeepCompareEffect;\n"],"file":"useDeepCompareEffect.js"}
|
|
@@ -20,8 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
import FormModel from "../models/form/FormModel";
|
|
22
22
|
|
|
23
|
-
import type { FormObjectModel } from "../models";
|
|
24
|
-
import type { AttributeType } from "../models";
|
|
23
|
+
import type { FormObjectModel, AttributeType } from "../models";
|
|
25
24
|
import type { UpdateFormOptions } from "../redux/types";
|
|
26
25
|
import type {
|
|
27
26
|
RemoveModelByKeyAction,
|
package/lib/hooks/useForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useForm","href","formHref","Href","addParameter","form","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAUA;;
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useForm","href","formHref","Href","addParameter","form","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"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","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel, AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateModelAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateModelAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateModelAction,\n cancel: (object: FormObjectModel) => UpdateModelAction,\n remove: (object: FormObjectModel) => UpdateModelAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
|
package/lib/hooks/useModal.js
CHANGED
|
@@ -30,8 +30,8 @@ var useModal = function useModal(modalId) {
|
|
|
30
30
|
var _context;
|
|
31
31
|
|
|
32
32
|
var modals = _ref.modals;
|
|
33
|
-
return (0, _find.default)(_context = modals.modals).call(_context, function (
|
|
34
|
-
return
|
|
33
|
+
return (0, _find.default)(_context = modals.modals).call(_context, function (m) {
|
|
34
|
+
return m.key === modalId;
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
var show = (0, _react.useCallback)(function () {
|
|
@@ -25,7 +25,7 @@ export const useModal: ModalHook = (modalId: string) => {
|
|
|
25
25
|
|
|
26
26
|
const dispatch = useDispatch();
|
|
27
27
|
const modal = useSelector(({ modals }) =>
|
|
28
|
-
modals.modals.find((
|
|
28
|
+
modals.modals.find((m) => m.key === modalId)
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const show = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useModal.js"],"names":["useModal","modalId","IllegalArgumentException","dispatch","modal","modals","key","show","close","size","visible"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAUA;AACA;AACA;AACO,IAAMA,QAAmB,GAAG,SAAtBA,QAAsB,CAACC,OAAD,EAAqB;AACtD,MAAI,CAACA,OAAL,EAAc;AACZ,UAAM,IAAIC,oCAAJ,CACJ,4CADI,CAAN;AAGD;;AAED,MAAMC,QAAQ,GAAG,8BAAjB;AACA,MAAMC,KAAK,GAAG,6BAAY;AAAA;;AAAA,QAAGC,MAAH,QAAGA,MAAH;AAAA,WACxB,8BAAAA,MAAM,CAACA,MAAP,iBAAmB,
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useModal.js"],"names":["useModal","modalId","IllegalArgumentException","dispatch","modal","modals","m","key","show","close","size","visible"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAUA;AACA;AACA;AACO,IAAMA,QAAmB,GAAG,SAAtBA,QAAsB,CAACC,OAAD,EAAqB;AACtD,MAAI,CAACA,OAAL,EAAc;AACZ,UAAM,IAAIC,oCAAJ,CACJ,4CADI,CAAN;AAGD;;AAED,MAAMC,QAAQ,GAAG,8BAAjB;AACA,MAAMC,KAAK,GAAG,6BAAY;AAAA;;AAAA,QAAGC,MAAH,QAAGA,MAAH;AAAA,WACxB,8BAAAA,MAAM,CAACA,MAAP,iBAAmB,UAACC,CAAD;AAAA,aAAOA,CAAC,CAACC,GAAF,KAAUN,OAAjB;AAAA,KAAnB,CADwB;AAAA,GAAZ,CAAd;AAIA,MAAMO,IAAI,GAAG,wBAAY,YAAM;AAC7BL,IAAAA,QAAQ,CAAC,uBAAUF,OAAV,CAAD,CAAR;AACD,GAFY,EAEV,CAACE,QAAD,EAAWF,OAAX,CAFU,CAAb;AAIA,MAAMQ,KAAK,GAAG,wBAAY,YAAM;AAC9BN,IAAAA,QAAQ,CAAC,wBAAWF,OAAX,CAAD,CAAR;AACD,GAFa,EAEX,CAACE,QAAD,EAAWF,OAAX,CAFW,CAAd;AAIA,SAAO;AACLM,IAAAA,GAAG,EAAEH,KAAK,GAAGA,KAAK,CAACG,GAAT,GAAe,IADpB;AAELG,IAAAA,IAAI,EAAEN,KAAK,GAAGA,KAAK,CAACM,IAAT,GAAgB,IAFtB;AAGLC,IAAAA,OAAO,EAAEP,KAAK,GAAGA,KAAK,CAACO,OAAT,GAAmB,KAH5B;AAILH,IAAAA,IAAI,EAAJA,IAJK;AAKLC,IAAAA,KAAK,EAALA;AALK,GAAP;AAOD,CA3BM","sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { showModal, closeModal } from \"../redux/actions/Modals\";\nimport { IllegalArgumentException } from \"../exceptions\";\n\ntype ModalHook = (modalId: string) => {\n key: string | null,\n size: string | null,\n visible: boolean,\n show: () => void,\n close: () => void,\n};\n\n/**\n * Manage modals\n */\nexport const useModal: ModalHook = (modalId: string) => {\n if (!modalId) {\n throw new IllegalArgumentException(\n \"Missing modalId argument for useModal hook\"\n );\n }\n\n const dispatch = useDispatch();\n const modal = useSelector(({ modals }) =>\n modals.modals.find((m) => m.key === modalId)\n );\n\n const show = useCallback(() => {\n dispatch(showModal(modalId));\n }, [dispatch, modalId]);\n\n const close = useCallback(() => {\n dispatch(closeModal(modalId));\n }, [dispatch, modalId]);\n\n return {\n key: modal ? modal.key : null,\n size: modal ? modal.size : null,\n visible: modal ? modal.visible : false,\n show,\n close,\n };\n};\n"],"file":"useModal.js"}
|
|
@@ -46,7 +46,6 @@ var useModularUI = function useModularUI(modelKey, url) {
|
|
|
46
46
|
var prevHref = (0, _react.useRef)(href); // dispatch loadModularUI
|
|
47
47
|
|
|
48
48
|
(0, _useDeepCompareEffect.default)(function () {
|
|
49
|
-
// console.info({ new: options }, { old: prevOptions.current });
|
|
50
49
|
// prevent reloads when previous option had the isReload, but the new options not
|
|
51
50
|
var isOldReload = prevHref.current === href && prevOptions.current.isReload && !options.isReload;
|
|
52
51
|
|
|
@@ -38,8 +38,6 @@ export const useModularUI = (
|
|
|
38
38
|
|
|
39
39
|
// dispatch loadModularUI
|
|
40
40
|
useDeepCompareEffect(() => {
|
|
41
|
-
// console.info({ new: options }, { old: prevOptions.current });
|
|
42
|
-
|
|
43
41
|
// prevent reloads when previous option had the isReload, but the new options not
|
|
44
42
|
const isOldReload =
|
|
45
43
|
prevHref.current === href &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useModularUI.js"],"names":["useKeyForHook","modelKey","url","locale","state","i18n","split","useModularUI","options","method","HTTP_METHODS","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","modularui"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAKA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,QAAD,EAAmBC,GAAnB,EAAmC;AAAA;;AACvD,MAAMC,MAAM,GAAG,6BAAY,UAACC,KAAD;AAAA,WAAWA,KAAK,CAACC,IAAN,CAAWF,MAAtB;AAAA,GAAZ,CAAf;AAEA,oFAAUF,QAAV,wBAAsBC,GAAG,CAACI,KAAJ,CAAU,GAAV,EAAe,CAAf,CAAtB,wBAA4CH,MAA5C;AACD,CAJD;AAMA;AACA;AACA;;;AACO,IAAMI,YAAY,GAAG,SAAfA,YAAe,CAC1BN,QAD0B,EAE1BC,GAF0B,EAOlB;AAAA,MAJRM,OAIQ,uEAJsB;AAC5BC,IAAAA,MAAM,EAAEC,wBAAaC,GADO;AAE5BC,IAAAA,eAAe,EAAE;AAFW,GAItB;AACR,MAAMC,QAAQ,GAAG,8BAAjB;AACA,MAAMC,IAAI,GAAGZ,GAAG,CAACa,QAAJ,EAAb;AACA,MAAMC,GAAG,GAAGhB,aAAa,CAACC,QAAD,EAAWa,IAAX,CAAzB;AAEA,MAAMG,WAAW,GAAG,mBAAOT,OAAP,CAApB;AACA,MAAMU,QAAQ,GAAG,mBAAOJ,IAAP,CAAjB,CANQ,CAQR;;AACA,qCAAqB,YAAM;AACzB;
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useModularUI.js"],"names":["useKeyForHook","modelKey","url","locale","state","i18n","split","useModularUI","options","method","HTTP_METHODS","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","modularui"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAKA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,QAAD,EAAmBC,GAAnB,EAAmC;AAAA;;AACvD,MAAMC,MAAM,GAAG,6BAAY,UAACC,KAAD;AAAA,WAAWA,KAAK,CAACC,IAAN,CAAWF,MAAtB;AAAA,GAAZ,CAAf;AAEA,oFAAUF,QAAV,wBAAsBC,GAAG,CAACI,KAAJ,CAAU,GAAV,EAAe,CAAf,CAAtB,wBAA4CH,MAA5C;AACD,CAJD;AAMA;AACA;AACA;;;AACO,IAAMI,YAAY,GAAG,SAAfA,YAAe,CAC1BN,QAD0B,EAE1BC,GAF0B,EAOlB;AAAA,MAJRM,OAIQ,uEAJsB;AAC5BC,IAAAA,MAAM,EAAEC,wBAAaC,GADO;AAE5BC,IAAAA,eAAe,EAAE;AAFW,GAItB;AACR,MAAMC,QAAQ,GAAG,8BAAjB;AACA,MAAMC,IAAI,GAAGZ,GAAG,CAACa,QAAJ,EAAb;AACA,MAAMC,GAAG,GAAGhB,aAAa,CAACC,QAAD,EAAWa,IAAX,CAAzB;AAEA,MAAMG,WAAW,GAAG,mBAAOT,OAAP,CAApB;AACA,MAAMU,QAAQ,GAAG,mBAAOJ,IAAP,CAAjB,CANQ,CAQR;;AACA,qCAAqB,YAAM;AACzB;AACA,QAAMK,WAAW,GACfD,QAAQ,CAACE,OAAT,KAAqBN,IAArB,IACAG,WAAW,CAACG,OAAZ,CAAoBC,QADpB,IAEA,CAACb,OAAO,CAACa,QAHX;;AAKA,QAAI,CAACF,WAAL,EAAkB;AAChBN,MAAAA,QAAQ,CAAC,4BAAcG,GAAd,EAAmBF,IAAnB,EAAyBN,OAAzB,CAAD,CAAR;AACD;;AAEDS,IAAAA,WAAW,CAACG,OAAZ,GAAsBZ,OAAtB;AACAU,IAAAA,QAAQ,CAACE,OAAT,GAAmBN,IAAnB;AACD,GAbD,EAaG,CAACE,GAAD,EAAMF,IAAN,EAAYN,OAAZ,CAbH;AAeA,8BAAoCA,OAApC,CAAQI,eAAR;AAAA,MAAQA,eAAR,sCAA0B,KAA1B;AACA,wBAAU,YAAM;AACd,WAAO,YAAM;AACX,UAAIA,eAAJ,EAAqB;AACnBC,QAAAA,QAAQ,CAAC,+BAAiBG,GAAjB,CAAD,CAAR;AACD;AACF,KAJD;AAKD,GAND,EAMG,CAACH,QAAD,EAAWG,GAAX,EAAgBJ,eAAhB,CANH,EAzBQ,CAiCR;;AACA,SAAO,6BAAY,UAACR,KAAD,EAAW;AAC5B,WAAOA,KAAK,CAACkB,SAAN,CAAgBN,GAAhB,CAAP;AACD,GAFM,CAAP;AAGD,CA5CM","sourcesContent":["// @flow\nimport { useEffect, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui/actions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport type Href from \"../models/href/Href\";\nimport type { RequestBaseOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useSelector((state) => state.i18n.locale);\n\n return `${modelKey}(${url.split(\"?\")[0]})(${locale})`;\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestBaseOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n }\n): any => {\n const dispatch = useDispatch();\n const href = url.toString();\n const key = useKeyForHook(modelKey, href);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n if (!isOldReload) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n }, [key, href, options]);\n\n const { removeOnUnmount = false } = options;\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(key));\n }\n };\n }, [dispatch, key, removeOnUnmount]);\n\n // retrieve current model from modularui reducer\n return useSelector((state) => {\n return state.modularui[key];\n });\n};\n"],"file":"useModularUI.js"}
|
|
@@ -23,9 +23,9 @@ var _reactRedux = require("react-redux");
|
|
|
23
23
|
|
|
24
24
|
var _ProgressIndicator = require("../redux/actions/ProgressIndicator");
|
|
25
25
|
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
27
|
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
*/
|
package/lib/i18n/Locale.js
CHANGED
|
@@ -4,12 +4,12 @@ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
|
4
4
|
|
|
5
5
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
6
6
|
|
|
7
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
8
|
+
|
|
7
9
|
var _Symbol$replace = require("@babel/runtime-corejs3/core-js-stable/symbol/replace");
|
|
8
10
|
|
|
9
11
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
10
12
|
|
|
11
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
12
|
-
|
|
13
13
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
14
14
|
|
|
15
15
|
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
@@ -47,11 +47,11 @@ var _exceptions = require("../exceptions");
|
|
|
47
47
|
|
|
48
48
|
var _constants = require("../constants");
|
|
49
49
|
|
|
50
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
50
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
51
51
|
|
|
52
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
52
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
53
|
|
|
54
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re,
|
|
54
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new _WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), (0, _setPrototypeOf2.default)(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return _Object$keys(g).reduce(function (groups, name) { return groups[name] = result[g[name]], groups; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[_Symbol$replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[_Symbol$replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[_Symbol$replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = _sliceInstanceProperty([]).call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[_Symbol$replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Create a locale
|
|
@@ -62,9 +62,11 @@ var Locale = /*#__PURE__*/function () {
|
|
|
62
62
|
(0, _defineProperty2.default)(this, "_code", void 0);
|
|
63
63
|
(0, _defineProperty2.default)(this, "_messages", void 0);
|
|
64
64
|
(0, _defineProperty2.default)(this, "_errors", void 0);
|
|
65
|
+
(0, _defineProperty2.default)(this, "_nativeName", void 0);
|
|
65
66
|
this._code = locale.code;
|
|
66
67
|
this._messages = this.fixPlaceHoldersInObject(locale.messages);
|
|
67
68
|
this._errors = this.fixPlaceHoldersInObject(locale.errors);
|
|
69
|
+
this._nativeName = locale.nativeName;
|
|
68
70
|
|
|
69
71
|
_formatMessage2.default.setup({
|
|
70
72
|
missingTranslation: "ignore"
|
|
@@ -87,6 +89,10 @@ var Locale = /*#__PURE__*/function () {
|
|
|
87
89
|
}, {
|
|
88
90
|
key: "nativeName",
|
|
89
91
|
get: function get() {
|
|
92
|
+
if (this._nativeName) {
|
|
93
|
+
return this._nativeName;
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
var aLocale = this.code.split("-");
|
|
91
97
|
|
|
92
98
|
if (aLocale.length > 0) {
|
package/lib/i18n/Locale.js.flow
CHANGED
|
@@ -15,6 +15,7 @@ class Locale {
|
|
|
15
15
|
_code: string;
|
|
16
16
|
_messages: { [string]: string };
|
|
17
17
|
_errors: { [string]: string };
|
|
18
|
+
_nativeName: ?string;
|
|
18
19
|
|
|
19
20
|
constructor(locale: LocaleConfiguration) {
|
|
20
21
|
this._code = locale.code;
|
|
@@ -22,6 +23,8 @@ class Locale {
|
|
|
22
23
|
this._messages = this.fixPlaceHoldersInObject(locale.messages);
|
|
23
24
|
this._errors = this.fixPlaceHoldersInObject(locale.errors);
|
|
24
25
|
|
|
26
|
+
this._nativeName = locale.nativeName;
|
|
27
|
+
|
|
25
28
|
formatMessage.setup({
|
|
26
29
|
missingTranslation: "ignore",
|
|
27
30
|
});
|
|
@@ -38,6 +41,10 @@ class Locale {
|
|
|
38
41
|
* Retrieve nativeName
|
|
39
42
|
*/
|
|
40
43
|
get nativeName(): string {
|
|
44
|
+
if (this._nativeName) {
|
|
45
|
+
return this._nativeName;
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
const aLocale = this.code.split("-");
|
|
42
49
|
|
|
43
50
|
if (aLocale.length > 0) {
|
package/lib/i18n/Locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i18n/Locale.js"],"names":["Locale","locale","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","formatMessage","setup","missingTranslation","aLocale","split","length","language","languages","lang","toUpperCase","IllegalStateException","message","replace","JSON","parse","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","warn","fixPlaceHolders","parameters","getBaseMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;AAIA;AACA;AACA;IACMA,M;
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/Locale.js"],"names":["Locale","locale","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","formatMessage","setup","missingTranslation","aLocale","split","length","language","languages","lang","toUpperCase","IllegalStateException","message","replace","JSON","parse","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","warn","fixPlaceHolders","parameters","getBaseMessage"],"mappings":"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","sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\")\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n console.warn(`Message with id ${id} not found for locale ${this.code}`);\n }\n\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"file":"Locale.js"}
|
package/lib/i18n/Locales.js
CHANGED
|
@@ -53,9 +53,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
53
53
|
|
|
54
54
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
55
|
|
|
56
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
56
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
57
57
|
|
|
58
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
58
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Array of available locales
|
package/lib/i18n/Message.js
CHANGED
|
@@ -27,9 +27,9 @@ var _useI18n = require("../hooks/useI18n");
|
|
|
27
27
|
|
|
28
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
29
|
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
31
|
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Message React component
|
|
@@ -39,6 +39,20 @@ describe("locale", () => {
|
|
|
39
39
|
expect(locale.getMessage("testMessage")).toBe("Updated message");
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
it("can handle languages without iso-639-2 code", () => {
|
|
43
|
+
const locale = new Locale({
|
|
44
|
+
code: "pap",
|
|
45
|
+
nativeName: "Papiamento",
|
|
46
|
+
messages: {
|
|
47
|
+
descr: "Papiamento",
|
|
48
|
+
},
|
|
49
|
+
errors: {},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(locale.code).toBe("pap");
|
|
53
|
+
expect(locale.nativeName).toBe("Papiamento");
|
|
54
|
+
});
|
|
55
|
+
|
|
42
56
|
it("throws on non exising locale", () => {
|
|
43
57
|
const locale = new Locale({
|
|
44
58
|
code: "NONEXISTING",
|
package/lib/i18n/languages.js
CHANGED
|
@@ -204,7 +204,8 @@ var languages = {
|
|
|
204
204
|
yo: ["Yoruba", "Yorùbá"],
|
|
205
205
|
za: ["Zhuang", "Cuengh / Tôô / 壮语"],
|
|
206
206
|
zh: ["Chinese", "中文"],
|
|
207
|
-
zu: ["Zulu", "isiZulu"]
|
|
207
|
+
zu: ["Zulu", "isiZulu"],
|
|
208
|
+
pap: ["Papiamento", "Papiamento"]
|
|
208
209
|
}
|
|
209
210
|
};
|
|
210
211
|
var _default = languages;
|