studiokit-scaffolding-js 7.0.12-next.2.9 → 7.0.13-alpha.1
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/LICENSE +21 -21
- package/README.md +137 -137
- package/lib/components/ActionList.d.ts +2 -2
- package/lib/components/ActionList.js +87 -166
- package/lib/components/AlertDialog.d.ts +3 -3
- package/lib/components/AlertDialog.js +18 -133
- package/lib/components/AlertWithIcon.js +52 -93
- package/lib/components/ConnectedModal.d.ts +2 -1
- package/lib/components/ConnectedModal.js +37 -43
- package/lib/components/Dropdowns/GroupsDropdown.d.ts +4 -4
- package/lib/components/Dropdowns/GroupsDropdown.js +82 -69
- package/lib/components/Dropdowns/ManagedNavDropdown.d.ts +2 -2
- package/lib/components/Dropdowns/ManagedNavDropdown.js +111 -99
- package/lib/components/Dropdowns/UserDropdown.js +70 -109
- package/lib/components/Dropdowns/index.js +11 -27
- package/lib/components/EntityOwnerList.d.ts +3 -3
- package/lib/components/EntityOwnerList.js +60 -52
- package/lib/components/Error.js +27 -107
- package/lib/components/ErrorBoundary.js +94 -133
- package/lib/components/ErrorMessage.d.ts +2 -2
- package/lib/components/ErrorMessage.js +14 -44
- package/lib/components/Forms/DateField.d.ts +2 -2
- package/lib/components/Forms/DateField.js +95 -63
- package/lib/components/Forms/TimeField.d.ts +2 -2
- package/lib/components/Forms/TimeField.js +108 -84
- package/lib/components/Forms/index.js +13 -27
- package/lib/components/Groups/CreateEditCopySaveButtons.d.ts +2 -2
- package/lib/components/Groups/CreateEditCopySaveButtons.js +14 -102
- package/lib/components/Groups/ExternalGroups/Attach.d.ts +7 -6
- package/lib/components/Groups/ExternalGroups/Attach.js +188 -213
- package/lib/components/Groups/ExternalGroups/Table.js +76 -183
- package/lib/components/Groups/GroupCreateOrEditCommonProps.js +1 -5
- package/lib/components/Groups/RosterSyncInfo.js +49 -140
- package/lib/components/HOC/AccessibleAppComponent.d.ts +2 -2
- package/lib/components/HOC/AccessibleAppComponent.js +124 -101
- package/lib/components/HOC/ActivityRequiredComponent.d.ts +14 -14
- package/lib/components/HOC/ActivityRequiredComponent.js +107 -93
- package/lib/components/HOC/AsyncComponent.d.ts +9 -9
- package/lib/components/HOC/AsyncComponent.js +129 -53
- package/lib/components/HOC/AuthenticatedComponent.d.ts +4 -4
- package/lib/components/HOC/AuthenticatedComponent.js +96 -59
- package/lib/components/HOC/CollectionComponent.d.ts +12 -12
- package/lib/components/HOC/CollectionComponent.js +171 -171
- package/lib/components/HOC/CollectionFirstItemComponent.d.ts +13 -13
- package/lib/components/HOC/CollectionFirstItemComponent.js +94 -52
- package/lib/components/HOC/CollectionItemComponent.d.ts +9 -9
- package/lib/components/HOC/CollectionItemComponent.js +168 -169
- package/lib/components/HOC/ConnectedModalComponent.d.ts +9 -9
- package/lib/components/HOC/ConnectedModalComponent.js +140 -110
- package/lib/components/HOC/DataDependentComponent.d.ts +55 -3
- package/lib/components/HOC/DataDependentComponent.js +79 -30
- package/lib/components/HOC/EntityComponent.d.ts +13 -13
- package/lib/components/HOC/EntityComponent.js +112 -74
- package/lib/components/HOC/FullscreenModalComponent.d.ts +9 -9
- package/lib/components/HOC/FullscreenModalComponent.js +185 -165
- package/lib/components/HOC/GroupActivityRequiredComponent.d.ts +2 -2
- package/lib/components/HOC/GroupActivityRequiredComponent.js +47 -48
- package/lib/components/HOC/GuidComponent.d.ts +1 -1
- package/lib/components/HOC/GuidComponent.js +68 -29
- package/lib/components/HOC/ModelContextDependencyVerifyComponent.d.ts +29 -28
- package/lib/components/HOC/ModelContextDependencyVerifyComponent.js +65 -42
- package/lib/components/HOC/ModelErrorRedirectComponent.d.ts +10 -10
- package/lib/components/HOC/ModelErrorRedirectComponent.js +94 -51
- package/lib/components/HOC/SearchPersistorComponent.d.ts +4 -4
- package/lib/components/HOC/SearchPersistorComponent.js +216 -243
- package/lib/components/HOC/UnauthenticatedComponent.d.ts +12 -12
- package/lib/components/HOC/UnauthenticatedComponent.js +82 -37
- package/lib/components/HOC/UserComponent.d.ts +1 -1
- package/lib/components/HOC/UserComponent.js +11 -12
- package/lib/components/Icons/IconAlphaList.js +20 -34
- package/lib/components/Icons/IconExternalUser.js +20 -34
- package/lib/components/Icons/IconImpersonation.js +20 -34
- package/lib/components/Icons/IconStopImpersonating.js +20 -34
- package/lib/components/Icons/IconTable.js +21 -35
- package/lib/components/Icons/IconTableDeleteCol.js +20 -34
- package/lib/components/Icons/IconTableDeleteRow.js +20 -34
- package/lib/components/Icons/IconTableInsertCol.js +20 -34
- package/lib/components/Icons/IconTableInsertRow.js +20 -34
- package/lib/components/Impersonation/Button.d.ts +2 -2
- package/lib/components/Impersonation/Button.js +56 -76
- package/lib/components/Impersonation/Link.d.ts +2 -2
- package/lib/components/Impersonation/Link.js +53 -76
- package/lib/components/Impersonation/UserDetail.css +22 -22
- package/lib/components/Impersonation/UserDetail.d.ts +2 -2
- package/lib/components/Impersonation/UserDetail.js +17 -66
- package/lib/components/Loading.js +21 -27
- package/lib/components/LockDownBrowser/Check.js +107 -194
- package/lib/components/LockDownBrowser/ExitButton.js +14 -27
- package/lib/components/LockDownBrowser/Launch.js +85 -70
- package/lib/components/Lti/Confirm.js +33 -152
- package/lib/components/Lti/CreateNonLtiGroupAlertDialog.d.ts +2 -4
- package/lib/components/Lti/CreateNonLtiGroupAlertDialog.js +78 -170
- package/lib/components/Lti/Launch.js +49 -105
- package/lib/components/Lti/LaunchGroup.js +39 -85
- package/lib/components/ManageTable.d.ts +2 -1
- package/lib/components/ManageTable.js +104 -309
- package/lib/components/ManageTableNoDataComponent.js +22 -42
- package/lib/components/NewVersionAlert.d.ts +2 -2
- package/lib/components/NewVersionAlert.js +91 -82
- package/lib/components/NotFound.js +28 -87
- package/lib/components/Notifications.d.ts +4 -4
- package/lib/components/Notifications.js +169 -187
- package/lib/components/PaginationNextButton.js +21 -33
- package/lib/components/PaginationPreviousButton.js +21 -33
- package/lib/components/Quill/CustomToolbar.d.ts +2 -2
- package/lib/components/Quill/CustomToolbar.js +257 -432
- package/lib/components/Quill/Formats/Image.d.ts +25 -10
- package/lib/components/Quill/Formats/Image.js +86 -80
- package/lib/components/Quill/Formats/List.d.ts +3 -6
- package/lib/components/Quill/Formats/List.js +74 -52
- package/lib/components/Quill/Formats/Video.d.ts +1 -2
- package/lib/components/Quill/Formats/Video.js +45 -31
- package/lib/components/Quill/ImageDropModule.d.ts +1 -1
- package/lib/components/Quill/ImageDropModule.js +122 -149
- package/lib/components/Quill/ImageWarning.d.ts +2 -2
- package/lib/components/Quill/ImageWarning.js +32 -45
- package/lib/components/Quill/ImageWithAltTextModal.d.ts +1 -0
- package/lib/components/Quill/ImageWithAltTextModal.js +141 -425
- package/lib/components/Quill/Specs/CustomImageSpec.d.ts +1 -1
- package/lib/components/Quill/Specs/CustomImageSpec.js +51 -43
- package/lib/components/Quill/Specs/CustomVideoSpec.d.ts +1 -1
- package/lib/components/Quill/Specs/CustomVideoSpec.js +44 -35
- package/lib/components/Quill/TableModule/Blots/BaseTableBlot.d.ts +1 -2
- package/lib/components/Quill/TableModule/Blots/BaseTableBlot.js +121 -105
- package/lib/components/Quill/TableModule/Blots/TableBlot.js +66 -53
- package/lib/components/Quill/TableModule/Blots/TableBodyBlot.js +67 -54
- package/lib/components/Quill/TableModule/Blots/TableCellBlot.d.ts +1 -1
- package/lib/components/Quill/TableModule/Blots/TableCellBlot.js +241 -225
- package/lib/components/Quill/TableModule/Blots/TableContainer.js +99 -82
- package/lib/components/Quill/TableModule/Blots/TableRowBlot.js +87 -76
- package/lib/components/Quill/TableModule/constants.js +41 -45
- package/lib/components/Quill/TableModule/index.css +171 -171
- package/lib/components/Quill/TableModule/index.d.ts +5 -14
- package/lib/components/Quill/TableModule/index.js +313 -373
- package/lib/components/Quill/TableModule/utils.js +45 -45
- package/lib/components/Quill/accessibilityFix.d.ts +1 -0
- package/lib/components/Quill/accessibilityFix.js +251 -235
- package/lib/components/Quill/index.js +32 -36
- package/lib/components/RefreshIndicator/Bordered.js +32 -48
- package/lib/components/RefreshIndicator/Inline.js +33 -48
- package/lib/components/RefreshIndicator/index.d.ts +2 -2
- package/lib/components/RefreshIndicator/index.js +113 -263
- package/lib/components/SearchControls.js +31 -216
- package/lib/components/SentryRoute.js +23 -10
- package/lib/components/Tables/RoleFilter.d.ts +4 -3
- package/lib/components/Tables/RoleFilter.js +46 -71
- package/lib/components/Tables/TextFilter.d.ts +3 -2
- package/lib/components/Tables/TextFilter.js +20 -62
- package/lib/components/UserRoles/Add.d.ts +3 -3
- package/lib/components/UserRoles/Add.js +161 -199
- package/lib/components/UserRoles/Context.js +9 -11
- package/lib/components/UserRoles/RoleCell.js +100 -180
- package/lib/components/UserRoles/Select.js +54 -157
- package/lib/components/UserRoles/Table.js +102 -221
- package/lib/components/UserRoles/index.d.ts +6 -6
- package/lib/components/UserRoles/index.js +466 -537
- package/lib/config/eslint/index.cjs +21 -0
- package/lib/config/eslint/lib/order.cjs +22 -0
- package/lib/config/eslint/lib/prettier.cjs +18 -0
- package/lib/config/eslint/lib/typescript.cjs +86 -0
- package/lib/config/eslint/react.cjs +9 -0
- package/lib/constants/baseActivity.js +26 -30
- package/lib/constants/baseRole.js +10 -14
- package/lib/constants/configuration.d.ts +1 -1
- package/lib/constants/configuration.js +39 -43
- package/lib/constants/externalProviderType.js +6 -10
- package/lib/constants/fetchErrorData.js +11 -15
- package/lib/constants/index.js +23 -137
- package/lib/constants/lockDownBrowser.js +24 -28
- package/lib/constants/mockData.d.ts +6 -4
- package/lib/constants/mockData.js +326 -385
- package/lib/constants/modelStatus.js +11 -15
- package/lib/constants/notificationType.js +8 -12
- package/lib/constants/operatingSystem.js +8 -12
- package/lib/constants/shard.js +7 -11
- package/lib/constants/table.js +21 -21
- package/lib/constants/tier.js +8 -12
- package/lib/constants/userRole.d.ts +2 -1
- package/lib/constants/userRole.js +17 -15
- package/lib/css/base/_base.css +98 -98
- package/lib/css/base/_typography.css +130 -130
- package/lib/css/components/_alert.css +86 -86
- package/lib/css/components/_bootstrap-grid.css +28 -28
- package/lib/css/components/_buttons.css +397 -397
- package/lib/css/components/_forms.css +101 -101
- package/lib/css/components/_menu.css +56 -56
- package/lib/css/components/_modals.css +46 -46
- package/lib/css/components/_quill.css +315 -315
- package/lib/css/components/_tables.css +497 -497
- package/lib/css/components/_tags.css +12 -12
- package/lib/css/index-with-variables.css +15 -15
- package/lib/css/index.css +14 -14
- package/lib/css/utils/_border.css +463 -463
- package/lib/css/utils/_color.css +317 -317
- package/lib/css/utils/_display.css +312 -305
- package/lib/css/utils/_general.css +48 -48
- package/lib/css/utils/_icon.css +16 -16
- package/lib/css/utils/_text.css +24 -25
- package/lib/css/utils/_width.css +60 -60
- package/lib/css/variables.css +84 -84
- package/lib/endpointMappings.js +193 -197
- package/lib/hooks/useCollection.js +65 -83
- package/lib/hooks/useCollectionConfiguration.d.ts +1 -0
- package/lib/hooks/useCollectionConfiguration.js +88 -185
- package/lib/hooks/useCollectionItem.js +58 -155
- package/lib/hooks/useGuid.js +10 -21
- package/lib/hooks/usePrevious.d.ts +1 -24
- package/lib/hooks/usePrevious.js +14 -84
- package/lib/index.js +36 -156
- package/lib/redux/actionCreator.d.ts +6 -6
- package/lib/redux/actionCreator.js +40 -51
- package/lib/redux/actions/AuthAction.js +31 -44
- package/lib/redux/actions/ModalAction.d.ts +1 -1
- package/lib/redux/actions/ModalAction.js +6 -10
- package/lib/redux/actions/ModelAction.d.ts +1 -1
- package/lib/redux/actions/ModelAction.js +49 -77
- package/lib/redux/actions/NotificationAction.js +6 -10
- package/lib/redux/actions/SearchAction.js +5 -9
- package/lib/redux/actions/index.js +16 -60
- package/lib/redux/configureReducers.d.ts +5 -2
- package/lib/redux/configureReducers.js +78 -67
- package/lib/redux/configureStore.d.ts +2 -2
- package/lib/redux/configureStore.js +115 -83
- package/lib/redux/helpers.js +2 -7
- package/lib/redux/reducers/authReducer.js +46 -52
- package/lib/redux/reducers/index.js +15 -41
- package/lib/redux/reducers/modalsReducer.js +52 -49
- package/lib/redux/reducers/modelsReducer.d.ts +2 -2
- package/lib/redux/reducers/modelsReducer.js +182 -183
- package/lib/redux/reducers/notificationsReducer.js +21 -26
- package/lib/redux/reducers/searchReducer.js +20 -26
- package/lib/redux/sagas/appInsightsSaga.js +62 -24
- package/lib/redux/sagas/authSaga.js +414 -287
- package/lib/redux/sagas/caliperSaga.js +263 -169
- package/lib/redux/sagas/clockOffsetSaga.js +77 -36
- package/lib/redux/sagas/configurationSaga.js +46 -13
- package/lib/redux/sagas/downtimeApiErrorSaga.d.ts +1 -0
- package/lib/redux/sagas/downtimeApiErrorSaga.js +64 -23
- package/lib/redux/sagas/errorSaga.d.ts +1 -0
- package/lib/redux/sagas/errorSaga.js +63 -29
- package/lib/redux/sagas/googleAnalyticsSaga.js +69 -29
- package/lib/redux/sagas/identityProviderSaga.js +69 -24
- package/lib/redux/sagas/initialDataLoadSaga.js +29 -38
- package/lib/redux/sagas/lockDownBrowserErrorSaga.d.ts +1 -0
- package/lib/redux/sagas/lockDownBrowserErrorSaga.js +81 -32
- package/lib/redux/sagas/modelFetchSaga.js +459 -379
- package/lib/redux/sagas/noStoreSaga.d.ts +1 -1
- package/lib/redux/sagas/noStoreSaga.js +101 -68
- package/lib/redux/sagas/postLoginDataSaga.js +79 -47
- package/lib/redux/sagas/postLoginRedirectSaga.js +71 -30
- package/lib/redux/sagas/rootSaga.js +137 -85
- package/lib/redux/sagas/sentrySaga.js +85 -29
- package/lib/redux/sagas/userIdSaga.js +54 -18
- package/lib/services/codeProviderService.js +29 -25
- package/lib/services/dateService.js +12 -14
- package/lib/services/documentService.js +13 -18
- package/lib/services/fetchService.js +168 -134
- package/lib/services/persistenceService.d.ts +4 -4
- package/lib/services/persistenceService.js +43 -45
- package/lib/services/ticketProviderService.js +33 -29
- package/lib/services/tokenPersistenceService.js +9 -13
- package/lib/services/windowService.js +17 -21
- package/lib/startup.d.ts +1 -1
- package/lib/startup.js +135 -132
- package/lib/types/AppConfiguration.js +1 -5
- package/lib/types/Artifact.js +7 -11
- package/lib/types/BaseReduxState.js +1 -5
- package/lib/types/Client.js +1 -5
- package/lib/types/Collection.d.ts +3 -3
- package/lib/types/Collection.js +1 -5
- package/lib/types/Configuration.js +1 -5
- package/lib/types/DeepLinkingResponseRequest.js +1 -5
- package/lib/types/DeletableModel.js +1 -5
- package/lib/types/Event.js +1 -5
- package/lib/types/ExternalGroup.js +1 -5
- package/lib/types/ExternalProvider.js +1 -5
- package/lib/types/ExternalTerm.js +1 -5
- package/lib/types/Group.js +1 -5
- package/lib/types/IdentityProvider.js +1 -5
- package/lib/types/LtiLaunch.js +1 -5
- package/lib/types/NameOnlyEntity.js +1 -5
- package/lib/types/Notification.d.ts +2 -2
- package/lib/types/Notification.js +1 -5
- package/lib/types/OptionalRecord.d.ts +1 -1
- package/lib/types/OptionalRecord.js +1 -5
- package/lib/types/OwnerSchedule.d.ts +1 -3
- package/lib/types/OwnerSchedule.js +1 -5
- package/lib/types/PropertyOfType.d.ts +3 -3
- package/lib/types/PropertyOfType.js +1 -5
- package/lib/types/Quill.js +1 -5
- package/lib/types/RoleDescription.d.ts +1 -0
- package/lib/types/RoleDescription.js +1 -5
- package/lib/types/Search.js +1 -5
- package/lib/types/SimpleLocation.js +1 -5
- package/lib/types/UniTime.js +1 -5
- package/lib/types/User.js +1 -5
- package/lib/types/UserRole.js +1 -5
- package/lib/types/auth/AuthState.js +1 -5
- package/lib/types/auth/CasV1LoginRequestBody.js +1 -5
- package/lib/types/auth/ClientCredentials.js +1 -5
- package/lib/types/auth/CodeProviderService.js +1 -5
- package/lib/types/auth/LocalLoginRequestBody.js +1 -5
- package/lib/types/auth/TicketProviderService.js +1 -5
- package/lib/types/auth/TokenPersistenceService.js +1 -5
- package/lib/types/auth/index.js +18 -82
- package/lib/types/index.js +39 -313
- package/lib/types/net/EndpointConfig.js +1 -5
- package/lib/types/net/EndpointMapping.js +1 -5
- package/lib/types/net/EndpointMappings.js +1 -5
- package/lib/types/net/ErrorHandler.d.ts +1 -1
- package/lib/types/net/ErrorHandler.js +1 -5
- package/lib/types/net/FetchConfig.d.ts +1 -1
- package/lib/types/net/FetchConfig.js +1 -5
- package/lib/types/net/FetchErrorData.js +6 -10
- package/lib/types/net/FetchResult.d.ts +2 -2
- package/lib/types/net/FetchResult.js +1 -5
- package/lib/types/net/HTTPMethod.d.ts +1 -1
- package/lib/types/net/HTTPMethod.js +1 -5
- package/lib/types/net/HTTPStatusCode.js +12 -16
- package/lib/types/net/Metadata.js +1 -5
- package/lib/types/net/Model.js +1 -5
- package/lib/types/net/ModelCollection.js +1 -5
- package/lib/types/net/ModelsState.js +1 -5
- package/lib/types/net/OAuthToken.js +1 -5
- package/lib/types/net/OAuthTokenOrNull.d.ts +1 -1
- package/lib/types/net/OAuthTokenOrNull.js +1 -5
- package/lib/types/net/TokenAccessFunction.d.ts +1 -1
- package/lib/types/net/TokenAccessFunction.js +1 -5
- package/lib/types/net/index.js +27 -181
- package/lib/utils/baseActivity.d.ts +2 -2
- package/lib/utils/baseActivity.js +136 -138
- package/lib/utils/baseRole.js +33 -37
- package/lib/utils/collection.js +310 -432
- package/lib/utils/cookies.js +37 -22
- package/lib/utils/date.js +320 -320
- package/lib/utils/dom.js +174 -186
- package/lib/utils/domainIdentifier.js +9 -9
- package/lib/utils/entityUserRole.js +2 -6
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +16 -18
- package/lib/utils/events.js +33 -40
- package/lib/utils/externalGroup.js +21 -25
- package/lib/utils/externalProviders.js +4 -8
- package/lib/utils/externalTerms.js +6 -9
- package/lib/utils/fetch.d.ts +1 -1
- package/lib/utils/fetch.js +185 -188
- package/lib/utils/group.js +9 -17
- package/lib/utils/groupDates.d.ts +1 -1
- package/lib/utils/groupDates.js +39 -43
- package/lib/utils/groupRoles.js +28 -28
- package/lib/utils/lockDownBrowser.js +12 -16
- package/lib/utils/logger.js +25 -30
- package/lib/utils/lti.js +5 -10
- package/lib/utils/model.d.ts +2 -2
- package/lib/utils/model.js +48 -39
- package/lib/utils/number.js +26 -23
- package/lib/utils/promise.d.ts +1 -6
- package/lib/utils/promise.js +15 -34
- package/lib/utils/quill.js +77 -66
- package/lib/utils/route.d.ts +2 -2
- package/lib/utils/route.js +60 -61
- package/lib/utils/search.d.ts +1 -1
- package/lib/utils/search.js +85 -78
- package/lib/utils/shard.js +41 -38
- package/lib/utils/sort.d.ts +3 -3
- package/lib/utils/sort.js +58 -62
- package/lib/utils/string.js +10 -14
- package/lib/utils/table.d.ts +3 -3
- package/lib/utils/table.js +36 -39
- package/lib/utils/timezone.js +26 -12
- package/lib/utils/url.d.ts +1 -2
- package/lib/utils/url.js +201 -146
- package/lib/utils/user.js +61 -59
- package/lib/utils/userAgent.js +11 -11
- package/lib/utils/userRole.d.ts +3 -3
- package/lib/utils/userRole.js +56 -58
- package/package.json +207 -226
- package/lib/config/eslint/index.d.ts +0 -2
- package/lib/config/eslint/index.js +0 -36
- package/lib/config/eslint/lib/order.d.ts +0 -3
- package/lib/config/eslint/lib/order.js +0 -30
- package/lib/config/eslint/lib/prettier.d.ts +0 -3
- package/lib/config/eslint/lib/prettier.js +0 -23
- package/lib/config/eslint/lib/typescript.d.ts +0 -2
- package/lib/config/eslint/lib/typescript.js +0 -98
- package/lib/config/eslint/react.d.ts +0 -2
- package/lib/config/eslint/react.js +0 -30
- package/lib/hooks/useEventCalback.d.ts +0 -14
- package/lib/hooks/useEventCalback.js +0 -51
- package/lib/types/externals.d.js +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { ComponentType } from 'react';
|
|
2
3
|
import { RouteComponentProps } from 'react-router';
|
|
3
4
|
import { Model } from '../../types';
|
|
@@ -6,21 +7,21 @@ export interface ModelContextDependencyVerifyComponentProps {
|
|
|
6
7
|
}
|
|
7
8
|
export declare function setupModelContextDependencyVerifyComponent<TOwnProps extends ModelContextDependencyVerifyComponentProps>(WrappedComponent: ComponentType<TOwnProps>, modelName: string, dependentModelName: string): {
|
|
8
9
|
new (props: (TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>) | Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>): {
|
|
9
|
-
render():
|
|
10
|
+
render(): React.JSX.Element;
|
|
10
11
|
context: any;
|
|
11
12
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
12
13
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
13
14
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
14
|
-
children?:
|
|
15
|
+
children?: React.ReactNode;
|
|
15
16
|
}>;
|
|
16
17
|
state: Readonly<{}>;
|
|
17
18
|
refs: {
|
|
18
|
-
[key: string]:
|
|
19
|
+
[key: string]: React.ReactInstance;
|
|
19
20
|
};
|
|
20
21
|
componentDidMount?(): void;
|
|
21
22
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
22
23
|
componentWillUnmount?(): void;
|
|
23
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
24
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
24
25
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
25
26
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
26
27
|
componentWillMount?(): void;
|
|
@@ -31,21 +32,21 @@ export declare function setupModelContextDependencyVerifyComponent<TOwnProps ext
|
|
|
31
32
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
33
|
};
|
|
33
34
|
new (props: TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>, context: any): {
|
|
34
|
-
render():
|
|
35
|
+
render(): React.JSX.Element;
|
|
35
36
|
context: any;
|
|
36
37
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
37
38
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
38
39
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
39
|
-
children?:
|
|
40
|
+
children?: React.ReactNode;
|
|
40
41
|
}>;
|
|
41
42
|
state: Readonly<{}>;
|
|
42
43
|
refs: {
|
|
43
|
-
[key: string]:
|
|
44
|
+
[key: string]: React.ReactInstance;
|
|
44
45
|
};
|
|
45
46
|
componentDidMount?(): void;
|
|
46
47
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
47
48
|
componentWillUnmount?(): void;
|
|
48
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
49
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
49
50
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
50
51
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
51
52
|
componentWillMount?(): void;
|
|
@@ -55,7 +56,7 @@ export declare function setupModelContextDependencyVerifyComponent<TOwnProps ext
|
|
|
55
56
|
componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
56
57
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
57
58
|
};
|
|
58
|
-
contextType?:
|
|
59
|
+
contextType?: React.Context<any> | undefined;
|
|
59
60
|
};
|
|
60
61
|
/**
|
|
61
62
|
* HOC that checks if the depender component is related to the dependee component.
|
|
@@ -64,23 +65,23 @@ export declare function setupModelContextDependencyVerifyComponent<TOwnProps ext
|
|
|
64
65
|
* @param {string} modelName The modelName of the dependent component itself.
|
|
65
66
|
* @param {string} dependentModelName The modelName that the dependent component depends on.
|
|
66
67
|
*/
|
|
67
|
-
export default function modelContextDependencyVerifyComponent<TOwnProps extends ModelContextDependencyVerifyComponentProps>(WrappedComponent: ComponentType<TOwnProps>, modelName: string, dependentModelName: string):
|
|
68
|
+
export default function modelContextDependencyVerifyComponent<TOwnProps extends ModelContextDependencyVerifyComponentProps>(WrappedComponent: ComponentType<TOwnProps>, modelName: string, dependentModelName: string): React.ComponentClass<import("react-router").Omit<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>, "match" | "location" | "history" | "staticContext"> & import("react-router").WithRouterProps<{
|
|
68
69
|
new (props: (TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>) | Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>): {
|
|
69
|
-
render():
|
|
70
|
+
render(): React.JSX.Element;
|
|
70
71
|
context: any;
|
|
71
72
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
72
73
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
73
74
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
74
|
-
children?:
|
|
75
|
+
children?: React.ReactNode;
|
|
75
76
|
}>;
|
|
76
77
|
state: Readonly<{}>;
|
|
77
78
|
refs: {
|
|
78
|
-
[key: string]:
|
|
79
|
+
[key: string]: React.ReactInstance;
|
|
79
80
|
};
|
|
80
81
|
componentDidMount?(): void;
|
|
81
82
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
82
83
|
componentWillUnmount?(): void;
|
|
83
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
84
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
84
85
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
85
86
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
86
87
|
componentWillMount?(): void;
|
|
@@ -91,21 +92,21 @@ export default function modelContextDependencyVerifyComponent<TOwnProps extends
|
|
|
91
92
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
92
93
|
};
|
|
93
94
|
new (props: TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>, context: any): {
|
|
94
|
-
render():
|
|
95
|
+
render(): React.JSX.Element;
|
|
95
96
|
context: any;
|
|
96
97
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
97
98
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
98
99
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
99
|
-
children?:
|
|
100
|
+
children?: React.ReactNode;
|
|
100
101
|
}>;
|
|
101
102
|
state: Readonly<{}>;
|
|
102
103
|
refs: {
|
|
103
|
-
[key: string]:
|
|
104
|
+
[key: string]: React.ReactInstance;
|
|
104
105
|
};
|
|
105
106
|
componentDidMount?(): void;
|
|
106
107
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
107
108
|
componentWillUnmount?(): void;
|
|
108
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
109
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
109
110
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
110
111
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
111
112
|
componentWillMount?(): void;
|
|
@@ -115,24 +116,24 @@ export default function modelContextDependencyVerifyComponent<TOwnProps extends
|
|
|
115
116
|
componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
116
117
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
117
118
|
};
|
|
118
|
-
contextType?:
|
|
119
|
+
contextType?: React.Context<any> | undefined;
|
|
119
120
|
}>, any> & import("react-router").WithRouterStatics<{
|
|
120
121
|
new (props: (TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>) | Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>): {
|
|
121
|
-
render():
|
|
122
|
+
render(): React.JSX.Element;
|
|
122
123
|
context: any;
|
|
123
124
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
124
125
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
125
126
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
126
|
-
children?:
|
|
127
|
+
children?: React.ReactNode;
|
|
127
128
|
}>;
|
|
128
129
|
state: Readonly<{}>;
|
|
129
130
|
refs: {
|
|
130
|
-
[key: string]:
|
|
131
|
+
[key: string]: React.ReactInstance;
|
|
131
132
|
};
|
|
132
133
|
componentDidMount?(): void;
|
|
133
134
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
134
135
|
componentWillUnmount?(): void;
|
|
135
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
136
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
136
137
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
137
138
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
138
139
|
componentWillMount?(): void;
|
|
@@ -143,21 +144,21 @@ export default function modelContextDependencyVerifyComponent<TOwnProps extends
|
|
|
143
144
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
144
145
|
};
|
|
145
146
|
new (props: TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>, context: any): {
|
|
146
|
-
render():
|
|
147
|
+
render(): React.JSX.Element;
|
|
147
148
|
context: any;
|
|
148
149
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
149
150
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
150
151
|
readonly props: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>> & Readonly<{
|
|
151
|
-
children?:
|
|
152
|
+
children?: React.ReactNode;
|
|
152
153
|
}>;
|
|
153
154
|
state: Readonly<{}>;
|
|
154
155
|
refs: {
|
|
155
|
-
[key: string]:
|
|
156
|
+
[key: string]: React.ReactInstance;
|
|
156
157
|
};
|
|
157
158
|
componentDidMount?(): void;
|
|
158
159
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
159
160
|
componentWillUnmount?(): void;
|
|
160
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
161
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
161
162
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>): any;
|
|
162
163
|
componentDidUpdate?(prevProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
163
164
|
componentWillMount?(): void;
|
|
@@ -167,5 +168,5 @@ export default function modelContextDependencyVerifyComponent<TOwnProps extends
|
|
|
167
168
|
componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
168
169
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & RouteComponentProps<{}, import("react-router").StaticContext, unknown>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
169
170
|
};
|
|
170
|
-
contextType?:
|
|
171
|
+
contextType?: React.Context<any> | undefined;
|
|
171
172
|
}>;
|
|
@@ -1,49 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.setupModelContextDependencyVerifyComponent = void 0;
|
|
31
|
+
var react_1 = __importDefault(require("react"));
|
|
32
|
+
var react_2 = require("react");
|
|
33
|
+
var react_router_dom_1 = require("react-router-dom");
|
|
11
34
|
function setupModelContextDependencyVerifyComponent(WrappedComponent, modelName, dependentModelName) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
params
|
|
17
|
-
},
|
|
18
|
-
model
|
|
19
|
-
} = this.props;
|
|
20
|
-
const routeParams = params;
|
|
21
|
-
const modelId = routeParams[`${modelName}Id`] ? parseInt(routeParams[`${modelName}Id`], 10) : undefined;
|
|
22
|
-
const dependentModelId = routeParams[`${dependentModelName}Id`] ? parseInt(routeParams[`${dependentModelName}Id`], 10) : undefined;
|
|
23
|
-
if (!!modelId && !!dependentModelId && model.id === modelId && model[`${dependentModelName}Id`] === dependentModelId) {
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
25
|
-
...this.props
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Redirect, {
|
|
29
|
-
to: {
|
|
30
|
-
pathname: '/error'
|
|
35
|
+
return /** @class */ (function (_super) {
|
|
36
|
+
__extends(ModelContextVerifyComponent, _super);
|
|
37
|
+
function ModelContextVerifyComponent() {
|
|
38
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
ModelContextVerifyComponent.prototype.render = function () {
|
|
41
|
+
var _a = this.props, params = _a.match.params, model = _a.model;
|
|
42
|
+
var routeParams = params;
|
|
43
|
+
var modelId = routeParams[modelName + "Id"] ? parseInt(routeParams[modelName + "Id"], 10) : undefined;
|
|
44
|
+
var dependentModelId = routeParams[dependentModelName + "Id"]
|
|
45
|
+
? parseInt(routeParams[dependentModelName + "Id"], 10)
|
|
46
|
+
: undefined;
|
|
47
|
+
if (!!modelId &&
|
|
48
|
+
!!dependentModelId &&
|
|
49
|
+
model.id === modelId &&
|
|
50
|
+
model[dependentModelName + "Id"] === dependentModelId) {
|
|
51
|
+
return react_1.default.createElement(WrappedComponent, __assign({}, this.props));
|
|
52
|
+
}
|
|
53
|
+
return (react_1.default.createElement(react_router_dom_1.Redirect, { to: {
|
|
54
|
+
pathname: '/error'
|
|
55
|
+
} }));
|
|
56
|
+
};
|
|
57
|
+
return ModelContextVerifyComponent;
|
|
58
|
+
}(react_2.Component));
|
|
35
59
|
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* HOC that checks if the depender component is related to the dependee component.
|
|
39
|
-
*
|
|
40
|
-
* @param {*} WrappedComponent The component to wrap.
|
|
41
|
-
* @param {string} modelName The modelName of the dependent component itself.
|
|
42
|
-
* @param {string} dependentModelName The modelName that the dependent component depends on.
|
|
60
|
+
exports.setupModelContextDependencyVerifyComponent = setupModelContextDependencyVerifyComponent;
|
|
61
|
+
/**
|
|
62
|
+
* HOC that checks if the depender component is related to the dependee component.
|
|
63
|
+
*
|
|
64
|
+
* @param {*} WrappedComponent The component to wrap.
|
|
65
|
+
* @param {string} modelName The modelName of the dependent component itself.
|
|
66
|
+
* @param {string} dependentModelName The modelName that the dependent component depends on.
|
|
43
67
|
*/
|
|
44
|
-
|
|
45
68
|
function modelContextDependencyVerifyComponent(WrappedComponent, modelName, dependentModelName) {
|
|
46
|
-
|
|
47
|
-
|
|
69
|
+
var component = setupModelContextDependencyVerifyComponent(WrappedComponent, modelName, dependentModelName);
|
|
70
|
+
return react_router_dom_1.withRouter(component);
|
|
48
71
|
}
|
|
49
|
-
|
|
72
|
+
exports.default = modelContextDependencyVerifyComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
2
|
import { Model } from '../../types';
|
|
3
3
|
import { CollectionComponentWrappedProps } from './CollectionComponent';
|
|
4
4
|
import { CollectionItemComponentWrappedProps } from './CollectionItemComponent';
|
|
@@ -16,21 +16,21 @@ import { CollectionItemComponentWrappedProps } from './CollectionItemComponent';
|
|
|
16
16
|
*/
|
|
17
17
|
export default function modelErrorRedirectComponent<TOwnProps extends CollectionItemComponentWrappedProps<Model> | CollectionComponentWrappedProps<Model>>(WrappedComponent: ComponentType<TOwnProps>): {
|
|
18
18
|
new (props: TOwnProps | Readonly<TOwnProps>): {
|
|
19
|
-
render():
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
20
|
context: any;
|
|
21
21
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
22
22
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
23
23
|
readonly props: Readonly<TOwnProps> & Readonly<{
|
|
24
|
-
children?:
|
|
24
|
+
children?: React.ReactNode;
|
|
25
25
|
}>;
|
|
26
26
|
state: Readonly<{}>;
|
|
27
27
|
refs: {
|
|
28
|
-
[key: string]:
|
|
28
|
+
[key: string]: React.ReactInstance;
|
|
29
29
|
};
|
|
30
30
|
componentDidMount?(): void;
|
|
31
31
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
32
32
|
componentWillUnmount?(): void;
|
|
33
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
33
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
34
34
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps>, prevState: Readonly<{}>): any;
|
|
35
35
|
componentDidUpdate?(prevProps: Readonly<TOwnProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
36
36
|
componentWillMount?(): void;
|
|
@@ -41,21 +41,21 @@ export default function modelErrorRedirectComponent<TOwnProps extends Collection
|
|
|
41
41
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
42
42
|
};
|
|
43
43
|
new (props: TOwnProps, context: any): {
|
|
44
|
-
render():
|
|
44
|
+
render(): React.JSX.Element;
|
|
45
45
|
context: any;
|
|
46
46
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TOwnProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
47
47
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
48
48
|
readonly props: Readonly<TOwnProps> & Readonly<{
|
|
49
|
-
children?:
|
|
49
|
+
children?: React.ReactNode;
|
|
50
50
|
}>;
|
|
51
51
|
state: Readonly<{}>;
|
|
52
52
|
refs: {
|
|
53
|
-
[key: string]:
|
|
53
|
+
[key: string]: React.ReactInstance;
|
|
54
54
|
};
|
|
55
55
|
componentDidMount?(): void;
|
|
56
56
|
shouldComponentUpdate?(nextProps: Readonly<TOwnProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
57
57
|
componentWillUnmount?(): void;
|
|
58
|
-
componentDidCatch?(error: Error, errorInfo:
|
|
58
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
59
59
|
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps>, prevState: Readonly<{}>): any;
|
|
60
60
|
componentDidUpdate?(prevProps: Readonly<TOwnProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
61
61
|
componentWillMount?(): void;
|
|
@@ -65,5 +65,5 @@ export default function modelErrorRedirectComponent<TOwnProps extends Collection
|
|
|
65
65
|
componentWillUpdate?(nextProps: Readonly<TOwnProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
66
66
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
67
67
|
};
|
|
68
|
-
contextType?:
|
|
68
|
+
contextType?: React.Context<any> | undefined;
|
|
69
69
|
};
|
|
@@ -1,56 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
5
37
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
var react_1 = __importStar(require("react"));
|
|
47
|
+
var react_router_dom_1 = require("react-router-dom");
|
|
48
|
+
var modelStatus_1 = require("../../constants/modelStatus");
|
|
49
|
+
var types_1 = require("../../types");
|
|
50
|
+
/**
|
|
51
|
+
* This component exists as a child to CollectionItemComponent to
|
|
52
|
+
* redirect the user to a 404/500 page if errors occur while fetching data.
|
|
53
|
+
*
|
|
54
|
+
* Nested CollectionItemComponent instances should not
|
|
55
|
+
* use this - they’ll want to handle errors according to the need for
|
|
56
|
+
* alerting the user in the parent.
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
* @param WrappedComponent Wrapped component that depends on the model. (Usually AsyncComponent)
|
|
60
|
+
* @returns A wrapped component or redirects
|
|
23
61
|
*/
|
|
24
62
|
function modelErrorRedirectComponent(WrappedComponent) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
return /** @class */ (function (_super) {
|
|
64
|
+
__extends(ModelErrorRedirectComponent, _super);
|
|
65
|
+
function ModelErrorRedirectComponent() {
|
|
66
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
67
|
+
}
|
|
68
|
+
ModelErrorRedirectComponent.prototype.render = function () {
|
|
69
|
+
var _a = this.props, model = _a.model, modelStatus = _a.modelStatus, previousModelStatus = _a.previousModelStatus;
|
|
70
|
+
var notFoundRoute = previousModelStatus === modelStatus_1.MODEL_STATUS.UNINITIALIZED &&
|
|
71
|
+
modelStatus === modelStatus_1.MODEL_STATUS.ERROR &&
|
|
72
|
+
model._metadata &&
|
|
73
|
+
model._metadata.hasError &&
|
|
74
|
+
model._metadata.lastFetchErrorData &&
|
|
75
|
+
model._metadata.lastFetchErrorData.status === types_1.HTTP_STATUS_CODE.NOT_FOUND;
|
|
76
|
+
var errorRoute = previousModelStatus === modelStatus_1.MODEL_STATUS.UNINITIALIZED &&
|
|
77
|
+
modelStatus === modelStatus_1.MODEL_STATUS.ERROR &&
|
|
78
|
+
model._metadata &&
|
|
79
|
+
model._metadata.hasError &&
|
|
80
|
+
model._metadata.lastFetchErrorData &&
|
|
81
|
+
model._metadata.lastFetchErrorData.status === types_1.HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR;
|
|
82
|
+
if (notFoundRoute) {
|
|
83
|
+
var pathname = window.location.pathname;
|
|
84
|
+
return (react_1.default.createElement(react_router_dom_1.Redirect, { to: {
|
|
85
|
+
pathname: '/not-found',
|
|
86
|
+
search: "?pathname=" + pathname
|
|
87
|
+
} }));
|
|
88
|
+
}
|
|
89
|
+
if (errorRoute) {
|
|
90
|
+
return (react_1.default.createElement(react_router_dom_1.Redirect, { to: {
|
|
91
|
+
pathname: '/error'
|
|
92
|
+
} }));
|
|
93
|
+
}
|
|
94
|
+
return react_1.default.createElement(WrappedComponent, __assign({}, this.props));
|
|
95
|
+
};
|
|
96
|
+
return ModelErrorRedirectComponent;
|
|
97
|
+
}(react_1.Component));
|
|
55
98
|
}
|
|
56
|
-
|
|
99
|
+
exports.default = modelErrorRedirectComponent;
|
|
@@ -4,7 +4,7 @@ import { Dispatch } from 'redux';
|
|
|
4
4
|
import { BaseReduxState, Search } from '../../types';
|
|
5
5
|
export interface SearchPersistorProps<T extends Search = Search> {
|
|
6
6
|
persistSearch: (search?: T) => void;
|
|
7
|
-
persistedSearch: T
|
|
7
|
+
persistedSearch: T;
|
|
8
8
|
}
|
|
9
9
|
export interface SearchPersistorMethods<T extends Search = Search> {
|
|
10
10
|
setSearchDefaults: (doSearch: () => void, search: T) => void;
|
|
@@ -22,9 +22,9 @@ export interface SearchPersistorMethods<T extends Search = Search> {
|
|
|
22
22
|
export interface SearchPersistorWrappedProps<T extends Search = Search> extends SearchPersistorProps<T>, SearchPersistorMethods<T> {
|
|
23
23
|
search?: T;
|
|
24
24
|
}
|
|
25
|
-
export declare function configureSearchPersistorComponent<TOwnProps extends
|
|
26
|
-
export declare function configureSearchPersistorComponent<TOwnProps extends
|
|
27
|
-
export declare const configureMapStateToProps: <TSearchType extends Search>(key: string) => (state: BaseReduxState) => SearchPersistorProps<TSearchType
|
|
25
|
+
export declare function configureSearchPersistorComponent<TOwnProps extends {}>(WrappedComponent: ComponentType<TOwnProps & SearchPersistorWrappedProps>, disableLocalSearch?: boolean): ComponentType<TOwnProps & SearchPersistorProps>;
|
|
26
|
+
export declare function configureSearchPersistorComponent<TOwnProps extends {}, TSearchType extends Search>(WrappedComponent: ComponentType<TOwnProps & SearchPersistorWrappedProps<TSearchType>>, disableLocalSearch?: boolean): ComponentType<TOwnProps & SearchPersistorProps<TSearchType>>;
|
|
27
|
+
export declare const configureMapStateToProps: <TSearchType extends Search>(key: string) => (state: BaseReduxState) => SearchPersistorProps<TSearchType>;
|
|
28
28
|
export declare const configureMapDispatchToProps: <TSearchType extends Search>(key: string) => (dispatch: Dispatch) => SearchPersistorProps<TSearchType>;
|
|
29
29
|
/**
|
|
30
30
|
* HOC to handle persistence and restoration of "Manage" components search parameters.
|